Author: jacopoc Date: Thu Oct 30 06:10:58 2014 New Revision: 1635399 URL: http://svn.apache.org/r1635399 Log: Merged branch with trunk.
Modified: ofbiz/branches/json-integration-refactoring/ (props changed) ofbiz/branches/json-integration-refactoring/applications/content/data/DemoBlogPubPtData.xml ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/routing/RoutingServices.java ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java ofbiz/branches/json-integration-refactoring/applications/marketing/src/org/ofbiz/marketing/marketing/MarketingServices.java ofbiz/branches/json-integration-refactoring/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java ofbiz/branches/json-integration-refactoring/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java ofbiz/branches/json-integration-refactoring/applications/order/servicedef/services.xml ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/OrderManagerEvents.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java (contents, props changed) ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/order/OrderEvents.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/order/OrderListState.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/quote/QuoteServices.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyHelper.java ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyServices.java ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyWorker.java ofbiz/branches/json-integration-refactoring/applications/product/script/org/ofbiz/product/product/ProductServices.xml ofbiz/branches/json-integration-refactoring/applications/product/servicedef/services.xml ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/category/CategoryServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/category/CategoryWorker.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/category/OfbizCatalogAltUrlTransform.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/imagemanagement/ImageUrlServlet.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/price/PriceServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/product/ProductEvents.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/product/ProductSearch.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/product/ProductServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/product/ProductWorker.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/product/VariantEvents.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/promo/PromoServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/test/StockMovesTest.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java ofbiz/branches/json-integration-refactoring/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java ofbiz/branches/json-integration-refactoring/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java ofbiz/branches/json-integration-refactoring/framework/common/data/GeoData.xml ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/CommonEvents.java ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/CommonWorkers.java ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/UrlServletHelper.java ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/geo/GeoWorker.java ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/login/LoginServices.java ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/cache/EntityCacheServices.java ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/ServiceUtil.java ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java ofbiz/branches/json-integration-refactoring/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java ofbiz/branches/json-integration-refactoring/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java ofbiz/branches/json-integration-refactoring/specialpurpose/cmssite/data/CmsSiteDemoData.xml ofbiz/branches/json-integration-refactoring/specialpurpose/cmssite/template/cms/MainDecorator.ftl ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/data/DemoWebSitePublishPointData.xml ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/data/topic.ftl ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java ofbiz/branches/json-integration-refactoring/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java ofbiz/branches/json-integration-refactoring/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java ofbiz/branches/json-integration-refactoring/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java ofbiz/branches/json-integration-refactoring/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java ofbiz/branches/json-integration-refactoring/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java ofbiz/branches/json-integration-refactoring/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java ofbiz/branches/json-integration-refactoring/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java ofbiz/branches/json-integration-refactoring/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumServices.java ofbiz/branches/json-integration-refactoring/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java Propchange: ofbiz/branches/json-integration-refactoring/ ------------------------------------------------------------------------------ Merged /ofbiz/trunk:r1634077-1635397 Modified: ofbiz/branches/json-integration-refactoring/applications/content/data/DemoBlogPubPtData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/content/data/DemoBlogPubPtData.xml?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/content/data/DemoBlogPubPtData.xml (original) +++ ofbiz/branches/json-integration-refactoring/applications/content/data/DemoBlogPubPtData.xml Thu Oct 30 06:10:58 2014 @@ -34,7 +34,7 @@ under the License. <ContentAssoc contentId="BLOGROOT" contentIdTo="BLOGROOTBIGAL" - contentAssocTypeId="SUB_CONTENT" + contentAssocTypeId="PUBLISH_LINK" fromDate="2004-11-22 17:32:33.987" createdByUserLogin="admin" lastModifiedByUserLogin="admin" @@ -56,7 +56,7 @@ under the License. <ContentAssoc contentId="BLOGROOT" contentIdTo="BLOGROOTMADMAX" - contentAssocTypeId="SUB_CONTENT" + contentAssocTypeId="PUBLISH_LINK" fromDate="2004-11-22 17:32:33.987" createdByUserLogin="admin" lastModifiedByUserLogin="admin" Modified: ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java Thu Oct 30 06:10:58 2014 @@ -28,7 +28,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; -import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.LocalDispatcher; /** Helper class containing static method useful when dealing @@ -64,9 +64,10 @@ public class BOMHelper { // If the date is null, set it to today. if (inDate == null) inDate = new Date(); int maxDepth = 0; - List<GenericValue> productNodesList = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productIdTo", productId, "productAssocTypeId", bomType), null, true); - productNodesList = EntityUtil.filterByDate(productNodesList, inDate); + List<GenericValue> productNodesList = EntityQuery.use(delegator).from("ProductAssoc") + .where("productIdTo", productId, + "productAssocTypeId", bomType) + .cache().filterByDate(inDate).queryList(); int depth = 0; for (GenericValue oneNode : productNodesList) { depth = 0; @@ -107,9 +108,10 @@ public class BOMHelper { productIdKeys = tree.getAllProductsId(); productIdKeys.add(productIdKey); } - List<GenericValue> productNodesList = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productIdTo", productId, "productAssocTypeId", bomType), null, true); - productNodesList = EntityUtil.filterByDate(productNodesList, inDate); + List<GenericValue> productNodesList = EntityQuery.use(delegator).from("ProductAssoc") + .where("productIdTo", productId, + "productAssocTypeId", bomType) + .cache().filterByDate(inDate).queryList(); GenericValue duplicatedNode = null; for (GenericValue oneNode : productNodesList) { for (int i = 0; i < productIdKeys.size(); i++) { @@ -133,11 +135,16 @@ public class BOMHelper { String shipmentId = request.getParameter("shipmentId"); try { - List<GenericValue> shipmentPlans = delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipmentId), null, false); + List<GenericValue> shipmentPlans = EntityQuery.use(delegator).from("OrderShipment") + .where("shipmentId", shipmentId).queryList(); for (GenericValue shipmentPlan : shipmentPlans) { GenericValue orderItem = shipmentPlan.getRelatedOne("OrderItem", false); - List<GenericValue> productionRuns = delegator.findByAnd("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId"), "shipGroupSeqId", shipmentPlan.getString("shipGroupSeqId")), null, true); + List<GenericValue> productionRuns = EntityQuery.use(delegator).from("WorkOrderItemFulfillment") + .where("orderId", shipmentPlan.get("orderId"), + "orderItemSeqId", shipmentPlan.get("orderItemSeqId"), + "shipGroupSeqId", shipmentPlan.get("shipGroupSeqId")) + .cache().queryList(); if (UtilValidate.isNotEmpty(productionRuns)) { Debug.logError("Production Run for order item (" + orderItem.getString("orderId") + "/" + orderItem.getString("orderItemSeqId") + ") not created.", module); continue; Modified: ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java Thu Oct 30 06:10:58 2014 @@ -36,6 +36,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.manufacturing.mrp.ProposedOrder; import org.ofbiz.service.GenericServiceException; @@ -85,7 +86,7 @@ public class BOMNode { } public BOMNode(String productId, Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) throws GenericEntityException { - this(delegator.findOne("Product", UtilMisc.toMap("productId", productId), false), dispatcher, userLogin); + this(EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(), dispatcher, userLogin); } protected void loadChildren(String partBomTypeId, Date inDate, List<GenericValue> productFeatures, int type) throws GenericEntityException { @@ -96,19 +97,19 @@ public class BOMNode { if (inDate == null) inDate = new Date(); bomTypeId = partBomTypeId; // Delegator delegator = product.getDelegator(); - List<GenericValue> rows = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productId", product.get("productId"), - "productAssocTypeId", partBomTypeId), - UtilMisc.toList("sequenceNum","productIdTo ASC"), false); - rows = EntityUtil.filterByDate(rows, inDate); + List<GenericValue> rows = EntityQuery.use(delegator).from("ProductAssoc") + .where("productId", product.get("productId"), + "productAssocTypeId", partBomTypeId) + .orderBy("sequenceNum", "productIdTo") + .filterByDate(inDate).queryList(); if ((UtilValidate.isEmpty(rows)) && substitutedNode != null) { // If no child is found and this is a substituted node // we try to search for substituted node's children. - rows = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productId", substitutedNode.getProduct().get("productId"), - "productAssocTypeId", partBomTypeId), - UtilMisc.toList("sequenceNum"), false); - rows = EntityUtil.filterByDate(rows, inDate); + rows = EntityQuery.use(delegator).from("ProductAssoc") + .where("productId", substitutedNode.getProduct().get("productId"), + "productAssocTypeId", partBomTypeId) + .orderBy("sequenceNum") + .filterByDate(inDate).queryList(); } children = FastList.newInstance(); children.addAll(rows); @@ -225,38 +226,40 @@ public class BOMNode { // If the part is VIRTUAL and // productFeatures and productPartRules are not null // we have to substitute the part with the right part's variant - List<GenericValue> productPartRules = delegator.findByAnd("ProductManufacturingRule", - UtilMisc.toMap("productId", productIdForRules, - "productIdFor", node.get("productId"), - "productIdIn", node.get("productIdTo")), null, false); + List<GenericValue> productPartRules = EntityQuery.use(delegator).from("ProductManufacturingRule") + .where("productId", productIdForRules, + "productIdFor", node.get("productId"), + "productIdIn", node.get("productIdTo")) + .filterByDate(inDate).queryList(); if (substitutedNode != null) { - productPartRules.addAll(delegator.findByAnd("ProductManufacturingRule", - UtilMisc.toMap("productId", productIdForRules, - "productIdFor", substitutedNode.getProduct().getString("productId"), - "productIdIn", node.get("productIdTo")), null, false)); + productPartRules.addAll(EntityQuery.use(delegator).from("ProductManufacturingRule") + .where("productId", productIdForRules, + "productIdFor", substitutedNode.getProduct().get("productId"), + "productIdIn", node.get("productIdTo")) + .filterByDate(inDate).queryList()); } - productPartRules = EntityUtil.filterByDate(productPartRules, inDate); newNode = substituteNode(oneChildNode, productFeatures, productPartRules); if (newNode.equals(oneChildNode)) { // If no substitution has been done (no valid rule applied), // we try to search for a generic link-rule - List<GenericValue> genericLinkRules = delegator.findByAnd("ProductManufacturingRule", - UtilMisc.toMap("productIdFor", node.get("productId"), - "productIdIn", node.get("productIdTo")), null, false); + List<GenericValue> genericLinkRules = EntityQuery.use(delegator).from("ProductManufacturingRule") + .where("productIdFor", node.get("productId"), + "productIdIn", node.get("productIdTo")) + .filterByDate(inDate).queryList(); if (substitutedNode != null) { - genericLinkRules.addAll(delegator.findByAnd("ProductManufacturingRule", - UtilMisc.toMap("productIdFor", substitutedNode.getProduct().getString("productId"), - "productIdIn", node.get("productIdTo")), null, false)); + genericLinkRules.addAll(EntityQuery.use(delegator).from("ProductManufacturingRule") + .where("productIdFor", substitutedNode.getProduct().get("productId"), + "productIdIn", node.get("productIdTo")) + .filterByDate(inDate).queryList()); } - genericLinkRules = EntityUtil.filterByDate(genericLinkRules, inDate); newNode = substituteNode(oneChildNode, productFeatures, genericLinkRules); if (newNode.equals(oneChildNode)) { // If no substitution has been done (no valid rule applied), // we try to search for a generic node-rule - List<GenericValue> genericNodeRules = delegator.findByAnd("ProductManufacturingRule", - UtilMisc.toMap("productIdIn", node.get("productIdTo")), - UtilMisc.toList("ruleSeqId"), false); - genericNodeRules = EntityUtil.filterByDate(genericNodeRules, inDate); + List<GenericValue> genericNodeRules = EntityQuery.use(delegator).from("ProductManufacturingRule") + .where("productIdIn", node.get("productIdTo")) + .orderBy("ruleSeqId") + .filterByDate(inDate).queryList(); newNode = null; newNode = substituteNode(oneChildNode, productFeatures, genericNodeRules); if (newNode.equals(oneChildNode)) { @@ -321,19 +324,19 @@ public class BOMNode { bomTypeId = partBomTypeId; // Delegator delegator = product.getDelegator(); - List<GenericValue> rows = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productIdTo", product.get("productId"), - "productAssocTypeId", partBomTypeId), - UtilMisc.toList("sequenceNum"), false); - rows = EntityUtil.filterByDate(rows, inDate); + List<GenericValue> rows = EntityQuery.use(delegator).from("ProductAssoc") + .where("productIdTo", product.get("productId"), + "productAssocTypeId", partBomTypeId) + .orderBy("sequenceNum") + .filterByDate(inDate).queryList(); if ((UtilValidate.isEmpty(rows)) && substitutedNode != null) { // If no parent is found and this is a substituted node // we try to search for substituted node's parents. - rows = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productIdTo", substitutedNode.getProduct().get("productId"), - "productAssocTypeId", partBomTypeId), - UtilMisc.toList("sequenceNum"), false); - rows = EntityUtil.filterByDate(rows, inDate); + rows = EntityQuery.use(delegator).from("ProductAssoc") + .where("productIdTo", substitutedNode.getProduct().get("productId"), + "productAssocTypeId", partBomTypeId) + .orderBy("sequenceNum") + .filterByDate(inDate).queryList(); } children = FastList.newInstance(); children.addAll(rows); Modified: ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java Thu Oct 30 06:10:58 2014 @@ -37,7 +37,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; -import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.order.order.OrderReadHelper; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -82,7 +82,8 @@ public class BOMServices { List<String> bomTypes = FastList.newInstance(); if (bomType == null) { try { - List<GenericValue> bomTypesValues = delegator.findByAnd("ProductAssocType", UtilMisc.toMap("parentTypeId", "PRODUCT_COMPONENT"), null, false); + List<GenericValue> bomTypesValues = EntityQuery.use(delegator).from("ProductAssocType") + .where("parentTypeId", "PRODUCT_COMPONENT").queryList(); for (GenericValue bomTypesValue : bomTypesValues) { bomTypes.add(bomTypesValue.getString("productAssocTypeId")); } @@ -135,19 +136,20 @@ public class BOMServices { Long llc = null; try { - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); Map<String, Object> depthResult = dispatcher.runSync("getMaxDepth", UtilMisc.toMap("productId", productId, "bomType", "MANUF_COMPONENT")); llc = (Long)depthResult.get("depth"); // If the product is a variant of a virtual, then the billOfMaterialLevel cannot be // lower than the billOfMaterialLevel of the virtual product. - List<GenericValue> virtualProducts = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productIdTo", productId, "productAssocTypeId", "PRODUCT_VARIANT"), null, false); - virtualProducts = EntityUtil.filterByDate(virtualProducts); + List<GenericValue> virtualProducts = EntityQuery.use(delegator).from("ProductAssoc") + .where("productIdTo", productId, + "productAssocTypeId", "PRODUCT_VARIANT") + .filterByDate().queryList(); int virtualMaxDepth = 0; for (GenericValue oneVirtualProductAssoc : virtualProducts) { int virtualDepth = 0; - GenericValue virtualProduct = delegator.findOne("Product", UtilMisc.toMap("productId", oneVirtualProductAssoc.getString("productId")), false); + GenericValue virtualProduct = EntityQuery.use(delegator).from("Product").where("productId", oneVirtualProductAssoc.getString("productId")).queryOne(); if (virtualProduct.get("billOfMaterialLevel") != null) { virtualDepth = virtualProduct.getLong("billOfMaterialLevel").intValue(); } else { @@ -181,11 +183,12 @@ public class BOMServices { } } if (alsoVariants.booleanValue()) { - List<GenericValue> variantProducts = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT"), null, false); - variantProducts = EntityUtil.filterByDate(variantProducts, true); + List<GenericValue> variantProducts = EntityQuery.use(delegator).from("ProductAssoc") + .where("productId", productId, + "productAssocTypeId", "PRODUCT_VARIANT") + .filterByDate().queryList(); for (GenericValue oneVariantProductAssoc : variantProducts) { - GenericValue variantProduct = delegator.findOne("Product", UtilMisc.toMap("productId", oneVariantProductAssoc.getString("productId")), false); + GenericValue variantProduct = EntityQuery.use(delegator).from("Product").where("productId", oneVariantProductAssoc.getString("productId")).queryOne(); variantProduct.set("billOfMaterialLevel", llc); variantProduct.store(); } @@ -210,8 +213,7 @@ public class BOMServices { Locale locale = (Locale) context.get("locale"); try { - List<GenericValue> products = delegator.findList("Product", null, null, - UtilMisc.toList("isVirtual DESC"), null, false); + List<GenericValue> products = EntityQuery.use(delegator).from("Product").orderBy("isVirtual DESC").queryList(); Long zero = Long.valueOf(0); List<GenericValue> allProducts = FastList.newInstance(); for (GenericValue product : products) { @@ -473,7 +475,7 @@ public class BOMServices { String shipmentId = (String) context.get("shipmentId"); try { - List<GenericValue> packages = delegator.findByAnd("ShipmentPackage", UtilMisc.toMap("shipmentId", shipmentId), null, false); + List<GenericValue> packages = EntityQuery.use(delegator).from("ShipmentPackage").where("shipmentId", shipmentId).queryList(); if (!UtilValidate.isEmpty(packages)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomPackageAlreadyFound", locale)); } @@ -483,7 +485,7 @@ public class BOMServices { // ShipmentItems are loaded List<GenericValue> shipmentItems = null; try { - shipmentItems = delegator.findByAnd("ShipmentItem", UtilMisc.toMap("shipmentId", shipmentId), null, false); + shipmentItems = EntityQuery.use(delegator).from("ShipmentItem").where("shipmentId", shipmentId).queryList(); } catch (GenericEntityException gee) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorLoadingShipmentItems", locale)); } @@ -491,13 +493,15 @@ public class BOMServices { Map<String, Object> partyOrderShipments = FastMap.newInstance(); for (GenericValue shipmentItem : shipmentItems) { // Get the OrderShipments - List<GenericValue> orderShipments = null; + GenericValue orderShipment = null; try { - orderShipments = delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentItemSeqId", shipmentItem.getString("shipmentItemSeqId")), null, false); + orderShipment = EntityQuery.use(delegator).from("OrderShipment") + .where("shipmentId", shipmentId, + "shipmentItemSeqId", shipmentItem.get("shipmentItemSeqId")) + .queryFirst(); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); } - GenericValue orderShipment = org.ofbiz.entity.util.EntityUtil.getFirst(orderShipments); if (orderShipment != null && !orderReadHelpers.containsKey(orderShipment.getString("orderId"))) { orderReadHelpers.put(orderShipment.getString("orderId"), new OrderReadHelper(delegator, orderShipment.getString("orderId"))); } @@ -575,7 +579,7 @@ public class BOMServices { if (!boxTypes.containsKey(boxTypeId)) { GenericValue boxType = null; try { - boxType = delegator.findOne("ShipmentBoxType", UtilMisc.toMap("shipmentBoxTypeId", boxTypeId), false); + boxType = EntityQuery.use(delegator).from("ShipmentBoxType").where("shipmentBoxTypeId", boxTypeId).queryOne(); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); } @@ -604,7 +608,7 @@ public class BOMServices { if (!boxTypes.containsKey(boxTypeId)) { GenericValue boxType = null; try { - boxType = delegator.findOne("ShipmentBoxType", UtilMisc.toMap("shipmentBoxTypeId", boxTypeId), false); + boxType = EntityQuery.use(delegator).from("ShipmentBoxType").where("shipmentBoxTypeId", boxTypeId).queryOne(); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); } Modified: ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java Thu Oct 30 06:10:58 2014 @@ -31,6 +31,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.product.store.ProductStoreWorker; import org.ofbiz.service.LocalDispatcher; @@ -97,27 +98,28 @@ public class BOMTree { this.delegator = delegator; this.dispatcher = dispatcher; - inputProduct = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + inputProduct = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); String productIdForRules = productId; // The selected product features are loaded - List<GenericValue> productFeaturesAppl = delegator.findByAnd("ProductFeatureAppl", - UtilMisc.toMap("productId", productId, "productFeatureApplTypeId", "STANDARD_FEATURE"), null, false); + List<GenericValue> productFeaturesAppl = EntityQuery.use(delegator).from("ProductFeatureAppl") + .where("productId", productId, + "productFeatureApplTypeId", "STANDARD_FEATURE") + .queryList(); List<GenericValue> productFeatures = FastList.newInstance(); GenericValue oneProductFeatureAppl = null; for (int i = 0; i < productFeaturesAppl.size(); i++) { oneProductFeatureAppl = productFeaturesAppl.get(i); - productFeatures.add(delegator.findOne("ProductFeature", - UtilMisc.toMap("productFeatureId", oneProductFeatureAppl.getString("productFeatureId")), false)); - + productFeatures.add(oneProductFeatureAppl.getRelatedOne("ProductFeature", false)); } // If the product is manufactured as a different product, // load the new product GenericValue manufacturedAsProduct = manufacturedAsProduct(productId, inDate); // We load the information about the product that needs to be manufactured // from Product entity - GenericValue product = delegator.findOne("Product", - UtilMisc.toMap("productId", (manufacturedAsProduct != null? manufacturedAsProduct.getString("productIdTo"): productId)), false); + GenericValue product = EntityQuery.use(delegator).from("Product") + .where("productId", (manufacturedAsProduct != null? manufacturedAsProduct.getString("productIdTo"): productId)) + .queryOne(); if (product == null) return; BOMNode originalNode = new BOMNode(product, dispatcher, userLogin); originalNode.setTree(this); @@ -133,8 +135,9 @@ public class BOMTree { // load the new product productIdForRules = virtualProduct.getString("productId"); manufacturedAsProduct = manufacturedAsProduct(virtualProduct.getString("productId"), inDate); - product = delegator.findOne("Product", - UtilMisc.toMap("productId", (manufacturedAsProduct != null? manufacturedAsProduct.getString("productIdTo"): virtualProduct.get("productId"))), false); + product = EntityQuery.use(delegator).from("Product") + .where("productId", (manufacturedAsProduct != null? manufacturedAsProduct.getString("productIdTo"): virtualProduct.get("productId"))) + .queryOne(); } } if (product == null) return; @@ -162,15 +165,10 @@ public class BOMTree { } private GenericValue manufacturedAsProduct(String productId, Date inDate) throws GenericEntityException { - List<GenericValue> manufacturedAsProducts = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productId", productId, - "productAssocTypeId", "PRODUCT_MANUFACTURED"), null, false); - manufacturedAsProducts = EntityUtil.filterByDate(manufacturedAsProducts, inDate); - GenericValue manufacturedAsProduct = null; - if (UtilValidate.isNotEmpty(manufacturedAsProducts)) { - manufacturedAsProduct = EntityUtil.getFirst(manufacturedAsProducts); - } - return manufacturedAsProduct; + return EntityQuery.use(delegator).from("ProductAssoc") + .where("productId", productId, + "productAssocTypeId", "PRODUCT_MANUFACTURED") + .filterByDate(inDate).queryFirst(); } private boolean hasBom(GenericValue product, Date inDate) throws GenericEntityException { @@ -333,7 +331,7 @@ public class BOMTree { if (root != null) { if (UtilValidate.isEmpty(facilityId)) { if (orderId != null) { - GenericValue order = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + GenericValue order = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); String productStoreId = order.getString("productStoreId"); if (productStoreId != null) { GenericValue productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); @@ -344,7 +342,7 @@ public class BOMTree { } if (facilityId == null && shipmentId != null) { - GenericValue shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); + GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); facilityId = shipment.getString("originFacilityId"); } } Modified: ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java Thu Oct 30 06:10:58 2014 @@ -33,6 +33,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.manufacturing.techdata.TechDataServices; import org.ofbiz.service.LocalDispatcher; @@ -76,11 +77,11 @@ public class ProductionRun { try { if (! UtilValidate.isEmpty(productionRunId)) { this.dispatcher = dispatcher; - GenericValue workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", productionRunId), false); + GenericValue workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", productionRunId).queryOne(); if (workEffort != null) { // If this is a task, get the parent production run if (workEffort.getString("workEffortTypeId") != null && "PROD_ORDER_TASK".equals(workEffort.getString("workEffortTypeId"))) { - workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffort.getString("workEffortParentId")), false); + workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffort.getString("workEffortParentId")).queryOne(); } } this.productionRun = workEffort; Modified: ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java Thu Oct 30 06:10:58 2014 @@ -29,6 +29,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.service.LocalDispatcher; @@ -57,7 +58,7 @@ public class ProductionRunHelper { try { if (productionRunId != null) { - GenericValue productionRun = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", productionRunId), false); + GenericValue productionRun = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", productionRunId).queryOne(); if (productionRun != null) { List<GenericValue> productionRunProducts = productionRun.getRelated("WorkEffortGoodStandard", UtilMisc.toMap("workEffortGoodStdTypeId", "PRUN_PROD_DELIV"),null, false); GenericValue productionRunProduct = EntityUtil.getFirst(productionRunProducts); @@ -77,17 +78,20 @@ public class ProductionRunHelper { } public static boolean hasTask(Delegator delegator, String taskName, String workEffortId) throws GenericEntityException { - List<GenericValue> tasks = delegator.findByAnd("WorkEffort", - UtilMisc.toMap("workEffortParentId", workEffortId, + List<GenericValue> tasks = EntityQuery.use(delegator).from("WorkEffort") + .where("workEffortParentId", workEffortId, "workEffortTypeId", "PROD_ORDER_TASK", - "workEffortName", taskName), null, false); + "workEffortName", taskName) + .queryList(); return (UtilValidate.isNotEmpty(tasks)); } public static void getLinkedProductionRuns(Delegator delegator, LocalDispatcher dispatcher, String productionRunId, List<ProductionRun> productionRuns) throws GenericEntityException { productionRuns.add(new ProductionRun(productionRunId, delegator, dispatcher)); - List<GenericValue> linkedWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", - UtilMisc.toMap("workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY"), null, false)); + List<GenericValue> linkedWorkEfforts = EntityQuery.use(delegator).from("WorkEffortAssoc") + .where("workEffortIdTo", productionRunId, + "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY") + .filterByDate().queryList(); for (int i = 0; i < linkedWorkEfforts.size(); i++) { GenericValue link = linkedWorkEfforts.get(i); getLinkedProductionRuns(delegator, dispatcher, link.getString("workEffortIdFrom"), productionRuns); @@ -95,8 +99,9 @@ public class ProductionRunHelper { } public static String getRootProductionRun(Delegator delegator, String productionRunId) throws GenericEntityException { - List<GenericValue> linkedWorkEfforts = delegator.findByAnd("WorkEffortAssoc", UtilMisc.toMap("workEffortIdFrom", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY"), null, false); - GenericValue linkedWorkEffort = EntityUtil.getFirst(linkedWorkEfforts); + GenericValue linkedWorkEffort = EntityQuery.use(delegator).from("WorkEffortAssoc") + .where("workEffortIdFrom", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY") + .queryFirst(); if (linkedWorkEffort != null) { productionRunId = getRootProductionRun(delegator, linkedWorkEffort.getString("workEffortIdTo")); }