Source Code Cross Referenced for ResourceImpl.java in  » Project-Management » OpenProj » com » projity » pm » resource » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Project Management » OpenProj » com.projity.pm.resource 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:        The contents of this file are subject to the Common Public Attribution License 
0003:        Version 1.0 (the "License"); you may not use this file except in compliance with 
0004:        the License. You may obtain a copy of the License at 
0005:        http://www.projity.com/license . The License is based on the Mozilla Public 
0006:        License Version 1.1 but Sections 14 and 15 have been added to cover use of 
0007:        software over a computer network and provide for limited attribution for the 
0008:        Original Developer. In addition, Exhibit A has been modified to be consistent 
0009:        with Exhibit B.
0010:
0011:        Software distributed under the License is distributed on an "AS IS" basis, 
0012:        WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
0013:        specific language governing rights and limitations under the License. The 
0014:        Original Code is OpenProj. The Original Developer is the Initial Developer and 
0015:        is Projity, Inc. All portions of the code written by Projity are Copyright (c) 
0016:        2006, 2007. All Rights Reserved. Contributors Projity, Inc.
0017:
0018:        Alternatively, the contents of this file may be used under the terms of the 
0019:        Projity End-User License Agreeement (the Projity License), in which case the 
0020:        provisions of the Projity License are applicable instead of those above. If you 
0021:        wish to allow use of your version of this file only under the terms of the 
0022:        Projity License and not to allow others to use your version of this file under 
0023:        the CPAL, indicate your decision by deleting the provisions above and replace 
0024:        them with the notice and other provisions required by the Projity  License. If 
0025:        you do not delete the provisions above, a recipient may use your version of this 
0026:        file under either the CPAL or the Projity License.
0027:
0028:        [NOTE: The text of this license may differ slightly from the text of the notices 
0029:        in Exhibits A and B of the license at http://www.projity.com/license. You should 
0030:        use the latest text at http://www.projity.com/license for your modifications.
0031:        You may not remove this license text from the source files.]
0032:
0033:        Attribution Information: Attribution Copyright Notice: Copyright � 2006, 2007 
0034:        Projity, Inc. Attribution Phrase (not exceeding 10 words): Powered by OpenProj, 
0035:        an open source solution from Projity. Attribution URL: http://www.projity.com 
0036:        Graphic Image as provided in the Covered Code as file:  openproj_logo.png with 
0037:        alternatives listed on http://www.projity.com/logo
0038:
0039:        Display of Attribution Information is required in Larger Works which are defined 
0040:        in the CPAL as a work which combines Covered Code or portions thereof with code 
0041:        not governed by the terms of the CPAL. However, in addition to the other notice 
0042:        obligations, all copies of the Covered Code in Executable and Source Code form 
0043:        distributed must, as a form of attribution of the original author, include on 
0044:        each user interface screen the "OpenProj" logo visible to all users.  The 
0045:        OpenProj logo should be located horizontally aligned with the menu bar and left 
0046:        justified on the top left of the screen adjacent to the File menu.  The logo 
0047:        must be at least 100 x 25 pixels.  When users click on the "OpenProj" logo it 
0048:        must direct them back to http://www.projity.com.  
0049:         */
0050:        package com.projity.pm.resource;
0051:
0052:        import java.io.IOException;
0053:        import java.io.ObjectInputStream;
0054:        import java.io.ObjectOutputStream;
0055:        import java.util.Collection;
0056:        import java.util.Date;
0057:        import java.util.HashSet;
0058:        import java.util.Iterator;
0059:        import java.util.List;
0060:        import java.util.Set;
0061:
0062:        import org.apache.commons.collections.Closure;
0063:        import org.apache.commons.collections.Predicate;
0064:
0065:        import com.projity.algorithm.ReverseQuery;
0066:        import com.projity.algorithm.TimeIteratorGenerator;
0067:        import com.projity.algorithm.buffer.CalculatedValues;
0068:        import com.projity.association.AssociationList;
0069:        import com.projity.company.ApplicationUser;
0070:        import com.projity.company.UserUtil;
0071:        import com.projity.configuration.CircularDependencyException;
0072:        import com.projity.configuration.Configuration;
0073:        import com.projity.configuration.FieldDictionary;
0074:        import com.projity.datatype.ImageLink;
0075:        import com.projity.datatype.Rate;
0076:        import com.projity.datatype.RateFormat;
0077:        import com.projity.document.Document;
0078:        import com.projity.field.CustomFields;
0079:        import com.projity.field.Field;
0080:        import com.projity.field.FieldContext;
0081:        import com.projity.graphic.configuration.HasIndicators;
0082:        import com.projity.graphic.configuration.HasResourceIndicators;
0083:        import com.projity.grouping.core.Node;
0084:        import com.projity.grouping.core.model.NodeModel;
0085:        import com.projity.interval.InvalidValueObjectForIntervalException;
0086:        import com.projity.pm.assignment.Assignment;
0087:        import com.projity.pm.availability.AvailabilityTable;
0088:        import com.projity.pm.availability.HasAvailability;
0089:        import com.projity.pm.calendar.WorkCalendar;
0090:        import com.projity.pm.costing.CostRateTable;
0091:        import com.projity.pm.key.HasKey;
0092:        import com.projity.pm.task.AccessControlPolicy;
0093:        import com.projity.pm.task.Project;
0094:        import com.projity.pm.task.Task;
0095:        import com.projity.util.Environment;
0096:
0097:        /**
0098:         * This class is used to hold resources assigned to a project.  Currently everything delegates to the global resource's values.
0099:         * In the future, some fields such as costs and availability should be overridable on he porject level.
0100:         */
0101:        public class ResourceImpl implements  Resource, HasAvailability,
0102:                HasResourceIndicators {
0103:            static final long serialVersionUID = 9485792329492L;
0104:            private static ResourceImpl UNASSIGNED = null;
0105:            static HashSet readOnlyUserFields = null;
0106:
0107:            private HashSet getReadOnlyUserFields() {
0108:                if (readOnlyUserFields == null) {
0109:                    readOnlyUserFields = new HashSet();
0110:                    readOnlyUserFields.add(Configuration
0111:                            .getFieldFromId("Field.name"));
0112:                    readOnlyUserFields.add(Configuration
0113:                            .getFieldFromId("Field.emailAddress"));
0114:                }
0115:                return readOnlyUserFields;
0116:            }
0117:
0118:            public long getEarliestAssignmentStart() {
0119:                return globalResource.getEarliestAssignmentStart();
0120:            }
0121:
0122:            public boolean hasActiveAssignment(long start, long end) {
0123:                return globalResource.hasActiveAssignment(start, end);
0124:            }
0125:
0126:            /**
0127:             * @return
0128:             */
0129:            public static Resource getUnassignedInstance() {
0130:                if (UNASSIGNED == null) {
0131:                    UNASSIGNED = new ResourceImpl(
0132:                            (EnterpriseResource) EnterpriseResource
0133:                                    .getUnassignedInstance());
0134:                }
0135:                return UNASSIGNED;
0136:            }
0137:
0138:            transient EnterpriseResource globalResource = null;
0139:            private int bookingType = BookingType.COMMITTED;
0140:
0141:            //Methods not in EnterpriseResources	
0142:            public int getBookingType() {
0143:                return bookingType;
0144:            }
0145:
0146:            public void setBookingType(int bookingType) {
0147:                this .bookingType = bookingType;
0148:            }
0149:
0150:            /**
0151:             * @return Returns the availabilityTable.
0152:             */
0153:            public AvailabilityTable getAvailabilityTable() {
0154:                return globalResource.getAvailabilityTable();
0155:            }
0156:
0157:            public void setAvailableFrom(long availableFrom)
0158:                    throws InvalidValueObjectForIntervalException {
0159:                getAvailabilityTable().setAvailableFrom(availableFrom);
0160:            }
0161:
0162:            public void setAvailableTo(long availableTo) {
0163:                getAvailabilityTable().setAvailableTo(availableTo);
0164:            }
0165:
0166:            public boolean isReadOnlyAvailableFrom(FieldContext fieldContext) {
0167:                return true;
0168:            }
0169:
0170:            public boolean isReadOnlyAvailableTo(FieldContext fieldContext) {
0171:                return true;
0172:            }
0173:
0174:            public long getAvailableFrom() {
0175:                return getAvailabilityTable().getAvailableFrom();
0176:            }
0177:
0178:            public long getAvailableTo() {
0179:                return getAvailabilityTable().getAvailableTo();
0180:            }
0181:
0182:            public double getMaximumUnits() {
0183:                return getAvailabilityTable().getMaximumUnits();
0184:                //		return globalResource.getMaximumUnits();
0185:            }
0186:
0187:            public void setMaximumUnits(double maxUnits) {
0188:                getAvailabilityTable().setMaximumUnits(maxUnits);
0189:                //		globalResource.setMaximumUnits(maxUnits);
0190:            }
0191:
0192:            public ResourceImpl() {
0193:            }
0194:
0195:            /**
0196:             * @param pool
0197:             */
0198:            public ResourceImpl(EnterpriseResource globalResource) {
0199:                this .globalResource = globalResource;
0200:            }
0201:
0202:            // Delegated methods
0203:
0204:            public static Closure forAllAssignments(Closure visitor) {
0205:                return EnterpriseResource.forAllAssignments(visitor);
0206:            }
0207:
0208:            public double actualCost(long start, long end) {
0209:                return globalResource.actualCost(start, end);
0210:            }
0211:
0212:            public long actualWork(long start, long end) {
0213:                return globalResource.actualWork(start, end);
0214:            }
0215:
0216:            public double acwp(long start, long end) {
0217:                return globalResource.acwp(start, end);
0218:            }
0219:
0220:            public void addAssignment(Assignment assignment) {
0221:                globalResource.addAssignment(assignment);
0222:                addInTeam();
0223:            }
0224:
0225:            /*public void addDefaultAssignment() {
0226:            	globalResource.addDefaultAssignment();
0227:            }*/
0228:            public double bac(long start, long end) {
0229:                return globalResource.bac(start, end);
0230:            }
0231:
0232:            public double baselineCost(long start, long end) {
0233:                return globalResource.baselineCost(start, end);
0234:            }
0235:
0236:            public long baselineWork(long start, long end) {
0237:                return globalResource.baselineWork(start, end);
0238:            }
0239:
0240:            public double bcwp(long start, long end) {
0241:                return globalResource.bcwp(start, end);
0242:            }
0243:
0244:            public double bcws(long start, long end) {
0245:                return globalResource.bcws(start, end);
0246:            }
0247:
0248:            public void buildReverseQuery(ReverseQuery reverseQuery) {
0249:                globalResource.buildReverseQuery(reverseQuery);
0250:            }
0251:
0252:            public long calcActiveAssignmentDuration(WorkCalendar workCalendar) {
0253:                return globalResource
0254:                        .calcActiveAssignmentDuration(workCalendar);
0255:            }
0256:
0257:            public void calcDataBetween(Object type,
0258:                    TimeIteratorGenerator generator, CalculatedValues values) {
0259:                globalResource.calcDataBetween(type, generator, values);
0260:            }
0261:
0262:            public Collection childrenToRollup() {
0263:                return globalResource.childrenToRollup();
0264:            }
0265:
0266:            public double cost(long start, long end) {
0267:                return globalResource.cost(start, end);
0268:            }
0269:
0270:            public boolean fieldHideActualCost(FieldContext fieldContext) {
0271:                return globalResource.fieldHideActualCost(fieldContext);
0272:            }
0273:
0274:            public boolean fieldHideActualWork(FieldContext fieldContext) {
0275:                return globalResource.fieldHideActualWork(fieldContext);
0276:            }
0277:
0278:            public boolean fieldHideAcwp(FieldContext fieldContext) {
0279:                return globalResource.fieldHideAcwp(fieldContext);
0280:            }
0281:
0282:            public boolean fieldHideBac(FieldContext fieldContext) {
0283:                return globalResource.fieldHideBac(fieldContext);
0284:            }
0285:
0286:            public boolean fieldHideBaselineCost(int numBaseline,
0287:                    FieldContext fieldContext) {
0288:                return globalResource.fieldHideBaselineCost(numBaseline,
0289:                        fieldContext);
0290:            }
0291:
0292:            public boolean fieldHideBaselineWork(int numBaseline,
0293:                    FieldContext fieldContext) {
0294:                return globalResource.fieldHideBaselineWork(numBaseline,
0295:                        fieldContext);
0296:            }
0297:
0298:            public boolean fieldHideBcwp(FieldContext fieldContext) {
0299:                return globalResource.fieldHideBcwp(fieldContext);
0300:            }
0301:
0302:            public boolean fieldHideBcws(FieldContext fieldContext) {
0303:                return globalResource.fieldHideBcws(fieldContext);
0304:            }
0305:
0306:            public boolean fieldHideCost(FieldContext fieldContext) {
0307:                return globalResource.fieldHideCost(fieldContext);
0308:            }
0309:
0310:            public boolean fieldHideCpi(FieldContext fieldContext) {
0311:                return globalResource.fieldHideCpi(fieldContext);
0312:            }
0313:
0314:            public boolean fieldHideCv(FieldContext fieldContext) {
0315:                return globalResource.fieldHideCv(fieldContext);
0316:            }
0317:
0318:            public boolean fieldHideCvPercent(FieldContext fieldContext) {
0319:                return globalResource.fieldHideCvPercent(fieldContext);
0320:            }
0321:
0322:            public boolean fieldHideEac(FieldContext fieldContext) {
0323:                return globalResource.fieldHideEac(fieldContext);
0324:            }
0325:
0326:            public boolean fieldHideSpi(FieldContext fieldContext) {
0327:                return globalResource.fieldHideSpi(fieldContext);
0328:            }
0329:
0330:            public boolean fieldHideSv(FieldContext fieldContext) {
0331:                return globalResource.fieldHideSv(fieldContext);
0332:            }
0333:
0334:            public boolean fieldHideSvPercent(FieldContext fieldContext) {
0335:                return globalResource.fieldHideSvPercent(fieldContext);
0336:            }
0337:
0338:            public boolean fieldHideTcpi(FieldContext fieldContext) {
0339:                return globalResource.fieldHideTcpi(fieldContext);
0340:            }
0341:
0342:            public boolean fieldHideVac(FieldContext fieldContext) {
0343:                return globalResource.fieldHideVac(fieldContext);
0344:            }
0345:
0346:            public boolean fieldHideWork(FieldContext fieldContext) {
0347:                return globalResource.fieldHideWork(fieldContext);
0348:            }
0349:
0350:            public Assignment findAssignment(Resource resource) {
0351:                return globalResource.findAssignment(resource);
0352:            }
0353:
0354:            public Assignment findAssignment(Task task) {
0355:                return globalResource.findAssignment(task);
0356:            }
0357:
0358:            public void forEachWorkingInterval(Closure visitor,
0359:                    boolean mergeWorking, WorkCalendar workCalendar) {
0360:                globalResource.forEachWorkingInterval(visitor, mergeWorking,
0361:                        workCalendar);
0362:            }
0363:
0364:            public int getAccrueAt() {
0365:                return globalResource.getAccrueAt();
0366:            }
0367:
0368:            public double getActualCost(FieldContext fieldContext) {
0369:                return globalResource.getActualCost(fieldContext);
0370:            }
0371:
0372:            public long getActualWork(FieldContext fieldContext) {
0373:                return globalResource.getActualWork(fieldContext);
0374:            }
0375:
0376:            public double getAcwp(FieldContext fieldContext) {
0377:                return globalResource.getAcwp(fieldContext);
0378:            }
0379:
0380:            public AssociationList getAssignments() {
0381:                return globalResource.getAssignments();
0382:            }
0383:
0384:            public double getBac(FieldContext fieldContext) {
0385:                return globalResource.getBac(fieldContext);
0386:            }
0387:
0388:            public double getBaselineCost(int numBaseline,
0389:                    FieldContext fieldContext) {
0390:                return globalResource
0391:                        .getBaselineCost(numBaseline, fieldContext);
0392:            }
0393:
0394:            public long getBaselineWork(int numBaseline,
0395:                    FieldContext fieldContext) {
0396:                return globalResource
0397:                        .getBaselineWork(numBaseline, fieldContext);
0398:            }
0399:
0400:            public double getBcwp(FieldContext fieldContext) {
0401:                return globalResource.getBcwp(fieldContext);
0402:            }
0403:
0404:            public double getBcws(FieldContext fieldContext) {
0405:                return globalResource.getBcws(fieldContext);
0406:            }
0407:
0408:            public double getCost(FieldContext fieldContext) {
0409:                return globalResource.getCost(fieldContext);
0410:            }
0411:
0412:            public double getCostPerUse() {
0413:                return globalResource.getCostPerUse();
0414:            }
0415:
0416:            public CostRateTable getCostRateTable(int costRateIndex) {
0417:                return globalResource.getCostRateTable(costRateIndex);
0418:            }
0419:
0420:            public double getCpi(FieldContext fieldContext) {
0421:                return globalResource.getCpi(fieldContext);
0422:            }
0423:
0424:            public Date getCreated() {
0425:                return globalResource.getCreated();
0426:            }
0427:
0428:            public double getCv(FieldContext fieldContext) {
0429:                return globalResource.getCv(fieldContext);
0430:            }
0431:
0432:            public double getCvPercent(FieldContext fieldContext) {
0433:                return globalResource.getCvPercent(fieldContext);
0434:            }
0435:
0436:            public Document getDocument() {
0437:                return globalResource.getDocument();
0438:            }
0439:
0440:            public double getEac(FieldContext fieldContext) {
0441:                return globalResource.getEac(fieldContext);
0442:            }
0443:
0444:            public WorkCalendar getEffectiveWorkCalendar() {
0445:                return globalResource.getEffectiveWorkCalendar();
0446:            }
0447:
0448:            public String getGroup() {
0449:                return globalResource.getGroup();
0450:            }
0451:
0452:            public long getId() {
0453:                return globalResource.getId();
0454:            }
0455:
0456:            public long getExternalId() {
0457:                return globalResource.getExternalId();
0458:            }
0459:
0460:            public String getInitials() {
0461:                return globalResource.getInitials();
0462:            }
0463:
0464:            public String getName() {
0465:                return globalResource.getName();
0466:            }
0467:
0468:            public String getName(FieldContext context) {
0469:                return globalResource.getName(context);
0470:            }
0471:
0472:            public String getNotes() {
0473:                return globalResource.getNotes();
0474:            }
0475:
0476:            public Rate getOvertimeRate() {
0477:                return globalResource.getOvertimeRate();
0478:            }
0479:
0480:            public String getPhonetics() {
0481:                return globalResource.getPhonetics();
0482:            }
0483:
0484:            public String getRbsCode() {
0485:                return globalResource.getRbsCode();
0486:            }
0487:
0488:            public double getRemainingOvertimeCost() {
0489:                return globalResource.getRemainingOvertimeCost();
0490:            }
0491:
0492:            public long getRemainingWork(FieldContext fieldContext) {
0493:                return globalResource.getRemainingWork(fieldContext);
0494:            }
0495:
0496:            public ResourcePool getResourcePool() {
0497:                return globalResource.getResourcePool();
0498:            }
0499:
0500:            public int getResourceType() {
0501:                return globalResource.getResourceType();
0502:            }
0503:
0504:            public int getSchedulingType() {
0505:                return globalResource.getSchedulingType();
0506:            }
0507:
0508:            public double getSpi(FieldContext fieldContext) {
0509:                return globalResource.getSpi(fieldContext);
0510:            }
0511:
0512:            public double getCsi(FieldContext fieldContext) {
0513:                return globalResource.getCsi(fieldContext);
0514:            }
0515:
0516:            public Rate getStandardRate() {
0517:                return globalResource.getStandardRate();
0518:            }
0519:
0520:            public double getSv(FieldContext fieldContext) {
0521:                return globalResource.getSv(fieldContext);
0522:            }
0523:
0524:            public double getSvPercent(FieldContext fieldContext) {
0525:                return globalResource.getSvPercent(fieldContext);
0526:            }
0527:
0528:            public double getTcpi(FieldContext fieldContext) {
0529:                return globalResource.getTcpi(fieldContext);
0530:            }
0531:
0532:            public long getUniqueId() {
0533:                return globalResource.getUniqueId();
0534:            }
0535:
0536:            public double getVac(FieldContext fieldContext) {
0537:                return globalResource.getVac(fieldContext);
0538:            }
0539:
0540:            public long getWork(FieldContext fieldContext) {
0541:                return globalResource.getWork(fieldContext);
0542:            }
0543:
0544:            public WorkCalendar getWorkCalendar() {
0545:                return globalResource.getWorkCalendar();
0546:            }
0547:
0548:            public int hashCode() {
0549:                return globalResource.hashCode();
0550:            }
0551:
0552:            public boolean isAssignment() {
0553:                return globalResource.isAssignment();
0554:            }
0555:
0556:            public boolean isEffortDriven() {
0557:                return globalResource.isEffortDriven();
0558:            }
0559:
0560:            public boolean isReadOnlyEffortDriven(FieldContext fieldContext) {
0561:                return globalResource.isReadOnlyEffortDriven(fieldContext);
0562:            }
0563:
0564:            public long remainingWork(long start, long end) {
0565:                return globalResource.remainingWork(start, end);
0566:            }
0567:
0568:            public void removeAssignment(Assignment assignment) {
0569:                globalResource.removeAssignment(assignment);
0570:            }
0571:
0572:            public void setAccrueAt(int accrueAt) {
0573:                globalResource.setAccrueAt(accrueAt);
0574:            }
0575:
0576:            public void setCostPerUse(double costPerUse) {
0577:                globalResource.setCostPerUse(costPerUse);
0578:            }
0579:
0580:            public void setCreated(Date created) {
0581:                globalResource.setCreated(created);
0582:            }
0583:
0584:            public void setEffortDriven(boolean effortDriven) {
0585:                globalResource.setEffortDriven(effortDriven);
0586:            }
0587:
0588:            public void setGroup(String group) {
0589:                globalResource.setGroup(group);
0590:            }
0591:
0592:            public void setId(long id) {
0593:                if (globalResource != null)
0594:                    globalResource.setId(id);
0595:            }
0596:
0597:            public void setExternalId(long id) {
0598:                if (globalResource != null)
0599:                    globalResource.setExternalId(id);
0600:            }
0601:
0602:            public void setInitials(String initials) {
0603:                globalResource.setInitials(initials);
0604:            }
0605:
0606:            public void setName(String name) {
0607:                if (globalResource != null)
0608:                    globalResource.setName(name);
0609:            }
0610:
0611:            public void setNotes(String notes) {
0612:                globalResource.setNotes(notes);
0613:            }
0614:
0615:            public void setOvertimeRate(Rate overtimeRate) {
0616:                globalResource.setOvertimeRate(overtimeRate);
0617:            }
0618:
0619:            public void setPhonetics(String phonetics) {
0620:                globalResource.setPhonetics(phonetics);
0621:            }
0622:
0623:            public void setRbsCode(String wbsCode) {
0624:                globalResource.setRbsCode(wbsCode);
0625:            }
0626:
0627:            public void setResourceType(int resourceType) {
0628:                globalResource.setResourceType(resourceType);
0629:            }
0630:
0631:            public void setSchedulingType(int schedulingType) {
0632:                globalResource.setSchedulingType(schedulingType);
0633:            }
0634:
0635:            public void setStandardRate(Rate standardRate) {
0636:                globalResource.setStandardRate(standardRate);
0637:            }
0638:
0639:            public void setUniqueId(long id) {
0640:                if (globalResource != null)
0641:                    globalResource.setUniqueId(id);
0642:            }
0643:
0644:            public void setWorkCalendar(WorkCalendar workCalendar) {
0645:                globalResource.setWorkCalendar(workCalendar);
0646:            }
0647:
0648:            public String toString() {
0649:                return globalResource.toString();
0650:            }
0651:
0652:            public void updateAssignment(Assignment modified) {
0653:                globalResource.updateAssignment(modified);
0654:            }
0655:
0656:            public long work(long start, long end) {
0657:                return globalResource.work(start, end);
0658:            }
0659:
0660:            public String getEmailAddress() {
0661:                return globalResource.getEmailAddress();
0662:            }
0663:
0664:            public void setEmailAddress(String emailAddress) {
0665:                globalResource.setEmailAddress(emailAddress);
0666:            }
0667:
0668:            public String getMaterialLabel() {
0669:                return globalResource.getMaterialLabel();
0670:            }
0671:
0672:            public void setMaterialLabel(String materialLabel) {
0673:                globalResource.setMaterialLabel(materialLabel);
0674:            }
0675:
0676:            public boolean isReadOnlyMaterialLabel(FieldContext fieldContext) {
0677:                return globalResource.isReadOnlyMaterialLabel(fieldContext);
0678:            }
0679:
0680:            public String getUserAccount() {
0681:                return globalResource.getUserAccount();
0682:            }
0683:
0684:            public final void setUserAccount(String userAccount) {
0685:                globalResource.setUserAccount(userAccount);
0686:            }
0687:
0688:            public boolean isInactive() {
0689:                return globalResource.isInactive();
0690:            }
0691:
0692:            public boolean isGeneric() {
0693:                return globalResource.isGeneric();
0694:            }
0695:
0696:            public void setInactive(boolean inactive) {
0697:                globalResource.setInactive(inactive);
0698:            }
0699:
0700:            public void setGeneric(boolean generic) {
0701:                globalResource.setGeneric(generic);
0702:            }
0703:
0704:            /**
0705:             * @return
0706:             */
0707:            public long getEffectiveDate() {
0708:                return globalResource.getEffectiveDate();
0709:            }
0710:
0711:            /**
0712:             * @return
0713:             */
0714:            public boolean isReadOnlyEffectiveDate(FieldContext fieldContext) {
0715:                return globalResource.isReadOnlyEffectiveDate(fieldContext);
0716:            }
0717:
0718:            /**
0719:             * @param effectiveDate
0720:             */
0721:            public void setEffectiveDate(long effectiveDate)
0722:                    throws InvalidValueObjectForIntervalException {
0723:                globalResource.setEffectiveDate(effectiveDate);
0724:            }
0725:
0726:            public boolean isDefault() {
0727:                return this  == UNASSIGNED;
0728:            }
0729:
0730:            public EnterpriseResource getGlobalResource() {
0731:                return globalResource;
0732:            }
0733:
0734:            public void setGlobalResource(EnterpriseResource globalResource) {
0735:                this .globalResource = globalResource;
0736:            }
0737:
0738:            private void writeObject(ObjectOutputStream s) throws IOException {
0739:                s.defaultWriteObject();
0740:            }
0741:
0742:            private void readObject(ObjectInputStream s) throws IOException,
0743:                    ClassNotFoundException {
0744:                s.defaultReadObject();
0745:            }
0746:
0747:            public Object clone() {
0748:                try {
0749:                    ResourceImpl resource = (ResourceImpl) super .clone();
0750:                    resource.globalResource = (EnterpriseResource) globalResource
0751:                            .clone();
0752:                    return resource;
0753:                } catch (CloneNotSupportedException e) {
0754:                    throw new InternalError();
0755:                }
0756:            }
0757:
0758:            public void cleanClone() {
0759:                globalResource.cleanClone();
0760:            }
0761:
0762:            /**
0763:             * @return
0764:             */
0765:            public WorkCalendar getBaseCalendar() {
0766:                return globalResource.getBaseCalendar();
0767:            }
0768:
0769:            /**
0770:             * @param baseCalendar
0771:             * @throws CircularDependencyException
0772:             */
0773:            public void setBaseCalendar(WorkCalendar baseCalendar)
0774:                    throws CircularDependencyException {
0775:                globalResource.setBaseCalendar(baseCalendar);
0776:            }
0777:
0778:            public boolean isReadOnlyWork(FieldContext fieldContext) {
0779:                return globalResource.isReadOnlyWork(fieldContext);
0780:            }
0781:
0782:            public void setWork(long work, FieldContext fieldContext) {
0783:                globalResource.setWork(work, fieldContext);
0784:            }
0785:
0786:            public boolean isReadOnlyActualWork(FieldContext fieldContext) {
0787:                return globalResource.isReadOnlyActualWork(fieldContext);
0788:            }
0789:
0790:            public boolean isReadOnlyRemainingWork(FieldContext fieldContext) {
0791:                return globalResource.isReadOnlyRemainingWork(fieldContext);
0792:            }
0793:
0794:            public void setActualWork(long actualWork, FieldContext fieldContext) {
0795:                globalResource.setActualWork(actualWork, fieldContext);
0796:            }
0797:
0798:            public void setRemainingWork(long remainingWork,
0799:                    FieldContext fieldContext) {
0800:                globalResource.setRemainingWork(remainingWork, fieldContext);
0801:            }
0802:
0803:            public double getActualFixedCost(FieldContext fieldContext) {
0804:                return 0;
0805:            }
0806:
0807:            public boolean fieldHideActualFixedCost(FieldContext fieldContext) {
0808:                return true;
0809:            }
0810:
0811:            /* (non-Javadoc)
0812:             * @see com.projity.pm.assignment.HasTimeDistributedData#actualFixedCost(long, long)
0813:             */
0814:            public double fixedCost(long start, long end) {
0815:                // TODO Auto-generated method stub
0816:                return 0;
0817:            }
0818:
0819:            /**
0820:             * @param start
0821:             * @param end
0822:             * @return
0823:             */
0824:            public double actualFixedCost(long start, long end) {
0825:                return globalResource.actualFixedCost(start, end);
0826:            }
0827:
0828:            /**
0829:             * @param fieldContext
0830:             * @return
0831:             */
0832:            public double getFixedCost(FieldContext fieldContext) {
0833:                return globalResource.getFixedCost(fieldContext);
0834:            }
0835:
0836:            /**
0837:             * @param fieldContext
0838:             * @return
0839:             */
0840:            public boolean isReadOnlyFixedCost(FieldContext fieldContext) {
0841:                return globalResource.isReadOnlyFixedCost(fieldContext);
0842:            }
0843:
0844:            public boolean isReadOnly() {
0845:                return false; //roles
0846:                //return globalResource.isReadOnly();
0847:            }
0848:
0849:            /**
0850:             * @param fixedCost
0851:             * @param fieldContext
0852:             */
0853:            public void setFixedCost(double fixedCost, FieldContext fieldContext) {
0854:                globalResource.setFixedCost(fixedCost, fieldContext);
0855:            }
0856:
0857:            public String getTimeUnitLabel() {
0858:                return globalResource.getTimeUnitLabel();
0859:            }
0860:
0861:            public boolean fieldHideOvertimeRate(FieldContext fieldContext) {
0862:                return globalResource.fieldHideOvertimeRate(fieldContext);
0863:            }
0864:
0865:            /* (non-Javadoc)
0866:             * @see com.projity.pm.availability.HasAvailability#fieldHideMaximumUnits(com.projity.field.FieldContext)
0867:             */
0868:            public boolean fieldHideMaximumUnits(FieldContext fieldContext) {
0869:                return fieldHideOvertimeRate(fieldContext);
0870:            }
0871:
0872:            public boolean fieldHideBaseCalendar(FieldContext fieldContext) {
0873:                return globalResource.fieldHideBaseCalendar(fieldContext);
0874:            }
0875:
0876:            public boolean isLabor() {
0877:                return globalResource.isLabor();
0878:            }
0879:
0880:            //	public boolean isNew() { //TODO does this have its own ID and not the global resource id?
0881:            //		return globalResource.isNew();
0882:            //	}
0883:            //	public void setNew(boolean isNew) {
0884:            //		globalResource.setNew(isNew);
0885:            //	}
0886:            /* (non-Javadoc)
0887:             * @see com.projity.pm.assignment.HasAssignments#hasLaborAssignment()
0888:             */
0889:            public boolean hasLaborAssignment() {
0890:                return globalResource.hasLaborAssignment();
0891:            }
0892:
0893:            public double getRemainingCost(FieldContext fieldContext) {
0894:                return globalResource.getRemainingCost(fieldContext);
0895:            }
0896:
0897:            public static Predicate instanceof Predicate() {
0898:                return new Predicate() {
0899:                    public boolean evaluate(Object arg0) {
0900:                        return arg0 instanceof  Resource;
0901:                    }
0902:                };
0903:            }
0904:
0905:            public void invalidateAssignmentCalendars() {
0906:                globalResource.invalidateAssignmentCalendars();
0907:            }
0908:
0909:            public Document invalidateCalendar() {
0910:                return globalResource.invalidateCalendar();
0911:            }
0912:
0913:            public boolean isMaterial() {
0914:                return globalResource.isMaterial();
0915:            }
0916:
0917:            public boolean isMe() {
0918:                return globalResource.isMe();
0919:            }
0920:
0921:            public boolean isWork() {
0922:                return globalResource.isWork();
0923:            }
0924:
0925:            public long getParentId(int outlineNumber) {
0926:                NodeModel model = getResourcePool().getResourceOutline(
0927:                        outlineNumber);
0928:                if (model == null)
0929:                    return 0;
0930:                Node node = model.getParent(model.search(this ));
0931:                Object impl = node.getImpl();
0932:                if (impl != null && impl instanceof  HasKey)
0933:                    return ((HasKey) impl).getId();
0934:                return 0;
0935:            }
0936:
0937:            public boolean isParent() {
0938:                NodeModel model = getResourcePool().getResourceOutline();
0939:                return model.hasChildren(model.search(this ));
0940:            }
0941:
0942:            public double getCustomCost(int i) {
0943:                return globalResource.getCustomCost(i);
0944:            }
0945:
0946:            public long getCustomDate(int i) {
0947:                return globalResource.getCustomDate(i);
0948:            }
0949:
0950:            public long getCustomDuration(int i) {
0951:                return globalResource.getCustomDuration(i);
0952:            }
0953:
0954:            public CustomFields getCustomFields() {
0955:                return globalResource.getCustomFields();
0956:            }
0957:
0958:            public long getCustomFinish(int i) {
0959:                return globalResource.getCustomFinish(i);
0960:            }
0961:
0962:            public boolean getCustomFlag(int i) {
0963:                return globalResource.getCustomFlag(i);
0964:            }
0965:
0966:            public double getCustomNumber(int i) {
0967:                return globalResource.getCustomNumber(i);
0968:            }
0969:
0970:            public long getCustomStart(int i) {
0971:                return globalResource.getCustomStart(i);
0972:            }
0973:
0974:            public String getCustomText(int i) {
0975:                return globalResource.getCustomText(i);
0976:            }
0977:
0978:            public void setCustomCost(int i, double cost) {
0979:                globalResource.setCustomCost(i, cost);
0980:            }
0981:
0982:            public void setCustomDate(int i, long date) {
0983:                globalResource.setCustomDate(i, date);
0984:            }
0985:
0986:            public void setCustomDuration(int i, long duration) {
0987:                globalResource.setCustomDuration(i, duration);
0988:            }
0989:
0990:            public void setCustomFinish(int i, long finish) {
0991:                globalResource.setCustomFinish(i, finish);
0992:            }
0993:
0994:            public void setCustomFlag(int i, boolean flag) {
0995:                globalResource.setCustomFlag(i, flag);
0996:            }
0997:
0998:            public void setCustomNumber(int i, double number) {
0999:                globalResource.setCustomNumber(i, number);
1000:            }
1001:
1002:            public void setCustomStart(int i, long start) {
1003:                globalResource.setCustomStart(i, start);
1004:            }
1005:
1006:            public void setCustomText(int i, String text) {
1007:                globalResource.setCustomText(i, text);
1008:            }
1009:
1010:            public boolean applyTimesheet(Collection fieldArray,
1011:                    long timesheetUpdateDate) {
1012:                return globalResource.applyTimesheet(fieldArray,
1013:                        timesheetUpdateDate);
1014:            }
1015:
1016:            public long getLastTimesheetUpdate() {
1017:                return globalResource.getLastTimesheetUpdate();
1018:            }
1019:
1020:            public int getTimesheetStatus() {
1021:                return globalResource.getTimesheetStatus();
1022:            }
1023:
1024:            public boolean isPendingTimesheetUpdate() {
1025:                return globalResource.isPendingTimesheetUpdate();
1026:            }
1027:
1028:            public String getTimesheetStatusName() {
1029:                return globalResource.getTimesheetStatusName();
1030:            }
1031:
1032:            private transient boolean dirty;
1033:
1034:            public boolean isDirty() {
1035:                return dirty;
1036:            }
1037:
1038:            public void setDirty(boolean dirty) {
1039:                this .dirty = dirty;
1040:            }
1041:
1042:            public long getFinishOffset() {
1043:                // TODO Auto-generated method stub
1044:                return 0;
1045:            }
1046:
1047:            public long getStartOffset() {
1048:                // TODO Auto-generated method stub
1049:                return 0;
1050:            }
1051:
1052:            public RateFormat getRateFormat() {
1053:                return globalResource.getRateFormat();
1054:            }
1055:
1056:            public String getResourceName() {
1057:                return globalResource.getResourceName();
1058:            }
1059:
1060:            public ImageLink getBudgetStatusIndicator() {
1061:                return globalResource.getBudgetStatusIndicator();
1062:            }
1063:
1064:            public ImageLink getScheduleStatusIndicator() {
1065:                return globalResource.getScheduleStatusIndicator();
1066:            }
1067:
1068:            public boolean inProgress() {
1069:                for (Iterator i = getAssignments().iterator(); i.hasNext();) {
1070:                    Assignment a = (Assignment) i.next();
1071:                    if (a.inProgress())
1072:                        return true;
1073:                }
1074:                return false;
1075:            }
1076:
1077:            public boolean isUnstarted() {
1078:                for (Iterator i = getAssignments().iterator(); i.hasNext();) {
1079:                    Assignment a = (Assignment) i.next();
1080:                    if (a.isUnstarted())
1081:                        return true;
1082:                }
1083:                return false;
1084:            }
1085:
1086:            public boolean isComplete() {
1087:                for (Iterator i = getAssignments().iterator(); i.hasNext();) {
1088:                    Assignment a = (Assignment) i.next();
1089:                    if (!a.isComplete())
1090:                        return false;
1091:                }
1092:                return true;
1093:            }
1094:
1095:            public boolean isReadOnly(Field f) {
1096:                // roles
1097:                boolean roleField = "Field.userRole".equals(f.getId());
1098:                //if (roleField&&!isUser()) return true;
1099:                if (!roleField && globalResource.isReadOnly())
1100:                    return true;
1101:
1102:                if (!isUser())
1103:                    return false;
1104:                return getReadOnlyUserFields().contains(f);
1105:            }
1106:
1107:            public boolean isUser() {
1108:                return globalResource.isUser();
1109:            }
1110:
1111:            public void renumber() {
1112:                globalResource.renumber();
1113:            }
1114:
1115:            public boolean isAssignedToSomeProject() {
1116:                return globalResource.isAssignedToSomeProject();
1117:            }
1118:
1119:            private transient int role;
1120:
1121:            public int getRole() {
1122:                return role;
1123:            }
1124:
1125:            public void setRole(int role) {
1126:                if (this .role != role) {
1127:                    int defaultRole = getDefaultRole();
1128:                    if (globalResource != null) {
1129:                        if ((!isExternal() && role != defaultRole)
1130:                                || (isExternal() && role != ApplicationUser.INACTIVE)) {
1131:                            ResourcePool resourcePool = getResourcePool();
1132:                            if (resourcePool != null) {
1133:                                Collection projects = resourcePool
1134:                                        .getProjects();
1135:                                if (projects != null && projects.size() > 0) {
1136:                                    Project project = (Project) projects
1137:                                            .iterator().next();
1138:                                    Field field = FieldDictionary
1139:                                            .getInstance()
1140:                                            .getFieldFromId(
1141:                                                    "Field.accessControlPolicy");
1142:                                    if (field != null)
1143:                                        field.setValue(project, project,
1144:                                                AccessControlPolicy.RESTRICTED);
1145:                                }
1146:                            }
1147:                        }
1148:                    }
1149:                    this .role = role;
1150:                    //System.out.println("New role for "+getName()+": "+role);
1151:                }
1152:            }
1153:
1154:            public int getExtendedRole() { //more information for field combo
1155:                return UserUtil.toExtendedRole(role, isUser());
1156:            }
1157:
1158:            public void setExtendedRole(int role) {
1159:                setRole(UserUtil.toNormalRole(role));
1160:            }
1161:
1162:            public boolean isReadOnlyExtendedRole(FieldContext fieldContext) { // moved out of spreadsheet model
1163:                if (Environment.getStandAlone())
1164:                    return true;
1165:                return Environment.getUser().getResourceId() == getUniqueId(); // prevents a user from losing access to his project
1166:            }
1167:
1168:            public int getLicense() {
1169:                return globalResource.getLicense();
1170:            }
1171:
1172:            public Set<Integer> getAuthorizedRoles() {
1173:                return globalResource.getAuthorizedRoles();
1174:            }
1175:
1176:            public void setAuthorizedRoles(Set<Integer> authorizedRoles) {
1177:                globalResource.setAuthorizedRoles(authorizedRoles);
1178:            }
1179:
1180:            public void filterRoles(List keys, List values) {
1181:                globalResource.filterRoles(keys, values);
1182:            }
1183:
1184:            public int getDefaultRole() {
1185:                return globalResource.getDefaultRole();
1186:            }
1187:
1188:            public void setDefaultRole(int defaultRole) {
1189:                globalResource.setDefaultRole(defaultRole);
1190:            }
1191:
1192:            public HasIndicators getIndicators() {
1193:                return this ;
1194:            }
1195:
1196:            public boolean isInTeam() {
1197:                return getRole() != ApplicationUser.INACTIVE
1198:                        || getAssignments().size() > 0;
1199:            }
1200:
1201:            public boolean isInactiveLicense() {
1202:                return globalResource.isInactiveLicense();
1203:            }
1204:
1205:            public boolean isExternal() {
1206:                return globalResource.isExternal();
1207:            }
1208:
1209:            public boolean isAdministrator() {
1210:                return globalResource.isAdministrator();
1211:            }
1212:
1213:            public boolean isRoleAllowed(int role) {
1214:                if (role == ApplicationUser.INACTIVE
1215:                        && getAssignments().size() > 0)
1216:                    return false;
1217:                return true;
1218:            }
1219:
1220:            public void addInTeam() {
1221:                if (!isRoleAllowed(getRole()))
1222:                    setRole(isUser() ? ApplicationUser.TEAM_MEMBER
1223:                            : ApplicationUser.TEAM_RESOURCE);
1224:            }
1225:
1226:            public void setServerMeta(Object o) {
1227:                globalResource.setServerMeta(o);
1228:            }
1229:
1230:            public Object getServerMeta() {
1231:                return globalResource.getServerMeta();
1232:            }
1233:
1234:            public boolean isLocal() {
1235:                return globalResource.isLocal();
1236:            }
1237:
1238:            public void setLocal(boolean local) {
1239:                globalResource.setLocal(local);
1240:            }
1241:
1242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.