svn commit: r1822978 - /ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/category/CategoryServices.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1822978 - /ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/category/CategoryServices.xml

jleroux@apache.org
Author: jleroux
Date: Fri Feb  2 15:55:52 2018
New Revision: 1822978

URL: http://svn.apache.org/viewvc?rev=1822978&view=rev
Log:
Improved: Removing of loadBestSellingCategory and all related methods in
CategoryServices.xml
(OFBIZ-10146)
While doing some conversions from MiniLang to Groovy, I stumbled across these
methods:
  loadBestSellingCategory
  RemoveProductFromBestSellCategory
  AddProductToBestSellCategory
  FindCategoryChild
  FindBestSellingProduct
These are all in CategoryServices.xml.

I started realizing, that the simple-method loadBestSellingCategory doesn't
work right (there are some logical failures in it) and while fixing it,
I searched for places where this is used, but couldn't find any.
I started looking deeper into it and found that all of these methods are never
used anywhere in OFBiz, neither are the services which are declared for these
methods.

This is why I propose to remove them; they have no real use, since they don't
work properly, and also are never used.

Thanks: Dennis Balkir

Modified:
    ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/category/CategoryServices.xml

Modified: ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/category/CategoryServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/category/CategoryServices.xml?rev=1822978&r1=1822977&r2=1822978&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/category/CategoryServices.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/category/CategoryServices.xml Fri Feb  2 15:55:52 2018
@@ -70,131 +70,4 @@ under the License.
             </then>
         </if>
     </simple-method>
