You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2008/07/07 13:34:12 UTC

svn commit: r674461 - in /ofbiz/trunk/applications: ecommerce/widget/ order/webapp/ordermgr/WEB-INF/actions/entry/cart/ order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ order/widget/ordermgr/

Author: lektran
Date: Mon Jul  7 04:34:11 2008
New Revision: 674461

URL: http://svn.apache.org/viewvc?rev=674461&view=rev
Log:
converted some bsh scripts to groovy

Added:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy
      - copied, changed from r674416, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.bsh
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy
      - copied, changed from r674416, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.bsh
Removed:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.bsh
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.bsh
Modified:
    ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml
    ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml
    ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml
    ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCatalogScreens.xml

Modified: ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml?rev=674461&r1=674460&r2=674461&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml (original)
+++ ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml Mon Jul  7 04:34:11 2008
@@ -110,7 +110,7 @@
                 <set field="MainColumnStyle" value="center"/>
                 <set field="productsummaryScreen" value="component://ecommerce/widget/CatalogScreens.xml#productsummary"/>
                 <set field="titleProperty" value="PageTitleShowPromotionDetails"/>
-                <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.bsh"/>
+                <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">

Modified: ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml?rev=674461&r1=674460&r2=674461&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml (original)
+++ ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml Mon Jul  7 04:34:11 2008
@@ -410,7 +410,7 @@
 
                 <set field="titleProperty" value="PageTitleAdvancedSearch"/>
                 <set field="headerItem" value="Advanced Search"/>
-                <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.bsh"/>
+                <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">

Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy (from r674416, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.bsh&r1=674416&r2=674461&rev=674461&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy Mon Jul  7 04:34:11 2008
@@ -22,67 +22,62 @@
 import org.ofbiz.order.shoppingcart.product.ProductPromoWorker;
 
 productPromoId = request.getParameter("productPromoId");
-productPromo = delegator.findByPrimaryKey("ProductPromo", UtilMisc.toMap("productPromoId", productPromoId));
+productPromo = delegator.findByPrimaryKey("ProductPromo", [productPromoId : productPromoId]);
 
 promoAutoDescription = ProductPromoWorker.makeAutoDescription(productPromo, delegator, locale);
 
-List productPromoCategoryList = delegator.findByAndCache("ProductPromoCategory", UtilMisc.toMap("productPromoId", productPromoId));
-productPromoCategoryIncludeList = EntityUtil.filterByAnd(productPromoCategoryList, UtilMisc.toMap("productPromoApplEnumId", "PPPA_INCLUDE"));
-productPromoCategoryExcludeList = EntityUtil.filterByAnd(productPromoCategoryList, UtilMisc.toMap("productPromoApplEnumId", "PPPA_EXCLUDE"));
-productPromoCategoryAlwaysList = EntityUtil.filterByAnd(productPromoCategoryList, UtilMisc.toMap("productPromoApplEnumId", "PPPA_ALWAYS"));
+productPromoCategoryList = delegator.findByAndCache("ProductPromoCategory", [productPromoId : productPromoId]);
+productPromoCategoryIncludeList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_INCLUDE"]);
+productPromoCategoryExcludeList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_EXCLUDE"]);
+productPromoCategoryAlwaysList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_ALWAYS"]);
 
-Set productIdsCond = new HashSet();
-Set productIdsAction = new HashSet();
+productIdsCond = [] as Set;
+productIdsAction = [] as Set;
 ProductPromoWorker.makeProductPromoCondActionIdSets(productPromoId, productIdsCond, productIdsAction, delegator, null);
 // Debug.logInfo("productIdsCond=" + productIdsCond.toString(), "showProductPromoDetails.bsh");
 // Debug.logInfo("productIdsAction=" + productIdsAction.toString(), "showProductPromoDetails.bsh");
 
-Set productIdSet = new TreeSet(productIdsCond);
-productIdSet.addAll(productIdsAction);
-List productIds = new ArrayList(productIdSet);
-
-context.put("productPromoId", productPromoId);
-context.put("productPromo", productPromo);
-context.put("promoAutoDescription", promoAutoDescription);
-
-context.put("productPromoCategoryIncludeList", productPromoCategoryIncludeList);
-context.put("productPromoCategoryExcludeList", productPromoCategoryExcludeList);
-context.put("productPromoCategoryAlwaysList", productPromoCategoryAlwaysList);
-
-context.put("productIdsCond", productIdsCond);
-context.put("productIdsAction", productIdsAction);
-context.put("productIds", productIds);
-
-int viewIndex = 0;
-int viewSize = 10;
-int highIndex = 0;
-int lowIndex = 0;
-int listSize = 0;
+productIds = new TreeSet(productIdsCond);
+productIds.addAll(productIdsAction);
+
+context.productPromoId = productPromoId;
+context.productPromo = productPromo;
+context.promoAutoDescription = promoAutoDescription;
+
+context.productPromoCategoryIncludeList = productPromoCategoryIncludeList;
+context.productPromoCategoryExcludeList = productPromoCategoryExcludeList;
+context.productPromoCategoryAlwaysList = productPromoCategoryAlwaysList;
+
+context.productIdsCond = productIdsCond;
+context.productIdsAction = productIdsAction;
+context.productIds = productIds as List;
+
+viewIndex = 0;
+viewSize = 10;
+highIndex = 0;
+lowIndex = 0;
+listSize = productIds.size();
 
 try {
-    viewIndex = Integer.valueOf((String) request.getParameter("VIEW_INDEX")).intValue();
+    viewIndex = Integer.valueOf(request.getParameter("VIEW_INDEX"));
 } catch (Exception e) {
     viewIndex = 0;
 }
 
 try {
-    viewSize = Integer.valueOf((String) request.getParameter("VIEW_SIZE")).intValue();
+    viewSize = Integer.valueOf(request.getParameter("VIEW_SIZE"));
 } catch (Exception e) {
     viewSize = 10;
 }
 
-if (productIds != null) {
-    listSize = productIds.size();
-}
-
 lowIndex = viewIndex * viewSize;
 highIndex = (viewIndex + 1) * viewSize;
 if (listSize < highIndex) {
     highIndex = listSize;
 }
 
-context.put("viewIndex", viewIndex);
-context.put("viewSize", viewSize);
-context.put("listSize", listSize);
-context.put("lowIndex", lowIndex);
-context.put("highIndex", highIndex);
+context.viewIndex = viewIndex;
+context.viewSize = viewSize;
+context.listSize = listSize;
+context.lowIndex = lowIndex;
+context.highIndex = highIndex;

Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy (from r674416, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.bsh&r1=674416&r2=674461&rev=674461&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy Mon Jul  7 04:34:11 2008
@@ -27,17 +27,17 @@
 import org.ofbiz.product.feature.*;
 import org.ofbiz.product.product.*;
 
-searchCategoryId = parameters.get("SEARCH_CATEGORY_ID");
-if (searchCategoryId == null || searchCategoryId.length() == 0) {
+searchCategoryId = parameters.SEARCH_CATEGORY_ID;
+if (!searchCategoryId) {
     currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
     searchCategoryId = CatalogWorker.getCatalogSearchCategoryId(request, currentCatalogId);
 }
-searchCategory = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", searchCategoryId));
+searchCategory = delegator.findByPrimaryKey("ProductCategory", [productCategoryId : searchCategoryId]);
 
 productFeaturesByTypeMap = ParametricSearch.makeCategoryFeatureLists(searchCategoryId, delegator);
-productFeatureTypeIdsOrdered = new ArrayList(new TreeSet(productFeaturesByTypeMap.keySet()));
+productFeatureTypeIdsOrdered = new TreeSet(productFeaturesByTypeMap.keySet()) as List;
 
-searchOperator = parameters.get("SEARCH_OPERATOR");
+searchOperator = parameters.SEARCH_OPERATOR;
 if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) {
   searchOperator = "OR";
 }
@@ -45,10 +45,10 @@
 searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator);
 searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request);
 
