001: /*
002: The contents of this file are subject to the Common Public Attribution License
003: Version 1.0 (the "License"); you may not use this file except in compliance with
004: the License. You may obtain a copy of the License at
005: http://www.projity.com/license . The License is based on the Mozilla Public
006: License Version 1.1 but Sections 14 and 15 have been added to cover use of
007: software over a computer network and provide for limited attribution for the
008: Original Developer. In addition, Exhibit A has been modified to be consistent
009: with Exhibit B.
010:
011: Software distributed under the License is distributed on an "AS IS" basis,
012: WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
013: specific language governing rights and limitations under the License. The
014: Original Code is OpenProj. The Original Developer is the Initial Developer and
015: is Projity, Inc. All portions of the code written by Projity are Copyright (c)
016: 2006, 2007. All Rights Reserved. Contributors Projity, Inc.
017:
018: Alternatively, the contents of this file may be used under the terms of the
019: Projity End-User License Agreeement (the Projity License), in which case the
020: provisions of the Projity License are applicable instead of those above. If you
021: wish to allow use of your version of this file only under the terms of the
022: Projity License and not to allow others to use your version of this file under
023: the CPAL, indicate your decision by deleting the provisions above and replace
024: them with the notice and other provisions required by the Projity License. If
025: you do not delete the provisions above, a recipient may use your version of this
026: file under either the CPAL or the Projity License.
027:
028: [NOTE: The text of this license may differ slightly from the text of the notices
029: in Exhibits A and B of the license at http://www.projity.com/license. You should
030: use the latest text at http://www.projity.com/license for your modifications.
031: You may not remove this license text from the source files.]
032:
033: Attribution Information: Attribution Copyright Notice: Copyright © 2006, 2007
034: Projity, Inc. Attribution Phrase (not exceeding 10 words): Powered by OpenProj,
035: an open source solution from Projity. Attribution URL: http://www.projity.com
036: Graphic Image as provided in the Covered Code as file: openproj_logo.png with
037: alternatives listed on http://www.projity.com/logo
038:
039: Display of Attribution Information is required in Larger Works which are defined
040: in the CPAL as a work which combines Covered Code or portions thereof with code
041: not governed by the terms of the CPAL. However, in addition to the other notice
042: obligations, all copies of the Covered Code in Executable and Source Code form
043: distributed must, as a form of attribution of the original author, include on
044: each user interface screen the "OpenProj" logo visible to all users. The
045: OpenProj logo should be located horizontally aligned with the menu bar and left
046: justified on the top left of the screen adjacent to the File menu. The logo
047: must be at least 100 x 25 pixels. When users click on the "OpenProj" logo it
048: must direct them back to http://www.projity.com.
049: */
050: package com.projity.script.object;
051:
052: import java.util.ArrayList;
053: import java.util.List;
054:
055: import com.projity.datatype.Duration;
056: import com.projity.datatype.TimeUnit;
057: import com.projity.field.FieldContext;
058: import com.projity.pm.assignment.TimeDistributedFields;
059: import com.projity.pm.key.HasId;
060: import com.projity.pm.key.HasName;
061: import com.projity.pm.scheduling.TimeSheetSchedule;
062: import com.projity.pm.time.MutableHasStartAndEnd;
063: import com.projity.server.data.ExtendedDistributionData;
064:
065: public class DistributionHolder implements HasId, HasName,
066: MutableHasStartAndEnd, TimeDistributedFields, TimeSheetSchedule {
067: protected long id, uniqueId;
068: protected String name;
069: protected long start, end, c;
070: protected List<ExtendedDistributionData> dist;
071: protected List<DistributionHolder> children;
072: protected long parentId;
073: protected Object extension;
074:
075: public List<ExtendedDistributionData> getDist() {
076: return dist;
077: }
078:
079: public void setDist(List<ExtendedDistributionData> dist) {
080: this .dist = dist;
081: }
082:
083: public long getId() {
084: return id;
085: }
086:
087: public void setId(long id) {
088: this .id = id;
089: }
090:
091: public long getUniqueId() {
092: return uniqueId;
093: }
094:
095: public void setUniqueId(long uniqueId) {
096: this .uniqueId = uniqueId;
097: }
098:
099: public String getName() {
100: return name;
101: }
102:
103: public String getName(FieldContext context) {
104: return name;
105: }
106:
107: public void setName(String name) {
108: this .name = name;
109: }
110:
111: public long getEnd() {
112: return end;
113: }
114:
115: public void setEnd(long end) {
116: this .end = end;
117: }
118:
119: public long getStart() {
120: return start;
121: }
122:
123: public void setStart(long start) {
124: this .start = start;
125: }
126:
127: public List<DistributionHolder> getChildren() {
128: return children;
129: }
130:
131: public void setChildren(List<DistributionHolder> children) {
132: this .children = children;
133: }
134:
135: public void addChild(DistributionHolder child) {
136: if (children == null)
137: children = new ArrayList<DistributionHolder>();
138: children.add(child);
139: }
140:
141: public Object getExtension() {
142: return extension;
143: }
144:
145: public void setExtension(Object extension) {
146: this .extension = extension;
147: }
148:
149: public long getParentId() {
150: return parentId;
151: }
152:
153: public void setParentId(long parentId) {
154: this .parentId = parentId;
155: }
156:
157: public long getC() {
158: return c;
159: }
160:
161: public void setC(long c) {
162: this .c = c;
163: }
164:
165: //TimeDistributedFields
166: protected double work, actualWork, cost, actualCost;
167:
168: public double getActualCost() {
169: return actualCost;
170: }
171:
172: public void setActualCost(double actualCost) {
173: this .actualCost = actualCost;
174: }
175:
176: public double getActualWork() {
177: return actualWork;
178: }
179:
180: public void setActualWork(double actualWork) {
181: this .actualWork = actualWork;
182: }
183:
184: public double getCost() {
185: return cost;
186: }
187:
188: public void setCost(double cost) {
189: this .cost = cost;
190: }
191:
192: public double getWork() {
193: return work;
194: }
195:
196: public void setWork(double work) {
197: this .work = work;
198: }
199:
200: public String dumpTimeDistributedFields() {
201: return "work=" + work + ", actualWork=" + actualWork
202: + ", cost=" + cost + ", =" + actualCost + ", ="
203: + actualCost;
204: }
205:
206: public boolean fieldHideActualCost(FieldContext fieldContext) {
207: // TODO Auto-generated method stub
208: return false;
209: }
210:
211: public boolean fieldHideActualFixedCost(FieldContext fieldContext) {
212: // TODO Auto-generated method stub
213: return false;
214: }
215:
216: public boolean fieldHideActualWork(FieldContext fieldContext) {
217: // TODO Auto-generated method stub
218: return false;
219: }
220:
221: public boolean fieldHideBaselineCost(int numBaseline,
222: FieldContext fieldContext) {
223: // TODO Auto-generated method stub
224: return false;
225: }
226:
227: public boolean fieldHideBaselineWork(int numBaseline,
228: FieldContext fieldContext) {
229: // TODO Auto-generated method stub
230: return false;
231: }
232:
233: public boolean fieldHideCost(FieldContext fieldContext) {
234: // TODO Auto-generated method stub
235: return false;
236: }
237:
238: public boolean fieldHideWork(FieldContext fieldContext) {
239: // TODO Auto-generated method stub
240: return false;
241: }
242:
243: public double getActualCost(FieldContext fieldContext) {
244: return getActualCost();
245: }
246:
247: public double getActualFixedCost(FieldContext fieldContext) {
248: // TODO Auto-generated method stub
249: return 0;
250: }
251:
252: public long getActualWork(FieldContext fieldContext) {
253: return Duration.getInstance(Math.round(getActualWork()),
254: TimeUnit.DAYS);
255: }
256:
257: public double getBaselineCost(int numBaseline,
258: FieldContext fieldContext) {
259: // TODO Auto-generated method stub
260: return 0;
261: }
262:
263: public long getBaselineWork(int numBaseline,
264: FieldContext fieldContext) {
265: // TODO Auto-generated method stub
266: return 0;
267: }
268:
269: public double getCost(FieldContext fieldContext) {
270: return getCost();
271: }
272:
273: public double getFixedCost(FieldContext fieldContext) {
274: // TODO Auto-generated method stub
275: return 0;
276: }
277:
278: public double getRemainingCost(FieldContext fieldContext) {
279: // TODO Auto-generated method stub
280: return 0;
281: }
282:
283: public long getRemainingWork(FieldContext fieldContext) {
284: // TODO Auto-generated method stub
285: return 0;
286: }
287:
288: public long getWork(FieldContext fieldContext) {
289: return Duration.getInstance(Math.round(getWork()),
290: TimeUnit.DAYS);
291: }
292:
293: public boolean isReadOnlyActualWork(FieldContext fieldContext) {
294: // TODO Auto-generated method stub
295: return false;
296: }
297:
298: public boolean isReadOnlyFixedCost(FieldContext fieldContext) {
299: // TODO Auto-generated method stub
300: return false;
301: }
302:
303: public boolean isReadOnlyRemainingWork(FieldContext fieldContext) {
304: // TODO Auto-generated method stub
305: return false;
306: }
307:
308: public boolean isReadOnlyWork(FieldContext fieldContext) {
309: // TODO Auto-generated method stub
310: return false;
311: }
312:
313: public void setActualWork(long actualWork, FieldContext fieldContext) {
314: setActualWork(actualWork);
315: }
316:
317: public void setFixedCost(double fixedCost, FieldContext fieldContext) {
318: // TODO Auto-generated method stub
319:
320: }
321:
322: public void setRemainingWork(long remainingWork,
323: FieldContext fieldContext) {
324: // TODO Auto-generated method stub
325:
326: }
327:
328: public void setWork(long work, FieldContext fieldContext) {
329: // TODO Auto-generated method stub
330:
331: }
332:
333: //TimeSheetSchedule
334:
335: public double getPercentComplete() {
336: return work == 0 ? 0.0 : actualWork / work;
337: }
338:
339: public long getRemainingDuration() {
340: // TODO Auto-generated method stub
341: return 0;
342: }
343:
344: public boolean isComplete() {
345: // TODO Auto-generated method stub
346: return false;
347: }
348:
349: public void setComplete(boolean complete) {
350: // TODO Auto-generated method stub
351:
352: }
353:
354: public void setPercentComplete(double percentComplete) {
355: // TODO Auto-generated method stub
356:
357: }
358:
359: public void setRemainingDuration(long remainingDuration) {
360: // TODO Auto-generated method stub
361:
362: }
363:
364: //Schedule?
365:
366: }
|