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 Mathieu BENOIT <mathieu-benoit@hotmail.fr>
005: *
006: * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
007: * General Public License as published by the Free Software Foundation; either version 2 of the License,
008: * or (at your option) any later version.
009: *
010: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
011: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU General Public License for more details.
013: *
014: * You should have received a copy of the GNU General Public License along with this program; if not,
015: * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
016: */
017:
018: package wilos.model.spem2.element;
019:
020: import org.apache.commons.lang.builder.EqualsBuilder;
021: import org.apache.commons.lang.builder.HashCodeBuilder;
022:
023: /**
024: *
025: * Every class defined in this specification is derived from Element. In other
026: * words Element is the root generalization for all classes and defines a common
027: * set of attributes inherited by every other element type of this model.
028: * <p />
029: * It's an element of the SPEM2 specification of the OMG organization
030: * (http://www.omg.org/).
031: *
032: */
033: public class Element implements Cloneable {
034:
035: /**
036: * The id for the database mapping.
037: */
038: private String id;
039:
040: /**
041: * The global unique id for EPF.
042: */
043: private String guid;
044:
045: /**
046: * The name of the element.
047: */
048: private String name;
049:
050: /**
051: * The sentences describe this element.
052: */
053: private String description;
054:
055: /**
056: * The main description of the element
057: */
058: private String mainDescription;
059:
060: /**
061: * the key considerations of the element
062: */
063: private String keyConsiderations;
064:
065: /**
066: * the insertion order of the element
067: */
068: private int insertionOrder;
069:
070: /**
071: * Constructor.
072: *
073: */
074: public Element() {
075: this .id = "";
076: this .guid = "";
077: this .name = "";
078: this .description = "";
079: this .mainDescription = "";
080: this .keyConsiderations = "";
081: }
082:
083: /**
084: * Returns a copy of the current instance of Element
085: *
086: * @return a copy of the Element
087: * @throws CloneNotSupportedException
088: */
089: @Override
090: public Element clone() throws CloneNotSupportedException {
091: Element element = new Element();
092: element.copy(this );
093: return element;
094: }
095:
096: /**
097: * Copy the values of the specified Element into the current instance of the
098: * class.
099: *
100: * @param _element
101: * The element to copy.
102: */
103: protected void copy(final Element _element) {
104: this .guid = _element.guid;
105: this .name = _element.name;
106: this .description = _element.description;
107: this .keyConsiderations = _element.keyConsiderations;
108: this .mainDescription = _element.mainDescription;
109: this .insertionOrder = _element.insertionOrder;
110: }
111:
112: /**
113: * Defines if the specified Object is the same or has the same values as the
114: * current instance of the Element.
115: *
116: * @param obj
117: * the Object to be compare to the Element
118: * @return true if the specified Object is the same, false otherwise
119: */
120: public boolean equals(Object _obj) {
121: if (_obj instanceof Element == false) {
122: return false;
123: }
124: if (this == _obj) {
125: return true;
126: }
127: Element element = (Element) _obj;
128: return new EqualsBuilder().append(this .guid, element.guid)
129: .append(this .name, element.name).append(
130: this .description, element.description).append(
131: this .keyConsiderations,
132: element.keyConsiderations).append(
133: this .mainDescription, element.mainDescription)
134: .append(this .insertionOrder, element.insertionOrder)
135: .isEquals();
136: }
137:
138: /**
139: * Returns a hash code value for the object. This method is supported for
140: * the benefit of hash tables.
141: *
142: * @return the hash code of the current instance of Element
143: */
144: public int hashCode() {
145: return new HashCodeBuilder(17, 37).append(this .guid).append(
146: this .name).append(this .description).append(
147: this .keyConsiderations).append(this .mainDescription)
148: .append(this .insertionOrder).toHashCode();
149: }
150:
151: /**
152: * Getter of the Element's description.
153: *
154: * @return the description.
155: */
156: public String getDescription() {
157: return this .description;
158: }
159:
160: /**
161: * Setter of the Element's description.
162: *
163: * @param _description
164: * The description to set.
165: */
166: public void setDescription(String _description) {
167: this .description = _description;
168: }
169:
170: /**
171: * Getter of the Element's id.
172: *
173: * @return the id.
174: */
175: public String getId() {
176: return this .id;
177: }
178:
179: /**
180: * Setter of the Element's id.
181: *
182: * @param _id
183: * The id to set.
184: */
185: @SuppressWarnings("unused")
186: private void setId(String _id) {
187: this .id = _id;
188: }
189:
190: /**
191: * Getter of the Element's name.
192: *
193: * @return the name.
194: */
195: public String getName() {
196: return this .name;
197: }
198:
199: /**
200: * Setter of the Element's name.
201: *
202: * @param _name
203: * The name to set.
204: */
205: public void setName(String _name) {
206: this .name = _name;
207: }
208:
209: /**
210: * Getter of idEPF.
211: *
212: * @return the idEPF.
213: */
214: public String getGuid() {
215: return this .guid;
216: }
217:
218: /**
219: * Setter of idEPF.
220: *
221: * @param _guid
222: * The idEPF to set.
223: */
224: public void setGuid(String _guid) {
225: this .guid = _guid;
226: }
227:
228: /**
229: * Getter of KeyConsiderations
230: *
231: * @return the KeyConsiderations
232: */
233: public String getKeyConsiderations() {
234: return keyConsiderations;
235: }
236:
237: /**
238: * Setter of KeyConsideration
239: *
240: * @param _keyConsiderations
241: * The KeyConsideration to set
242: */
243: public void setKeyConsiderations(String _keyConsiderations) {
244: keyConsiderations = _keyConsiderations;
245: }
246:
247: /**
248: * Getter on the Element's MainDescription
249: *
250: * @return the MainDescription
251: */
252: public String getMainDescription() {
253: return mainDescription;
254: }
255:
256: /**
257: * Setter of the the Element's MainDescription
258: *
259: * @param _mainDescription
260: * The MainDescription to set
261: */
262: public void setMainDescription(String _mainDescription) {
263: mainDescription = _mainDescription;
264: }
265:
266: /**
267: * Getter of the the Element's insertionOrder
268: *
269: * @return the insertionOrder
270: */
271: public int getInsertionOrder() {
272: return this .insertionOrder;
273: }
274:
275: /**
276: * Setter of the the Element's insertionOrder
277: *
278: * @param _insertionOrder
279: * the insertionOrder to set
280: */
281: public void setInsertionOrder(int _insertionOrder) {
282: this.insertionOrder = _insertionOrder;
283: }
284:
285: }
|