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.misc.dailyremainingtime;
018:
019: import java.util.Date;
020: import java.util.HashSet;
021: import java.util.Set;
022:
023: import org.apache.commons.lang.builder.EqualsBuilder;
024: import org.apache.commons.lang.builder.HashCodeBuilder;
025:
026: import wilos.model.misc.concretetask.ConcreteTaskDescriptor;
027:
028: /**
029: *
030: * A ConcreteRoleDescriptor is a specific {@link RoleDescriptor} for a
031: * {@link Project}.
032: *
033: */
034: public class DailyRemainingTime {
035:
036: private String id;
037:
038: private Float remainingTime;
039:
040: private Date date;
041:
042: private ConcreteTaskDescriptor dailyTaskDescriptor_id;
043:
044: /**
045: * Returns the identifier assigned to the DailyRemainingTime.
046: *
047: * @return the identifier of the DailyRemainingTime
048: */
049: public String getId() {
050: return id;
051: }
052:
053: /**
054: * Sets the identifier assigned to the DailyRemainingTime.
055: */
056: public void setId(String _id) {
057: id = _id;
058: }
059:
060: /**
061: * Class constructor
062: */
063: public DailyRemainingTime() {
064: }
065:
066: /**
067: * Returns a copy of the current instance of DailyRemainingTime
068: *
069: * @return a copy of the DailyRemainingTime
070: * @throws CloneNotSupportedException
071: */
072: @Override
073: public DailyRemainingTime clone() throws CloneNotSupportedException {
074: DailyRemainingTime dailyRemainingTime = new DailyRemainingTime();
075: dailyRemainingTime.copy(this );
076: return dailyRemainingTime;
077: }
078:
079: /**
080: * Copy the values of the specified DailyRemainingTime into the current
081: * instance of the class.
082: *
083: * @param _dailyRemainingTime
084: * the DailyRemainingTime to copy
085: */
086: protected void copy(final DailyRemainingTime _dailyRemainingTime) {
087: this .date = _dailyRemainingTime.getDate();
088: this .remainingTime = _dailyRemainingTime.getRemainingTime();
089: this .dailyTaskDescriptor_id = _dailyRemainingTime
090: .getDailyTaskDescriptor_id();
091: }
092:
093: /**
094: * Defines if the specified Object is the same or has the same values as the
095: * current instance of the class.
096: *
097: * @param obj
098: * the Object to be compare to the DailyRemainingTime
099: * @return true if the specified Object is the same, false otherwise
100: */
101: public boolean equals(Object _obj) {
102: if (_obj instanceof DailyRemainingTime == false) {
103: return false;
104: }
105: if (this == _obj) {
106: return true;
107: }
108: DailyRemainingTime dailyRemainingTime = (DailyRemainingTime) _obj;
109: return new EqualsBuilder().appendSuper(
110: super .equals(dailyRemainingTime)).append(
111: this .dailyTaskDescriptor_id,
112: dailyRemainingTime.dailyTaskDescriptor_id).append(
113: this .date, dailyRemainingTime.date).append(
114: this .remainingTime, dailyRemainingTime.remainingTime)
115: .isEquals();
116:
117: }
118:
119: /**
120: * Returns a hash code value for the object. This method is supported for
121: * the benefit of hash tables.
122: *
123: * @return the hash code of the current instance of DailyRemainingTime
124: */
125: public int hashCode() {
126: return new HashCodeBuilder(17, 37)
127: .appendSuper(super .hashCode()).append(this .date)
128: .append(this .remainingTime).append(
129: this .dailyTaskDescriptor_id).toHashCode();
130: }
131:
132: /*
133: * Relation between DailyRemainingTime and ConcreteTaskDescriptor.
134: *
135: */
136:
137: /**
138: * Adds a relation between the current instance of DailyRemainingTime
139: * and a specified ConcreteTaskDescriptor.
140: *
141: * @param _concreteTaskDescriptor
142: * the ConcreteTaskDescriptor to relate to the DailyRemainingTime
143: */
144: public void addPrimaryConcreteTaskDescriptor(
145: ConcreteTaskDescriptor _concreteTaskDescriptor) {
146: this .dailyTaskDescriptor_id = _concreteTaskDescriptor;
147: _concreteTaskDescriptor.getDailyRemainingTimes().add(this );
148: }
149:
150: /**
151: * Removes the relation between the current instance of DailyRemainingTime
152: * and a specified ConcreteTaskDescriptor.
153: *
154: * @param _concreteTaskDescriptor
155: * the ConcreteTaskDescriptor to unlinked to the DailyRemainingTime
156: */
157: public void removePrimaryConcreteTaskDescriptor(
158: ConcreteTaskDescriptor _concreteTaskDescriptor) {
159: _concreteTaskDescriptor.getDailyRemainingTimes().remove(this );
160: }
161:
162: /*
163: * Getter and Setter.
164: *
165: */
166:
167: /**
168: * Returns the Date assigned to the DailyRemainingTime.
169: *
170: * @return the Date of the DailyRemainingTime
171: */
172: public Date getDate() {
173: return date;
174: }
175:
176: /**
177: * Sets the Date assigned to the DailyRemainingTime.
178: */
179: public void setDate(Date _date) {
180: date = _date;
181: }
182:
183: /**
184: * Returns the value of the remain time
185: *
186: * @return the remaining time
187: */
188: public Float getRemainingTime() {
189: return remainingTime;
190: }
191:
192: /**
193: * Sets the value of the remain time
194: *
195: * @param the remaining time to set
196: */
197: public void setRemainingTime(Float _remainingTime) {
198: remainingTime = _remainingTime;
199: }
200:
201: /**
202: * Returns the identifier of the ConcreteTaskDescriptor assigned to the DailyRemainingTime.
203: *
204: * @return the identifier of the ConcreteTaskDescriptor
205: */
206: public ConcreteTaskDescriptor getDailyTaskDescriptor_id() {
207: return dailyTaskDescriptor_id;
208: }
209:
210: /**
211: * Sets the identifier of the ConcreteTaskDescriptor assigned to the DailyRemainingTime.
212: *
213: * @param the identifier of the ConcreteTaskDescriptor to set
214: */
215: public void setDailyTaskDescriptor_id(
216: ConcreteTaskDescriptor _dailytaskdescriptor_id) {
217: dailyTaskDescriptor_id = _dailytaskdescriptor_id;
218: }
219:
220: }
|