svn commit: r596510 - in /ofbiz/trunk/applications/content: script/org/ofbiz/content/content/ContentServices.xml servicedef/services_content.xml

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

svn commit: r596510 - in /ofbiz/trunk/applications/content: script/org/ofbiz/content/content/ContentServices.xml servicedef/services_content.xml

jaz-3
Author: jaz
Date: Mon Nov 19 17:35:58 2007
New Revision: 596510

URL: http://svn.apache.org/viewvc?rev=596510&view=rev
Log:
added method to create text content with a optional sub-section of uploaded content (i.e. text with an image/audio/video)

Modified:
    ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml
    ofbiz/trunk/applications/content/servicedef/services_content.xml

Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml?rev=596510&r1=596509&r2=596510&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml (original)
+++ ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml Mon Nov 19 17:35:58 2007
@@ -533,6 +533,28 @@
         <remove-value value-name="lookedUpValue"/>
     </simple-method>
 
+    <!-- combined text + uploaded file service -->
+    <simple-method method-name="createTextAndUploadedContent" short-description="Creates Text and Optionally Uploaded (sub) Content records">
+        <set-service-fields service-name="createTextContent" map-name="parameters" to-map-name="textContext"/>
+        <call-service service-name="createTextContent" in-map-name="textContext">
+            <result-to-field result-name="contentId" field-name="parentContentId" map-name="parameters"/>
+        </call-service>
+
+        <log level="always" message="${parameters}"/>
+
+        <if-not-empty field-name="uploadedFile" map-name="parameters">
+            <log level="always" message="Uploaded file found; processing sub-content"/>
+            <set-service-fields service-name="createContentFromUploadedFile" map-name="parameters" to-map-name="uploadContext"/>
+            <set field="uploadContext.ownerContentId" from-field="parameters.parentContentId"/>
+            <set field="uploadContext.contentIdFrom" from-field="parameters.parentContentId"/>
+            <set field="uploadContext.contentAssocTypeId" value="SUB_CONTENT"/>
+            <set field="uploadContext.contentPurposeTypeId" value="SECTION"/>
+            <call-service service-name="createContentFromUploadedFile" in-map-name="uploadContext"/>
+        </if-not-empty>
+
+        <field-to-result field-name="parentContentId" map-name="parameters" result-name="contentId"/>
+    </simple-method>
+
     <!-- Util -->
     <simple-method method-name="findAssocContent" short-description="Find associated content">
         <set from-field="parameters.contentId" field="queryMap.contentId"/>

Modified: ofbiz/trunk/applications/content/servicedef/services_content.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_content.xml?rev=596510&r1=596509&r2=596510&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/servicedef/services_content.xml (original)
+++ ofbiz/trunk/applications/content/servicedef/services_content.xml Mon Nov 19 17:35:58 2007
@@ -51,6 +51,14 @@
         
     </service>
 
+    <service name="createTextAndUploadedContent" engine="simple" auth="true"
+            location="org/ofbiz/content/content/ContentServices.xml" invoke="createTextAndUploadedContent">
+        <description>Creates text content and optional uploaded sub-content</description>
+        <implements service="createTextContent"/>
+        <implements service="uploadFileInterface" optional="true"/>
+        <implements service="createContentFromUploadedFile" optional="true"/>
+    </service>
+
     <service name="createTextContent" engine="group" auth="true">
         <description>Creates a Text Document DataResource and Content Records</description>
         <!-- uses createContent internally; additonal permission(s) not necessary -->
@@ -75,7 +83,8 @@
         <!-- uses createContent internally; additonal permission(s) not necessary -->
         <implements service="uploadFileInterface"/>
         <attribute name="dataResourceId" type="String" mode="INOUT" optional="false"/>
-        <attribute name="mimeTypeId" type="String" mode="INOUT" optional="false"/>
+        <!-- mimetype is set from the uploaded file (contentType) when empty -->
+        <attribute name="mimeTypeId" type="String" mode="INOUT" optional="true"/>
     </service>
 
     <service name="createContentFromUploadedFile" engine="group" transaction-timeout="300">