svn commit: r703728 - in /ofbiz/trunk: applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java specialpurpose/projectmgr/data/ProjectMgrDemoData.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r703728 - in /ofbiz/trunk: applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java specialpurpose/projectmgr/data/ProjectMgrDemoData.xml

adrianc
Author: adrianc
Date: Sat Oct 11 13:50:49 2008
New Revision: 703728

URL: http://svn.apache.org/viewvc?rev=703728&view=rev
Log:
Added recurring calendar event demo data.

The basic work for recurring calendar events is done. All we need now are UI artifacts to enter event duration information in work efforts.

Modified:
    ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
    ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml

Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=703728&r1=703727&r2=703728&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java (original)
+++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Sat Oct 11 13:50:49 2008
@@ -36,6 +36,7 @@
 
 import org.ofbiz.base.util.DateRange;
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.TimeDuration;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
@@ -531,8 +532,17 @@
                             for (DateRange periodRange : periodRanges) {
                                 if (periodRange.includesDate(occurrence)) {
                                     GenericValue cloneWorkEffort = (GenericValue) workEffort.clone();
-                                    cloneWorkEffort.set("estimatedStartDate", periodRange.startStamp());
-                                    cloneWorkEffort.set("estimatedCompletionDate", periodRange.endStamp());
+                                    Double durationMillis = workEffort.getDouble("estimatedMilliSeconds");
+                                    if (durationMillis != null) {
+                                        TimeDuration duration = TimeDuration.fromLong(durationMillis.longValue());
+                                        Calendar endCal = UtilDateTime.toCalendar(occurrence, timeZone, locale);
+                                        Date endDate = duration.addToCalendar(endCal).getTime();
+                                        cloneWorkEffort.set("estimatedStartDate", new Timestamp(occurrence.getTime()));
+                                        cloneWorkEffort.set("estimatedCompletionDate", new Timestamp(endDate.getTime()));
+                                    } else {
+                                        cloneWorkEffort.set("estimatedStartDate", periodRange.startStamp());
+                                        cloneWorkEffort.set("estimatedCompletionDate", periodRange.endStamp());
+                                    }
                                     inclusions.add(cloneWorkEffort);
                                 }
                             }

Modified: ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml?rev=703728&r1=703727&r2=703728&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml Sat Oct 11 13:50:49 2008
@@ -138,5 +138,17 @@
     <WorkEffortAssoc workEffortIdFrom="9102" workEffortIdTo="9103" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2000-01-01 00:00:00.0"/>
     <WorkEffortAssoc workEffortIdFrom="9103" workEffortIdTo="9105" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2000-01-01 00:00:00.0"/>
     <WorkEffortAssoc workEffortIdFrom="9105" workEffortIdTo="9106" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2000-01-01 00:00:00.0"/>
-    
+
+    <!-- Recurring calendar event demo - set up a staff meeting on the first Monday of each month -->
+    <TemporalExpression tempExprId="STAFF_MTG" tempExprTypeId="INTERSECTION"/>
+    <TemporalExpression tempExprId="10AM_TO_11AM" tempExprTypeId="TIME_OF_DAY_RANGE" string1="10:00" string2="11:00"/>
+    <TemporalExpressionAssoc fromTempExprId="STAFF_MTG" toTempExprId="1ST_MONDAY_IN_MONTH"/>
+    <TemporalExpressionAssoc fromTempExprId="STAFF_MTG" toTempExprId="10AM_TO_11AM"/>
+    <FixedAsset fixedAssetId="DEMO_PROJECTOR" fixedAssetName="Overhead Projector" fixedAssetTypeId="EQUIPMENT"/>
+    <WorkEffort workEffortId="STAFF_MTG" workEffortTypeId="MEETING" currentStatusId="CAL_TENTATIVE" lastStatusUpdate="2008-01-01 00:00:00.0" scopeEnumId="WES_PUBLIC" workEffortName="Staff Meeting" description="Staff Meeting" tempExprId="STAFF_MTG" estimatedStartDate="2008-01-01 00:00:00.0" estimatedMilliSeconds="3600000"/>
+    <WorkEffortFixedAssetAssign workEffortId="STAFF_MTG" fixedAssetId="DEMO_PROJECTOR" statusId="FA_ASGN_REQUESTED" availabilityStatusId="WEFA_IN_USE" fromDate="2008-01-01 00:00:00.0"/>
+    <WorkEffortPartyAssignment workEffortId="STAFF_MTG" partyId="DemoEmployee1" statusId="PRTYASGN_ASSIGNED" roleTypeId="CAL_OWNER" availabilityStatusId="WEPA_AV_BUSY" fromDate="2008-01-01 00:00:00.0"/>
+    <WorkEffortPartyAssignment workEffortId="STAFF_MTG" partyId="DemoEmployee2" statusId="PRTYASGN_ASSIGNED" roleTypeId="CAL_ATTENDEE" availabilityStatusId="WEPA_AV_BUSY" fromDate="2008-01-01 00:00:00.0"/>
+    <WorkEffortPartyAssignment workEffortId="STAFF_MTG" partyId="DemoEmployee3" statusId="PRTYASGN_ASSIGNED" roleTypeId="CAL_ATTENDEE" availabilityStatusId="WEPA_AV_BUSY" fromDate="2008-01-01 00:00:00.0"/>
+
 </entity-engine-xml>
\ No newline at end of file