001: /*
002: * Wilos Is a cLever process Orchestration Software - http://www.wilos-project.org
003: * Copyright (C) 2007-2008 Paul Sabatier University, IUP ISI (Toulouse, France) <massie@irit.fr>
004: *
005: * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
006: * General Public License as published by the Free Software Foundation; either version 2 of the License,
007: * or (at your option) any later version.
008: *
009: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
010: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011: * GNU General Public License for more details.
012: *
013: * You should have received a copy of the GNU General Public License along with this program; if not,
014: * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
015: */
016:
017: package wilos.model.spem2.workproduct;
018:
019: import java.util.HashSet;
020: import java.util.Set;
021:
022: import org.apache.commons.lang.builder.EqualsBuilder;
023:
024: import wilos.model.spem2.element.Element;
025: import wilos.model.spem2.guide.Guidance;
026:
027: import wilos.model.spem2.workproduct.WorkProductDescriptor;
028:
029: public class WorkProductDefinition extends Element {
030:
031: /**
032: * Collection of WorkProductDescriptor
033: */
034: private Set<WorkProductDescriptor> workProductDescriptors;
035:
036: private String impactOfNotHaving;
037: private String purpose;
038: private String reasonsForNotNeeding;
039: private String briefOutline;
040: private String representationOptions;
041:
042: private Set<Guidance> guidances;
043:
044: /**
045: * Default constructor
046: */
047: public WorkProductDefinition() {
048: super ();
049: this .guidances = new HashSet<Guidance>();
050: this .workProductDescriptors = new HashSet<WorkProductDescriptor>();
051: this .impactOfNotHaving = "";
052: this .purpose = "";
053: this .reasonsForNotNeeding = "";
054: this .briefOutline = "";
055: this .representationOptions = "";
056: }
057:
058: public boolean equals(Object obj) {
059: if (obj instanceof WorkProductDefinition == false) {
060: return false;
061: }
062: if (this == obj) {
063: return true;
064: }
065: WorkProductDefinition workProduct = (WorkProductDefinition) obj;
066: return new EqualsBuilder().appendSuper(
067: super .equals(workProduct)).isEquals();
068: }
069:
070: public WorkProductDefinition clone()
071: throws CloneNotSupportedException {
072: WorkProductDefinition workProductDefinition = new WorkProductDefinition();
073: workProductDefinition.copy(this );
074: return workProductDefinition;
075: }
076:
077: /**
078: * Copy the _roleDefinition into this.
079: */
080: protected void copy(
081: final WorkProductDefinition _workProductDefinition) {
082: super .copy(_workProductDefinition);
083: this .workProductDescriptors.addAll(_workProductDefinition
084: .getWorkProductDescriptors());
085: this .guidances.addAll(_workProductDefinition.getGuidances());
086: }
087:
088: /*
089: * connection to guidances
090: */
091: public void removeGuidance(Guidance _guidance) {
092: _guidance.getWorkProductDefinitions().remove(this );
093: this .guidances.remove(_guidance);
094: }
095:
096: public void addGuidance(Guidance _guidance) {
097: this .guidances.add(_guidance);
098: _guidance.getWorkProductDefinitions().add(this );
099: }
100:
101: public void removeAllGuidances() {
102: for (Guidance guidance : this .guidances) {
103: guidance.getWorkProductDefinitions().remove(this );
104: }
105: this .guidances.clear();
106: }
107:
108: public void addAllGuidances(Set<Guidance> _guidances) {
109: for (Guidance _guid1 : _guidances) {
110: this .addGuidance(_guid1);
111: }
112: }
113:
114: public Set<Guidance> getGuidances() {
115: return this .guidances;
116: }
117:
118: public void setGuidances(Set<Guidance> _guidances) {
119: this .guidances = _guidances;
120: }
121:
122: /**
123: * Getter of workProductDescriptors.
124: *
125: * @return the workProductDescriptors.
126: */
127: public Set<WorkProductDescriptor> getWorkProductDescriptors() {
128: return workProductDescriptors;
129: }
130:
131: /**
132: * Setter of workProductDescriptors.
133: *
134: * @param _workProductDescriptors
135: * The workProductDescriptors to set.
136: */
137: public void setWorkProductDescriptors(
138: Set<WorkProductDescriptor> workProductDescriptors) {
139: this .workProductDescriptors = workProductDescriptors;
140: }
141:
142: /**
143: * relation between WorkProductDefinition and WorkProductDescriptor
144: */
145: /**
146: * add a WorkProductDescriptor to the set
147: *
148: * @param _workProductDescriptor
149: */
150: public void addWorkProductDescriptor(
151: WorkProductDescriptor _workProductDescriptor) {
152: this .workProductDescriptors.add(_workProductDescriptor);
153: _workProductDescriptor.setWorkProductDefinition(this );
154: }
155:
156: /**
157: * remove a WorkProductDescriptor
158: *
159: * @param _workProductDescriptor
160: */
161: public void removeWorkProductDescriptor(
162: WorkProductDescriptor _workProductDescriptor) {
163: _workProductDescriptor.setWorkProductDefinition(null);
164: this .workProductDescriptors.remove(_workProductDescriptor);
165:
166: }
167:
168: /**
169: * Remove from an WorkProductDefinition all its WorkProductDescriptor
170: *
171: */
172: public void removeAllWorkProductDescriptors() {
173: for (WorkProductDescriptor _workProduct : this .workProductDescriptors) {
174: _workProduct.setWorkProductDefinition(null);
175: }
176: this .workProductDescriptors.clear();
177: }
178:
179: /**
180: * Add a WorkProductDescriptor collection to the WorkProductDescriptor
181: * collection of an WorkProductDefinition
182: *
183: * @param _workProduct
184: */
185: public void addAllWorkProductDescriptors(
186: Set<WorkProductDescriptor> _workProduct) {
187: for (WorkProductDescriptor _workProduct1 : _workProduct) {
188: _workProduct1.addWorkProductDefinition(this );
189: }
190: }
191:
192: /**
193: * @return the impactOfNotHaving
194: */
195: public String getImpactOfNotHaving() {
196: return impactOfNotHaving;
197: }
198:
199: /**
200: * @param _impactOfNotHaving
201: * the impactOfNotHaving to set
202: */
203: public void setImpactOfNotHaving(String _impactOfNotHaving) {
204: impactOfNotHaving = _impactOfNotHaving;
205: }
206:
207: /**
208: * @return the purpose
209: */
210: public String getPurpose() {
211: return purpose;
212: }
213:
214: /**
215: * @param _purpose
216: * the purpose to set
217: */
218: public void setPurpose(String _purpose) {
219: purpose = _purpose;
220: }
221:
222: /**
223: * @return the reasonsForNotNeeding
224: */
225: public String getReasonsForNotNeeding() {
226: return reasonsForNotNeeding;
227: }
228:
229: /**
230: * @param _reasonsForNotNeeding
231: * the reasonsForNotNeeding to set
232: */
233: public void setReasonsForNotNeeding(String _reasonsForNotNeeding) {
234: reasonsForNotNeeding = _reasonsForNotNeeding;
235: }
236:
237: /**
238: * @return the briefOutline
239: */
240: public String getBriefOutline() {
241: return briefOutline;
242: }
243:
244: /**
245: * @param _briefOutline
246: * the briefOutline to set
247: */
248: public void setBriefOutline(String _briefOutline) {
249: briefOutline = _briefOutline;
250: }
251:
252: /**
253: * @return the representationOptions
254: */
255: public String getRepresentationOptions() {
256: return representationOptions;
257: }
258:
259: /**
260: * @param _representationOptions
261: * the representationOptions to set
262: */
263: public void setRepresentationOptions(String _representationOptions) {
264: representationOptions = _representationOptions;
265: }
266: }
|