Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryWorker.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryWorker.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryWorker.java Wed May 28 00:22:59 2008 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -15,7 +15,7 @@ * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - *******************************************************************************/ + */ package org.ofbiz.product.inventory; @@ -33,8 +33,8 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityConditionList; -import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; public class InventoryWorker { @@ -49,15 +49,15 @@ */ public static List getOutstandingPurchaseOrders(String productId, GenericDelegator delegator) { try { - List purchaseOrderConditions = UtilMisc.toList(new EntityExpr("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"), - new EntityExpr("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"), - new EntityExpr("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), - new EntityExpr("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED"), - new EntityExpr("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"), - new EntityExpr("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED")); - purchaseOrderConditions.add(new EntityExpr("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER")); - purchaseOrderConditions.add(new EntityExpr("productId", EntityOperator.EQUALS, productId)); - List purchaseOrders = delegator.findList("OrderHeaderAndItems", new EntityConditionList(purchaseOrderConditions, EntityOperator.AND), + List purchaseOrderConditions = UtilMisc.toList(EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"), + EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"), + EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), + EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED"), + EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"), + EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED")); + purchaseOrderConditions.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER")); + purchaseOrderConditions.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)); + List purchaseOrders = delegator.findList("OrderHeaderAndItems", EntityCondition.makeCondition(purchaseOrderConditions, EntityOperator.AND), null, UtilMisc.toList("estimatedDeliveryDate DESC", "orderDate"), null, false); return purchaseOrders; } catch (GenericEntityException ex) { @@ -109,18 +109,18 @@ public static Map getOutstandingProductQuantities(Collection productIds, String orderTypeId, GenericDelegator delegator) { Set fieldsToSelect = UtilMisc.toSet("productId", "quantityOpen"); List condList = UtilMisc.toList( - new EntityExpr("orderTypeId", EntityOperator.EQUALS, orderTypeId), - new EntityExpr("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"), - new EntityExpr("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), - new EntityExpr("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED") + EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, orderTypeId), + EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"), + EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), + EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED") ); if (productIds.size() > 0) { - condList.add(new EntityExpr("productId", EntityOperator.IN, productIds)); + condList.add(EntityCondition.makeCondition("productId", EntityOperator.IN, productIds)); } - condList.add(new EntityExpr("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED")); - condList.add(new EntityExpr("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED")); - condList.add(new EntityExpr("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED")); - EntityConditionList conditions = new EntityConditionList(condList, EntityOperator.AND); + condList.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED")); + condList.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED")); + condList.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED")); + EntityConditionList conditions = EntityCondition.makeCondition(condList, EntityOperator.AND); Map results = FastMap.newInstance(); try { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java Wed May 28 00:22:59 2008 @@ -201,22 +201,22 @@ Double amountDbl = (Double) context.get("amount"); List productPriceEcList = FastList.newInstance(); - productPriceEcList.add(new EntityExpr("productId", EntityOperator.EQUALS, productId)); + productPriceEcList.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)); // this funny statement is for backward compatibility purposes; the productPricePurposeId is a new pk field on the ProductPrice entity and in order databases may not be populated, until the pk is updated and such; this will ease the transition somewhat if ("PURCHASE".equals(productPricePurposeId)) { - productPriceEcList.add(new EntityExpr( - new EntityExpr("productPricePurposeId", EntityOperator.EQUALS, productPricePurposeId), + productPriceEcList.add(EntityCondition.makeCondition( + EntityCondition.makeCondition("productPricePurposeId", EntityOperator.EQUALS, productPricePurposeId), EntityOperator.OR, - new EntityExpr("productPricePurposeId", EntityOperator.EQUALS, null))); + EntityCondition.makeCondition("productPricePurposeId", EntityOperator.EQUALS, null))); } else { - productPriceEcList.add(new EntityExpr("productPricePurposeId", EntityOperator.EQUALS, productPricePurposeId)); + productPriceEcList.add(EntityCondition.makeCondition("productPricePurposeId", EntityOperator.EQUALS, productPricePurposeId)); } - productPriceEcList.add(new EntityExpr("currencyUomId", EntityOperator.EQUALS, currencyUomId)); - productPriceEcList.add(new EntityExpr("productStoreGroupId", EntityOperator.EQUALS, productStoreGroupId)); + productPriceEcList.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, currencyUomId)); + productPriceEcList.add(EntityCondition.makeCondition("productStoreGroupId", EntityOperator.EQUALS, productStoreGroupId)); if (UtilValidate.isNotEmpty(termUomId)) { - productPriceEcList.add(new EntityExpr("termUomId", EntityOperator.EQUALS, termUomId)); + productPriceEcList.add(EntityCondition.makeCondition("termUomId", EntityOperator.EQUALS, termUomId)); } - EntityCondition productPriceEc = new EntityConditionList(productPriceEcList, EntityOperator.AND); + EntityCondition productPriceEc = EntityCondition.makeCondition(productPriceEcList, EntityOperator.AND); // for prices, get all ProductPrice entities for this productId and currencyUomId List productPrices = null; @@ -887,8 +887,8 @@ } } else { // this would be nice, but we can't cache this so easily... - // List pprExprs = UtilMisc.toList(new EntityExpr("thruDate", EntityOperator.EQUALS, null), - // new EntityExpr("thruDate", EntityOperator.GREATER_THAN, UtilDateTime.nowTimestamp())); + // List pprExprs = UtilMisc.toList(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), + // EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, UtilDateTime.nowTimestamp())); // productPriceRules = delegator.findByOr("ProductPriceRule", pprExprs); productPriceRules = delegator.findList("ProductPriceRule", null, null, null, null, true); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Wed May 28 00:22:59 2008 @@ -93,16 +93,16 @@ EntityCondition condition = null; if (!"Y".equals(doAll)) { List condList = new LinkedList(); - condList.add(new EntityExpr(new EntityExpr("autoCreateKeywords", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("autoCreateKeywords", EntityOperator.NOT_EQUAL, "N"))); + condList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("autoCreateKeywords", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("autoCreateKeywords", EntityOperator.NOT_EQUAL, "N"))); if ("true".equals(UtilProperties.getPropertyValue("prodsearch", "index.ignore.variants"))) { - condList.add(new EntityExpr(new EntityExpr("isVariant", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("isVariant", EntityOperator.NOT_EQUAL, "Y"))); + condList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("isVariant", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("isVariant", EntityOperator.NOT_EQUAL, "Y"))); } if ("true".equals(UtilProperties.getPropertyValue("prodsearch", "index.ignore.discontinued.sales"))) { - condList.add(new EntityExpr(new EntityExpr("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("salesDiscontinuationDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp))); + condList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp))); } - condition = new EntityConditionList(condList, EntityOperator.AND); + condition = EntityCondition.makeCondition(condList, EntityOperator.AND); } else { - condition = new EntityExpr(new EntityExpr("autoCreateKeywords", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("autoCreateKeywords", EntityOperator.NOT_EQUAL, "N")); + condition = EntityCondition.makeCondition(EntityCondition.makeCondition("autoCreateKeywords", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("autoCreateKeywords", EntityOperator.NOT_EQUAL, "N")); } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java Wed May 28 00:22:59 2008 @@ -294,7 +294,7 @@ dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - entityConditionList.add(new EntityExpr(prefix + "Keyword", EntityOperator.LIKE, keyword)); + entityConditionList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); //don't add an alias for this, will be part of a complex alias: dynamicViewEntity.addAlias(entityAlias, prefix + "RelevancyWeight", "relevancyWeight", null, null, null, null); //needed when doingBothAndOr or will get an SQL error @@ -326,9 +326,9 @@ Iterator keywordIter = keywordFixedOrSet.iterator(); while (keywordIter.hasNext()) { String keyword = (String) keywordIter.next(); - keywordOrList.add(new EntityExpr(prefix + "Keyword", EntityOperator.LIKE, keyword)); + keywordOrList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); } - entityConditionList.add(new EntityConditionList(keywordOrList, EntityOperator.OR)); + entityConditionList.add(EntityCondition.makeCondition(keywordOrList, EntityOperator.OR)); productIdGroupBy = true; @@ -379,9 +379,9 @@ this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - incExcCondList.add(new EntityExpr(new EntityExpr(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - incExcCondList.add(new EntityExpr(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - incExcCondList.add(new EntityExpr(categoryPrefix + "ProductCategoryId", EntityOperator.EQUALS, includeCategoryId)); + incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + incExcCondList.add(EntityCondition.makeCondition(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + incExcCondList.add(EntityCondition.makeCondition(categoryPrefix + "ProductCategoryId", EntityOperator.EQUALS, includeCategoryId)); } } if (includeFeatureIds.size() > 0) { @@ -397,9 +397,9 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - incExcCondList.add(new EntityExpr(new EntityExpr(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - incExcCondList.add(new EntityExpr(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - incExcCondList.add(new EntityExpr(featurePrefix + "ProductFeatureId", EntityOperator.EQUALS, includeFeatureId)); + incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "ProductFeatureId", EntityOperator.EQUALS, includeFeatureId)); } } if (includeFeatureCategoryIds.size() > 0) { @@ -419,9 +419,9 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productFeatureId")); - incExcCondList.add(new EntityExpr(new EntityExpr(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - incExcCondList.add(new EntityExpr(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - incExcCondList.add(new EntityExpr(otherFeaturePrefix + "ProductFeatureCategoryId", EntityOperator.EQUALS, includeFeatureCategoryId)); + incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + incExcCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "ProductFeatureCategoryId", EntityOperator.EQUALS, includeFeatureCategoryId)); } } if (includeFeatureGroupIds.size() > 0) { @@ -443,47 +443,47 @@ this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productFeatureId")); - incExcCondList.add(new EntityExpr(new EntityExpr(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - incExcCondList.add(new EntityExpr(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - incExcCondList.add(new EntityExpr(new EntityExpr(otherFeaturePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(otherFeaturePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - incExcCondList.add(new EntityExpr(otherFeaturePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - incExcCondList.add(new EntityExpr(otherFeaturePrefix + "ProductFeatureGroupId", EntityOperator.EQUALS, includeFeatureGroupId)); + incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + incExcCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + incExcCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "ProductFeatureGroupId", EntityOperator.EQUALS, includeFeatureGroupId)); } } if (excludeCategoryIds.size() > 0) { List idExcludeCondList = FastList.newInstance(); - idExcludeCondList.add(new EntityExpr(new EntityExpr("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - idExcludeCondList.add(new EntityExpr("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - idExcludeCondList.add(new EntityExpr("productCategoryId", EntityOperator.IN, excludeCategoryIds)); - EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductCategoryMember", "productId", new EntityConditionList(idExcludeCondList, EntityOperator.AND), true, delegator); - incExcCondList.add(new EntityExpr("mainProductId", EntityOperator.NOT_EQUAL, subSelCond)); + idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + idExcludeCondList.add(EntityCondition.makeCondition("productCategoryId", EntityOperator.IN, excludeCategoryIds)); + EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductCategoryMember", "productId", EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator); + incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond)); } if (excludeFeatureIds.size() > 0) { List idExcludeCondList = FastList.newInstance(); - idExcludeCondList.add(new EntityExpr(new EntityExpr("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - idExcludeCondList.add(new EntityExpr("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - idExcludeCondList.add(new EntityExpr("productFeatureId", EntityOperator.IN, excludeFeatureIds)); - EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductFeatureAppl", "productId", new EntityConditionList(idExcludeCondList, EntityOperator.AND), true, delegator); - incExcCondList.add(new EntityExpr("mainProductId", EntityOperator.NOT_EQUAL, subSelCond)); + idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + idExcludeCondList.add(EntityCondition.makeCondition("productFeatureId", EntityOperator.IN, excludeFeatureIds)); + EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductFeatureAppl", "productId", EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator); + incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond)); } if (excludeFeatureCategoryIds.size() > 0) { List idExcludeCondList = FastList.newInstance(); - idExcludeCondList.add(new EntityExpr(new EntityExpr("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - idExcludeCondList.add(new EntityExpr("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - idExcludeCondList.add(new EntityExpr("productFeatureCategoryId", EntityOperator.IN, excludeFeatureCategoryIds)); - EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductFeatureAndAppl", "productId", new EntityConditionList(idExcludeCondList, EntityOperator.AND), true, delegator); - incExcCondList.add(new EntityExpr("mainProductId", EntityOperator.NOT_EQUAL, subSelCond)); + idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + idExcludeCondList.add(EntityCondition.makeCondition("productFeatureCategoryId", EntityOperator.IN, excludeFeatureCategoryIds)); + EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductFeatureAndAppl", "productId", EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator); + incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond)); } if (excludeFeatureGroupIds.size() > 0) { List idExcludeCondList = FastList.newInstance(); - idExcludeCondList.add(new EntityExpr(new EntityExpr("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - idExcludeCondList.add(new EntityExpr("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - idExcludeCondList.add(new EntityExpr(new EntityExpr("groupThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("groupThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - idExcludeCondList.add(new EntityExpr("groupFromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - idExcludeCondList.add(new EntityExpr("productFeatureGroupId", EntityOperator.IN, excludeFeatureGroupIds)); - EntityConditionValue subSelCond = new EntityConditionSubSelect("ProdFeaGrpAppAndProdFeaApp", "productId", new EntityConditionList(idExcludeCondList, EntityOperator.AND), true, delegator); - incExcCondList.add(new EntityExpr("mainProductId", EntityOperator.NOT_EQUAL, subSelCond)); + idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("groupThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("groupThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + idExcludeCondList.add(EntityCondition.makeCondition("groupFromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + idExcludeCondList.add(EntityCondition.makeCondition("productFeatureGroupId", EntityOperator.IN, excludeFeatureGroupIds)); + EntityConditionValue subSelCond = new EntityConditionSubSelect("ProdFeaGrpAppAndProdFeaApp", "productId", EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator); + incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond)); } if (alwaysIncludeCategoryIds.size() > 0) { @@ -496,9 +496,9 @@ this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - alwIncCondList.add(new EntityExpr(new EntityExpr(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - alwIncCondList.add(new EntityExpr(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - alwIncCondList.add(new EntityExpr(categoryPrefix + "ProductCategoryId", EntityOperator.IN, alwaysIncludeCategoryIds)); + alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + alwIncCondList.add(EntityCondition.makeCondition(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + alwIncCondList.add(EntityCondition.makeCondition(categoryPrefix + "ProductCategoryId", EntityOperator.IN, alwaysIncludeCategoryIds)); } if (alwaysIncludeFeatureIds.size() > 0) { String featurePrefix = "pfa" + this.index; @@ -510,9 +510,9 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - alwIncCondList.add(new EntityExpr(new EntityExpr(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - alwIncCondList.add(new EntityExpr(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - alwIncCondList.add(new EntityExpr(featurePrefix + "ProductFeatureId", EntityOperator.IN, alwaysIncludeFeatureIds)); + alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "ProductFeatureId", EntityOperator.IN, alwaysIncludeFeatureIds)); } if (alwaysIncludeFeatureCategoryIds.size() > 0) { Iterator alwaysIncludeFeatureCategoryIdIter = alwaysIncludeFeatureCategoryIds.iterator(); @@ -531,9 +531,9 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productFeatureId")); - alwIncCondList.add(new EntityExpr(new EntityExpr(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - alwIncCondList.add(new EntityExpr(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - alwIncCondList.add(new EntityExpr(otherFeaturePrefix + "ProductFeatureCategoryId", EntityOperator.EQUALS, alwaysIncludeFeatureCategoryId)); + alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + alwIncCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "ProductFeatureCategoryId", EntityOperator.EQUALS, alwaysIncludeFeatureCategoryId)); } } if (alwaysIncludeFeatureGroupIds.size() > 0) { @@ -555,11 +555,11 @@ this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productFeatureId")); - alwIncCondList.add(new EntityExpr(new EntityExpr(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - alwIncCondList.add(new EntityExpr(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - alwIncCondList.add(new EntityExpr(new EntityExpr(otherFeaturePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(otherFeaturePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - alwIncCondList.add(new EntityExpr(otherFeaturePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - alwIncCondList.add(new EntityExpr(otherFeaturePrefix + "ProductFeatureGroupId", EntityOperator.EQUALS, alwaysIncludeFeatureGroupId)); + alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + alwIncCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + alwIncCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "ProductFeatureGroupId", EntityOperator.EQUALS, alwaysIncludeFeatureGroupId)); } } @@ -577,9 +577,9 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - incExcCondList.add(new EntityExpr(new EntityExpr(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - incExcCondList.add(new EntityExpr(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - incExcCondList.add(new EntityExpr(featurePrefix + "ProductFeatureId", EntityOperator.IN, includeFeatureIdOrSet)); + incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "ProductFeatureId", EntityOperator.IN, includeFeatureIdOrSet)); } } if (alwaysIncludeFeatureIdOrSetAndList.size() > 0) { @@ -595,9 +595,9 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - alwIncCondList.add(new EntityExpr(new EntityExpr(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - alwIncCondList.add(new EntityExpr(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - alwIncCondList.add(new EntityExpr(featurePrefix + "ProductFeatureId", EntityOperator.IN, alwaysIncludeFeatureIdOrSet)); + alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "ProductFeatureId", EntityOperator.IN, alwaysIncludeFeatureIdOrSet)); } } @@ -615,9 +615,9 @@ this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - incExcCondList.add(new EntityExpr(new EntityExpr(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - incExcCondList.add(new EntityExpr(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - incExcCondList.add(new EntityExpr(categoryPrefix + "ProductCategoryId", EntityOperator.IN, includeCategoryIdOrSet)); + incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + incExcCondList.add(EntityCondition.makeCondition(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + incExcCondList.add(EntityCondition.makeCondition(categoryPrefix + "ProductCategoryId", EntityOperator.IN, includeCategoryIdOrSet)); } } if (alwaysIncludeCategoryIdOrSetAndList.size() > 0) { @@ -633,21 +633,21 @@ this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - alwIncCondList.add(new EntityExpr(new EntityExpr(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); - alwIncCondList.add(new EntityExpr(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); - alwIncCondList.add(new EntityExpr(categoryPrefix + "ProductCategoryId", EntityOperator.IN, alwaysIncludeCategoryIdOrSet)); + alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); + alwIncCondList.add(EntityCondition.makeCondition(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); + alwIncCondList.add(EntityCondition.makeCondition(categoryPrefix + "ProductCategoryId", EntityOperator.IN, alwaysIncludeCategoryIdOrSet)); } } if (incExcCondList.size() > 0) { - incExcCond = new EntityConditionList(incExcCondList, EntityOperator.AND); + incExcCond = EntityCondition.makeCondition(incExcCondList, EntityOperator.AND); } if (alwIncCondList.size() > 0) { - alwIncCond = new EntityConditionList(alwIncCondList, EntityOperator.AND); + alwIncCond = EntityCondition.makeCondition(alwIncCondList, EntityOperator.AND); } if (incExcCond != null && alwIncCond != null) { - topCond = new EntityExpr(incExcCond, EntityOperator.OR, alwIncCond); + topCond = EntityCondition.makeCondition(incExcCond, EntityOperator.OR, alwIncCond); } else if (incExcCond != null) { topCond = incExcCond; } else if (alwIncCond != null) { @@ -670,7 +670,7 @@ } dynamicViewEntity.addAlias("PROD", "mainProductId", "productId", null, null, new Boolean(productIdGroupBy), null); - EntityCondition whereCondition = new EntityConditionList(entityConditionList, EntityOperator.AND); + EntityCondition whereCondition = EntityCondition.makeCondition(entityConditionList, EntityOperator.AND); EntityFindOptions efo = new EntityFindOptions(); efo.setDistinct(true); efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE); @@ -884,9 +884,9 @@ productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ProductCategoryId", "productCategoryId", null, null, null, null); productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); productSearchContext.entityConditionList.add(new EntityExpr(prefix + "ProductCategoryId", EntityOperator.IN, productCategoryIds)); - productSearchContext.entityConditionList.add(new EntityExpr(new EntityExpr(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(prefix + "ThruDate", EntityOperator.GREATER_THAN, productSearchContext.nowTimestamp))); - productSearchContext.entityConditionList.add(new EntityExpr(prefix + "FromDate", EntityOperator.LESS_THAN, productSearchContext.nowTimestamp)); + productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductCategoryId", EntityOperator.IN, productCategoryIds)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, productSearchContext.nowTimestamp))); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, productSearchContext.nowTimestamp)); // add in productSearchConstraint, don't worry about the productSearchResultId or constraintSeqId, those will be fill in later productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", this.prodCatalogId))); @@ -1543,12 +1543,12 @@ context.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - context.entityConditionList.add(new EntityExpr(prefix + "ProductPriceTypeId", EntityOperator.EQUALS, productPriceTypeId)); - context.entityConditionList.add(new EntityExpr(prefix + "ProductPricePurposeId", EntityOperator.EQUALS, "PURCHASE")); - context.entityConditionList.add(new EntityExpr(prefix + "CurrencyUomId", EntityOperator.EQUALS, currencyUomId)); - context.entityConditionList.add(new EntityExpr(prefix + "ProductStoreGroupId", EntityOperator.EQUALS, productStoreGroupId)); - context.entityConditionList.add(new EntityExpr(new EntityExpr(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(prefix + "ThruDate", EntityOperator.GREATER_THAN, context.nowTimestamp))); - context.entityConditionList.add(new EntityExpr(prefix + "FromDate", EntityOperator.LESS_THAN, context.nowTimestamp)); + context.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPriceTypeId", EntityOperator.EQUALS, productPriceTypeId)); + context.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPricePurposeId", EntityOperator.EQUALS, "PURCHASE")); + context.entityConditionList.add(EntityCondition.makeCondition(prefix + "CurrencyUomId", EntityOperator.EQUALS, currencyUomId)); + context.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductStoreGroupId", EntityOperator.EQUALS, productStoreGroupId)); + context.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, context.nowTimestamp))); + context.entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, context.nowTimestamp)); } public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) { @@ -1603,17 +1603,17 @@ productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - productSearchContext.entityConditionList.add(new EntityExpr(prefix + "ProductPriceTypeId", EntityOperator.EQUALS, "LIST_PRICE")); - productSearchContext.entityConditionList.add(new EntityExpr(prefix + "ProductPricePurposeId", EntityOperator.EQUALS, "PURCHASE")); - productSearchContext.entityConditionList.add(new EntityExpr(prefix + "CurrencyUomId", EntityOperator.EQUALS, currencyUomId)); - productSearchContext.entityConditionList.add(new EntityExpr(prefix + "ProductStoreGroupId", EntityOperator.EQUALS, "_NA_")); - productSearchContext.entityConditionList.add(new EntityExpr(new EntityExpr(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(prefix + "ThruDate", EntityOperator.GREATER_THAN, productSearchContext.nowTimestamp))); - productSearchContext.entityConditionList.add(new EntityExpr(prefix + "FromDate", EntityOperator.LESS_THAN, productSearchContext.nowTimestamp)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPriceTypeId", EntityOperator.EQUALS, "LIST_PRICE")); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPricePurposeId", EntityOperator.EQUALS, "PURCHASE")); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "CurrencyUomId", EntityOperator.EQUALS, currencyUomId)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductStoreGroupId", EntityOperator.EQUALS, "_NA_")); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, productSearchContext.nowTimestamp))); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, productSearchContext.nowTimestamp)); if (this.lowPrice != null) { - productSearchContext.entityConditionList.add(new EntityExpr(prefix + "Price", EntityOperator.GREATER_THAN_EQUAL_TO, this.lowPrice)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "Price", EntityOperator.GREATER_THAN_EQUAL_TO, this.lowPrice)); } if (this.highPrice != null) { - productSearchContext.entityConditionList.add(new EntityExpr(prefix + "Price", EntityOperator.LESS_THAN_EQUAL_TO, this.highPrice)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "Price", EntityOperator.LESS_THAN_EQUAL_TO, this.highPrice)); } // add in productSearchConstraint, don't worry about the productSearchResultId or constraintSeqId, those will be fill in later @@ -1693,7 +1693,7 @@ productSearchContext.dynamicViewEntity.addMemberEntity(entityAlias, "SupplierProduct"); productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "SupplierPartyId", "partyId", null, null, null, null); productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - productSearchContext.entityConditionList.add(new EntityExpr(prefix + "SupplierPartyId", EntityOperator.EQUALS, supplierPartyId)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "SupplierPartyId", EntityOperator.EQUALS, supplierPartyId)); // add in productSearchConstraint, don't worry about the productSearchResultId or constraintSeqId, those will be fill in later productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", this.supplierPartyId))); @@ -1731,7 +1731,7 @@ public void addConstraint(ProductSearchContext productSearchContext) { productSearchContext.dynamicViewEntity.addAlias("PROD", "prodIsVariant", "isVariant", null, null, null, null); - productSearchContext.entityConditionList.add(new EntityExpr("prodIsVariant", EntityOperator.NOT_EQUAL, "Y")); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition("prodIsVariant", EntityOperator.NOT_EQUAL, "Y")); // add in productSearchConstraint, don't worry about the productSearchResultId or constraintSeqId, those will be fill in later productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", ""))); @@ -1759,9 +1759,9 @@ public void addConstraint(ProductSearchContext productSearchContext) { productSearchContext.dynamicViewEntity.addAlias("PROD", "prodIntroductionDate", "introductionDate", null, null, null, null); - productSearchContext.entityConditionList.add(new EntityExpr(new EntityExpr("prodIntroductionDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("prodIntroductionDate", EntityOperator.LESS_THAN_EQUAL_TO, productSearchContext.nowTimestamp))); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("prodIntroductionDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("prodIntroductionDate", EntityOperator.LESS_THAN_EQUAL_TO, productSearchContext.nowTimestamp))); productSearchContext.dynamicViewEntity.addAlias("PROD", "prodSalesDiscontinuationDate", "salesDiscontinuationDate", null, null, null, null); - productSearchContext.entityConditionList.add(new EntityExpr(new EntityExpr("prodSalesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("prodSalesDiscontinuationDate", EntityOperator.GREATER_THAN, productSearchContext.nowTimestamp))); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("prodSalesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("prodSalesDiscontinuationDate", EntityOperator.GREATER_THAN, productSearchContext.nowTimestamp))); productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", ""))); } @@ -1812,12 +1812,12 @@ if (UtilValidate.isNotEmpty(goodIdentificationTypeId)) { productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "GoodIdentificationTypeId", "goodIdentificationTypeId", null, null, null, null); - productSearchContext.entityConditionList.add(new EntityExpr(prefix + "GoodIdentificationTypeId", operator, goodIdentificationTypeId)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "GoodIdentificationTypeId", operator, goodIdentificationTypeId)); } if (UtilValidate.isNotEmpty(goodIdentificationValue)) { productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "GoodIdentificationValue", "idValue", null, null, null, null); - productSearchContext.entityConditionList.add(new EntityExpr(prefix + "GoodIdentificationValue", operator, goodIdentificationValue)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "GoodIdentificationValue", operator, goodIdentificationValue)); } productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); @@ -1996,13 +1996,13 @@ productSearchContext.dynamicViewEntity.addAlias("SPPRC", "sortThruDate", "thruDate", null, null, null, null); productSearchContext.dynamicViewEntity.addAlias("SPPRC", "sortPrice", "price", null, null, null, null); - productSearchContext.entityConditionList.add(new EntityExpr("sortProductPriceTypeId", EntityOperator.EQUALS, this.productPriceTypeId)); - productSearchContext.entityConditionList.add(new EntityExpr("sortCurrencyUomId", EntityOperator.EQUALS, this.currencyUomId)); - productSearchContext.entityConditionList.add(new EntityExpr("sortProductStoreGroupId", EntityOperator.EQUALS, this.productStoreGroupId)); - productSearchContext.entityConditionList.add(new EntityExpr("sortFromDate", EntityOperator.LESS_THAN_EQUAL_TO, productSearchContext.nowTimestamp)); - productSearchContext.entityConditionList.add(new EntityExpr( - new EntityExpr("sortThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, - new EntityExpr("sortThruDate", EntityOperator.GREATER_THAN_EQUAL_TO, productSearchContext.nowTimestamp))); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition("sortProductPriceTypeId", EntityOperator.EQUALS, this.productPriceTypeId)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition("sortCurrencyUomId", EntityOperator.EQUALS, this.currencyUomId)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition("sortProductStoreGroupId", EntityOperator.EQUALS, this.productStoreGroupId)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition("sortFromDate", EntityOperator.LESS_THAN_EQUAL_TO, productSearchContext.nowTimestamp)); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition( + EntityCondition.makeCondition("sortThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, + EntityCondition.makeCondition("sortThruDate", EntityOperator.GREATER_THAN_EQUAL_TO, productSearchContext.nowTimestamp))); if (ascending) { productSearchContext.orderByList.add("+sortPrice"); @@ -2082,9 +2082,9 @@ dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - entityConditionList.add(new EntityExpr(prefix + "ProductCategoryId", EntityOperator.IN, productCategoryIdList)); - entityConditionList.add(new EntityExpr(new EntityExpr(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(prefix + "ThruDate", EntityOperator.GREATER_THAN, nowTimestamp))); - entityConditionList.add(new EntityExpr(prefix + "FromDate", EntityOperator.LESS_THAN, nowTimestamp)); + entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductCategoryId", EntityOperator.IN, productCategoryIdList)); + entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, nowTimestamp))); + entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, nowTimestamp)); } // Keyword @@ -2108,7 +2108,7 @@ dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - entityConditionList.add(new EntityExpr(prefix + "Keyword", EntityOperator.LIKE, keyword)); + entityConditionList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); //don't add an alias for this, will be part of a complex alias: dynamicViewEntity.addAlias(entityAlias, prefix + "RelevancyWeight", "relevancyWeight", null, null, null, null); complexAlias.addComplexAliasMember(new ComplexAliasField(entityAlias, "relevancyWeight")); @@ -2132,9 +2132,9 @@ Iterator keywordIter = keywordList.iterator(); while (keywordIter.hasNext()) { String keyword = (String) keywordIter.next(); - keywordOrList.add(new EntityExpr(prefix + "Keyword", EntityOperator.LIKE, keyword)); + keywordOrList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); } - entityConditionList.add(new EntityConditionList(keywordOrList, EntityOperator.OR)); + entityConditionList.add(EntityCondition.makeCondition(keywordOrList, EntityOperator.OR)); productIdGroupBy = true; } @@ -2156,14 +2156,14 @@ dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - entityConditionList.add(new EntityExpr(prefix + "ProductFeatureId", EntityOperator.EQUALS, productFeatureId)); - entityConditionList.add(new EntityExpr(new EntityExpr(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr(prefix + "ThruDate", EntityOperator.GREATER_THAN, nowTimestamp))); - entityConditionList.add(new EntityExpr(prefix + "FromDate", EntityOperator.LESS_THAN, nowTimestamp)); + entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductFeatureId", EntityOperator.EQUALS, productFeatureId)); + entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, nowTimestamp))); + entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, nowTimestamp)); } } dynamicViewEntity.addAlias("PROD", "productId", null, null, null, new Boolean(productIdGroupBy), null); - EntityCondition whereCondition = new EntityConditionList(entityConditionList, EntityOperator.AND); + EntityCondition whereCondition = EntityCondition.makeCondition(entityConditionList, EntityOperator.AND); EntityFindOptions efo = new EntityFindOptions(); efo.setDistinct(true); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java Wed May 28 00:22:59 2008 @@ -19,6 +19,7 @@ package org.ofbiz.product.product; import java.io.IOException; +import java.sql.Timestamp; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -28,8 +29,6 @@ import java.util.Locale; import java.util.Map; import java.util.Set; -import java.sql.Timestamp; - import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; @@ -43,13 +42,10 @@ import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; -import org.ofbiz.webapp.stats.VisitHandler; -import org.ofbiz.webapp.control.RequestHandler; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; -import org.ofbiz.entity.condition.EntityConditionList; -import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; @@ -65,6 +61,8 @@ import org.ofbiz.product.product.ProductSearch.ResultSortOrder; import org.ofbiz.product.product.ProductSearch.SortKeywordRelevancy; import org.ofbiz.product.store.ProductStoreWorker; +import org.ofbiz.webapp.control.RequestHandler; +import org.ofbiz.webapp.stats.VisitHandler; /** * Utility class with methods to prepare and perform ProductSearch operations in the content of an HttpSession @@ -885,13 +883,13 @@ // always include the members of the addOnTopProdCategoryId Timestamp now = UtilDateTime.nowTimestamp(); List addOnTopProdCondList = FastList.newInstance(); - addOnTopProdCondList.add(new EntityExpr(new EntityExpr("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("thruDate", EntityOperator.GREATER_THAN, now))); - addOnTopProdCondList.add(new EntityExpr("fromDate", EntityOperator.LESS_THAN, now)); - addOnTopProdCondList.add(new EntityExpr("productCategoryId", EntityOperator.EQUALS, addOnTopProdCategoryId)); + addOnTopProdCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, now))); + addOnTopProdCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, now)); + addOnTopProdCondList.add(EntityCondition.makeCondition("productCategoryId", EntityOperator.EQUALS, addOnTopProdCategoryId)); EntityFindOptions findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true); EntityListIterator pli = null; try { - pli = delegator.find("ProductCategoryMember", new EntityConditionList(addOnTopProdCondList, EntityOperator.AND), null, UtilMisc.toSet("productId", "sequenceNum"), UtilMisc.toList("sequenceNum"), findOpts); + pli = delegator.find("ProductCategoryMember", EntityCondition.makeCondition(addOnTopProdCondList, EntityOperator.AND), null, UtilMisc.toSet("productId", "sequenceNum"), UtilMisc.toList("sequenceNum"), findOpts); addOnTopProductCategoryMembers = pli.getPartialList(lowIndex, viewSize); addOnTopListSize = addOnTopProductCategoryMembers.size(); for (int i = 0; i < addOnTopProductCategoryMembers.size(); i++) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java Wed May 28 00:22:59 2008 @@ -69,10 +69,10 @@ String errMsg = null; try { - EntityCondition conditionOne = new EntityConditionList(UtilMisc.toList( - new EntityExpr("isVariant", EntityOperator.EQUALS, "Y"), - new EntityExpr("salesDiscontinuationDate", EntityOperator.NOT_EQUAL, null), - new EntityExpr("salesDiscontinuationDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp) + EntityCondition conditionOne = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("isVariant", EntityOperator.EQUALS, "Y"), + EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.NOT_EQUAL, null), + EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp) ), EntityOperator.AND); EntityListIterator eliOne = delegator.find("Product", conditionOne, null, null, null, null); GenericValue productOne = null; @@ -102,9 +102,9 @@ eliOne.close(); // get all non-discontinued virtuals, see if all variant ProductAssocs are expired, if discontinue - EntityCondition condition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("isVirtual", EntityOperator.EQUALS, "Y"), - new EntityExpr(new EntityExpr("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("salesDiscontinuationDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) + EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, "Y"), + EntityCondition.makeCondition(EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) ), EntityOperator.AND); EntityListIterator eli = delegator.find("Product", condition, null, null, null, null); GenericValue product = null; @@ -140,9 +140,9 @@ String errMsg = null; try { - EntityCondition condition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("salesDiscontinuationDate", EntityOperator.NOT_EQUAL, null), - new EntityExpr("salesDiscontinuationDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp) + EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.NOT_EQUAL, null), + EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp) ), EntityOperator.AND); EntityListIterator eli = delegator.find("Product", condition, null, null, null, null); GenericValue product = null; @@ -190,11 +190,11 @@ dve.addAlias("PCM", "thruDate", null, null, null, null, null); dve.addAlias("PCM", "productIdCount", "productId", null, null, null, "count"); - EntityCondition condition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("fromDate", EntityOperator.LESS_THAN, nowTimestamp), - new EntityExpr("thruDate", EntityOperator.EQUALS, null) + EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, nowTimestamp), + EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null) ), EntityOperator.AND); - EntityCondition havingCond = new EntityExpr("productIdCount", EntityOperator.GREATER_THAN, new Long(1)); + EntityCondition havingCond = EntityCondition.makeCondition("productIdCount", EntityOperator.GREATER_THAN, new Long(1)); EntityListIterator eli = delegator.findListIteratorByCondition(dve, condition, havingCond, UtilMisc.toList("productId", "productCategoryId", "productIdCount"), null, null); GenericValue pcm = null; int numSoFar = 0; @@ -251,11 +251,11 @@ //dve.addAlias("PVAR", "variantProductId", "productId", null, null, null, null); try { - EntityCondition condition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_VARIANT"), - new EntityExpr(new EntityExpr("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("salesDiscontinuationDate", EntityOperator.GREATER_THAN, nowTimestamp)) + EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_VARIANT"), + EntityCondition.makeCondition(EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN, nowTimestamp)) ), EntityOperator.AND); - EntityCondition havingCond = new EntityExpr("productIdToCount", EntityOperator.EQUALS, new Long(1)); + EntityCondition havingCond = EntityCondition.makeCondition("productIdToCount", EntityOperator.EQUALS, new Long(1)); EntityListIterator eliOne = delegator.findListIteratorByCondition(dve, condition, havingCond, UtilMisc.toList("productId", "productIdToCount"), null, null); List valueList = eliOne.getCompleteList(); eliOne.close(); @@ -288,11 +288,11 @@ } } - EntityCondition conditionWithDates = new EntityConditionList(UtilMisc.toList( - new EntityExpr("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_VARIANT"), - new EntityExpr(new EntityExpr("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("salesDiscontinuationDate", EntityOperator.GREATER_THAN, nowTimestamp)), - new EntityExpr("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), - new EntityExpr(new EntityExpr("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) + EntityCondition conditionWithDates = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_VARIANT"), + EntityCondition.makeCondition(EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN, nowTimestamp)), + EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), + EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) ), EntityOperator.AND); EntityListIterator eliMulti = delegator.findListIteratorByCondition(dve, conditionWithDates, havingCond, UtilMisc.toList("productId", "productIdToCount"), null, null); List valueMultiList = eliMulti.getCompleteList(); @@ -478,7 +478,7 @@ newRelatedValue.set("fromDate", nowTimestamp); } - if (delegator.findCountByCondition(relatedEntityName, new EntityFieldMap(newRelatedValue.getPrimaryKey(), EntityOperator.AND), null, null) == 0) { + if (delegator.findCountByCondition(relatedEntityName, EntityCondition.makeCondition(newRelatedValue.getPrimaryKey(), EntityOperator.AND), null, null) == 0) { if (test) { Debug.logInfo("Test mode, would create: " + newRelatedValue, module); } else { @@ -569,7 +569,7 @@ String errMsg = null; try { - EntityListIterator eli = delegator.find("Product", new EntityExpr("isVirtual", EntityOperator.EQUALS, "Y"), null, null, null, null); + EntityListIterator eli = delegator.find("Product", EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, "Y"), null, null, null, null); GenericValue product = null; int numSoFar = 0; while ((product = (GenericValue) eli.next()) != null) { @@ -682,10 +682,10 @@ while (productCategoryMemberIter.hasNext()) { GenericValue productCategoryMember = (GenericValue) productCategoryMemberIter.next(); String productId = productCategoryMember.getString("productId"); - EntityCondition condition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("productId", EntityOperator.EQUALS, productId), - new EntityExpr("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), - new EntityExpr(new EntityExpr("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) + EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId), + EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), + EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) ), EntityOperator.AND); EntityListIterator productFeatureAndApplEli = delegator.find("ProductFeatureAndAppl", condition, null, null, null, null); GenericValue productFeatureAndAppl = null; @@ -735,11 +735,11 @@ Iterator productFeatureIdIter = productFeatureIdSet.iterator(); while (productFeatureIdIter.hasNext()) { String productFeatureId = (String) productFeatureIdIter.next(); - EntityCondition condition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("productFeatureId", EntityOperator.EQUALS, productFeatureId), - new EntityExpr("productFeatureGroupId", EntityOperator.EQUALS, productFeatureGroupId), - new EntityExpr("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), - new EntityExpr(new EntityExpr("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) + EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("productFeatureId", EntityOperator.EQUALS, productFeatureId), + EntityCondition.makeCondition("productFeatureGroupId", EntityOperator.EQUALS, productFeatureGroupId), + EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), + EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) ), EntityOperator.AND); if (delegator.findCountByCondition("ProductFeatureGroupAppl", condition, null, null) == 0) { // if no valid ones, create one @@ -754,20 +754,20 @@ while (subCategoryIter.hasNext()) { GenericValue productCategoryRollup = (GenericValue) subCategoryIter.next(); String subProductCategoryId = productCategoryRollup.getString("productCategoryId"); - EntityCondition condition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("productCategoryId", EntityOperator.EQUALS, subProductCategoryId), - new EntityExpr("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), - new EntityExpr(new EntityExpr("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) + EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("productCategoryId", EntityOperator.EQUALS, subProductCategoryId), + EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), + EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) ), EntityOperator.AND); EntityListIterator productFeatureCatGrpApplEli = delegator.find("ProductFeatureCatGrpAppl", condition, null, null, null, null); GenericValue productFeatureCatGrpAppl = null; while ((productFeatureCatGrpAppl = (GenericValue) productFeatureCatGrpApplEli.next()) != null) { String productFeatureGroupId = productFeatureCatGrpAppl.getString("productFeatureGroupId"); - EntityCondition checkCondition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("productCategoryId", EntityOperator.EQUALS, productCategoryId), - new EntityExpr("productFeatureGroupId", EntityOperator.EQUALS, productFeatureGroupId), - new EntityExpr("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), - new EntityExpr(new EntityExpr("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) + EntityCondition checkCondition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("productCategoryId", EntityOperator.EQUALS, productCategoryId), + EntityCondition.makeCondition("productFeatureGroupId", EntityOperator.EQUALS, productFeatureGroupId), + EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), + EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) ), EntityOperator.AND); if (delegator.findCountByCondition("ProductFeatureCatGrpAppl", checkCondition, null, null) == 0) { // if no valid ones, create one Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java Wed May 28 00:22:59 2008 @@ -84,12 +84,12 @@ List condList = new LinkedList(); if (UtilValidate.isEmpty(productStoreId)) { - condList.add(new EntityExpr("productStoreId", EntityOperator.EQUALS, productStoreId)); + condList.add(EntityCondition.makeCondition("productStoreId", EntityOperator.EQUALS, productStoreId)); } - condList.add(new EntityExpr("userEntered", EntityOperator.EQUALS, "Y")); - condList.add(new EntityExpr("thruDate", EntityOperator.NOT_EQUAL, null)); - condList.add(new EntityExpr("thruDate", EntityOperator.LESS_THAN, nowTimestamp)); - EntityCondition cond = new EntityConditionList(condList, EntityOperator.AND); + condList.add(EntityCondition.makeCondition("userEntered", EntityOperator.EQUALS, "Y")); + condList.add(EntityCondition.makeCondition("thruDate", EntityOperator.NOT_EQUAL, null)); + condList.add(EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN, nowTimestamp)); + EntityCondition cond = EntityCondition.makeCondition(condList, EntityOperator.AND); try { EntityListIterator eli = delegator.find("ProductStorePromoAndAppl", cond, null, null, null, null); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java Wed May 28 00:22:59 2008 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -15,7 +15,7 @@ * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - *******************************************************************************/ + */ package org.ofbiz.product.supplier; @@ -31,7 +31,7 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; -import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.product.product.ProductWorker; @@ -92,7 +92,7 @@ // filter the list down by the minimumOrderQuantity if one is provided if (quantity != null) { //minimumOrderQuantity - supplierProducts = EntityUtil.filterByCondition(supplierProducts, new EntityExpr("minimumOrderQuantity", EntityOperator.LESS_THAN_EQUAL_TO, quantity)); + supplierProducts = EntityUtil.filterByCondition(supplierProducts, EntityCondition.makeCondition("minimumOrderQuantity", EntityOperator.LESS_THAN_EQUAL_TO, quantity)); } // filter the list down by the canDropShip if one is provided |
Free forum by Nabble | Edit this page |