svn commit: r788208 - in /ofbiz/trunk/applications/workeffort: script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml servicedef/services.xml src/org/ofbiz/workeffort/workeffort/ICalConverter.java

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

svn commit: r788208 - in /ofbiz/trunk/applications/workeffort: script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml servicedef/services.xml src/org/ofbiz/workeffort/workeffort/ICalConverter.java

adrianc
Author: adrianc
Date: Wed Jun 24 23:21:08 2009
New Revision: 788208

URL: http://svn.apache.org/viewvc?rev=788208&view=rev
Log:
Fixed a couple bugs in the new iCalendar stuff.

Modified:
    ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml
    ofbiz/trunk/applications/workeffort/servicedef/services.xml
    ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java

Modified: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml?rev=788208&r1=788207&r2=788208&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml (original)
+++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml Wed Jun 24 23:21:08 2009
@@ -1474,7 +1474,7 @@
 
     <!-- iCalendar services -->
 
-    <simple-method method-name="getICalWorkEfforts" short-description="Get All Work Efforts Related To An iCalendar Publish Point">
+    <simple-method method-name="getICalWorkEfforts" short-description="Get All Work Efforts Related To An iCalendar Publish Point" login-required="false">
         <!-- Servlet already confirmed workEffortId is a valid publish point -->
         <set field="workEffortId" from-field="parameters.workEffortId"/>
         <entity-condition list="assignedParties" entity-name="WorkEffortPartyAssignment" filter-by-date="true">
@@ -1517,7 +1517,7 @@
         <field-to-result field="workEfforts"/>
     </simple-method>
     
-    <simple-method method-name="getPartyICalUri" short-description="Get The Party iCalendar URI">
+    <simple-method method-name="getPartyICalUri" short-description="Get The Party iCalendar URI" login-required="false">
         <!-- RFC 2445 4.8.4.1 and 4.8.4.3 Value must be a URI (4.3.3) -->
         <!-- For now we just look for a primary email address. This could be expanded later. -->
         <set field="partyId" from-field="parameters.partyId"/>

Modified: ofbiz/trunk/applications/workeffort/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/servicedef/services.xml?rev=788208&r1=788207&r2=788208&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/workeffort/servicedef/services.xml Wed Jun 24 23:21:08 2009
@@ -686,14 +686,14 @@
         <implements service="permissionInterface"/>
         <attribute type="String" mode="IN" name="workEffortId" optional="false"/>
     </service>
-    <service name="getICalWorkEfforts" engine="simple"
+    <service name="getICalWorkEfforts" engine="simple" auth="false"
              location="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml" invoke="getICalWorkEfforts">
         <description>Get iCalendar Work Efforts</description>
         <!-- No permission checking - the servlet handles that -->
         <attribute type="String" mode="IN" name="workEffortId" optional="false"/>
         <attribute type="List" mode="OUT" name="workEfforts"/>
     </service>
-    <service name="getPartyICalUri" engine="simple"
+    <service name="getPartyICalUri" engine="simple" auth="false"
              location="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml" invoke="getPartyICalUri">
         <description>Get Party iCalendar URI</description>
         <!-- No permission checking - the servlet handles that -->

Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java?rev=788208&r1=788207&r2=788208&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java (original)
+++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java Wed Jun 24 23:21:08 2009
@@ -593,18 +593,14 @@
                     " on URL workEffortId " + context.get("workEffortId"), module);
             return;
         }
-        Map<String, ? extends Object> serviceMap = UtilMisc.toMap("workEffortId", workEffortId, "icalData", calendar.toString());
         GenericDelegator delegator = (GenericDelegator) context.get("delegator");
         GenericValue publishProperties = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false);
         if (!isCalendarPublished(publishProperties)) {
             Debug.logInfo("WorkEffort calendar is not published: " + workEffortId, module);
             return;
         }
-        GenericValue iCalData = publishProperties.getRelatedOne("WorkEffortIcalData");
-        if (iCalData == null) {
-            invokeService("createWorkEffortICalData", serviceMap, context);
-        } else {
-            invokeService("updateWorkEffortICalData", serviceMap, context);
+        if (!hasPermission(workEffortId, "UPDATE", context)) {
+            return;
         }
         List<GenericValue> workEfforts = getRelatedWorkEfforts(publishProperties, context);
         if (workEfforts == null || workEfforts.size() == 0) {
@@ -627,9 +623,18 @@
                                 " on URL workEffortId " + context.get("workEffortId"), module);
                         continue;
                     }
+                } else {
+                    // TODO: create a new work effort
                 }
             }
         }
+        Map<String, ? extends Object> serviceMap = UtilMisc.toMap("workEffortId", workEffortId, "icalData", calendar.toString());
+        GenericValue iCalData = publishProperties.getRelatedOne("WorkEffortIcalData");
+        if (iCalData == null) {
+            invokeService("createWorkEffortICalData", serviceMap, context);
+        } else {
+            invokeService("updateWorkEffortICalData", serviceMap, context);
+        }
     }
 
     protected static void storeWorkEffort(Component component, Map<String, Object> context) throws GenericEntityException, GenericServiceException {