Author: byersa
Date: Wed Jun 13 09:23:24 2007 New Revision: 546949 URL: http://svn.apache.org/viewvc?view=rev&rev=546949 Log: Added two services, getSubContentWithPerm and getSubSubContentWithPerm. The first gets a list of sub content and does a genericContentPermission check on each one. The second one uses the list from the first and gets a subcontent record for each one that exists. It is meant to get the "summary" record for an article. Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml ofbiz/trunk/applications/content/servicedef/services.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?view=diff&rev=546949&r1=546948&r2=546949 ============================================================================== --- ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml (original) +++ ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml Wed Jun 13 09:23:24 2007 @@ -1162,7 +1162,41 @@ <set field="contentViewList[]" from-field="view"/> </if-compare> </iterate> + <field-to-result field-name="contentViewList" result-name="subContentList"/> + </simple-method> + + <simple-method method-name="getSubSubContentWithPermCheck" short-description="Get sub content and perform permission check on each record"> + + <set-service-fields service-name="getSubContentWithPermCheck" map-name="parameters" to-map-name="inMap"/> + <call-service service-name="getSubContentWithPermCheck" in-map-name="inMap"> + <result-to-field result-name="subContentList"/> + </call-service> + + <iterate entry-name="view" list-name="subContentList"> + <entity-condition list-name="viewList" entity-name="ContentAssocViewTo" filter-by-date="true" use-cache="${useCache}"> + <condition-list combine="and"> + <condition-expr field-name="contentIdStart" env-name="view.caContentIdTo"/> + <condition-expr field-name="caContentAssocTypeId" env-name="parameters.subContentAssocTypeId" ignore-if-empty="true"/> + <condition-expr field-name="caMapKey" env-name="parameters.subMapKey" ignore-if-empty="true"/> + </condition-list> + </entity-condition> + <clear-field field-name="view2"/> + <first-from-list entry-name="view2" list-name="viewList"/> + <clear-field field-name="map"/> + <set field="map.contentIdFrom" from-field="view.contentId"/> + <set field="map.dataResourceIdFrom" from-field="view.dataResourceId"/> + <set field="map.contentId" from-field="view2.contentId"/> + <set field="map.contentName" from-field="view2.contentName"/> + <set field="map.description" from-field="view2.description"/> + <entity-one entity-name="ElectronicText" value-name="electronicText"> + <field-map field-name="dataResourceId" env-name="view2.dataResourceId"/> + </entity-one> + <set field="map.textData" from-field="electronicText.textData"/> + <set field="contentViewList[]" from-field="map"/> + </iterate> + <field-to-result field-name="subContentList" result-name="subContentList"/> + <field-to-result field-name="contentViewList" result-name="subSubContentList"/> </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/content/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services.xml?view=diff&rev=546949&r1=546948&r2=546949 ============================================================================== --- ofbiz/trunk/applications/content/servicedef/services.xml (original) +++ ofbiz/trunk/applications/content/servicedef/services.xml Wed Jun 13 09:23:24 2007 @@ -44,14 +44,23 @@ location="org/ofbiz/content/content/ContentServices.xml" invoke="getSubContentWithPermCheck"> <description>Get Content and resource information</description> <permission-service service-name="genericContentPermission" main-action="VIEW"/> - <attribute mode="IN" name="content" optional="false" type="String"/> + <attribute mode="IN" name="contentId" optional="false" type="String"/> <attribute mode="IN" name="contentAssocTypeId" optional="true" type="String"/> <attribute mode="IN" name="mapKey" optional="true" type="String"/> <attribute mode="IN" name="mainAction" optional="true" type="String"/> <attribute mode="IN" name="contentOperationId" optional="true" type="String"/> <attribute mode="IN" name="useCache" optional="true" type="Boolean"/> <attribute mode="IN" name="filterByDate" optional="true" type="Boolean"/> - <attribute mode="OUT" name="resultData" optional="true" type="java.util.Map"/> + <attribute mode="OUT" name="subContentList" optional="false" type="java.util.List"/> + </service> + + <service name="getSubSubContentWithPermCheck" engine="simple" auth="true" + location="org/ofbiz/content/content/ContentServices.xml" invoke="getSubSubContentWithPermCheck"> + <description>Get Content associated with Content</description> + <implements service="getSubContentWithPermCheck"/> + <attribute mode="IN" name="subContentAssocTypeId" optional="true" type="String"/> + <attribute mode="IN" name="subMapKey" optional="true" type="String"/> + <attribute mode="OUT" name="subSubContentList" optional="false" type="java.util.List"/> </service> <service name="getContentAndDataResource" engine="simple" default-entity-name="Content" auth="true" |
Free forum by Nabble | Edit this page |