Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java Wed May 28 00:22:59 2008 @@ -83,7 +83,7 @@ // check security flag for purchase orders boolean canViewPo = security.hasEntityPermission("ORDERMGR", "_PURCHASE_VIEW", userLogin); if (!canViewPo) { - conditions.add(new EntityExpr("orderTypeId", EntityOperator.NOT_EQUAL, "PURCHASE_ORDER")); + conditions.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.NOT_EQUAL, "PURCHASE_ORDER")); } // dynamic view entity @@ -110,10 +110,10 @@ paramList.add("orderTypeId=" + orderTypeId); if (!"PURCHASE_ORDER".equals(orderTypeId) || ("PURCHASE_ORDER".equals(orderTypeId) && canViewPo)) { - orExprs.add(new EntityExpr("orderTypeId", EntityOperator.EQUALS, orderTypeId)); + orExprs.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, orderTypeId)); } } - conditions.add(new EntityConditionList(orExprs, EntityOperator.OR)); + conditions.add(EntityCondition.makeCondition(orExprs, EntityOperator.OR)); } String orderName = (String) context.get("orderName"); @@ -131,15 +131,15 @@ paramList.add("orderStatusId=" + orderStatusId); if ("PENDING".equals(orderStatusId)) { List pendExprs = FastList.newInstance(); - pendExprs.add(new EntityExpr("statusId", EntityOperator.EQUALS, "ORDER_CREATED")); - pendExprs.add(new EntityExpr("statusId", EntityOperator.EQUALS, "ORDER_PROCESSING")); - pendExprs.add(new EntityExpr("statusId", EntityOperator.EQUALS, "ORDER_APPROVED")); - orExprs.add(new EntityConditionList(pendExprs, EntityOperator.OR)); + pendExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ORDER_CREATED")); + pendExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ORDER_PROCESSING")); + pendExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ORDER_APPROVED")); + orExprs.add(EntityCondition.makeCondition(pendExprs, EntityOperator.OR)); } else { - orExprs.add(new EntityExpr("statusId", EntityOperator.EQUALS, orderStatusId)); + orExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, orderStatusId)); } } - conditions.add(new EntityConditionList(orExprs, EntityOperator.OR)); + conditions.add(EntityCondition.makeCondition(orExprs, EntityOperator.OR)); } List productStoreList = (List) context.get("productStoreId"); @@ -149,9 +149,9 @@ while (i.hasNext()) { String productStoreId = (String) i.next(); paramList.add("productStoreId=" + productStoreId); - orExprs.add(new EntityExpr("productStoreId", EntityOperator.EQUALS, productStoreId)); + orExprs.add(EntityCondition.makeCondition("productStoreId", EntityOperator.EQUALS, productStoreId)); } - conditions.add(new EntityConditionList(orExprs, EntityOperator.OR)); + conditions.add(EntityCondition.makeCondition(orExprs, EntityOperator.OR)); } List webSiteList = (List) context.get("orderWebSiteId"); @@ -161,9 +161,9 @@ while (i.hasNext()) { String webSiteId = (String) i.next(); paramList.add("webSiteId=" + webSiteId); - orExprs.add(new EntityExpr("webSiteId", EntityOperator.EQUALS, webSiteId)); + orExprs.add(EntityCondition.makeCondition("webSiteId", EntityOperator.EQUALS, webSiteId)); } - conditions.add(new EntityConditionList(orExprs, EntityOperator.OR)); + conditions.add(EntityCondition.makeCondition(orExprs, EntityOperator.OR)); } List saleChannelList = (List) context.get("salesChannelEnumId"); @@ -173,9 +173,9 @@ while (i.hasNext()) { String salesChannelEnumId = (String) i.next(); paramList.add("salesChannelEnumId=" + salesChannelEnumId); - orExprs.add(new EntityExpr("salesChannelEnumId", EntityOperator.EQUALS, salesChannelEnumId)); + orExprs.add(EntityCondition.makeCondition("salesChannelEnumId", EntityOperator.EQUALS, salesChannelEnumId)); } - conditions.add(new EntityConditionList(orExprs, EntityOperator.OR)); + conditions.add(EntityCondition.makeCondition(orExprs, EntityOperator.OR)); } String createdBy = (String) context.get("createdBy"); @@ -218,7 +218,7 @@ try { Object converted = ObjectType.simpleTypeConvert(minDate, "Timestamp", null, null); if (converted != null) { - conditions.add(new EntityExpr(dateField, EntityOperator.GREATER_THAN_EQUAL_TO, converted)); + conditions.add(EntityCondition.makeCondition(dateField, EntityOperator.GREATER_THAN_EQUAL_TO, converted)); } } catch (GeneralException e) { Debug.logWarning(e.getMessage(), module); @@ -234,7 +234,7 @@ try { Object converted = ObjectType.simpleTypeConvert(maxDate, "Timestamp", null, null); if (converted != null) { - conditions.add(new EntityExpr("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, converted)); + conditions.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, converted)); } } catch (GeneralException e) { Debug.logWarning(e.getMessage(), module); @@ -281,7 +281,7 @@ paramList.add("roleTypeId=" + roleTypeId); orExprs.add(makeExpr("roleTypeId", roleTypeId)); } - conditions.add(new EntityConditionList(orExprs, EntityOperator.OR)); + conditions.add(EntityCondition.makeCondition(orExprs, EntityOperator.OR)); } // order item fields @@ -326,7 +326,7 @@ String isVirtual = product.getString("isVirtual"); if (isVirtual != null && "Y".equals(isVirtual)) { List orExprs = FastList.newInstance(); - orExprs.add(new EntityExpr("productId", EntityOperator.EQUALS, productId)); + orExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)); Map varLookup = null; try { @@ -339,12 +339,12 @@ Iterator i = variants.iterator(); while (i.hasNext()) { GenericValue v = (GenericValue) i.next(); - orExprs.add(new EntityExpr("productId", EntityOperator.EQUALS, v.getString("productIdTo"))); + orExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, v.getString("productIdTo"))); } } - conditions.add(new EntityConditionList(orExprs, EntityOperator.OR)); + conditions.add(EntityCondition.makeCondition(orExprs, EntityOperator.OR)); } else { - conditions.add(new EntityExpr("productId", EntityOperator.EQUALS, productId)); + conditions.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)); } } } @@ -455,13 +455,13 @@ paramList.add("hasBackOrders=" + hasBackOrders); if ("Y".equals(hasBackOrders)) { - conditions.add(new EntityExpr("quantityNotAvailable", EntityOperator.NOT_EQUAL, null)); - conditions.add(new EntityExpr("quantityNotAvailable", EntityOperator.GREATER_THAN, new Double(0))); + conditions.add(EntityCondition.makeCondition("quantityNotAvailable", EntityOperator.NOT_EQUAL, null)); + conditions.add(EntityCondition.makeCondition("quantityNotAvailable", EntityOperator.GREATER_THAN, new Double(0))); } else if ("N".equals(hasBackOrders)) { List orExpr = FastList.newInstance(); - orExpr.add(new EntityExpr("quantityNotAvailable", EntityOperator.EQUALS, null)); - orExpr.add(new EntityExpr("quantityNotAvailable", EntityOperator.EQUALS, new Double(0))); - conditions.add(new EntityConditionList(orExpr, EntityOperator.OR)); + orExpr.add(EntityCondition.makeCondition("quantityNotAvailable", EntityOperator.EQUALS, null)); + orExpr.add(EntityCondition.makeCondition("quantityNotAvailable", EntityOperator.EQUALS, new Double(0))); + conditions.add(EntityCondition.makeCondition(orExpr, EntityOperator.OR)); } } @@ -471,7 +471,7 @@ // create the main condition EntityCondition cond = null; if (conditions.size() > 0 || showAll.equalsIgnoreCase("Y")) { - cond = new EntityConditionList(conditions, EntityOperator.AND); + cond = EntityCondition.makeCondition(conditions, EntityOperator.AND); } if (Debug.verboseOn()) { @@ -654,6 +654,6 @@ } } - return new EntityExpr(fieldName, op, value); + return EntityCondition.makeCondition(fieldName, op, value); } } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Wed May 28 00:22:59 2008 @@ -214,8 +214,8 @@ GenericValue paymentPref = (GenericValue) ppit.next(); List payments = FastList.newInstance(); try { - List exprs = UtilMisc.toList(new EntityExpr("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"), - new EntityExpr("statusId", EntityOperator.EQUALS, "PMNT_CONFIRMED")); + List exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"), + EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_CONFIRMED")); payments = paymentPref.getRelated("Payment"); payments = EntityUtil.filterByOr(payments, exprs); } catch (GenericEntityException e) { @@ -773,8 +773,8 @@ if (item.get("productId") != null) { try { featureAppls = item.getDelegator().findByAndCache("ProductFeatureAppl", UtilMisc.toMap("productId", item.getString("productId"))); - List filterExprs = UtilMisc.toList(new EntityExpr("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE")); - filterExprs.add(new EntityExpr("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE")); + List filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE")); + filterExprs.add(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE")); featureAppls = EntityUtil.filterByOr(featureAppls, filterExprs); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get ProductFeatureAppl for item : " + item, module); @@ -820,8 +820,8 @@ if (item.get("productId") != null) { try { featureAppls = item.getDelegator().findByAndCache("ProductFeatureAppl", UtilMisc.toMap("productId", item.getString("productId"))); - List filterExprs = UtilMisc.toList(new EntityExpr("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE")); - filterExprs.add(new EntityExpr("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE")); + List filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE")); + filterExprs.add(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE")); featureAppls = EntityUtil.filterByOr(featureAppls, filterExprs); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get ProductFeatureAppl for item : " + item, module); @@ -1091,13 +1091,13 @@ // get the payments of the desired type for these invoices TODO: in models where invoices can have many orders, this needs to be refined List conditions = UtilMisc.toList( - new EntityExpr("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"), - new EntityExpr("invoiceId", EntityOperator.IN, invoiceIds) + EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"), + EntityCondition.makeCondition("invoiceId", EntityOperator.IN, invoiceIds) ); if (paymentMethodTypeId != null) { - conditions.add(new EntityExpr("paymentMethodTypeId", EntityOperator.EQUALS, paymentMethodTypeId)); + conditions.add(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, paymentMethodTypeId)); } - EntityConditionList ecl = new EntityConditionList(conditions, EntityOperator.AND); + EntityConditionList ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND); List payments = orderHeader.getDelegator().findList("PaymentAndApplication", ecl, null, null, null, true); for (Iterator iter = payments.iterator(); iter.hasNext(); ) { @@ -1379,19 +1379,19 @@ } public List getOrderItemAndShipGroupAssoc(String shipGroupSeqId) { - List exprs = UtilMisc.toList(new EntityExpr("shipGroupSeqId", EntityOperator.EQUALS, shipGroupSeqId)); + List exprs = UtilMisc.toList(EntityCondition.makeCondition("shipGroupSeqId", EntityOperator.EQUALS, shipGroupSeqId)); return EntityUtil.filterByAnd(getOrderItemAndShipGroupAssoc(), exprs); } public List getValidOrderItems() { List exprs = UtilMisc.toList( - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED")); + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED")); return EntityUtil.filterByAnd(getOrderItems(), exprs); } public boolean getPastEtaOrderItems(String orderId) { - /*List exprs = UtilMisc.toList(new EntityExpr("statusId", EntityOperator.EQUALS, "ITEM_APPROVED")); + /*List exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_APPROVED")); List itemsApproved = EntityUtil.filterByAnd(getOrderItems(), exprs); Iterator i = itemsApproved.iterator(); while (i.hasNext()) { @@ -1445,7 +1445,7 @@ } public boolean getPartiallyReceivedItems() { - /*List exprs = UtilMisc.toList(new EntityExpr("statusId", EntityOperator.EQUALS, "ITEM_APPROVED")); + /*List exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_APPROVED")); List itemsApproved = EntityUtil.filterByAnd(getOrderItems(), exprs); Iterator i = itemsApproved.iterator(); while (i.hasNext()) { @@ -1486,14 +1486,14 @@ public List getValidOrderItems(String shipGroupSeqId) { if (shipGroupSeqId == null) return getValidOrderItems(); List exprs = UtilMisc.toList( - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"), - new EntityExpr("shipGroupSeqId", EntityOperator.EQUALS, shipGroupSeqId)); + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"), + EntityCondition.makeCondition("shipGroupSeqId", EntityOperator.EQUALS, shipGroupSeqId)); return EntityUtil.filterByAnd(getOrderItemAndShipGroupAssoc(), exprs); } public GenericValue getOrderItem(String orderItemSeqId) { - List exprs = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, orderItemSeqId)); + List exprs = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderItemSeqId)); return EntityUtil.getFirst(EntityUtil.filterByAnd(getOrderItems(), exprs)); } @@ -1501,8 +1501,8 @@ List digitalItems = new ArrayList(); // only approved or complete items apply List exprs = UtilMisc.toList( - new EntityExpr("statusId", EntityOperator.EQUALS, "ITEM_APPROVED"), - new EntityExpr("statusId", EntityOperator.EQUALS, "ITEM_COMPLETED")); + EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_APPROVED"), + EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_COMPLETED")); List items = EntityUtil.filterByOr(getOrderItems(), exprs); Iterator i = items.iterator(); while (i.hasNext()) { @@ -1543,9 +1543,9 @@ Debug.logError("Unable to get ProductContent from Product", module); } List cExprs = UtilMisc.toList( - new EntityExpr("productContentTypeId", EntityOperator.EQUALS, "DIGITAL_DOWNLOAD"), - new EntityExpr("productContentTypeId", EntityOperator.EQUALS, "FULFILLMENT_EMAIL"), - new EntityExpr("productContentTypeId", EntityOperator.EQUALS, "FULFILLMENT_EXTERNAL")); + EntityCondition.makeCondition("productContentTypeId", EntityOperator.EQUALS, "DIGITAL_DOWNLOAD"), + EntityCondition.makeCondition("productContentTypeId", EntityOperator.EQUALS, "FULFILLMENT_EMAIL"), + EntityCondition.makeCondition("productContentTypeId", EntityOperator.EQUALS, "FULFILLMENT_EXTERNAL")); // add more as needed productContents = EntityUtil.filterByDate(productContents); productContents = EntityUtil.filterByOr(productContents, cExprs); @@ -1741,14 +1741,14 @@ List returnedItems = new ArrayList(returnedItemsBase.size()); // filter just order items - List orderItemExprs = UtilMisc.toList(new EntityExpr("returnItemTypeId", EntityOperator.EQUALS, "RET_PROD_ITEM")); - orderItemExprs.add(new EntityExpr("returnItemTypeId", EntityOperator.EQUALS, "RET_FPROD_ITEM")); - orderItemExprs.add(new EntityExpr("returnItemTypeId", EntityOperator.EQUALS, "RET_DPROD_ITEM")); - orderItemExprs.add(new EntityExpr("returnItemTypeId", EntityOperator.EQUALS, "RET_FDPROD_ITEM")); - orderItemExprs.add(new EntityExpr("returnItemTypeId", EntityOperator.EQUALS, "RET_PROD_FEATR_ITEM")); - orderItemExprs.add(new EntityExpr("returnItemTypeId", EntityOperator.EQUALS, "RET_SPROD_ITEM")); - orderItemExprs.add(new EntityExpr("returnItemTypeId", EntityOperator.EQUALS, "RET_WE_ITEM")); - orderItemExprs.add(new EntityExpr("returnItemTypeId", EntityOperator.EQUALS, "RET_TE_ITEM")); + List orderItemExprs = UtilMisc.toList(EntityCondition.makeCondition("returnItemTypeId", EntityOperator.EQUALS, "RET_PROD_ITEM")); + orderItemExprs.add(EntityCondition.makeCondition("returnItemTypeId", EntityOperator.EQUALS, "RET_FPROD_ITEM")); + orderItemExprs.add(EntityCondition.makeCondition("returnItemTypeId", EntityOperator.EQUALS, "RET_DPROD_ITEM")); + orderItemExprs.add(EntityCondition.makeCondition("returnItemTypeId", EntityOperator.EQUALS, "RET_FDPROD_ITEM")); + orderItemExprs.add(EntityCondition.makeCondition("returnItemTypeId", EntityOperator.EQUALS, "RET_PROD_FEATR_ITEM")); + orderItemExprs.add(EntityCondition.makeCondition("returnItemTypeId", EntityOperator.EQUALS, "RET_SPROD_ITEM")); + orderItemExprs.add(EntityCondition.makeCondition("returnItemTypeId", EntityOperator.EQUALS, "RET_WE_ITEM")); + orderItemExprs.add(EntityCondition.makeCondition("returnItemTypeId", EntityOperator.EQUALS, "RET_TE_ITEM")); returnedItemsBase = EntityUtil.filterByOr(returnedItemsBase, orderItemExprs); // get only the RETURN_RECEIVED and RETURN_COMPLETED statusIds @@ -1788,7 +1788,7 @@ } else { // otherwise get all of them except cancelled ones returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, - UtilMisc.toList(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "RETURN_CANCELLED")))); + UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "RETURN_CANCELLED")))); } BigDecimal returnedAmount = ZERO; Iterator i = returnedItems.iterator(); @@ -1991,10 +1991,10 @@ public BigDecimal getItemPickedQuantityBd(GenericValue orderItem) { BigDecimal quantityPicked = ZERO; - EntityConditionList pickedConditions = new EntityConditionList(UtilMisc.toList( - new EntityExpr("orderId", EntityOperator.EQUALS, orderItem.get("orderId")), - new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, orderItem.getString("orderItemSeqId")), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PICKLIST_CANCELLED")), + EntityConditionList pickedConditions = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderItem.get("orderId")), + EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderItem.getString("orderItemSeqId")), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PICKLIST_CANCELLED")), EntityOperator.AND); List picked = null; @@ -2273,12 +2273,12 @@ } public static List getOrderHeaderAdjustments(List adjustments, String shipGroupSeqId) { - List contraints1 = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null)); - List contraints2 = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); - List contraints3 = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, "")); + List contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null)); + List contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); + List contraints3 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, "")); List contraints4 = FastList.newInstance(); if (shipGroupSeqId != null) { - contraints4.add(new EntityExpr("shipGroupSeqId", EntityOperator.EQUALS, shipGroupSeqId)); + contraints4.add(EntityCondition.makeCondition("shipGroupSeqId", EntityOperator.EQUALS, shipGroupSeqId)); } List toFilter = null; List adj = FastList.newInstance(); @@ -2296,13 +2296,13 @@ } public static List getOrderHeaderStatuses(List orderStatuses) { - List contraints1 = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null)); - contraints1.add(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); - contraints1.add(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, "")); + List contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null)); + contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); + contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, "")); - List contraints2 = UtilMisc.toList(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, null)); - contraints2.add(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); - contraints2.add(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, "")); + List contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null)); + contraints2.add(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); + contraints2.add(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, "")); List newOrderStatuses = FastList.newInstance(); newOrderStatuses.addAll(EntityUtil.filterByOr(orderStatuses, contraints1)); @@ -2556,10 +2556,10 @@ } public static List getOrderItemStatuses(GenericValue orderItem, List orderStatuses) { - List contraints1 = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, orderItem.get("orderItemSeqId"))); - List contraints2 = UtilMisc.toList(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, null)); - contraints2.add(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); - contraints2.add(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, "")); + List contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderItem.get("orderItemSeqId"))); + List contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null)); + contraints2.add(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); + contraints2.add(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, "")); List newOrderStatuses = FastList.newInstance(); newOrderStatuses.addAll(EntityUtil.filterByAnd(orderStatuses, contraints1)); @@ -2667,12 +2667,12 @@ double quantity = 0.0; // first find all open purchase orders - List openOrdersExprs = UtilMisc.toList(new EntityExpr("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER")); - openOrdersExprs.add(new EntityExpr("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED")); - openOrdersExprs.add(new EntityExpr("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED")); - openOrdersExprs.add(new EntityExpr("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED")); - openOrdersExprs.add(new EntityExpr("productId", EntityOperator.EQUALS, productId)); - EntityCondition openOrdersCond = new EntityConditionList(openOrdersExprs, EntityOperator.AND); + List openOrdersExprs = UtilMisc.toList(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER")); + openOrdersExprs.add(EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED")); + openOrdersExprs.add(EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED")); + openOrdersExprs.add(EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED")); + openOrdersExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)); + EntityCondition openOrdersCond = EntityCondition.makeCondition(openOrdersExprs, EntityOperator.AND); List openOrders = null; try { openOrders = delegator.findList("OrderHeaderAndItems", openOrdersCond, null, null, null, false); @@ -2742,7 +2742,7 @@ GenericValue orderAdjustment = (GenericValue) orderAdjIterator.next(); long count = 0; try { - count = orderHeader.getDelegator().findCountByCondition("ReturnAdjustment", new EntityExpr("orderAdjustmentId", EntityOperator.EQUALS, orderAdjustment.get("orderAdjustmentId")), null, null); + count = orderHeader.getDelegator().findCountByCondition("ReturnAdjustment", EntityCondition.makeCondition("orderAdjustmentId", EntityOperator.EQUALS, orderAdjustment.get("orderAdjustmentId")), null, null); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -2808,11 +2808,11 @@ } public static List getOrderPaymentStatuses(List orderStatuses) { - List contraints1 = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null)); - contraints1.add(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); - contraints1.add(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, "")); + List contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null)); + contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); + contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, "")); - List contraints2 = UtilMisc.toList(new EntityExpr("orderPaymentPreferenceId", EntityOperator.NOT_EQUAL, null)); + List contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.NOT_EQUAL, null)); List newOrderStatuses = FastList.newInstance(); newOrderStatuses.addAll(EntityUtil.filterByOr(orderStatuses, contraints1)); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.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,24 +15,23 @@ * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - *******************************************************************************/ + */ package org.ofbiz.order.order; import java.math.BigDecimal; import java.sql.Timestamp; import java.util.ArrayList; -import java.util.LinkedHashMap; import java.util.HashMap; import java.util.Iterator; -import java.util.LinkedList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; -import javolution.util.FastMap; import javolution.util.FastList; +import javolution.util.FastMap; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralRuntimeException; @@ -46,8 +45,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; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.product.product.ProductContentWrapper; @@ -400,13 +399,13 @@ if (orderHeader != null) { OrderReadHelper orh = new OrderReadHelper(orderHeader); // OrderItems which have been issued may be returned. - EntityConditionList whereConditions = new EntityConditionList(UtilMisc.toList( - new EntityExpr("orderId", EntityOperator.EQUALS, orderHeader.getString("orderId")), - new EntityExpr("orderItemStatusId", EntityOperator.IN, UtilMisc.toList("ITEM_APPROVED", "ITEM_COMPLETED")) + EntityConditionList whereConditions = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderHeader.getString("orderId")), + EntityCondition.makeCondition("orderItemStatusId", EntityOperator.IN, UtilMisc.toList("ITEM_APPROVED", "ITEM_COMPLETED")) ), EntityOperator.AND); /* - EntityConditionList havingConditions = new EntityConditionList(UtilMisc.toList( - new EntityExpr("quantityIssued", EntityOperator.GREATER_THAN, new Double(0)) + EntityConditionList havingConditions = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("quantityIssued", EntityOperator.GREATER_THAN, new Double(0)) ), EntityOperator.AND); */ List orderItemQuantitiesIssued = null; @@ -905,7 +904,7 @@ orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); // sort these desending by maxAmount orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", UtilMisc.toList("-maxAmount")); - List exprs = UtilMisc.toList(new EntityExpr("statusId", EntityOperator.EQUALS, "PAYMENT_SETTLED"), new EntityExpr("statusId", EntityOperator.EQUALS, "PAYMENT_RECEIVED")); + List exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_SETTLED"), EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_RECEIVED")); orderPayPrefs = EntityUtil.filterByOr(orderPayPrefs, exprs); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get Order details for #" + orderId, module); @@ -998,7 +997,7 @@ orderedRefundPaymentMethodTypes.add("EFT_ACCOUNT"); // Add all the other paymentMethodTypes, in no particular order - EntityConditionList pmtConditionList = new EntityConditionList(UtilMisc.toList(new EntityExpr("paymentMethodTypeId", EntityOperator.NOT_IN, orderedRefundPaymentMethodTypes)), EntityOperator.AND); + EntityConditionList pmtConditionList = EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.NOT_IN, orderedRefundPaymentMethodTypes)), EntityOperator.AND); List otherPaymentMethodTypes = new ArrayList(); try { otherPaymentMethodTypes = delegator.findList("PaymentMethodType", pmtConditionList, null, null, null, true); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Wed May 28 00:22:59 2008 @@ -1295,9 +1295,9 @@ EntityCondition cond = null; if (!forceAll.booleanValue()) { - List exprs = UtilMisc.toList(new EntityExpr("grandTotal", EntityOperator.EQUALS, null), - new EntityExpr("remainingSubTotal", EntityOperator.EQUALS, null)); - cond = new EntityConditionList(exprs, EntityOperator.OR); + List exprs = UtilMisc.toList(EntityCondition.makeCondition("grandTotal", EntityOperator.EQUALS, null), + EntityCondition.makeCondition("remainingSubTotal", EntityOperator.EQUALS, null)); + cond = EntityCondition.makeCondition(exprs, EntityOperator.OR); } Set fields = UtilMisc.toSet("orderId"); @@ -2727,12 +2727,12 @@ // create the query expressions List exprs = UtilMisc.toList( - new EntityExpr("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED") + EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED") ); - EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(exprs, EntityOperator.AND); + EntityConditionList<EntityExpr> ecl = EntityCondition.makeCondition(exprs, EntityOperator.AND); // get the orders try { @@ -2798,14 +2798,14 @@ List itemsExprs = new ArrayList(); // create the query expressions - itemsExprs.add(new EntityExpr("orderId", EntityOperator.EQUALS, orderId)); - itemsExprs.add(new EntityConditionList(UtilMisc.toList(new EntityExpr("statusId", EntityOperator.EQUALS, "ITEM_CREATED"), - new EntityExpr("statusId", EntityOperator.EQUALS, "ITEM_APPROVED")), EntityOperator.OR)); - itemsExprs.add(new EntityExpr("dontCancelSetUserLogin", EntityOperator.EQUALS, GenericEntity.NULL_FIELD)); - itemsExprs.add(new EntityExpr("dontCancelSetDate", EntityOperator.EQUALS, GenericEntity.NULL_FIELD)); - itemsExprs.add(new EntityExpr("autoCancelDate", EntityOperator.NOT_EQUAL, GenericEntity.NULL_FIELD)); + itemsExprs.add(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId)); + itemsExprs.add(EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_CREATED"), + EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_APPROVED")), EntityOperator.OR)); + itemsExprs.add(EntityCondition.makeCondition("dontCancelSetUserLogin", EntityOperator.EQUALS, GenericEntity.NULL_FIELD)); + itemsExprs.add(EntityCondition.makeCondition("dontCancelSetDate", EntityOperator.EQUALS, GenericEntity.NULL_FIELD)); + itemsExprs.add(EntityCondition.makeCondition("autoCancelDate", EntityOperator.NOT_EQUAL, GenericEntity.NULL_FIELD)); - ecl = new EntityConditionList<EntityExpr>(itemsExprs, EntityOperator.AND); + ecl = EntityCondition.makeCondition(itemsExprs); List orderItems = null; try { @@ -3495,13 +3495,13 @@ // cancel other (non-completed and non-cancelled) payments List paymentPrefsToCancel = null; try { - List exprs = UtilMisc.toList(new EntityExpr("orderId", EntityOperator.EQUALS, orderId)); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_RECEIVED")); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_DECLINED")); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_SETTLED")); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_REFUNDED")); - EntityCondition cond = new EntityConditionList(exprs, EntityOperator.AND); + List exprs = UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId)); + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_RECEIVED")); + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")); + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_DECLINED")); + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_SETTLED")); + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_REFUNDED")); + EntityCondition cond = EntityCondition.makeCondition(exprs, EntityOperator.AND); paymentPrefsToCancel = delegator.findList("OrderPaymentPreference", cond, null, null, null, false); } catch (GenericEntityException e) { Debug.logError(e, module); @@ -3524,13 +3524,13 @@ // remove the adjustments try { List adjExprs = new LinkedList(); - adjExprs.add(new EntityExpr("orderId", EntityOperator.EQUALS, orderId)); + adjExprs.add(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId)); List exprs = new LinkedList(); - exprs.add(new EntityExpr("orderAdjustmentTypeId", EntityOperator.EQUALS, "PROMOTION_ADJUSTMENT")); - exprs.add(new EntityExpr("orderAdjustmentTypeId", EntityOperator.EQUALS, "SHIPPING_CHARGES")); - exprs.add(new EntityExpr("orderAdjustmentTypeId", EntityOperator.EQUALS, "SALES_TAX")); - adjExprs.add(new EntityConditionList(exprs, EntityOperator.OR)); - EntityCondition cond = new EntityConditionList(adjExprs, EntityOperator.AND); + exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "PROMOTION_ADJUSTMENT")); + exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "SHIPPING_CHARGES")); + exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "SALES_TAX")); + adjExprs.add(EntityCondition.makeCondition(exprs, EntityOperator.OR)); + EntityCondition cond = EntityCondition.makeCondition(adjExprs, EntityOperator.AND); delegator.removeByCondition("OrderAdjustment", cond); } catch (GenericEntityException e) { Debug.logError(e, module); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.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.order.requirement; import java.util.*; @@ -57,27 +57,27 @@ try { List orderBy = UtilMisc.toList("partyId", "requirementId"); List<EntityCondition> conditions = UtilMisc.toList( - new EntityExpr("requirementTypeId", EntityOperator.EQUALS, "PRODUCT_REQUIREMENT"), + EntityCondition.makeCondition("requirementTypeId", EntityOperator.EQUALS, "PRODUCT_REQUIREMENT"), EntityUtil.getFilterByDateExpr() ); if (statusIds != null && statusIds.size() > 0) { - conditions.add( new EntityExpr("statusId", EntityOperator.IN, statusIds) ); + conditions.add( EntityCondition.makeCondition("statusId", EntityOperator.IN, statusIds) ); } else { - conditions.add( new EntityExpr("statusId", EntityOperator.EQUALS, "REQ_APPROVED") ); + conditions.add( EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "REQ_APPROVED") ); } if (requirementConditions != null) conditions.add(requirementConditions); // we're either getting the requirements for a given supplier, unassigned requirements, or requirements for all suppliers if (UtilValidate.isNotEmpty(partyId)) { - conditions.add( new EntityExpr("partyId", EntityOperator.EQUALS, partyId) ); - conditions.add( new EntityExpr("roleTypeId", EntityOperator.EQUALS, "SUPPLIER") ); + conditions.add( EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId) ); + conditions.add( EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "SUPPLIER") ); } else if (UtilValidate.isNotEmpty(unassignedRequirements)) { - conditions.add( new EntityExpr("partyId", EntityOperator.EQUALS, null) ); + conditions.add( EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, null) ); } else { - conditions.add( new EntityExpr("roleTypeId", EntityOperator.EQUALS, "SUPPLIER") ); + conditions.add( EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "SUPPLIER") ); } - EntityConditionList<EntityCondition> ecl = new EntityConditionList<EntityCondition>(conditions, EntityOperator.AND); + EntityConditionList<EntityCondition> ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND); List requirementAndRoles = delegator.findList("RequirementAndRole", ecl, null, orderBy, null, false); // maps to cache the associated suppliers and products data, so we don't do redundant DB and service requests @@ -110,11 +110,11 @@ if (supplierProduct == null) { conditions = UtilMisc.toList( // TODO: it is possible to restrict to quantity > minimumOrderQuantity, but then the entire requirement must be skipped - new EntityExpr("partyId", EntityOperator.EQUALS, partyId), - new EntityExpr("productId", EntityOperator.EQUALS, productId), + EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId), + EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId), EntityUtil.getFilterByDateExpr("availableFromDate", "availableThruDate") ); - ecl = new EntityConditionList<EntityCondition>(conditions, EntityOperator.AND); + ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND); List<GenericValue> supplierProducts = delegator.findList("SupplierProduct", ecl, null, UtilMisc.toList("minimumOrderQuantity", "lastPrice"), null, false); supplierProduct = EntityUtil.getFirst(supplierProducts); @@ -156,12 +156,12 @@ // how many of the products were sold (note this is for a fixed time period across all product stores) Double sold = (Double) productsSold.get(productId); if (sold == null) { - EntityCondition prodConditions = new EntityConditionList( UtilMisc.toList( - new EntityExpr("productId", EntityOperator.EQUALS, productId), - new EntityExpr("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"), - new EntityExpr("orderStatusId", EntityOperator.NOT_IN, UtilMisc.toList("ORDER_REJECTED", "ORDER_CANCELLED")), - new EntityExpr("orderItemStatusId", EntityOperator.NOT_IN, UtilMisc.toList("ITEM_REJECTED", "ITEM_CANCELLED")), - new EntityExpr("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, timePeriodStart) + EntityCondition prodConditions = EntityCondition.makeCondition( UtilMisc.toList( + EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId), + EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"), + EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_IN, UtilMisc.toList("ORDER_REJECTED", "ORDER_CANCELLED")), + EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_IN, UtilMisc.toList("ITEM_REJECTED", "ITEM_CANCELLED")), + EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, timePeriodStart) ), EntityOperator.AND); GenericValue count = EntityUtil.getFirst( delegator.findList("OrderItemQuantityReportGroupByProduct", prodConditions, UtilMisc.toSet("quantityOrdered"), null, null, false)); if (count != null) { @@ -287,12 +287,12 @@ // count all current requirements for this product double pendingRequirements = 0.0; - EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(UtilMisc.toList( - new EntityExpr("facilityId", EntityOperator.EQUALS, facilityId), - new EntityExpr("productId", EntityOperator.EQUALS, product.get("productId")), - new EntityExpr("requirementTypeId", EntityOperator.EQUALS, "PRODUCT_REQUIREMENT"), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "REQ_ORDERED"), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "REQ_REJECTED")), + EntityConditionList<EntityExpr> ecl = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId), + EntityCondition.makeCondition("productId", EntityOperator.EQUALS, product.get("productId")), + EntityCondition.makeCondition("requirementTypeId", EntityOperator.EQUALS, "PRODUCT_REQUIREMENT"), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "REQ_ORDERED"), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "REQ_REJECTED")), EntityOperator.AND); List requirements = delegator.findList("Requirement", ecl, null, null, null, false); for (Iterator riter = requirements.iterator(); riter.hasNext(); ) { Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.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.order.shoppingcart; import java.math.BigDecimal; @@ -31,20 +31,28 @@ import java.util.Map; import java.util.Set; -import org.ofbiz.base.util.*; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.ObjectType; +import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.base.util.UtilFormatOut; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; 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.EntityFieldValue; import org.ofbiz.entity.condition.EntityFunction; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.finaccount.FinAccountHelper; import org.ofbiz.order.order.OrderChangeHelper; -import org.ofbiz.order.shoppingcart.shipping.ShippingEvents; import org.ofbiz.order.order.OrderReadHelper; +import org.ofbiz.order.shoppingcart.shipping.ShippingEvents; import org.ofbiz.party.contact.ContactHelper; import org.ofbiz.product.store.ProductStoreWorker; import org.ofbiz.service.GenericServiceException; @@ -888,11 +896,11 @@ } // filter out cancelled preferences - List canExpr = UtilMisc.toList(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")); + List canExpr = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")); allPaymentPreferences = EntityUtil.filterByAnd(allPaymentPreferences, canExpr); // check for online payment methods or in-hand payment types with verbal or external refs - List exprs = UtilMisc.toList(new EntityExpr("manualRefNum", EntityOperator.NOT_EQUAL, null)); + List exprs = UtilMisc.toList(EntityCondition.makeCondition("manualRefNum", EntityOperator.NOT_EQUAL, null)); List manualRefPaymentPrefs = EntityUtil.filterByAnd(allPaymentPreferences, exprs); if (manualRefPaymentPrefs != null && manualRefPaymentPrefs.size() > 0) { Iterator i = manualRefPaymentPrefs.iterator(); @@ -1037,10 +1045,10 @@ } } else { // Get the paymentMethodTypeIds - this will need to change when ecom supports multiple payments - List cashCodPcBaExpr = UtilMisc.toList(new EntityExpr("paymentMethodTypeId", EntityOperator.EQUALS, "CASH"), - new EntityExpr("paymentMethodTypeId", EntityOperator.EQUALS, "EXT_COD"), - new EntityExpr("paymentMethodTypeId", EntityOperator.EQUALS, "PERSONAL_CHECK"), - new EntityExpr("paymentMethodTypeId", EntityOperator.EQUALS, "EXT_BILLACT")); + List cashCodPcBaExpr = UtilMisc.toList(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, "CASH"), + EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, "EXT_COD"), + EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, "PERSONAL_CHECK"), + EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, "EXT_BILLACT")); List cashCodPcBaPaymentPreferences = EntityUtil.filterByOr(allPaymentPreferences, cashCodPcBaExpr); if (UtilValidate.isNotEmpty(cashCodPcBaPaymentPreferences) && @@ -1148,9 +1156,10 @@ } String shippingAddress = UtilFormatOut.checkNull(shippingAddressObj.getString("address1")).toUpperCase(); shippingAddress = UtilFormatOut.makeSqlSafe(shippingAddress); - List exprs = UtilMisc.toList(new EntityExpr( - new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("blacklistString")), EntityOperator.EQUALS, new EntityFunction.UPPER(shippingAddress)), EntityOperator.AND, - new EntityExpr("orderBlacklistTypeId", EntityOperator.EQUALS, "BLACKLIST_ADDRESS"))); + List exprs = UtilMisc.toList(EntityCondition.makeCondition( + EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("blacklistString"), EntityOperator.EQUALS, EntityFunction.UPPER(shippingAddress)), + EntityOperator.AND, + EntityCondition.makeCondition("orderBlacklistTypeId", EntityOperator.EQUALS, "BLACKLIST_ADDRESS"))); String errMsg=null; List paymentMethods = this.cart.getPaymentMethods(); @@ -1171,16 +1180,17 @@ } if (creditCard != null) { String creditCardNumber = UtilFormatOut.checkNull(creditCard.getString("cardNumber")); - exprs.add(new EntityExpr( - new EntityExpr("blacklistString", EntityOperator.EQUALS, creditCardNumber), EntityOperator.AND, - new EntityExpr("orderBlacklistTypeId", EntityOperator.EQUALS, "BLACKLIST_CREDITCARD"))); + exprs.add(EntityCondition.makeCondition( + EntityCondition.makeCondition("blacklistString", EntityOperator.EQUALS, creditCardNumber), EntityOperator.AND, + EntityCondition.makeCondition("orderBlacklistTypeId", EntityOperator.EQUALS, "BLACKLIST_CREDITCARD"))); } if (billingAddress != null) { String address = UtilFormatOut.checkNull(billingAddress.getString("address1").toUpperCase()); address = UtilFormatOut.makeSqlSafe(address); - exprs.add(new EntityExpr( - new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("blacklistString")), EntityOperator.EQUALS, new EntityFunction.UPPER(address)), EntityOperator.AND, - new EntityExpr("orderBlacklistTypeId", EntityOperator.EQUALS, "BLACKLIST_ADDRESS"))); + exprs.add(EntityCondition.makeCondition( + EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("blacklistString"), EntityOperator.EQUALS, EntityFunction.UPPER(address)), + EntityOperator.AND, + EntityCondition.makeCondition("orderBlacklistTypeId", EntityOperator.EQUALS, "BLACKLIST_ADDRESS"))); } } } @@ -1188,7 +1198,7 @@ List blacklistFound = null; if (exprs.size() > 0) { try { - EntityConditionList ecl = new EntityConditionList(exprs, EntityOperator.AND); + EntityConditionList ecl = EntityCondition.makeCondition(exprs, EntityOperator.AND); blacklistFound = this.delegator.findList("OrderBlacklist", ecl, null, null, null, false); } catch (GenericEntityException e) { Debug.logError(e, "Problems with OrderBlacklist lookup.", module); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Wed May 28 00:22:59 2008 @@ -631,9 +631,9 @@ try { if ("Y".equals(addToCartRemoveIncompat)) { List productAssocs = null; - EntityCondition cond = new EntityConditionList(UtilMisc.toList( - new EntityExpr(new EntityExpr("productId", EntityOperator.EQUALS, productId), EntityOperator.OR, new EntityExpr("productIdTo", EntityOperator.EQUALS, productId)), - new EntityExpr("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_INCOMPATABLE")), EntityOperator.AND); + EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId), EntityOperator.OR, EntityCondition.makeCondition("productIdTo", EntityOperator.EQUALS, productId)), + EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_INCOMPATABLE")), EntityOperator.AND); productAssocs = delegator.findList("ProductAssoc", cond, null, null, null, false); productAssocs = EntityUtil.filterByDate(productAssocs); List productList = FastList.newInstance(); @@ -663,9 +663,9 @@ } if ("Y".equals(addToCartReplaceUpsell)) { List productList = null; - EntityCondition cond = new EntityConditionList(UtilMisc.toList( - new EntityExpr("productIdTo", EntityOperator.EQUALS, productId), - new EntityExpr("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_UPGRADE")), EntityOperator.AND); + EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("productIdTo", EntityOperator.EQUALS, productId), + EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_UPGRADE")), EntityOperator.AND); productList = delegator.findList("ProductAssoc", cond, UtilMisc.toSet("productId"), null, null, false); if (productList != null) { Iterator sciIter = cart.iterator(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.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.order.shoppingcart; import java.math.BigDecimal; @@ -44,7 +44,7 @@ import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericPK; 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.order.order.OrderReadHelper; @@ -1725,8 +1725,8 @@ List featureAppls = null; try { featureAppls = product.getRelated("ProductFeatureAppl"); - List filterExprs = UtilMisc.toList(new EntityExpr("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE")); - filterExprs.add(new EntityExpr("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE")); + List filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE")); + filterExprs.add(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE")); featureAppls = EntityUtil.filterByOr(featureAppls, filterExprs); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get features from product : " + product.get("productId"), module); @@ -2052,8 +2052,8 @@ List featureAppls = null; try { featureAppls = product.getRelated("ProductFeatureAppl"); - List filterExprs = UtilMisc.toList(new EntityExpr("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE")); - filterExprs.add(new EntityExpr("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE")); + List filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE")); + filterExprs.add(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE")); featureAppls = EntityUtil.filterByOr(featureAppls, filterExprs); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get features from product : " + product.get("productId"), module); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Wed May 28 00:22:59 2008 @@ -227,12 +227,12 @@ // load the payment infos List orderPaymentPrefs = null; try { - List exprs = UtilMisc.toList(new EntityExpr("orderId", EntityOperator.EQUALS, orderId)); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_RECEIVED")); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_DECLINED")); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_SETTLED")); - EntityCondition cond = new EntityConditionList(exprs, EntityOperator.AND); + List exprs = UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId)); + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_RECEIVED")); + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")); + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_DECLINED")); + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_SETTLED")); + EntityCondition cond = EntityCondition.makeCondition(exprs, EntityOperator.AND); orderPaymentPrefs = delegator.findList("OrderPaymentPreference", cond, null, null, null, false); } catch (GenericEntityException e) { Debug.logError(e, module); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Wed May 28 00:22:59 2008 @@ -378,7 +378,7 @@ Set enteredCodes = cart.getProductPromoCodesEntered(); if (enteredCodes.size() > 0) { // get all promo codes entered, do a query with an IN condition to see if any of those are related - EntityCondition codeCondition = new EntityExpr(new EntityExpr("productPromoId", EntityOperator.EQUALS, productPromoId), EntityOperator.AND, new EntityExpr("productPromoCodeId", EntityOperator.IN, enteredCodes)); + EntityCondition codeCondition = EntityCondition.makeCondition(EntityCondition.makeCondition("productPromoId", EntityOperator.EQUALS, productPromoId), EntityOperator.AND, EntityCondition.makeCondition("productPromoCodeId", EntityOperator.IN, enteredCodes)); // may want to sort by something else to decide which code to use if there is more than one candidate List productPromoCodeList = delegator.findList("ProductPromoCode", codeCondition, null, UtilMisc.toList("productPromoCodeId"), null, false); Iterator productPromoCodeIter = productPromoCodeList.iterator(); @@ -447,11 +447,11 @@ long productPromoCustomerUseSize = 0; if (UtilValidate.isNotEmpty(partyId)) { // check to see how many times this has been used for other orders for this customer, the remainder is the limit for this order - EntityCondition checkCondition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("productPromoId", EntityOperator.EQUALS, productPromoId), - new EntityExpr("partyId", EntityOperator.EQUALS, partyId), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED")), EntityOperator.AND); + EntityCondition checkCondition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("productPromoId", EntityOperator.EQUALS, productPromoId), + EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED")), EntityOperator.AND); productPromoCustomerUseSize = delegator.findCountByCondition("ProductPromoUseCheck", checkCondition, null, null); } long perCustomerThisOrder = useLimitPerCustomer.longValue() - productPromoCustomerUseSize; @@ -465,10 +465,10 @@ Long useLimitPerPromotion = productPromo.getLong("useLimitPerPromotion"); if (useLimitPerPromotion != null) { // check to see how many times this has been used for other orders for this customer, the remainder is the limit for this order - EntityCondition checkCondition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("productPromoId", EntityOperator.EQUALS, productPromoId), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED")), EntityOperator.AND); + EntityCondition checkCondition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("productPromoId", EntityOperator.EQUALS, productPromoId), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED")), EntityOperator.AND); long productPromoUseSize = delegator.findCountByCondition("ProductPromoUseCheck", checkCondition, null, null); long perPromotionThisOrder = useLimitPerPromotion.longValue() - productPromoUseSize; if (candidateUseLimit == null || candidateUseLimit.longValue() > perPromotionThisOrder) { @@ -491,11 +491,11 @@ long productPromoCustomerUseSize = 0; if (UtilValidate.isNotEmpty(partyId)) { // check to see how many times this has been used for other orders for this customer, the remainder is the limit for this order - EntityCondition checkCondition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("productPromoCodeId", EntityOperator.EQUALS, productPromoCodeId), - new EntityExpr("partyId", EntityOperator.EQUALS, partyId), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED")), EntityOperator.AND); + EntityCondition checkCondition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("productPromoCodeId", EntityOperator.EQUALS, productPromoCodeId), + EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED")), EntityOperator.AND); productPromoCustomerUseSize = delegator.findCountByCondition("ProductPromoUseCheck", checkCondition, null, null); } long perCustomerThisOrder = codeUseLimitPerCustomer.longValue() - productPromoCustomerUseSize; @@ -507,10 +507,10 @@ Long codeUseLimitPerCode = productPromoCode.getLong("useLimitPerCode"); if (codeUseLimitPerCode != null) { // check to see how many times this has been used for other orders for this customer, the remainder is the limit for this order - EntityCondition checkCondition = new EntityConditionList(UtilMisc.toList( - new EntityExpr("productPromoCodeId", EntityOperator.EQUALS, productPromoCodeId), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED")), EntityOperator.AND); + EntityCondition checkCondition = EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("productPromoCodeId", EntityOperator.EQUALS, productPromoCodeId), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED")), EntityOperator.AND); long productPromoCodeUseSize = delegator.findCountByCondition("ProductPromoUseCheck", checkCondition, null, null); long perCodeThisOrder = codeUseLimitPerCode.longValue() - productPromoCodeUseSize; if (codeUseLimit == null || codeUseLimit.longValue() > perCodeThisOrder) { @@ -551,12 +551,12 @@ // check email address in ProductPromoCodeEmail List validEmailCondList = new ArrayList(); - validEmailCondList.add(new EntityExpr("partyId", EntityOperator.EQUALS, partyId)); - validEmailCondList.add(new EntityExpr("productPromoCodeId", EntityOperator.EQUALS, productPromoCodeId)); - validEmailCondList.add(new EntityExpr("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp)); - validEmailCondList.add(new EntityExpr(new EntityExpr("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp), - EntityOperator.OR, new EntityExpr("thruDate", EntityOperator.EQUALS, null))); - EntityCondition validEmailCondition = new EntityConditionList(validEmailCondList, EntityOperator.AND); + validEmailCondList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)); + validEmailCondList.add(EntityCondition.makeCondition("productPromoCodeId", EntityOperator.EQUALS, productPromoCodeId)); + validEmailCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp)); + validEmailCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp), + EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null))); + EntityCondition validEmailCondition = EntityCondition.makeCondition(validEmailCondList, EntityOperator.AND); long validEmailCount = delegator.findCountByCondition("ProductPromoCodeEmailParty", validEmailCondition, null, null); if (validEmailCount > 0) { // there was an email in the list, looks good... Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java Wed May 28 00:22:59 2008 @@ -321,13 +321,13 @@ */ public static GenericValue getShippingOriginContactMech(GenericDelegator delegator, String supplierPartyId) throws GeneralException { List<EntityCondition> conditions = UtilMisc.toList( - new EntityExpr("partyId", EntityOperator.EQUALS, supplierPartyId), - new EntityExpr("contactMechTypeId", EntityOperator.EQUALS, "POSTAL_ADDRESS"), - new EntityExpr("contactMechPurposeTypeId", EntityOperator.IN, UtilMisc.toList("SHIP_ORIG_LOCATION", "GENERAL_LOCATION")), + EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, supplierPartyId), + EntityCondition.makeCondition("contactMechTypeId", EntityOperator.EQUALS, "POSTAL_ADDRESS"), + EntityCondition.makeCondition("contactMechPurposeTypeId", EntityOperator.IN, UtilMisc.toList("SHIP_ORIG_LOCATION", "GENERAL_LOCATION")), EntityUtil.getFilterByDateExpr("contactFromDate", "contactThruDate"), EntityUtil.getFilterByDateExpr("purposeFromDate", "purposeThruDate") ); - EntityConditionList<EntityCondition> ecl = new EntityConditionList<EntityCondition>(conditions, EntityOperator.AND); + EntityConditionList<EntityCondition> ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND); List<GenericValue> addresses = delegator.findList("PartyContactWithPurpose", ecl, null, UtilMisc.toList("contactMechPurposeTypeId DESC"), null, false); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java Wed May 28 00:22:59 2008 @@ -126,9 +126,9 @@ try { beganTransaction = TransactionUtil.begin(); - List exprs = UtilMisc.toList(new EntityExpr("shoppingListTypeId", EntityOperator.EQUALS, "SLT_AUTO_REODR"), - new EntityExpr("isActive", EntityOperator.EQUALS, "Y")); - EntityCondition cond = new EntityConditionList(exprs, EntityOperator.AND); + List exprs = UtilMisc.toList(EntityCondition.makeCondition("shoppingListTypeId", EntityOperator.EQUALS, "SLT_AUTO_REODR"), + EntityCondition.makeCondition("isActive", EntityOperator.EQUALS, "Y")); + EntityCondition cond = EntityCondition.makeCondition(exprs, EntityOperator.AND); List order = UtilMisc.toList("-lastOrderedDate"); EntityListIterator eli = null; Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh Wed May 28 00:22:59 2008 @@ -34,24 +34,24 @@ mainConditionList = new LinkedList(); //make sure the look up is case insensitive -conditionList.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("productId")), +conditionList.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("productId")), EntityOperator.LIKE, productId.toUpperCase() + "%")); // do not include configurabl products -conditionList.add(new EntityExpr("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED")); +conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED")); // no virtual products: note that isVirtual could be null, which in some databases is different than isVirtual != "Y". // we consider those products to be non-virtual and hence addable to the order in bulk -orConditionList.add(new EntityExpr("isVirtual", EntityOperator.NOT_EQUAL, "Y")); -orConditionList.add(new EntityExpr("isVirtual", EntityOperator.EQUALS, "N")); -orConditionList.add(new EntityExpr("isVirtual", EntityOperator.EQUALS, null)); +orConditionList.add(EntityCondition.makeCondition("isVirtual", EntityOperator.NOT_EQUAL, "Y")); +orConditionList.add(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, "N")); +orConditionList.add(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, null)); -orConditions = new EntityConditionList(orConditionList, EntityOperator.OR); -conditions = new EntityConditionList(conditionList, EntityOperator.AND); +orConditions = EntityCondition.makeCondition(orConditionList, EntityOperator.OR); +conditions = EntityCondition.makeCondition(conditionList, EntityOperator.AND); mainConditionList.add(orConditions); mainConditionList.add(conditions); -mainConditions = new EntityConditionList(mainConditionList, EntityOperator.AND); +mainConditions = EntityCondition.makeCondition(mainConditionList, EntityOperator.AND); productList = delegator.findList("Product", mainConditions, UtilMisc.toSet("productId", "brandName", "internalName"), UtilMisc.toList("productId"), null, false); context.put("productList", productList); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.bsh?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.bsh Wed May 28 00:22:59 2008 @@ -38,12 +38,12 @@ conditionList = new LinkedList(); // make sure the look up is case insensitive -conditionList.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("productId")), +conditionList.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("productId")), EntityOperator.LIKE, productId.toUpperCase() + "%")); -conditionList.add(new EntityExpr("partyId", EntityOperator.EQUALS, shoppingCart.getOrderPartyId())); -conditionList.add(new EntityExpr("currencyUomId", EntityOperator.EQUALS, shoppingCart.getCurrency())); -conditions = new EntityConditionList(conditionList, EntityOperator.AND); +conditionList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, shoppingCart.getOrderPartyId())); +conditionList.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, shoppingCart.getCurrency())); +conditions = EntityCondition.makeCondition(conditionList, EntityOperator.AND); List selectedFields = UtilMisc.toSet("productId", "supplierProductId", "supplierProductName", "lastPrice", "minimumOrderQuantity"); selectedFields.add("availableFromDate"); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh?rev=660843&r1=660842&r2=660843&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh Wed May 28 00:22:59 2008 @@ -81,9 +81,9 @@ // get the shopping lists for the user (if logged in) if (userLogin != null) { - exprList = UtilMisc.toList(new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.getString("partyId")), - new EntityExpr("listName", EntityOperator.NOT_EQUAL, "auto-save")); - condition = new EntityConditionList(exprList, EntityOperator.AND); + exprList = UtilMisc.toList(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, userLogin.getString("partyId")), + EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")); + condition = EntityCondition.makeCondition(exprList, EntityOperator.AND); allShoppingLists = delegator.findList("ShoppingList", condition, null, UtilMisc.toList("listName"), null, false); context.put("shoppingLists", allShoppingLists); } @@ -198,7 +198,7 @@ context.put("productReviews", reviews); // get the average rating if (reviews != null && reviews.size() > 0) { - List ratingReviews = EntityUtil.filterByAnd(reviews, UtilMisc.toList(new EntityExpr("productRating", EntityOperator.NOT_EQUAL, null))); + List ratingReviews = EntityUtil.filterByAnd(reviews, UtilMisc.toList(EntityCondition.makeCondition("productRating", EntityOperator.NOT_EQUAL, null))); if (ratingReviews.size() > 0) { context.put("averageRating", ProductWorker.getAverageProductRating(product, reviews, productStoreId)); context.put("numRatings", ratingReviews.size()); |
Free forum by Nabble | Edit this page |