001: package com.technoetic.xplanner.domain;
002:
003: import java.util.Date;
004:
005: public class Integration extends DomainObject {
006: public static final char PENDING = 'P';
007: public static final char ACTIVE = 'A';
008: public static final char FINISHED = 'F';
009: public static final char CANCELED = 'X';
010:
011: private int personId;
012: private char state;
013: private String comment;
014: private Date whenStarted;
015: private Date whenRequested;
016: private Date whenComplete;
017: private int projectId;
018:
019: public int getPersonId() {
020: return personId;
021: }
022:
023: public void setPersonId(int personId) {
024: this .personId = personId;
025: }
026:
027: public void setState(char state) {
028: this .state = state;
029: }
030:
031: public char getState() {
032: return state;
033: }
034:
035: public void setComment(String comment) {
036: this .comment = comment;
037: }
038:
039: public String getComment() {
040: return comment;
041: }
042:
043: public String getDescription() {
044: return getComment();
045: }
046:
047: public void setWhenStarted(Date whenStarted) {
048: this .whenStarted = whenStarted;
049: }
050:
051: public Date getWhenStarted() {
052: return whenStarted;
053: }
054:
055: public void setWhenRequested(Date whenRequested) {
056: this .whenRequested = whenRequested;
057: }
058:
059: public Date getWhenRequested() {
060: return whenRequested;
061: }
062:
063: public Date getWhenComplete() {
064: return whenComplete;
065: }
066:
067: public void setWhenComplete(Date whenComplete) {
068: this .whenComplete = whenComplete;
069: }
070:
071: public double getDuration() {
072: if (whenStarted != null && whenComplete != null) {
073: long delta = whenComplete.getTime() - whenStarted.getTime();
074: return delta / 3600000.0;
075: } else {
076: return 0;
077: }
078: }
079:
080: public int getProjectId() {
081: return projectId;
082: }
083:
084: public void setProjectId(int projectId) {
085: this .projectId = projectId;
086: }
087:
088: //DEBT: LSP violation. Should have a class of domain object that are not Nameable
089: public String getName() {
090: return "";
091: }
092:
093: public String toString() {
094: return "Integration(id=" + this .getId() + ", personId="
095: + this .getPersonId() + ", projectId="
096: + this .getProjectId() + ", comment="
097: + this .getComment() + ", lastUpdateTime="
098: + this .getLastUpdateTime() + ", whenComplete="
099: + this .getWhenComplete() + ", whenStarted="
100: + this .getWhenStarted() + ")";
101: }
102: }
|