001: /*
002: * Wilos Is a cLever process Orchestration Software - http://www.wilos-project.org
003: * Copyright (C) 2006-2007 Paul Sabatier University, IUP ISI (Toulouse, France) <massie@irit.fr>
004: * Copyright (C) 2007 Sebastien BALARD <sbalard@wilos-project.org>
005: * Copyright (C) 2007 Mathieu BENOIT <mathieu-benoit@hotmail.fr>
006: *
007: * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
008: * General Public License as published by the Free Software Foundation; either version 2 of the License,
009: * or (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
012: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013: * GNU General Public License for more details.
014: *
015: * You should have received a copy of the GNU General Public License along with this program; if not,
016: * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
017: */
018:
019: package wilos.model.spem2.workbreakdownelement;
020:
021: import org.apache.commons.lang.builder.EqualsBuilder;
022: import org.apache.commons.lang.builder.HashCodeBuilder;
023:
024: /**
025: *
026: * WorkOrder represents a relationship between two Breakdown Elements in which
027: * one Breakdown Elements depends on the start or finish of another Breakdown
028: * Elements in order to begin or end. The WorkOrder class defines predecessor
029: * and successor relations amongst Breakdown Elements. This information is in
030: * particular critical for planning applications.
031: * <p />
032: * It's an element of the SPEM2 specification of the OMG
033: * organization (http://www.omg.org/).
034: *
035: */
036: public class WorkOrder {
037:
038: //TODO [Wilos1] remove this constant (already defined in wilos.utils.Constantes)
039: public final static String START_TO_START = "startToStart";
040: //TODO [Wilos1] remove this constant (already defined in wilos.utils.Constantes)
041: public final static String START_TO_FINISH = "startToFinish";
042: //TODO [Wilos1] remove this constant (already defined in wilos.utils.Constantes)
043: public final static String FINISH_TO_START = "finishToStart";
044: //TODO [Wilos1] remove this constant (already defined in wilos.utils.Constantes)
045: public final static String FINISH_TO_FINISH = "finishToFinish";
046: //TODO [Wilos1] move this array to wilos.utils.Constantes
047: public final static String[] linkTypes = { START_TO_START,
048: START_TO_FINISH, FINISH_TO_START, FINISH_TO_FINISH };
049:
050: private WorkOrderId workOrderId;
051:
052: private WorkBreakdownElement predecessor;
053:
054: private WorkBreakdownElement successor;
055:
056: private String linkType;
057:
058: public WorkOrder() {
059: this .workOrderId = null;
060: this .predecessor = null;
061: this .successor = null;
062: this .linkType = "";
063: }
064:
065: /*
066: * (non-Javadoc)
067: *
068: * @see java.lang.Object#equals(java.lang.Object)
069: */
070: @Override
071: public boolean equals(Object _obj) {
072: if (_obj instanceof WorkOrder == false) {
073: return false;
074: }
075: if (this == _obj) {
076: return true;
077: }
078: WorkOrder workOrder = (WorkOrder) _obj;
079: return new EqualsBuilder().append(this .workOrderId,
080: workOrder.workOrderId).append(this .linkType,
081: workOrder.linkType).isEquals();
082: }
083:
084: /*
085: * (non-Javadoc)
086: *
087: * @see java.lang.Object#hashCode()
088: */
089: @Override
090: public int hashCode() {
091: return new HashCodeBuilder(17, 37).append(this .workOrderId)
092: .toHashCode();
093: }
094:
095: /**
096: * @return the linkType
097: */
098: public String getLinkType() {
099: return this .linkType;
100: }
101:
102: /**
103: * @param _linkType
104: * the linkType to set
105: */
106: public void setLinkType(String _linkType) {
107: this .linkType = _linkType;
108: }
109:
110: /**
111: * @return the predecessor
112: */
113: public WorkBreakdownElement getPredecessor() {
114: return this .predecessor;
115: }
116:
117: /**
118: * @param _predecessor
119: * the predecessor to set
120: */
121: public void setPredecessor(WorkBreakdownElement _predecessor) {
122: this .predecessor = _predecessor;
123: }
124:
125: /**
126: * @return the successor
127: */
128: public WorkBreakdownElement getSuccessor() {
129: return this .successor;
130: }
131:
132: /**
133: * @param _successor
134: * the successor to set
135: */
136: public void setSuccessor(WorkBreakdownElement _successor) {
137: this .successor = _successor;
138: }
139:
140: /**
141: * @return the workOrderId
142: */
143: public WorkOrderId getWorkOrderId() {
144: return this .workOrderId;
145: }
146:
147: /**
148: * @param _workOrderId
149: * the workOrderId to set
150: */
151: public void setWorkOrderId(WorkOrderId _workOrderId) {
152: this.workOrderId = _workOrderId;
153: }
154:
155: }
|