001: /*
002: * JBoss, Home of Professional Open Source
003: * Copyright 2005, JBoss Inc., and individual contributors as indicated
004: * by the @authors tag. See the copyright.txt in the distribution for a
005: * full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jbpm.graph.exe;
023:
024: import java.io.Serializable;
025: import java.util.Date;
026:
027: import org.jbpm.security.SecurityHelper;
028: import org.jbpm.taskmgmt.exe.TaskInstance;
029: import org.jbpm.util.EqualsUtil;
030:
031: public class Comment implements Serializable {
032:
033: private static final long serialVersionUID = 1L;
034:
035: long id = 0;
036: int version = 0;
037: protected String actorId = null;
038: protected Date time = null;
039: protected String message = null;
040: protected Token token = null;
041: protected TaskInstance taskInstance = null;
042:
043: public Comment() {
044: }
045:
046: public Comment(String message) {
047: this .actorId = SecurityHelper.getAuthenticatedActorId();
048: this .time = new Date();
049: this .message = message;
050: }
051:
052: public Comment(String actorId, String message) {
053: this .actorId = actorId;
054: this .time = new Date();
055: this .message = message;
056: }
057:
058: // equals ///////////////////////////////////////////////////////////////////
059: // hack to support comparing hibernate proxies against the real objects
060: // since this always falls back to ==, we don't need to overwrite the hashcode
061: public boolean equals(Object o) {
062: return EqualsUtil.equals(this , o);
063: }
064:
065: // getters and setters //////////////////////////////////////////////////////
066:
067: public String getActorId() {
068: return actorId;
069: }
070:
071: public long getId() {
072: return id;
073: }
074:
075: public String getMessage() {
076: return message;
077: }
078:
079: public Date getTime() {
080: return time;
081: }
082:
083: public TaskInstance getTaskInstance() {
084: return taskInstance;
085: }
086:
087: public Token getToken() {
088: return token;
089: }
090:
091: public void setTaskInstance(TaskInstance taskInstance) {
092: this .taskInstance = taskInstance;
093: }
094:
095: public void setToken(Token token) {
096: this .token = token;
097: }
098:
099: public void setActorId(String actorId) {
100: this .actorId = actorId;
101: }
102:
103: public void setMessage(String message) {
104: this .message = message;
105: }
106:
107: public void setTime(Date time) {
108: this.time = time;
109: }
110: }
|