001: /*
002: * Copyright (c) 2004-2006, Jean-François Brazeau. All rights reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * 1. Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * 2. Redistributions in binary form must reproduce the above copyright
011: * notice, this list of conditions and the following disclaimer in the
012: * documentation and/or other materials provided with the distribution.
013: *
014: * 3. The name of the author may not be used to endorse or promote products
015: * derived from this software without specific prior written permission.
016: *
017: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
018: * IMPLIEDWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
019: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
020: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
021: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
022: * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
023: * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
024: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
025: * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
026: * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027: */
028: package jfb.tools.activitymgr.core.beans;
029:
030: import jfb.tools.activitymgr.core.util.StringHelper;
031:
032: /**
033: * Tâche.
034: */
035: public class Task extends SimpleIdentityBean {
036:
037: /** Code de la tache */
038: private String code;
039:
040: /** Nom de la tache */
041: private String name;
042:
043: /** Chemin de la tache */
044: private String path;
045:
046: /** Numéro de la tâche */
047: private byte number;
048:
049: /** Nombre de taches filles */
050: private int subTasksCount;
051:
052: /** Budget */
053: private long budget;
054:
055: /** Consommation initiale */
056: private long initiallyConsumed;
057:
058: /** Reste à faire */
059: private long todo;
060:
061: /** Commentaire sur la tache */
062: private String comment;
063:
064: /**
065: * @return le code de la tache.
066: */
067: public String getCode() {
068: return code;
069: }
070:
071: /**
072: * @return le budget alloué à la tache.
073: */
074: public long getBudget() {
075: return budget;
076: }
077:
078: /**
079: * @return le consommé initial de la tache.
080: */
081: public long getInitiallyConsumed() {
082: return initiallyConsumed;
083: }
084:
085: /**
086: * @return le nom de la tâche.
087: */
088: public String getName() {
089: return name;
090: }
091:
092: /**
093: * @return le numéro de la tache.
094: */
095: public byte getNumber() {
096: return number;
097: }
098:
099: /**
100: * @return le chemin de la tache.
101: */
102: public String getPath() {
103: return path;
104: }
105:
106: /**
107: * @return le nombre de tâches filles.
108: */
109: public int getSubTasksCount() {
110: return subTasksCount;
111: }
112:
113: /**
114: * @return le reste à faire associé à la tâche.
115: */
116: public long getTodo() {
117: return todo;
118: }
119:
120: /**
121: * Définit le code de la tâche.
122: * @param code le nouveau code.
123: */
124: public void setCode(String code) {
125: this .code = code;
126: }
127:
128: /**
129: * Définit le budget alloué à la tache
130: * @param budget le nouveau budget.
131: */
132: public void setBudget(long budget) {
133: this .budget = budget;
134: }
135:
136: /**
137: * Définit le consommé initial de la tache.
138: * @param initiallyConsumed le nouveau consommé initial.
139: */
140: public void setInitiallyConsumed(long initiallyConsumed) {
141: this .initiallyConsumed = initiallyConsumed;
142: }
143:
144: /**
145: * Définit le nom de la tache.
146: * @param name le nouveau nom.
147: */
148: public void setName(String name) {
149: this .name = name;
150: }
151:
152: /**
153: * Définit le numéro de la tache.
154: * @param number le nouveau numéro.
155: */
156: public void setNumber(byte number) {
157: this .number = number;
158: }
159:
160: /**
161: * Définit le chemin de la tache.
162: * @param path le nouveau chemin.
163: */
164: public void setPath(String path) {
165: this .path = path;
166: }
167:
168: /**
169: * Définiti le nombre de taches filles.
170: * @param subTasksCount le nouveau nombre de taches filles.
171: */
172: public void setSubTasksCount(int subTasksCount) {
173: this .subTasksCount = subTasksCount;
174: }
175:
176: /**
177: * Définit le reste à faire associé à la tache.
178: * @param todo le nouveau reste à faire.
179: */
180: public void setTodo(long todo) {
181: this .todo = todo;
182: }
183:
184: /**
185: * Construit le chemin complet de la tâche.
186: * @return le chemin complet de la tâche.
187: */
188: public String getFullPath() {
189: StringBuffer result = new StringBuffer(path != null ? path : "");
190: result.append(StringHelper.toHex(number));
191: return result.toString();
192: }
193:
194: /**
195: * Retourne le commentaire associé à la tache.
196: * @return le commentaire associé à la tache.
197: */
198: public String getComment() {
199: return comment;
200: }
201:
202: /**
203: * Définit le commentaire de la tache.
204: * @param comment le nouveau commentaire.
205: */
206: public void setComment(String comment) {
207: this .comment = comment;
208: }
209:
210: /* (non-Javadoc)
211: * @see java.lang.Object#toString()
212: */
213: public String toString() {
214: return new StringBuffer("Task(").append(getId()).append(", ")
215: .append(code).append(", ").append(name).append(",")
216: .append(path).append(",").append(number).append(",")
217: .append(getFullPath()).append(")").toString();
218: }
219:
220: }
|