svn commit: r617172 - /ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java

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

svn commit: r617172 - /ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java

mrisaliti
Author: mrisaliti
Date: Thu Jan 31 09:50:46 2008
New Revision: 617172

URL: http://svn.apache.org/viewvc?rev=617172&view=rev
Log:
Add getWorkEffortAssignedEventsForRoleOfAllParties method to WorkEffortServices to get the events of a role but not filter by PartyId.

Modified:
    ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java

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=617172&r1=617171&r2=617172&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 Thu Jan 31 09:50:46 2008
@@ -88,6 +88,34 @@
         result.put("events", validWorkEfforts);
         return result;
     }
+    
+    public static Map getWorkEffortAssignedEventsForRoleOfAllParties(DispatchContext ctx, Map context) {
+        GenericDelegator delegator = ctx.getDelegator();
+        String roleTypeId = (String) context.get("roleTypeId");
+
+        List validWorkEfforts = null;
+        
+        try {
+            List conditionList = UtilMisc.toList(new EntityExpr("roleTypeId", EntityOperator.EQUALS, roleTypeId),
+                            new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "EVENT"));
+            conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED"));
+            conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED"));
+            conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"));
+            conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"));
+            validWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAndPartyAssign",
+                                                   conditionList, UtilMisc.toList("estimatedStartDate", "priority")));
+        } catch (GenericEntityException e) {
+            Debug.logWarning(e, module);
+            return ServiceUtil.returnError("Error finding desired WorkEffort records: " + e.toString());
+        }
+
+        Map result = new HashMap();
+        if (validWorkEfforts == null) {
+            validWorkEfforts = new LinkedList();
+        }
+        result.put("events", validWorkEfforts);
+        return result;
+    }
 
     public static Map getWorkEffortAssignedTasks(DispatchContext ctx, Map context) {
         GenericDelegator delegator = ctx.getDelegator();