converted some bsh scripts to groovy

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@674461 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Scott Gray
2008-07-07 11:34:11 +00:00
parent 1054052beb
commit 3aa246dfec
6 changed files with 46 additions and 51 deletions
@@ -110,7 +110,7 @@ under the License.
<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}">
@@ -410,7 +410,7 @@ under the License.
<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}">
@@ -22,67 +22,62 @@ import org.ofbiz.entity.util.EntityUtil;
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);
productIds = new TreeSet(productIdsCond);
productIds.addAll(productIdsAction);
context.put("productPromoId", productPromoId);
context.put("productPromo", productPromo);
context.put("promoAutoDescription", promoAutoDescription);
context.productPromoId = productPromoId;
context.productPromo = productPromo;
context.promoAutoDescription = promoAutoDescription;
context.put("productPromoCategoryIncludeList", productPromoCategoryIncludeList);
context.put("productPromoCategoryExcludeList", productPromoCategoryExcludeList);
context.put("productPromoCategoryAlwaysList", productPromoCategoryAlwaysList);
context.productPromoCategoryIncludeList = productPromoCategoryIncludeList;
context.productPromoCategoryExcludeList = productPromoCategoryExcludeList;
context.productPromoCategoryAlwaysList = productPromoCategoryAlwaysList;
context.put("productIdsCond", productIdsCond);
context.put("productIdsAction", productIdsAction);
context.put("productIds", productIds);
context.productIdsCond = productIdsCond;
context.productIdsAction = productIdsAction;
context.productIds = productIds as List;
int viewIndex = 0;
int viewSize = 10;
int highIndex = 0;
int lowIndex = 0;
int listSize = 0;
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;
@@ -27,17 +27,17 @@ import org.ofbiz.product.catalog.*;
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 @@ if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) {
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;
@@ -138,7 +138,7 @@ under the License.
<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">
@@ -216,7 +216,7 @@ under the License.
<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"/>