-
-    <!-- Load data of best selling category -->
-    <simple-method method-name="loadBestSellingCategory" short-description="Load data of best selling category by week.">
-        <now-date-to-env field="nowDate"/>
-        <set field="week" value="${groovy: import java.util.Calendar;
-            Calendar cal = Calendar.getInstance();
-            cal.setTime(nowDate);
-            return cal.get(Calendar.WEEK_OF_YEAR);}" type="Long"/>
-        <set field="year" value="${groovy: import java.util.Calendar;
-            Calendar cal = Calendar.getInstance();
-            cal.setTime(nowDate);
-            int aa = cal.get(Calendar.YEAR);
-            return aa;}" type="Long"/>
-        <if-compare field="week" operator="equals" value="1">
-            <set field="week" value="52"/>
-        <else>
-            <calculate field="week">
-                <calcop operator="subtract" field="week">
-                    <number value="1"/>
-                </calcop>
-            </calculate>
-            <if-compare field="week" operator="equals" value="1">
-                <calculate field="year">
-                    <calcop operator="subtract" field="year">
-                        <number value="1"/>
-                    </calcop>
-                </calculate>
-            </if-compare>
-        </else>
-        </if-compare>
-
-        <entity-and entity-name="ProductStoreCatalog" list="productStoreCatalogs" filter-by-date="true">
-            <field-map field-name="productStoreId" from-field="parameters.productStoreId"/>
-        </entity-and>
-        <if-not-empty field="productStoreCatalogs">
-            <first-from-list list="productStoreCatalogs" entry="productStoreCatalog"/>
-            <set field="callRemoveProductMap.prodCatalogId" from-field="productStoreCatalog.prodCatalogId"/>
-            <call-service service-name="RemoveProductFromBestSellCategory" in-map-name="callRemoveProductMap"/>
-
-            <set field="callAddProductMap.productStoreId" from-field="parameters.productStoreId"/>
-            <set field="callAddProductMap.prodCatalogId" from-field="productStoreCatalog.prodCatalogId"/>
-            <set field="callAddProductMap.week" from-field="week" type="Long"/>
-            <set field="callAddProductMap.year" from-field="year" type="Long"/>
-            <call-service service-name="AddProductToBestSellCategory" in-map-name="callAddProductMap"/>
-        </if-not-empty>
-    </simple-method>
-
-    <simple-method method-name="RemoveProductFromBestSellCategory" short-description="Remove products from best selling category.">
-        <entity-and entity-name="ProdCatalogCategory" list="prodCatalogCategorys">
-            <field-map field-name="prodCatalogId" from-field="parameters.prodCatalogId"/>
-            <field-map field-name="prodCatalogCategoryTypeId" value="PCCT_BEST_SELL"/>
-        </entity-and>
-        <iterate list="prodCatalogCategorys" entry="prodCatalogCategory">
-            <entity-and entity-name="ProductCategoryRollup" list="productCategoryRollups">
-                <field-map field-name="parentProductCategoryId" from-field="prodCatalogCategory.productCategoryId"/>
-            </entity-and>
-            <iterate list="productCategoryRollups" entry="productCategoryRollup">
-                <entity-and entity-name="ProductCategoryMember" list="productCategoryMembers">
-                    <field-map field-name="productCategoryId" from-field="productCategoryRollup.productCategoryId"/>
-                </entity-and>
-                <iterate list="productCategoryMembers" entry="productCategoryMember">
-                    <remove-value value-field="productCategoryMember"/>
-                </iterate>
-            </iterate>
-        </iterate>
-    </simple-method>
-
-    <simple-method method-name="AddProductToBestSellCategory" short-description="Add products to best selling category.">
-        <entity-and entity-name="ProdCatalogCategory" list="prodCatalogCategorys">
-            <field-map field-name="prodCatalogId" from-field="parameters.prodCatalogId"/>
-            <field-map field-name="prodCatalogCategoryTypeId" value="PCCT_BEST_SELL"/>
-        </entity-and>
-        <first-from-list list="prodCatalogCategorys" entry="prodCatalogCategory"/>
-        <entity-and entity-name="ProductCategoryRollup" list="productCategoryRollupList">
-            <field-map field-name="parentProductCategoryId" from-field="prodCatalogCategory.productCategoryId"/>
-        </entity-and>
-        <iterate list="productCategoryRollupList" entry="productCategoryRollup">
-            <set-service-fields service-name="FindCategoryChild" map="parameters" to-map="CategoryChildMap"/>
-            <set field="CategoryChildMap.productCategoryId" from-field="productCategoryRollup.productCategoryId"/>
-            <set field="CategoryChildMap.primaryProductCategoryId" from-field="productCategoryRollup.productCategoryId"/>
-            <call-service service-name="FindCategoryChild" in-map-name="CategoryChildMap"/>
-        </iterate>
-    </simple-method>
-
-    <simple-method method-name="FindCategoryChild" short-description="Find category child.">
-        <entity-and entity-name="ProductCategoryRollup" list="productCategoryRollupList">
-            <field-map field-name="parentProductCategoryId" from-field="parameters.productCategoryId"/>
-        </entity-and>
-        <if-empty field="productCategoryRollupList">
-            <set-service-fields service-name="FindBestSellingProduct" map="parameters" to-map="AddProductMap"/>
-            <set field="AddProductMap.productCategoryId" from-field="parameters.productCategoryId"/>
-            <call-service service-name="FindBestSellingProduct" in-map-name="AddProductMap"/>
-        <else>
-            <iterate list="productCategoryRollupList" entry="productCategoryRollup">
-                <set-service-fields service-name="FindCategoryChild" map="parameters" to-map="CategoryChildMap"/>
-                <set field="CategoryChildMap.productCategoryId" from-field="productCategoryRollup.productCategoryId"/>
-                <call-service service-name="FindCategoryChild" in-map-name="CategoryChildMap"/>
-            </iterate>
-        </else>
-        </if-empty>
-    </simple-method>
-
-    <simple-method method-name="FindBestSellingProduct" short-description="Find best selling product.">
-        <now-timestamp field="nowTimestamp"/>
-        <entity-and entity-name="ProductCategoryMember" list="productCategoryMembers" filter-by-date="true">
-            <field-map field-name="productCategoryId" from-field="parameters.productCategoryId"/>
-        </entity-and>
-        <iterate list="productCategoryMembers" entry="productCategoryMember">
-            <entity-condition entity-name="SalesOrderItemStarSchema" list="salesOrderItemStarSchemas" distinct="true">
-                <condition-list combine="and">
-                    <condition-expr field-name="productProductId" operator="equals" from-field="productCategoryMember.productId"/>
-                    <condition-expr field-name="productStoreId" operator="equals" from-field="parameters.productStoreId"/>
-                    <condition-expr field-name="orderDateWeekOfYear" operator="equals" from-field="parameters.week"/>
-                    <condition-expr field-name="orderDateYearName" operator="equals" from-field="parameters.year"/>
-                </condition-list>
-            </entity-condition>
-            <if-not-empty field="salesOrderItemStarSchemas">
-                <first-from-list list="salesOrderItemStarSchemas" entry="salesOrderItemStarSchema"/>
-                <make-value entity-name="ProductCategoryMember" value-field="newEntity"/>
-                <set field="newEntity.productCategoryId" from-field="parameters.primaryProductCategoryId"/>
-                <set field="newEntity.productId" from-field="salesOrderItemStarSchema.productProductId"/>
-                <set field="newEntity.fromDate" from-field="nowTimestamp"/>
-                <set field="newEntity.quantity" from-field="salesOrderItemStarSchema.quantity"/>
-                <create-value value-field="newEntity"/>
-            </if-not-empty>
-        </iterate>
-    </simple-method>
 </simple-methods>