-context.put("searchCategoryId", searchCategoryId);
-context.put("searchCategory", searchCategory);
-context.put("productFeaturesByTypeMap", productFeaturesByTypeMap);
-context.put("productFeatureTypeIdsOrdered", productFeatureTypeIdsOrdered);
-context.put("searchOperator", searchOperator);
-context.put("searchConstraintStrings", searchConstraintStrings);
-context.put("searchSortOrderString", searchSortOrderString);
+context.searchCategoryId = searchCategoryId;
+context.searchCategory = searchCategory;
+context.productFeaturesByTypeMap = productFeaturesByTypeMap;
+context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered;
+context.searchOperator = searchOperator;
+context.searchConstraintStrings = searchConstraintStrings;
+context.searchSortOrderString = searchSortOrderString;

Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml?rev=674461&r1=674460&r2=674461&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml Mon Jul  7 04:34:11 2008
@@ -138,7 +138,7 @@
 
                 <set field="title" value="Show Promotion Details"/>
                 <set field="productsummaryScreen" value="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productsummary"/>
-                <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.bsh"/>
+                <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonOrderEntryDecorator" location="component://order/widget/ordermgr/OrderEntryCommonScreens.xml">

Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCatalogScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCatalogScreens.xml?rev=674461&r1=674460&r2=674461&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCatalogScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCatalogScreens.xml Mon Jul  7 04:34:11 2008
@@ -216,7 +216,7 @@
                 
                 <set field="title-property" value="PageTitleAdvancedSearch"/>
                 <set field="headerItem" value="Advanced Search"/>
-                <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.bsh"/>
+                <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy"/>
                 
                 <entity-condition entity-name="PartyRoleAndPartyDetail" list-name="supplerPartyRoleAndPartyDetails">
                     <condition-expr field-name="roleTypeId" value="SUPPLIER"/>