Author: hansbak
Date: Fri Jul 8 09:52:08 2011 New Revision: 1144227 URL: http://svn.apache.org/viewvc?rev=1144227&view=rev Log: improvement on the createContentAlternativeUrl service to create url for existing content Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml ofbiz/trunk/applications/content/servicedef/secas.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=1144227&r1=1144226&r2=1144227&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 Fri Jul 8 09:52:08 2011 @@ -1278,16 +1278,27 @@ </simple-method> <simple-method method-name="createContentAlternativeUrl" short-description="Create Content Alternative URLs."> - <set field="defaultLocaleString" from-field="parameters.locale"/> - <entity-condition list="contents" entity-name="Content"> - <condition-list combine="and"> + <set field="defaultLocaleString" from-field="parameters.locale" default-value="en"/> + <set field="contents" type="List"/> + <if-empty field="parameters.contentId"> + <entity-condition list="contents" entity-name="Content"> <condition-expr field-name="contentName" operator="not-equals" from-field="nullField"/> - <condition-expr field-name="contentId" operator="equals" from-field="parameters.contentId" ignore-if-empty="true" ignore-if-null="true"/> - </condition-list> - <select-field field-name="contentId"/> - <select-field field-name="contentName"/> - <select-field field-name="localeString"/> - </entity-condition> + <select-field field-name="contentId"/> + <select-field field-name="contentName"/> + <select-field field-name="localeString"/> + </entity-condition> + <else> + <entity-condition list="contents" entity-name="Content"> + <condition-list combine="and"> + <condition-expr field-name="contentName" operator="not-equals" from-field="nullField"/> + <condition-expr field-name="contentId" operator="equals" from-field="parameters.contentId"/> + </condition-list> + <select-field field-name="contentId"/> + <select-field field-name="contentName"/> + <select-field field-name="localeString"/> + </entity-condition> + </else> + </if-empty> <iterate entry="content" list="contents"> <set field="localeString" from-field="content.localeString" default-value="${defaultLocaleString}"/> <entity-condition list="contentAssocDataResources" entity-name="ContentAssocDataResourceViewTo"> @@ -1304,9 +1315,12 @@ </entity-condition> <filter-list-by-date list="contentAssocDataResources" from-field-name="caFromDate" thru-field-name="caThruDate"/> <if-empty field="contentAssocDataResources"> - <call-class-method method-name="invalidCharacter" class-name="org.ofbiz.common.UrlServletHelper" ret-field="altUrl"> - <field field="content.contentName"/> - </call-class-method> + <set field="altUrl"/> + <if-not-empty field="content.contentName"> + <call-class-method method-name="invalidCharacter" class-name="org.ofbiz.common.UrlServletHelper" ret-field="altUrl"> + <field field="content.contentName"/> + </call-class-method> + </if-not-empty> <set field="altUrl" value="/${altUrl}-${content.contentId}-content"/> <sequenced-id sequence-name="DataResource" field="createDataResourceCtx.dataResourceId"/> <set field="createDataResourceCtx.dataResourceTypeId" value="ELECTRONIC_TEXT"/> @@ -1319,7 +1333,7 @@ </call-service> <set field="electronicTextCtx.dataResourceId" from-field="dataResourceId"/> <set field="electronicTextCtx.textData" from-field="content.contentName"/> - <call-service service-name="createElectronicText" in-map-name="electronicTextCtx"></call-service> + <call-service service-name="createElectronicText" in-map-name="electronicTextCtx" include-user-login="true"></call-service> <sequenced-id sequence-name="Content" field="contentCtx.contentId"/> <set field="contentCtx.contentTypeId" value="DOCUMENT"/> @@ -1332,7 +1346,7 @@ <set field="createContentAssocCtx.contentId" from-field="content.contentId"/> <set field="createContentAssocCtx.contentIdTo" from-field="contentIdTo"/> <set field="createContentAssocCtx.contentAssocTypeId" value="ALTERNATIVE_URL"/> - <call-service service-name="createContentAssoc" in-map-name="createContentAssocCtx"/> + <call-service service-name="createContentAssoc" in-map-name="createContentAssocCtx" include-user-login="true"/> </if-empty> </iterate> </simple-method> Modified: ofbiz/trunk/applications/content/servicedef/secas.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/secas.xml?rev=1144227&r1=1144226&r2=1144227&view=diff ============================================================================== --- ofbiz/trunk/applications/content/servicedef/secas.xml (original) +++ ofbiz/trunk/applications/content/servicedef/secas.xml Fri Jul 8 09:52:08 2011 @@ -179,7 +179,7 @@ under the License. <action service="checkContentAssocIds" mode="sync"/> </eca> - <eca service="createContent" event="return"> + <eca service="createContent" event="commit"> <condition field-name="contentId" operator="is-not-empty"/> <action service="createContentAlternativeUrl" mode="sync" run-as-user="system"/> </eca> |
Free forum by Nabble | Edit this page |