You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2011/08/16 08:21:04 UTC

svn commit: r1158120 - in /ofbiz/trunk/applications: content/script/org/ofbiz/content/content/ContentServices.xml content/servicedef/services_content.xml party/script/org/ofbiz/party/communication/CommunicationEventServices.xml

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>



Re: svn commit: r1158120 - in /ofbiz/trunk/applications: content/script/org/ofbiz/content/content/ContentServices.xml content/servicedef/services_content.xml party/script/org/ofbiz/party/communication/CommunicationEventServices.xml

Posted by Deepak Dixit <de...@hotwaxmedia.com>.
Thanks Hans. 

Thanks & Regards
-- 
Deepak Dixit


On Aug 18, 2011, at 12:40 PM, Hans Bakker wrote:

> Thanks for the comment, fixed in Revision: 1159064
> 
> Regards,
> hans
> 
> On Thu, 2011-08-18 at 11:40 +0530, Deepak Dixit wrote:
>> Hello Hans,
>> 
>> inline:
>> 
>> On Aug 16, 2011, at 11:51 AM, hansbak@apache.org wrote:
>> 
>>> 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"/>
>> 
>> map is not a valid attribute for entity-one tag. Its giving error on console, Here is the error message:
>> 
>>  [java] 2011-08-18 11:04:08,214 (main) [            UtilXml.java:1060:ERROR] XmlFileLoader: File file:/sandbox/ofbiz/applications/content/script/org/ofbiz/content/content/ContentServices.xml process error. Line: 75. Error message: cvc-complex-type.3.2.2: Attribute 'map' is not allowed to appear in element 'entity-one'.
>> 
>> 
>> Thanks & Regards
>> -- 
>> Deepak Dixit
>> HotWax Media Pvt. Ltd.
>> www.hotwaxmedia.com
>> Contact :- +91-98267-54548
>> Skype  :- deepakdixit
>> 
>> 
>>> +        <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>
>>> 
>>> 
>> 
> 
> -- 
> Ofbiz on twitter: http://twitter.com/apache_ofbiz
> Myself on twitter: http://twitter.com/hansbak
> Antwebsystems.com: Quality services for competitive rates.
> 


Re: svn commit: r1158120 - in /ofbiz/trunk/applications: content/script/org/ofbiz/content/content/ContentServices.xml content/servicedef/services_content.xml party/script/org/ofbiz/party/communication/CommunicationEventServices.xml

Posted by Hans Bakker <ma...@antwebsystems.com>.
Thanks for the comment, fixed in Revision: 1159064

Regards,
hans

On Thu, 2011-08-18 at 11:40 +0530, Deepak Dixit wrote:
> Hello Hans,
> 
> inline:
> 
> On Aug 16, 2011, at 11:51 AM, hansbak@apache.org wrote:
> 
> > 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"/>
> 
> map is not a valid attribute for entity-one tag. Its giving error on console, Here is the error message:
> 
>   [java] 2011-08-18 11:04:08,214 (main) [            UtilXml.java:1060:ERROR] XmlFileLoader: File file:/sandbox/ofbiz/applications/content/script/org/ofbiz/content/content/ContentServices.xml process error. Line: 75. Error message: cvc-complex-type.3.2.2: Attribute 'map' is not allowed to appear in element 'entity-one'.
> 
> 
> Thanks & Regards
> -- 
> Deepak Dixit
> HotWax Media Pvt. Ltd.
> www.hotwaxmedia.com
> Contact :- +91-98267-54548
> Skype  :- deepakdixit
> 
> 
> > +        <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>
> > 
> > 
> 

-- 
Ofbiz on twitter: http://twitter.com/apache_ofbiz
Myself on twitter: http://twitter.com/hansbak
Antwebsystems.com: Quality services for competitive rates.


Re: svn commit: r1158120 - in /ofbiz/trunk/applications: content/script/org/ofbiz/content/content/ContentServices.xml content/servicedef/services_content.xml party/script/org/ofbiz/party/communication/CommunicationEventServices.xml

Posted by Deepak Dixit <de...@hotwaxmedia.com>.
Hello Hans,

inline:

On Aug 16, 2011, at 11:51 AM, hansbak@apache.org wrote:

> 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"/>

map is not a valid attribute for entity-one tag. Its giving error on console, Here is the error message:

  [java] 2011-08-18 11:04:08,214 (main) [            UtilXml.java:1060:ERROR] XmlFileLoader: File file:/sandbox/ofbiz/applications/content/script/org/ofbiz/content/content/ContentServices.xml process error. Line: 75. Error message: cvc-complex-type.3.2.2: Attribute 'map' is not allowed to appear in element 'entity-one'.


Thanks & Regards
-- 
Deepak Dixit
HotWax Media Pvt. Ltd.
www.hotwaxmedia.com
Contact :- +91-98267-54548
Skype  :- deepakdixit


> +        <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>
> 
>