<service verb="get" noun="Products">
<implements service="sang.product.ProductServices.get#ProductsWithPagination"/>
<in-parameters>
<parameter name="productCategoryId" required="true"/>
<parameter name="geoId" required="true"/>
<parameter name="level" type="Integer" default-value="1"/>
</in-parameters>
<actions>
<set field="cacheKeyName" from="productCategoryId + '_' + level + '_' + geoId + '_' + pageIndex + '_' + pageSize + '_' + pageNoLimit + '_' + orderByField"/>
<script>
def categoryGeoProductCache = ec.cache.getCache('Product_List_By_Category_Geo')
productList = (List) categoryGeoProductCache.get(cacheKeyName)
</script>
<if condition="productList != null"><return/></if>
<service-call name="sang.moqui.extend.BasicServices.get#ChildGeoIds" in-map="[ geoId: geoId, level: 20 ]" out-map="context"/>
<set field="geoIds" from="geoIds + [geoId]"/>
<service-call name="sang.product.CategoryServices.get#ChildProductCategoryIds" out-map="context"
in-map="[ productCategoryId: productCategoryId, level: level ]"/> <set field="paginateMap" from="[pageIndex: pageIndex, pageSize: pageSize, pageNoLimit: pageNoLimit, orderByField: orderByField]"/>
<entity-find entity-name="sang.product.ProductAndCategoryAndGeo" list="pList" distinct="true" cache="true">
<search-form-inputs input-fields-map="paginateMap"/>
<date-filter/>
<econdition field-name="statusId" value="ProductOnShelf"/>
<econdition field-name="geoId" operator="in" from="geoIds"/>
<econdition field-name="productCategoryId" operator="in" from="productCategoryIds"/>
<select-field field-name="productId"/>
</entity-find> <service-call name="sang.product.ProductServices.get#ProductsByIds" in-map="[productIds: pList.productId]" out-map="context"/>
<service-call name="sang.common.CommonServices.add#PaginateResponseHeaders"
in-map="[ pageIndex: pageIndex, pageSize: pageSize, totalCount: pListCount, pageMaxIndex: pListPageMaxIndex,
pageRangeLow: pListPageRangeLow, pageRangeHigh: pListPageRangeHigh ]"/>
<script>
categoryGeoProductCache.put(cacheKeyName, productList)
</script>
</actions>
</service>
<?xml version="1.0" encoding="UTF-8" ?>
<moqui-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/moqui-conf-2.0.xsd"> <cache-list warm-on-start="false">
<cache name="Product_List_By_Category_Geo" expire-time-live="60" value-type="List"/>
</cache-list>
<webapp-list>
<webapp name="webroot" https-enabled="false" require-session-token="false">
<after-login><actions>
</actions></after-login>
</webapp>
</webapp-list>
</moqui-conf>