001: package com.technoetic.xplanner.history;
002:
003: import com.technoetic.xplanner.domain.Identifiable;
004:
005: import java.util.Date;
006:
007: public class HistoricalEvent implements Identifiable {
008: public static final String CREATED = "created";
009: public static final String UPDATED = "updated";
010: public static final String DELETED = "deleted";
011: public static final String REESTIMATED = "reestimated";
012: public static final String ITERATION_STARTED = "started";
013: public static final String ITERATION_CLOSED = "closed";
014: public static final String MOVED = "moved";
015: public static final String MOVED_IN = "moved in";
016: public static final String MOVED_OUT = "moved out";
017: public static final String CONTINUED = "continued";
018:
019: private Date when;
020: private int targetObjectId;
021: private int containerId;
022: private String objectType;
023: private String action;
024: private String description;
025: private int personId;
026: private boolean notified;
027: private int id;
028:
029: //For hibernate
030: HistoricalEvent() {
031: }
032:
033: public HistoricalEvent(int containerId, int targetObjectId,
034: String objectType, String action, String description,
035: int personId, Date when) {
036: this .containerId = containerId;
037: this .objectType = objectType;
038: this .when = when;
039: this .targetObjectId = targetObjectId;
040: this .action = action;
041: this .description = description;
042: this .personId = personId;
043: }
044:
045: public Date getWhen() {
046: return when;
047: }
048:
049: public void setWhen(Date when) {
050: this .when = when;
051: }
052:
053: public int getTargetObjectId() {
054: return targetObjectId;
055: }
056:
057: public void setTargetObjectId(int targetObjectId) {
058: this .targetObjectId = targetObjectId;
059: }
060:
061: public String getAction() {
062: return action;
063: }
064:
065: public void setAction(String action) {
066: this .action = action;
067: }
068:
069: public String getDescription() {
070: return description;
071: }
072:
073: public void setDescription(String description) {
074: this .description = description;
075: }
076:
077: public int getPersonId() {
078: return personId;
079: }
080:
081: public void setPersonId(int personId) {
082: this .personId = personId;
083: }
084:
085: public boolean isNotified() {
086: return notified;
087: }
088:
089: public void setNotified(boolean notified) {
090: this .notified = notified;
091: }
092:
093: public int getId() {
094: return id;
095: }
096:
097: public void setId(int id) {
098: this .id = id;
099: }
100:
101: public String getObjectType() {
102: return objectType;
103: }
104:
105: public void setObjectType(String objectType) {
106: this .objectType = objectType;
107: }
108:
109: public int getContainerId() {
110: return containerId;
111: }
112:
113: public void setContainerId(int containerId) {
114: this .containerId = containerId;
115: }
116:
117: public String toString() {
118: return "HistoricalEvent(id=" + this .getId() + ", personId="
119: + this .getPersonId() + ", targetObjectId="
120: + this .getTargetObjectId() + ", objectType="
121: + objectType + ", action=" + this .getAction()
122: + ", containerId=" + this .getContainerId()
123: + ", desc.='" + this .getDescription() + '\''
124: + ", date=" + this .getWhen() + ", notified=" + notified
125: + ")";
126: }
127:
128: public boolean equals(Object o) {
129: if (this == o)
130: return true;
131: if (o == null || getClass() != o.getClass())
132: return false;
133:
134: final HistoricalEvent event = (HistoricalEvent) o;
135:
136: if (containerId != event.containerId)
137: return false;
138: if (id != event.id)
139: return false;
140: if (notified != event.notified)
141: return false;
142: if (personId != event.personId)
143: return false;
144: if (targetObjectId != event.targetObjectId)
145: return false;
146: if (action != null ? !action.equals(event.action)
147: : event.action != null)
148: return false;
149: if (description != null ? !description
150: .equals(event.description) : event.description != null)
151: return false;
152: if (objectType != null ? !objectType.equals(event.objectType)
153: : event.objectType != null)
154: return false;
155: return !(when != null ? !when.equals(event.when)
156: : event.when != null);
157:
158: }
159:
160: public int hashCode() {
161: int result;
162: result = (when != null ? when.hashCode() : 0);
163: result = 29 * result + targetObjectId;
164: result = 29 * result + containerId;
165: result = 29 * result
166: + (objectType != null ? objectType.hashCode() : 0);
167: result = 29 * result + (action != null ? action.hashCode() : 0);
168: result = 29 * result
169: + (description != null ? description.hashCode() : 0);
170: result = 29 * result + personId;
171: result = 29 * result + (notified ? 1 : 0);
172: result = 29 * result + id;
173: return result;
174: }
175: }
|