svn commit: r493221 - in /ofbiz/trunk/applications/workeffort: script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml servicedef/services.xml src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java

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

svn commit: r493221 - in /ofbiz/trunk/applications/workeffort: script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml servicedef/services.xml src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java

jaz-3
Author: jaz
Date: Fri Jan  5 14:51:13 2007
New Revision: 493221

URL: http://svn.apache.org/viewvc?view=rev&rev=493221
Log:
added upate workeffort content; extended the workeffort content wrapper to pull IDs (data resource and content)

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/content/WorkEffortContentWrapper.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?view=diff&rev=493221&r1=493220&r2=493221
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml (original)
+++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml Fri Jan  5 14:51:13 2007
@@ -898,10 +898,12 @@
 
     <!-- Create/Update/Delete Work Effort Content-->    
     <simple-method method-name="createWorkEffortContent" short-description="Create Work Effort Content">
+        <!-- need a better way to handle per workeffort permissions
         <check-permission permission="WORKEFFORTMGR" action="_CREATE">
             <fail-property resource="WorkEffortUiLabels" property="WorkEffortCreatePermissionError"/>
         </check-permission>
         <check-errors />
+        -->
         <make-value entity-name="WorkEffortContent" value-name="newEntity"/>
         <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
         <set-pk-fields map-name="parameters" value-name="newEntity"/>
@@ -914,20 +916,24 @@
         <create-value value-name="newEntity"/>
     </simple-method>
     <simple-method method-name="updateWorkEffortContent" short-description="Update Work Effort Content">
+        <!-- need a better way to handle permissions
         <check-permission permission="WORKEFFORTMGR" action="_UPDATE">
             <fail-property resource="WorkEffortUiLabels" property="WorkEffortUpdatePermissionERror"/>
         </check-permission>
         <check-errors />
+        -->
         <entity-one entity-name="WorkEffortContent" value-name="lookedUpValue"/>
         <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
         <store-value value-name="lookedUpValue"/>
     </simple-method>
     <simple-method method-name="deleteWorkEffortContent"
             short-description="Remove a WorkEffort Content">
+        <!-- need a better way to handle per workeffort permissions
         <check-permission permission="WORKEFFORTMGR" action="_DELETE">
             <fail-property resource="WorkEffortUiLabels" property="WorkEffortDeletePermissionError"/>
         </check-permission>
         <check-errors />
+        -->
         <entity-one entity-name="WorkEffortContent" value-name="lookedUpValue" />
         <remove-value value-name="lookedUpValue" />
     </simple-method>

Modified: ofbiz/trunk/applications/workeffort/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/servicedef/services.xml?view=diff&rev=493221&r1=493220&r2=493221
==============================================================================
--- ofbiz/trunk/applications/workeffort/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/workeffort/servicedef/services.xml Fri Jan  5 14:51:13 2007
@@ -447,6 +447,13 @@
             <invoke name="createWorkEffortContent"/>
         </group>
     </service>
+    <service name="updateWorkEffortTextContent" engine="group" transaction-timeout="300" auth="true">
+        <description>Update a Text Document DataResource and Content Records</description>
+        <group>
+            <invoke name="updateTextContent" result-to-context="true"/>
+            <invoke name="updateWorkEffortContent"/>
+        </group>
+    </service>
 
     <service name="uploadWorkEffortContentFile" engine="group" transaction-timeout="300">
         <description>Upload and attach a file to a WorkEffort</description>

Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java?view=diff&rev=493221&r1=493220&r2=493221
==============================================================================
--- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java (original)
+++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java Fri Jan  5 14:51:13 2007
@@ -85,7 +85,7 @@
      * @param contentTypeId Type of content to return
      * @return String containing the contentId
      */
-    public String getId(String contentTypeId) {
+    public String getContentId(String contentTypeId) {
         GenericValue workEffortContent = getFirstWorkEffortContentByType(null, workEffort, contentTypeId, workEffort.getDelegator());
         if (workEffortContent != null) {
             return workEffortContent.getString("contentId");
@@ -99,7 +99,7 @@
      * @param contentTypeId Type of content to return
      * @return String containing the name of the content record
      */
-    public String getName(String contentTypeId) {
+    public String getContentName(String contentTypeId) {
         GenericValue workEffortContent = getFirstWorkEffortContentByType(null, workEffort, contentTypeId, workEffort.getDelegator());
         if (workEffortContent != null) {
             GenericValue content;
@@ -132,6 +132,33 @@
         }
     }
 
+    public String getDataResourceId(String contentTypeId) {
+        GenericValue workEffortContent = getFirstWorkEffortContentByType(null, workEffort, contentTypeId, workEffort.getDelegator());
+        if (workEffortContent != null) {
+            GenericValue content;
+            try {
+                content = workEffortContent.getRelatedOne("Content");
+            } catch (GeneralException e) {
+                Debug.logError(e, module);
+                return null;
+            }
+            if (content != null) {
+                GenericValue dataResource;
+                try {
+                    dataResource = content.getRelatedOne("DataResource");
+                } catch (GeneralException e) {
+                    Debug.logError(e, module);
+                    return null;
+                }
+                if (dataResource != null) {
+                    return dataResource.getString("dataResourceId");
+                }
+            }
+        }
+
+        return null;
+    }
+    
     public List getList(String contentTypeId) {
         try {
             return getWorkEffortContentTextList(workEffort, contentTypeId, locale, mimeTypeId, workEffort.getDelegator());