Author: lektran
Date: Fri May 9 22:35:16 2008 New Revision: 655013 URL: http://svn.apache.org/viewvc?rev=655013&view=rev Log: Removed more calls to deprecated GenericDelegator methods Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/project/ProjectWorker.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java?rev=655013&r1=655012&r2=655013&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java Fri May 9 22:35:16 2008 @@ -33,6 +33,7 @@ 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.EntityOperator; import org.ofbiz.entity.util.EntityUtil; @@ -73,8 +74,9 @@ constraints.add(new EntityExpr("currentStatusId", EntityOperator.EQUALS, "ROU_ACTIVE")); constraints.add(new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "ROU_TASK")); + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(constraints, EntityOperator.AND); try { - listRoutingTask = delegator.findByAnd("WorkEffort", constraints, UtilMisc.toList("workEffortName")); + listRoutingTask = delegator.findList("WorkEffort", ecl, null, UtilMisc.toList("workEffortName"), null, false); } catch (GenericEntityException e) { Debug.logWarning(e, module); return ServiceUtil.returnError("Error finding desired WorkEffort records: " + e.toString()); 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=655013&r1=655012&r2=655013&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 Fri May 9 22:35:16 2008 @@ -2688,17 +2688,19 @@ //Locale locale = (Locale) context.get("locale"); List ordersToCheck = null; - List exprs = new ArrayList(); // create the query expressions - exprs.add(new EntityExpr("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED")); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED")); - exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED")); + 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") + ); + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(exprs, EntityOperator.AND); // get the orders try { - ordersToCheck = delegator.findByAnd("OrderHeader", exprs, UtilMisc.toList("orderDate")); + ordersToCheck = delegator.findList("OrderHeader", ecl, null, UtilMisc.toList("orderDate"), null, false); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting order headers", module); } @@ -2766,10 +2768,12 @@ 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)); + + ecl = new EntityConditionList<EntityExpr>(itemsExprs, EntityOperator.AND); List orderItems = null; try { - orderItems = delegator.findByAnd("OrderItem", itemsExprs, null); + orderItems = delegator.findList("OrderItem", ecl, null, null, null, false); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting order item records", 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=655013&r1=655012&r2=655013&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 Fri May 9 22:35:16 2008 @@ -56,7 +56,7 @@ List statusIds = (List) context.get("statusIds"); try { List orderBy = UtilMisc.toList("partyId", "requirementId"); - List conditions = UtilMisc.toList( + List<EntityCondition> conditions = UtilMisc.toList( new EntityExpr("requirementTypeId", EntityOperator.EQUALS, "PRODUCT_REQUIREMENT"), EntityUtil.getFilterByDateExpr() ); @@ -76,10 +76,12 @@ } else { conditions.add( new EntityExpr("roleTypeId", EntityOperator.EQUALS, "SUPPLIER") ); } - List requirementAndRoles = delegator.findByAnd("RequirementAndRole", conditions, orderBy); + + EntityConditionList<EntityCondition> ecl = new EntityConditionList<EntityCondition>(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 - Map suppliers = FastMap.newInstance(); + Map<String, GenericValue> suppliers = FastMap.newInstance(); Map gids = FastMap.newInstance(); Map inventories = FastMap.newInstance(); Map productsSold = FastMap.newInstance(); @@ -112,7 +114,10 @@ new EntityExpr("productId", EntityOperator.EQUALS, productId), EntityUtil.getFilterByDateExpr("availableFromDate", "availableThruDate") ); - supplierProduct = EntityUtil.getFirst( delegator.findByAnd("SupplierProduct", conditions, UtilMisc.toList("minimumOrderQuantity", "lastPrice")) ); + ecl = new EntityConditionList<EntityCondition>(conditions, EntityOperator.AND); + List<GenericValue> supplierProducts = delegator.findList("SupplierProduct", ecl, null, UtilMisc.toList("minimumOrderQuantity", "lastPrice"), null, false); + + supplierProduct = EntityUtil.getFirst(supplierProducts); suppliers.put(supplierKey, supplierProduct); } 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=655013&r1=655012&r2=655013&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 Fri May 9 22:35:16 2008 @@ -32,6 +32,8 @@ import org.ofbiz.base.util.UtilProperties; import org.ofbiz.entity.GenericDelegator; 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; @@ -318,14 +320,16 @@ * Attempts to get the supplier's shipping origin address and failing that, the general location. */ public static GenericValue getShippingOriginContactMech(GenericDelegator delegator, String supplierPartyId) throws GeneralException { - List conditions = UtilMisc.toList( + 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")), EntityUtil.getFilterByDateExpr("contactFromDate", "contactThruDate"), EntityUtil.getFilterByDateExpr("purposeFromDate", "purposeThruDate") ); - List<GenericValue> addresses = delegator.findByAnd("PartyContactWithPurpose", conditions, UtilMisc.toList("contactMechPurposeTypeId DESC")); + EntityConditionList<EntityCondition> ecl = new EntityConditionList<EntityCondition>(conditions, EntityOperator.AND); + + List<GenericValue> addresses = delegator.findList("PartyContactWithPurpose", ecl, null, UtilMisc.toList("contactMechPurposeTypeId DESC"), null, false); GenericValue generalAddress = null; GenericValue originAddress = null; Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java?rev=655013&r1=655012&r2=655013&view=diff ============================================================================== --- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java (original) +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java Fri May 9 22:35:16 2008 @@ -652,10 +652,8 @@ } try { - List exprs = new LinkedList(); - - exprs.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("infoString")), EntityOperator.EQUALS, new EntityFunction.UPPER(email.toUpperCase()))); - List c = EntityUtil.filterByDate(delegator.findByAnd("PartyAndContactMech", exprs, UtilMisc.toList("infoString")), true); + EntityExpr ee = new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("infoString")), EntityOperator.EQUALS, new EntityFunction.UPPER(email.toUpperCase())); + List c = EntityUtil.filterByDate(delegator.findList("PartyAndContactMech", ee, null, UtilMisc.toList("infoString"), null, false), true); if (Debug.verboseOn()) Debug.logVerbose("List: " + c, module); if (Debug.infoOn()) Debug.logInfo("PartyFromEmail number found: " + c.size(), module); @@ -693,10 +691,8 @@ } try { - List exprs = new LinkedList(); - - exprs.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("infoString")), EntityOperator.LIKE, new EntityFunction.UPPER(("%" + email.toUpperCase()) + "%"))); - List c = EntityUtil.filterByDate(delegator.findByAnd("PartyAndContactMech", exprs, UtilMisc.toList("infoString")), true); + EntityExpr ee = new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("infoString")), EntityOperator.LIKE, new EntityFunction.UPPER(("%" + email.toUpperCase()) + "%")); + List c = EntityUtil.filterByDate(delegator.findList("PartyAndContactMech", ee, null, UtilMisc.toList("infoString"), null, false), true); if (Debug.verboseOn()) Debug.logVerbose("List: " + c, module); if (Debug.infoOn()) Debug.logInfo("PartyFromEmail number found: " + c.size(), module); @@ -738,10 +734,8 @@ return ServiceUtil.returnError("Required parameter 'userLoginId' cannot be empty."); try { - List exprs = new LinkedList(); - - exprs.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("userLoginId")), EntityOperator.LIKE, new EntityFunction.UPPER("%" + userLoginId.toUpperCase() + "%"))); - Collection ulc = delegator.findByAnd("PartyAndUserLogin", exprs, UtilMisc.toList("userloginId")); + EntityExpr ee = new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("userLoginId")), EntityOperator.LIKE, new EntityFunction.UPPER("%" + userLoginId.toUpperCase() + "%")); + Collection ulc = delegator.findList("PartyAndUserLogin", ee, null, UtilMisc.toList("userloginId"), null, false); if (Debug.verboseOn()) Debug.logVerbose("Collection: " + ulc, module); if (Debug.infoOn()) Debug.logInfo("PartyFromUserLogin number found: " + ulc.size(), module); @@ -792,11 +786,11 @@ } try { - List exprs = new LinkedList(); - - exprs.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("firstName")), EntityOperator.LIKE, new EntityFunction.UPPER("%" + firstName.toUpperCase() + "%"))); - exprs.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("lastName")), EntityOperator.LIKE, new EntityFunction.UPPER("%" + lastName.toUpperCase() + "%"))); - Collection pc = delegator.findByAnd("Person", exprs, UtilMisc.toList("lastName", "firstName", "partyId")); + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(UtilMisc.toList( + new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("firstName")), EntityOperator.LIKE, new EntityFunction.UPPER("%" + firstName.toUpperCase() + "%")), + new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("lastName")), EntityOperator.LIKE, new EntityFunction.UPPER("%" + lastName.toUpperCase() + "%"))), + EntityOperator.AND); + Collection pc = delegator.findList("Person", ecl, null, UtilMisc.toList("lastName", "firstName", "partyId"), null, false); if (Debug.infoOn()) Debug.logInfo("PartyFromPerson number found: " + pc.size(), module); if (pc != null) { @@ -838,10 +832,8 @@ } try { - List exprs = new LinkedList(); - - exprs.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("groupName")), EntityOperator.LIKE, new EntityFunction.UPPER("%" + groupName.toUpperCase() + "%"))); - Collection pc = delegator.findByAnd("PartyGroup", exprs, UtilMisc.toList("groupName", "partyId")); + EntityExpr ee = new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("groupName")), EntityOperator.LIKE, new EntityFunction.UPPER("%" + groupName.toUpperCase() + "%")); + Collection pc = delegator.findList("PartyGroup", ee, null, UtilMisc.toList("groupName", "partyId"), null, false); if (Debug.infoOn()) Debug.logInfo("PartyFromGroup number found: " + pc.size(), module); if (pc != null) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=655013&r1=655012&r2=655013&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java Fri May 9 22:35:16 2008 @@ -27,6 +27,8 @@ import java.util.Map; import java.util.Set; +import javolution.util.FastList; + import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; @@ -34,6 +36,7 @@ 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; @@ -379,12 +382,14 @@ // get the incomming shipment information for the item List shipmentAndItems = null; try { - List exprs = new ArrayList(); + List<EntityExpr> exprs = FastList.newInstance(); exprs.add(new EntityExpr("productId", EntityOperator.EQUALS, inventoryItem.get("productId"))); exprs.add(new EntityExpr("destinationFacilityId", EntityOperator.EQUALS, inventoryItem.get("facilityId"))); exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_DELIVERED")); exprs.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_CANCELLED")); - shipmentAndItems = delegator.findByAnd("ShipmentAndItem", exprs, UtilMisc.toList("estimatedArrivalDate")); + + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(exprs, EntityOperator.AND); + shipmentAndItems = delegator.findList("ShipmentAndItem", ecl, null, UtilMisc.toList("estimatedArrivalDate"), null, false); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting ShipmentAndItem records", module); return ServiceUtil.returnError("Problem getting ShipmentAndItem records"); Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/project/ProjectWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/project/ProjectWorker.java?rev=655013&r1=655012&r2=655013&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/project/ProjectWorker.java (original) +++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/project/ProjectWorker.java Fri May 9 22:35:16 2008 @@ -30,6 +30,7 @@ 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; @@ -49,14 +50,15 @@ if (userLogin != null && userLogin.get("partyId") != null) { try { - validWorkEfforts = delegator.findByAnd("WorkEffortAndPartyAssign", - UtilMisc.toList(new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId")), - new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_COMPLETED"), - new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_TERMINATED"), - new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_ABORTED"), - new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "TASK"), - new EntityExpr("workEffortPurposeTypeId", EntityOperator.EQUALS, "WEPT_PROJECT")), - UtilMisc.toList("priority")); + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(UtilMisc.toList( + new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId")), + new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_COMPLETED"), + new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_TERMINATED"), + new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_ABORTED"), + new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "TASK"), + new EntityExpr("workEffortPurposeTypeId", EntityOperator.EQUALS, "WEPT_PROJECT")), + EntityOperator.AND); + validWorkEfforts = delegator.findList("WorkEffortAndPartyAssign", ecl, null, UtilMisc.toList("priority"), null, false); } catch (GenericEntityException e) { Debug.logWarning(e, module); } @@ -75,11 +77,12 @@ if (userLogin != null && userLogin.get("partyId") != null) { try { - validWorkEfforts = delegator.findByAnd("WorkEffortAndPartyAssign", - UtilMisc.toList(new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId")), - new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "TASK"), - new EntityExpr("workEffortPurposeTypeId", EntityOperator.EQUALS, "WEPT_PROJECT")), - UtilMisc.toList("priority")); + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(UtilMisc.toList( + new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId")), + new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "TASK"), + new EntityExpr("workEffortPurposeTypeId", EntityOperator.EQUALS, "WEPT_PROJECT")), + EntityOperator.AND); + validWorkEfforts = delegator.findList("WorkEffortAndPartyAssign", ecl, null, UtilMisc.toList("priority"), null, false); } catch (GenericEntityException e) { Debug.logWarning(e, module); } @@ -203,9 +206,8 @@ if (userLogin != null && userLogin.get("partyId") != null) { try { - notes = delegator.findByAnd("WorkEffortNoteAndData", - UtilMisc.toList(new EntityExpr("workEffortId", EntityOperator.EQUALS, workEffortId)), - UtilMisc.toList("noteDateTime")); + EntityExpr ee = new EntityExpr("workEffortId", EntityOperator.EQUALS, workEffortId); + notes = delegator.findList("WorkEffortNoteAndData", ee, null, UtilMisc.toList("noteDateTime"), null, false); } catch (GenericEntityException e) { Debug.logWarning(e, module); } Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=655013&r1=655012&r2=655013&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java (original) +++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Fri May 9 22:35:16 2008 @@ -32,6 +32,8 @@ import java.util.Set; import java.util.TimeZone; +import javolution.util.FastList; + import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; @@ -65,16 +67,20 @@ if (userLogin != null && userLogin.get("partyId") != null) { try { - List conditionList = UtilMisc.toList(new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId")), + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>( + EntityOperator.AND, + new EntityExpr[] { + new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId")), new EntityExpr("roleTypeId", EntityOperator.EQUALS, roleTypeId), - new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "EVENT")); - conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED")); - conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED")); - conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED")); - conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED")); - validWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAndPartyAssign", - conditionList, - UtilMisc.toList("estimatedStartDate", "priority"))); + new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "EVENT"), + new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED"), + new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED"), + new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"), + new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED") + }); + validWorkEfforts = EntityUtil.filterByDate( + delegator.findList("WorkEffortAndPartyAssign", ecl, null, UtilMisc.toList("estimatedStartDate", "priority"), null, false) + ); } catch (GenericEntityException e) { Debug.logWarning(e, module); return ServiceUtil.returnError("Error finding desired WorkEffort records: " + e.toString()); @@ -96,14 +102,18 @@ List validWorkEfforts = null; try { - List conditionList = UtilMisc.toList(new EntityExpr("roleTypeId", EntityOperator.EQUALS, roleTypeId), - new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "EVENT")); + List<EntityExpr> conditionList = FastList.newInstance(); + conditionList.add(new EntityExpr("roleTypeId", EntityOperator.EQUALS, roleTypeId)); + conditionList.add(new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "EVENT")); conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED")); conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED")); conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED")); conditionList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED")); - validWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAndPartyAssign", - conditionList, UtilMisc.toList("estimatedStartDate", "priority"))); + + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(conditionList, EntityOperator.AND); + validWorkEfforts = EntityUtil.filterByDate( + delegator.findList("WorkEffortAndPartyAssign", ecl, null, UtilMisc.toList("estimatedStartDate", "priority"), null, false) + ); } catch (GenericEntityException e) { Debug.logWarning(e, module); return ServiceUtil.returnError("Error finding desired WorkEffort records: " + e.toString()); @@ -121,25 +131,37 @@ GenericDelegator delegator = ctx.getDelegator(); GenericValue userLogin = (GenericValue) context.get("userLogin"); - List validWorkEfforts = null; + List<GenericValue> validWorkEfforts = null; if (userLogin != null && userLogin.get("partyId") != null) { try { - validWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAndPartyAssign", - UtilMisc.toList(new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId")), + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>( + EntityOperator.AND, + new EntityExpr[]{ + new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId")), new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "TASK"), new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED"), new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED"), new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"), - new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED")), - UtilMisc.toList("priority"))); - validWorkEfforts.addAll(EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAndPartyAssign", - UtilMisc.toList(new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId")), - new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "PROD_ORDER_TASK"), - new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CANCELLED "), - new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_COMPLETED"), - new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CLOSED")), - UtilMisc.toList("createdDate DESC")))); + new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED") + }); + validWorkEfforts = EntityUtil.filterByDate( + delegator.findList("WorkEffortAndPartyAssign", ecl, null, UtilMisc.toList("priority"), null, false) + ); + ecl = new EntityConditionList<EntityExpr>( + EntityOperator.AND, + new EntityExpr[]{ + new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId")), + new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "PROD_ORDER_TASK"), + new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CANCELLED "), + new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_COMPLETED"), + new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CLOSED") + }); + validWorkEfforts.addAll( + EntityUtil.filterByDate( + delegator.findList("WorkEffortAndPartyAssign", ecl, null, UtilMisc.toList("createdDate DESC"), null, false) + ) + ); } catch (GenericEntityException e) { Debug.logWarning(e, module); return ServiceUtil.returnError("Error finding desired WorkEffort records: " + e.toString()); @@ -160,7 +182,7 @@ if (userLogin != null && userLogin.get("partyId") != null) { try { - List constraints = new LinkedList(); + List<EntityExpr> constraints = FastList.newInstance(); constraints.add(new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId"))); constraints.add(new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "ACTIVITY")); @@ -171,7 +193,11 @@ constraints.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_COMPLETED")); constraints.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_TERMINATED")); constraints.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_ABORTED")); - validWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAndPartyAssign", constraints, UtilMisc.toList("priority"))); + + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(constraints, EntityOperator.AND); + validWorkEfforts = EntityUtil.filterByDate( + delegator.findList("WorkEffortAndPartyAssign", ecl, null, UtilMisc.toList("priority"), null, false) + ); } catch (GenericEntityException e) { Debug.logWarning(e, module); return ServiceUtil.returnError("Error finding desired WorkEffort records: " + e.toString()); @@ -192,7 +218,7 @@ if (userLogin != null && userLogin.get("partyId") != null) { try { - List constraints = new LinkedList(); + List<EntityExpr> constraints = FastList.newInstance(); constraints.add(new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId"))); constraints.add(new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "ACTIVITY")); @@ -203,7 +229,11 @@ constraints.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_COMPLETED")); constraints.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_TERMINATED")); constraints.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_ABORTED")); - roleWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignByRole", constraints, UtilMisc.toList("priority"))); + + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(constraints, EntityOperator.AND); + roleWorkEfforts = EntityUtil.filterByDate( + delegator.findList("WorkEffortPartyAssignByRole", ecl, null, UtilMisc.toList("priority"), null, false) + ); } catch (GenericEntityException e) { Debug.logWarning(e, module); return ServiceUtil.returnError("Error finding desired WorkEffort records: " + e.toString()); @@ -224,7 +254,7 @@ if (userLogin != null && userLogin.get("partyId") != null) { try { - List constraints = new LinkedList(); + List<EntityExpr> constraints = FastList.newInstance(); constraints.add(new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.get("partyId"))); constraints.add(new EntityExpr("workEffortTypeId", EntityOperator.EQUALS, "ACTIVITY")); @@ -235,7 +265,11 @@ constraints.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_COMPLETED")); constraints.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_TERMINATED")); constraints.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "WF_ABORTED")); - groupWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignByGroup", constraints, UtilMisc.toList("priority"))); + + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(constraints, EntityOperator.AND); + groupWorkEfforts = EntityUtil.filterByDate( + delegator.findList("WorkEffortPartyAssignByGroup", ecl, null, UtilMisc.toList("priority"), null, false) + ); } catch (GenericEntityException e) { Debug.logWarning(e, module); return ServiceUtil.returnError("Error finding desired WorkEffort records: " + e.toString()); @@ -451,15 +485,16 @@ if (filterOutCanceledEvents.booleanValue()) { entityExprList.add(new EntityExpr("currentStatusId", EntityOperator.NOT_EQUAL, "EVENT_CANCELLED")); } - + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(entityExprList, EntityOperator.AND); + // Use the View Entity if (partyIdsToUse.size() > 0 || UtilValidate.isNotEmpty(facilityId) || UtilValidate.isNotEmpty(fixedAssetId)) { try { List tempWorkEfforts = null; if (partyIds != null && partyIds.size() > 0) { - tempWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAndPartyAssign", entityExprList, UtilMisc.toList("estimatedStartDate"))); + tempWorkEfforts = EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssign", ecl, null, UtilMisc.toList("estimatedStartDate"), null, false)); } else { - tempWorkEfforts = delegator.findByAnd("WorkEffort", entityExprList, UtilMisc.toList("estimatedStartDate")); + tempWorkEfforts = delegator.findList("WorkEffort", ecl, null, UtilMisc.toList("estimatedStartDate"), null, false); } // This block needs to be here to filter duplicate workeffort ids when Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=655013&r1=655012&r2=655013&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Fri May 9 22:35:16 2008 @@ -1980,7 +1980,7 @@ } /** Finds Generic Entity records by all of the specified expressions (ie: combined using AND) - * NOTE 20080502: 11 references + * NOTE 20080502: 11 references; all changed to findList *@param entityName The Name of the Entity as defined in the entity XML file *@param expressions The expressions to use for the lookup, each consisting of at least a field name, an EntityOperator, and a value to compare to *@return List of GenericValue instances that match the query Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java?rev=655013&r1=655012&r2=655013&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java Fri May 9 22:35:16 2008 @@ -207,8 +207,10 @@ List<EntityExpr> exprs = UtilMisc.toList(new EntityExpr("finishDateTime", EntityOperator.EQUALS, null)); exprs.add(new EntityExpr("cancelDateTime", EntityOperator.EQUALS, null)); exprs.add(new EntityExpr("runByInstanceId", EntityOperator.EQUALS, instanceId)); + EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(exprs, EntityOperator.AND); + try { - crashed = delegator.findByAnd("JobSandbox", exprs, UtilMisc.toList("startDateTime")); + crashed = delegator.findList("JobSandbox", ecl, null, UtilMisc.toList("startDateTime"), null, false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to load crashed jobs", module); } |
Free forum by Nabble | Edit this page |