Author: hansbak
Date: Tue Aug 16 06:21:04 2011
New Revision: 1158120

URL: http://svn.apache.org/viewvc?rev=1158120&view=rev
Log:
extended the commevent delete service to delete also seo friendly url's 
connected to the attached content of a comm event

Modified:
    
ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml
    ofbiz/trunk/applications/content/servicedef/services_content.xml
    
ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.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=1158120&r1=1158119&r2=1158120&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
 Tue Aug 16 06:21:04 2011
@@ -69,6 +69,29 @@
 
         <remove-value value-field="content"/>
     </simple-method>
+    <simple-method method-name="removeContentAndRelated" 
short-description="Remove a Content Record, related resource(s) and assocs.">
+        <make-value entity-name="Content" value-field="lookupKeyValue"/>
+        <set-pk-fields map="parameters" value-field="lookupKeyValue"/>
+        <entity-one entity-name="Content" map="lookupKeyValue" 
value-field="content"/>
+        <remove-related value-field="content" relation-name="ContentRole"/>
+        <remove-related value-field="content" relation-name="ContentKeyword"/>
+        <remove-related value-field="content" 
relation-name="FromContentAssoc"/>
+        <remove-related value-field="content" relation-name="ToContentAssoc"/>
+        <remove-value value-field="content"/>
+        <get-related-one value-field="content" relation-name="DataResource" 
to-value-field="dataResource"/>
+        <if-not-empty field="dataResource">
+            <get-related-one value-field="dataResource" 
relation-name="ImageDataResource" to-value-field="imageDataResource"/>
+            <if-not-empty field="imageDataResource">
+                <remove-value value-field="imageDataResource"/>
+            </if-not-empty>
+            <get-related-one value-field="dataResource" 
relation-name="ElectronicText" to-value-field="electronicText"/>
+            <if-not-empty field="electronicText">
+                <remove-value value-field="electronicText"/>
+            </if-not-empty>
+            <remove-related value-field="dataResource" 
relation-name="DataResourceRole"/>
+            <remove-value value-field="dataResource"/>
+        </if-not-empty>
+    </simple-method>
 
     <!-- content assoc services -->
     <simple-method method-name="createContentAssoc" short-description="Create 
a ContntAssoc Record">

Modified: ofbiz/trunk/applications/content/servicedef/services_content.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_content.xml?rev=1158120&r1=1158119&r2=1158120&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/servicedef/services_content.xml (original)
+++ ofbiz/trunk/applications/content/servicedef/services_content.xml Tue Aug 16 
06:21:04 2011
@@ -151,6 +151,17 @@
         <attribute mode="INOUT" name="roleTypeList" optional="true" 
type="List"/>
     </service>
 
+    <service name="removeContentAndRelated" default-entity-name="Content" 
engine="simple"
+            
location="component://content/script/org/ofbiz/content/content/ContentServices.xml"
 invoke="removeContentAndRelated" auth="true">
+        <description>Remove Content</description>
+        <permission-service service-name="genericContentPermission" 
main-action="DELETE"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <attribute mode="IN" name="targetOperationList" optional="true" 
type="List"/>
+        <attribute mode="IN" name="contentPurposeTypeId" optional="true" 
type="String"/>
+        <attribute mode="IN" name="userLogin" optional="true" 
type="org.ofbiz.entity.GenericValue"/>
+        <attribute mode="INOUT" name="roleTypeList" optional="true" 
type="List"/>
+    </service>
+
     <!-- TODO: old permission service; being replaced with 
genericContentPermission -->
     <service name="checkContentPermission"
         transaction-timeout="7200"

Modified: 
ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml?rev=1158120&r1=1158119&r2=1158120&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
 (original)
+++ 
ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
 Tue Aug 16 06:21:04 2011
@@ -358,6 +358,18 @@ under the License.
                         <iterate entry="content" list="contents">
                             <remove-related value-field="content" 
relation-name="ContentRole"/>
                             <remove-related value-field="content" 
relation-name="ContentKeyword"/>
+                            <get-related value-field="content" 
relation-name="FromContentAssoc" list="relatedFromContentassocs"/>
+                            <iterate entry="relatedFromContentassoc" 
list="relatedFromContentassocs">
+                                <set 
field="removeContentAndRelatedInmap.contentId" 
from-field="relatedFromContentassoc.contentIdTo"/>
+                                <call-service 
service-name="removeContentAndRelated" 
in-map-name="removeContentAndRelatedInmap"/>
+                            </iterate>
+                            <remove-related value-field="content" 
relation-name="FromContentAssoc"/>
+                            <get-related value-field="content" 
relation-name="ToContentAssoc" list="relatedToContentassocs"/>
+                            <iterate entry="relatedToContentassoc" 
list="relatedToContentassocs">
+                                <set 
field="removeContentAndRelatedInmap.contentId" 
from-field="relatedFromContentassoc.contentIdFrom"/>
+                                <call-service 
service-name="removeContentAndRelated" 
in-map-name="removeContentAndRelatedInmap"/>
+                            </iterate>
+                            <remove-related value-field="content" 
relation-name="ToContentAssoc"/>
                             <remove-value value-field="content"/>
                             <!-- check first if the content is used on any 
other communication event if yes, only delete link-->
                             <entity-and entity-name="CommEventContentAssoc" 
list="commEvents">
@@ -365,19 +377,8 @@ under the License.
                             </entity-and>
                             <set field="commEventsSize" value="${groovy: 
return(commEvents.size())}" type="Integer"/>
                             <if-compare field="commEventsSize" 
operator="equals" value="1">
-                                <get-related-one value-field="content" 
relation-name="DataResource" to-value-field="dataResource"/>
-                                <if-not-empty field="dataResource">
-                                    <get-related-one 
value-field="dataResource" relation-name="ImageDataResource" 
to-value-field="imageDataResource"/>
-                                    <if-not-empty field="imageDataResource">
-                                        <remove-value 
value-field="imageDataResource"/>
-                                    </if-not-empty>
-                                    <get-related-one 
value-field="dataResource" relation-name="ElectronicText" 
to-value-field="electronicText"/>
-                                    <if-not-empty field="electronicText">
-                                        <remove-value 
value-field="electronicText"/>
-                                    </if-not-empty>
-                                    <remove-related value-field="dataResource" 
relation-name="DataResourceRole"/>
-                                    <remove-value value-field="dataResource"/>
-                                </if-not-empty>
+                                <set 
field="removeContentAndRelatedInmap.contentId" from-field="content.contentId"/>
+                                <call-service 
service-name="removeContentAndRelated" 
in-map-name="removeContentAndRelatedInmap"/>
                             </if-compare>
                         </iterate>
                     </if-not-empty>


Reply via email to