Author: adrianc
Date: Thu Aug 13 23:33:38 2009 New Revision: 804060 URL: http://svn.apache.org/viewvc?rev=804060&view=rev Log: First pass at extracting interfaces in the entity component. Once this is finished in the entity component, I'll move the interfaces, factories, util classes, etc to /framework/api. Added: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactory.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactoryImpl.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityObjectFactory.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/GenericEntityImpl.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/GenericPKImpl.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntityImpl.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelEntityImpl.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFieldImpl.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelKeyMapImpl.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelRelationImpl.java (with props) Modified: ofbiz/branches/executioncontext20090812/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java ofbiz/branches/executioncontext20090812/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/branches/executioncontext20090812/applications/party/src/org/ofbiz/party/party/PartyServices.java ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/product/ProductSearch.java ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java ofbiz/branches/executioncontext20090812/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/GenericEntity.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/GenericPK.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/GenericValue.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelField.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelKeyMap.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelReader.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java ofbiz/branches/executioncontext20090812/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java ofbiz/branches/executioncontext20090812/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java ofbiz/branches/executioncontext20090812/framework/webslinger/build.xml ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/expression/ActivityIteratorCondExprBldr.java ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/expression/BaseEntityCondExprBldr.java ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/instance/EntityPersistentMgr.java Modified: ofbiz/branches/executioncontext20090812/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=804060&r1=804059&r2=804060&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original) +++ ofbiz/branches/executioncontext20090812/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Aug 13 23:33:38 2009 @@ -43,6 +43,7 @@ import org.ofbiz.base.util.UtilNumber; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.EntityFactory; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.GenericEntityException; @@ -1525,7 +1526,7 @@ try { // Select all the unapplied payment applications associated to the billing account List<EntityExpr> conditionList = UtilMisc.toList(EntityCondition.makeCondition("billingAccountId", EntityOperator.EQUALS, billingAccountId), - EntityCondition.makeCondition("invoiceId", EntityOperator.EQUALS, GenericEntity.NULL_FIELD)); + EntityCondition.makeCondition("invoiceId", EntityOperator.EQUALS, EntityFactory.NULL_FIELD)); EntityCondition conditions = EntityCondition.makeCondition(conditionList, EntityOperator.AND); List<GenericValue> paymentApplications = delegator.findList("PaymentApplication", conditions, null, UtilMisc.toList("-amountApplied"), null, false); Modified: ofbiz/branches/executioncontext20090812/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java?rev=804060&r1=804059&r2=804060&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java (original) +++ ofbiz/branches/executioncontext20090812/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java Thu Aug 13 23:33:38 2009 @@ -33,6 +33,7 @@ import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.entity.EntityFactory; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericPK; import org.ofbiz.service.GenericServiceException; @@ -75,7 +76,7 @@ request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } - GenericPK key = GenericPK.create(delegator.getModelEntity("WorkEffortGoodStandard"), UtilMisc.toMap("workEffortId", (String)componentRow.get("productionRunTaskId"), + GenericPK key = EntityFactory.createGenericPK(delegator.getModelEntity("WorkEffortGoodStandard"), UtilMisc.toMap("workEffortId", (String)componentRow.get("productionRunTaskId"), "productId", (String)componentRow.get("productId"), "fromDate", fromDate, "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED")); Modified: ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java?rev=804060&r1=804059&r2=804060&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java (original) +++ ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java Thu Aug 13 23:33:38 2009 @@ -30,6 +30,7 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilNumber; import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.EntityFactory; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.GenericEntityException; @@ -148,7 +149,7 @@ // now we need to get the encrypted version of the fin account code the user passed in to look up against FinAccount // we do this by making a temporary generic entity with same finAccountCode and then doing a match ModelEntity finAccountEntity = delegator.getModelEntity("FinAccount"); - GenericEntity encryptedFinAccount = GenericEntity.createGenericEntity(finAccountEntity, UtilMisc.toMap("finAccountCode", finAccountCode)); + GenericEntity encryptedFinAccount = EntityFactory.createGenericEntity(finAccountEntity, UtilMisc.toMap("finAccountCode", finAccountCode)); delegator.encryptFields(encryptedFinAccount); String encryptedFinAccountCode = encryptedFinAccount.getString("finAccountCode"); Modified: ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java?rev=804060&r1=804059&r2=804060&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java (original) +++ ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java Thu Aug 13 23:33:38 2009 @@ -27,6 +27,7 @@ import org.ofbiz.entity.condition.*; import org.ofbiz.entity.model.DynamicViewEntity; import org.ofbiz.entity.model.ModelKeyMap; +import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; import org.ofbiz.entity.util.EntityUtil; @@ -89,11 +90,11 @@ } // dynamic view entity - DynamicViewEntity dve = new DynamicViewEntity(); + DynamicViewEntity dve = ModelUtil.createDynamicViewEntity(); dve.addMemberEntity("OH", "OrderHeader"); dve.addAliasAll("OH", ""); // no prefix - dve.addRelation("one-nofk", "", "OrderType", UtilMisc.toList(new ModelKeyMap("orderTypeId", "orderTypeId"))); - dve.addRelation("one-nofk", "", "StatusItem", UtilMisc.toList(new ModelKeyMap("statusId", "statusId"))); + dve.addRelation("one-nofk", "", "OrderType", UtilMisc.toList(ModelUtil.createModelKeyMap("orderTypeId", "orderTypeId"))); + dve.addRelation("one-nofk", "", "StatusItem", UtilMisc.toList(ModelUtil.createModelKeyMap("statusId", "statusId"))); // start the lookup String orderId = (String) context.get("orderId"); @@ -274,7 +275,7 @@ dve.addMemberEntity("OISG", "OrderItemShipGroup"); dve.addAlias("OISG", "shipmentMethodTypeId"); dve.addAlias("OISG", "carrierPartyId"); - dve.addViewLink("OH", "OISG", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "OISG", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); if (UtilValidate.isNotEmpty(carrierPartyId )) { paramList.add("carrierPartyId=" + carrierPartyId); @@ -295,8 +296,8 @@ dve.addAlias("OPP", "orderPaymentPreferenceId"); dve.addAlias("PGR", "gatewayAvsResult"); dve.addAlias("PGR", "gatewayScoreResult"); - dve.addViewLink("OH", "OPP", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("orderId", "orderId"))); - dve.addViewLink("OPP", "PGR", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("orderPaymentPreferenceId", "orderPaymentPreferenceId"))); + dve.addViewLink("OH", "OPP", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OPP", "PGR", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderPaymentPreferenceId", "orderPaymentPreferenceId"))); } if (UtilValidate.isNotEmpty(gatewayAvsResult)) { @@ -314,7 +315,7 @@ dve.addMemberEntity("OT", "OrderRole"); dve.addAlias("OT", "partyId"); dve.addAlias("OT", "roleTypeId"); - dve.addViewLink("OH", "OT", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "OT", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); } if (UtilValidate.isNotEmpty(partyId)) { @@ -349,7 +350,7 @@ dve.addAlias("OI", "productId"); dve.addAlias("OI", "budgetId"); dve.addAlias("OI", "quoteId"); - dve.addViewLink("OH", "OI", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "OI", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); } if (UtilValidate.isNotEmpty(correspondingPoId)) { @@ -422,7 +423,7 @@ dve.addAlias("OP", "billingAccountId"); dve.addAlias("OP", "finAccountId"); dve.addAlias("OP", "paymentMethodId"); - dve.addViewLink("OH", "OP", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "OP", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); } // search by billing account ID @@ -441,7 +442,7 @@ if (UtilValidate.isNotEmpty(cardNumber)) { dve.addMemberEntity("CC", "CreditCard"); dve.addAlias("CC", "cardNumber"); - dve.addViewLink("OP", "CC", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("paymentMethodId", "paymentMethodId"))); + dve.addViewLink("OP", "CC", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("paymentMethodId", "paymentMethodId"))); paramList.add("cardNumber=" + cardNumber); conditions.add(makeExpr("cardNumber", cardNumber)); @@ -451,7 +452,7 @@ if (UtilValidate.isNotEmpty(accountNumber)) { dve.addMemberEntity("EF", "EftAccount"); dve.addAlias("EF", "accountNumber"); - dve.addViewLink("OP", "EF", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("paymentMethodId", "paymentMethodId"))); + dve.addViewLink("OP", "EF", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("paymentMethodId", "paymentMethodId"))); paramList.add("accountNumber=" + accountNumber); conditions.add(makeExpr("accountNumber", accountNumber)); @@ -467,13 +468,13 @@ dve.addMemberEntity("II", "ItemIssuance"); dve.addAlias("II", "shipmentId"); dve.addAlias("II", "inventoryItemId"); - dve.addViewLink("OH", "II", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "II", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); if (softIdentifier != null || serialNumber != null) { dve.addMemberEntity("IV", "InventoryItem"); dve.addAlias("IV", "softIdentifier"); dve.addAlias("IV", "serialNumber"); - dve.addViewLink("II", "IV", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("inventoryItemId", "inventoryItemId"))); + dve.addViewLink("II", "IV", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("inventoryItemId", "inventoryItemId"))); } } @@ -502,7 +503,7 @@ if (UtilValidate.isNotEmpty(hasBackOrders)) { dve.addMemberEntity("IR", "OrderItemShipGrpInvRes"); dve.addAlias("IR", "quantityNotAvailable"); - dve.addViewLink("OH", "IR", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "IR", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); paramList.add("hasBackOrders=" + hasBackOrders); if ("Y".equals(hasBackOrders)) { @@ -528,8 +529,8 @@ dve.addAlias("OCM", "contactMechId"); dve.addAlias("OCM", "contactMechPurposeTypeId"); dve.addAlias("PA", "countryGeoId"); - dve.addViewLink("OH", "OCM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("orderId")); - dve.addViewLink("OCM", "PA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId")); + dve.addViewLink("OH", "OCM", Boolean.FALSE, ModelUtil.makeKeyMapList("orderId")); + dve.addViewLink("OCM", "PA", Boolean.FALSE, ModelUtil.makeKeyMapList("contactMechId")); EntityConditionList exprs = null; if ("Y".equals(includeCountry)) { Modified: ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=804060&r1=804059&r2=804060&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Aug 13 23:33:38 2009 @@ -49,8 +49,8 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.collections.ResourceBundleMapWrapper; import org.ofbiz.common.DataModelConstants; +import org.ofbiz.entity.EntityFactory; import org.ofbiz.entity.GenericDelegator; -import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; @@ -2865,9 +2865,9 @@ 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)); + itemsExprs.add(EntityCondition.makeCondition("dontCancelSetUserLogin", EntityOperator.EQUALS, EntityFactory.NULL_FIELD)); + itemsExprs.add(EntityCondition.makeCondition("dontCancelSetDate", EntityOperator.EQUALS, EntityFactory.NULL_FIELD)); + itemsExprs.add(EntityCondition.makeCondition("autoCancelDate", EntityOperator.NOT_EQUAL, EntityFactory.NULL_FIELD)); ecl = EntityCondition.makeCondition(itemsExprs); Modified: ofbiz/branches/executioncontext20090812/applications/party/src/org/ofbiz/party/party/PartyServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/party/src/org/ofbiz/party/party/PartyServices.java?rev=804060&r1=804059&r2=804060&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/applications/party/src/org/ofbiz/party/party/PartyServices.java (original) +++ ofbiz/branches/executioncontext20090812/applications/party/src/org/ofbiz/party/party/PartyServices.java Thu Aug 13 23:33:38 2009 @@ -45,6 +45,7 @@ import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.model.DynamicViewEntity; import org.ofbiz.entity.model.ModelKeyMap; +import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; import org.ofbiz.entity.util.EntityTypeUtil; @@ -1066,15 +1067,15 @@ paramList = paramList + "&lookupFlag=" + lookupFlag + "&showAll=" + showAll + "&extInfo=" + extInfo; // create the dynamic view entity - DynamicViewEntity dynamicView = new DynamicViewEntity(); + DynamicViewEntity dynamicView = ModelUtil.createDynamicViewEntity(); // default view settings dynamicView.addMemberEntity("PT", "Party"); dynamicView.addAlias("PT", "partyId"); dynamicView.addAlias("PT", "statusId"); dynamicView.addAlias("PT", "partyTypeId"); - dynamicView.addRelation("one-nofk", "", "PartyType", ModelKeyMap.makeKeyMapList("partyTypeId")); - dynamicView.addRelation("many", "", "UserLogin", ModelKeyMap.makeKeyMapList("partyId")); + dynamicView.addRelation("one-nofk", "", "PartyType", ModelUtil.makeKeyMapList("partyTypeId")); + dynamicView.addRelation("many", "", "UserLogin", ModelUtil.makeKeyMapList("partyId")); // define the main condition & expression list List<EntityCondition> andExprs = FastList.newInstance(); @@ -1094,7 +1095,7 @@ dynamicView.addMemberEntity("PRSHP", "PartyRelationship"); dynamicView.addAlias("PRSHP", "partyIdTo"); dynamicView.addAlias("PRSHP", "partyRelationshipTypeId"); - dynamicView.addViewLink("PT", "PRSHP", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId", "partyIdTo")); + dynamicView.addViewLink("PT", "PRSHP", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId", "partyIdTo")); List<String> ownerPartyIds = (List) context.get("ownerPartyIds"); EntityCondition relationshipCond = null; if (UtilValidate.isEmpty(ownerPartyIds)) { @@ -1154,7 +1155,7 @@ // modify the dynamic view dynamicView.addMemberEntity("UL", "UserLogin"); dynamicView.addAlias("UL", "userLoginId"); - dynamicView.addViewLink("PT", "UL", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId")); + dynamicView.addViewLink("PT", "UL", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); // add the expr andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.LIKE, EntityFunction.UPPER("%"+userLoginId+"%"))); @@ -1173,7 +1174,7 @@ // modify the dynamic view dynamicView.addMemberEntity("PG", "PartyGroup"); dynamicView.addAlias("PG", "groupName"); - dynamicView.addViewLink("PT", "PG", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId")); + dynamicView.addViewLink("PT", "PG", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); // add the expr andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("groupName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+groupName+"%"))); @@ -1190,7 +1191,7 @@ dynamicView.addMemberEntity("PE", "Person"); dynamicView.addAlias("PE", "firstName"); dynamicView.addAlias("PE", "lastName"); - dynamicView.addViewLink("PT", "PE", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId")); + dynamicView.addViewLink("PT", "PE", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); fieldsToSelect.add("firstName"); fieldsToSelect.add("lastName"); @@ -1221,7 +1222,7 @@ // add role to view dynamicView.addMemberEntity("PR", "PartyRole"); dynamicView.addAlias("PR", "roleTypeId"); - dynamicView.addViewLink("PT", "PR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId")); + dynamicView.addViewLink("PT", "PR", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); // add the expr andExprs.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, roleTypeId)); @@ -1244,7 +1245,7 @@ // add role to view dynamicView.addMemberEntity("II", "InventoryItem"); dynamicView.addAlias("II", "ownerPartyId"); - dynamicView.addViewLink("PT", "II", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId", "ownerPartyId")); + dynamicView.addViewLink("PT", "II", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId", "ownerPartyId")); } if (UtilValidate.isNotEmpty(inventoryItemId)) { paramList = paramList + "&inventoryItemId=" + inventoryItemId; @@ -1282,8 +1283,8 @@ dynamicView.addAlias("PA", "stateProvinceGeoId"); dynamicView.addAlias("PA", "countryGeoId"); dynamicView.addAlias("PA", "postalCode"); - dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId")); - dynamicView.addViewLink("PC", "PA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId")); + dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); + dynamicView.addViewLink("PC", "PA", Boolean.FALSE, ModelUtil.makeKeyMapList("contactMechId")); // filter on address1 String address1 = (String) context.get("address1"); @@ -1333,8 +1334,8 @@ dynamicView.addMemberEntity("CM", "ContactMech"); dynamicView.addAlias("PC", "contactMechId"); dynamicView.addAlias("CM", "infoString"); - dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId")); - dynamicView.addViewLink("PC", "CM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId")); + dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); + dynamicView.addViewLink("PC", "CM", Boolean.FALSE, ModelUtil.makeKeyMapList("contactMechId")); // filter on infoString String infoString = (String) context.get("infoString"); @@ -1357,8 +1358,8 @@ dynamicView.addAlias("TM", "countryCode"); dynamicView.addAlias("TM", "areaCode"); dynamicView.addAlias("TM", "contactNumber"); - dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId")); - dynamicView.addViewLink("PC", "TM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId")); + dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); + dynamicView.addViewLink("PC", "TM", Boolean.FALSE, ModelUtil.makeKeyMapList("contactMechId")); // filter on countryCode String countryCode = (String) context.get("countryCode"); Modified: ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=804060&r1=804059&r2=804060&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java (original) +++ ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java Thu Aug 13 23:33:38 2009 @@ -43,6 +43,7 @@ import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.model.DynamicViewEntity; import org.ofbiz.entity.model.ModelKeyMap; +import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityListIterator; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -873,8 +874,8 @@ } } - DynamicViewEntity salesUsageViewEntity = new DynamicViewEntity(); - DynamicViewEntity productionUsageViewEntity = new DynamicViewEntity(); + DynamicViewEntity salesUsageViewEntity = ModelUtil.createDynamicViewEntity(); + DynamicViewEntity productionUsageViewEntity = ModelUtil.createDynamicViewEntity(); if (! UtilValidate.isEmpty(checkTime)) { // Construct a dynamic view entity to search against for sales usage quantities @@ -882,9 +883,9 @@ salesUsageViewEntity.addMemberEntity("OH", "OrderHeader"); salesUsageViewEntity.addMemberEntity("ItIss", "ItemIssuance"); salesUsageViewEntity.addMemberEntity("InvIt", "InventoryItem"); - salesUsageViewEntity.addViewLink("OI", "OH", Boolean.valueOf(false), ModelKeyMap.makeKeyMapList("orderId")); - salesUsageViewEntity.addViewLink("OI", "ItIss", Boolean.valueOf(false), ModelKeyMap.makeKeyMapList("orderId", "orderId", "orderItemSeqId", "orderItemSeqId")); - salesUsageViewEntity.addViewLink("ItIss", "InvIt", Boolean.valueOf(false), ModelKeyMap.makeKeyMapList("inventoryItemId")); + salesUsageViewEntity.addViewLink("OI", "OH", Boolean.valueOf(false), ModelUtil.makeKeyMapList("orderId")); + salesUsageViewEntity.addViewLink("OI", "ItIss", Boolean.valueOf(false), ModelUtil.makeKeyMapList("orderId", "orderId", "orderItemSeqId", "orderItemSeqId")); + salesUsageViewEntity.addViewLink("ItIss", "InvIt", Boolean.valueOf(false), ModelUtil.makeKeyMapList("inventoryItemId")); salesUsageViewEntity.addAlias("OI", "productId"); salesUsageViewEntity.addAlias("OH", "statusId"); salesUsageViewEntity.addAlias("OH", "orderTypeId"); @@ -897,8 +898,8 @@ productionUsageViewEntity.addMemberEntity("WEIA", "WorkEffortInventoryAssign"); productionUsageViewEntity.addMemberEntity("WE", "WorkEffort"); productionUsageViewEntity.addMemberEntity("II", "InventoryItem"); - productionUsageViewEntity.addViewLink("WEIA", "WE", Boolean.valueOf(false), ModelKeyMap.makeKeyMapList("workEffortId")); - productionUsageViewEntity.addViewLink("WEIA", "II", Boolean.valueOf(false), ModelKeyMap.makeKeyMapList("inventoryItemId")); + productionUsageViewEntity.addViewLink("WEIA", "WE", Boolean.valueOf(false), ModelUtil.makeKeyMapList("workEffortId")); + productionUsageViewEntity.addViewLink("WEIA", "II", Boolean.valueOf(false), ModelUtil.makeKeyMapList("inventoryItemId")); productionUsageViewEntity.addAlias("WEIA", "quantity"); productionUsageViewEntity.addAlias("WE", "actualCompletionDate"); productionUsageViewEntity.addAlias("WE", "workEffortTypeId"); Modified: ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/product/ProductSearch.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/product/ProductSearch.java?rev=804060&r1=804059&r2=804060&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/product/ProductSearch.java (original) +++ ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/product/ProductSearch.java Thu Aug 13 23:33:38 2009 @@ -49,7 +49,7 @@ import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.config.EntityConfigUtil; import org.ofbiz.entity.model.DynamicViewEntity; -import org.ofbiz.entity.model.ModelKeyMap; +import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.model.ModelViewEntity.ComplexAlias; import org.ofbiz.entity.model.ModelViewEntity.ComplexAliasField; import org.ofbiz.entity.transaction.GenericTransactionException; @@ -144,7 +144,7 @@ public List<EntityCondition> entityConditionList = FastList.newInstance(); public List<String> orderByList = FastList.newInstance(); public List<String> fieldsToSelect = UtilMisc.toList("mainProductId"); - public DynamicViewEntity dynamicViewEntity = new DynamicViewEntity(); + public DynamicViewEntity dynamicViewEntity = ModelUtil.createDynamicViewEntity(); public boolean productIdGroupBy = false; public boolean includedKeywordSearch = false; public Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); @@ -186,7 +186,7 @@ this.visitId = visitId; dynamicViewEntity.addMemberEntity("PROD", "Product"); dynamicViewEntity.addMemberEntity("PRODCI", "ProductCalculatedInfo"); - dynamicViewEntity.addViewLink("PROD", "PRODCI", Boolean.TRUE, ModelKeyMap.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", "PRODCI", Boolean.TRUE, ModelUtil.makeKeyMapList("productId")); } public GenericDelegator getDelegator() { @@ -282,7 +282,7 @@ dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); entityConditionList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); //don't add an alias for this, will be part of a complex alias: dynamicViewEntity.addAlias(entityAlias, prefix + "RelevancyWeight", "relevancyWeight", null, null, null, null); @@ -308,7 +308,7 @@ dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); List<EntityCondition> keywordOrList = FastList.newInstance(); for (String keyword: keywordFixedOrSet) { keywordOrList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); @@ -361,7 +361,7 @@ this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ProductCategoryId", "productCategoryId", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); incExcCondList.add(EntityCondition.makeCondition(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); incExcCondList.add(EntityCondition.makeCondition(categoryPrefix + "ProductCategoryId", EntityOperator.EQUALS, includeCategoryId)); @@ -377,7 +377,7 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ProductFeatureId", "productFeatureId", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "ProductFeatureId", EntityOperator.EQUALS, includeFeatureId)); @@ -396,8 +396,8 @@ this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "ProductFeatureCategoryId", "productFeatureCategoryId", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productFeatureId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productFeatureId")); incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); incExcCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "ProductFeatureCategoryId", EntityOperator.EQUALS, includeFeatureCategoryId)); @@ -418,8 +418,8 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productFeatureId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productFeatureId")); incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); @@ -472,7 +472,7 @@ this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ProductCategoryId", "productCategoryId", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); alwIncCondList.add(EntityCondition.makeCondition(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); alwIncCondList.add(EntityCondition.makeCondition(categoryPrefix + "ProductCategoryId", EntityOperator.IN, alwaysIncludeCategoryIds)); @@ -486,7 +486,7 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ProductFeatureId", "productFeatureId", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "ProductFeatureId", EntityOperator.IN, alwaysIncludeFeatureIds)); @@ -504,8 +504,8 @@ this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "ProductFeatureCategoryId", "productFeatureCategoryId", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productFeatureId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productFeatureId")); alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); alwIncCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "ProductFeatureCategoryId", EntityOperator.EQUALS, alwaysIncludeFeatureCategoryId)); @@ -526,8 +526,8 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productFeatureId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productFeatureId")); alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); @@ -547,7 +547,7 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ProductFeatureId", "productFeatureId", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "ProductFeatureId", EntityOperator.IN, includeFeatureIdOrSet)); @@ -563,7 +563,7 @@ this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ProductFeatureId", "productFeatureId", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "ProductFeatureId", EntityOperator.IN, alwaysIncludeFeatureIdOrSet)); @@ -581,7 +581,7 @@ this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ProductCategoryId", "productCategoryId", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); incExcCondList.add(EntityCondition.makeCondition(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); incExcCondList.add(EntityCondition.makeCondition(categoryPrefix + "ProductCategoryId", EntityOperator.IN, includeCategoryIdOrSet)); @@ -597,7 +597,7 @@ this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ProductCategoryId", "productCategoryId", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "FromDate", "fromDate", null, null, null, null); this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ThruDate", "thruDate", null, null, null, null); - this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp))); alwIncCondList.add(EntityCondition.makeCondition(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp)); alwIncCondList.add(EntityCondition.makeCondition(categoryPrefix + "ProductCategoryId", EntityOperator.IN, alwaysIncludeCategoryIdOrSet)); @@ -845,7 +845,7 @@ productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ProductCategoryId", "productCategoryId", null, null, null, null); productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductCategoryId", EntityOperator.IN, productCategoryIds)); productSearchContext.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, productSearchContext.nowTimestamp))); productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, productSearchContext.nowTimestamp)); @@ -1519,7 +1519,7 @@ context.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); context.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - context.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + context.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); context.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPriceTypeId", EntityOperator.EQUALS, productPriceTypeId)); context.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPricePurposeId", EntityOperator.EQUALS, "PURCHASE")); @@ -1582,7 +1582,7 @@ productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "Price", "price", null, null, null, null); - productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPriceTypeId", EntityOperator.EQUALS, "LIST_PRICE")); productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPricePurposeId", EntityOperator.EQUALS, "PURCHASE")); @@ -1676,7 +1676,7 @@ productSearchContext.dynamicViewEntity.addMemberEntity(entityAlias, "SupplierProduct"); productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "SupplierPartyId", "partyId", null, null, null, null); - productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "SupplierPartyId", EntityOperator.EQUALS, supplierPartyId)); // add in productSearchConstraint, don't worry about the productSearchResultId or constraintSeqId, those will be fill in later @@ -1813,7 +1813,7 @@ productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "GoodIdentificationValue", operator, goodIdentificationValue)); } - productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", "goodIdentificationTypeId [" + this.goodIdentificationTypeId + "] goodIdentificationValue [" + this.goodIdentificationValue + "] include [" + this.include + "]"))); @@ -1992,7 +1992,7 @@ // SortProductPrice, this will be a bit more complex, need to add a ProductPrice member entity productSearchContext.dynamicViewEntity.addMemberEntity("SPPRC", "ProductPrice"); - productSearchContext.dynamicViewEntity.addViewLink("PROD", "SPPRC", Boolean.TRUE, UtilMisc.toList(new ModelKeyMap("productId", "productId"))); + productSearchContext.dynamicViewEntity.addViewLink("PROD", "SPPRC", Boolean.TRUE, UtilMisc.toList(ModelUtil.createModelKeyMap("productId", "productId"))); productSearchContext.dynamicViewEntity.addAlias("SPPRC", "sortProductPriceTypeId", "productPriceTypeId", null, null, null, null); productSearchContext.dynamicViewEntity.addAlias("SPPRC", "sortCurrencyUomId", "currencyUomId", null, null, null, null); productSearchContext.dynamicViewEntity.addAlias("SPPRC", "sortProductStoreGroupId", "productStoreGroupId", null, null, null, null); @@ -2062,7 +2062,7 @@ List entityConditionList = new FastList.newInstance(); List orderByList = new FastList.newInstance(); List fieldsToSelect = UtilMisc.toList("productId"); - DynamicViewEntity dynamicViewEntity = new DynamicViewEntity(); + DynamicViewEntity dynamicViewEntity = ModelUtil.createDynamicViewEntity(); dynamicViewEntity.addMemberEntity("PROD", "Product"); dynamicViewEntity.addAlias("PROD", "productName"); boolean productIdGroupBy = false; @@ -2088,7 +2088,7 @@ dynamicViewEntity.addAlias(entityAlias, prefix + "ProductCategoryId", "productCategoryId", null, null, null, null); dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductCategoryId", EntityOperator.IN, productCategoryIdList)); entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, nowTimestamp))); entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, nowTimestamp)); @@ -2111,7 +2111,7 @@ dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); entityConditionList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); //don't add an alias for this, will be part of a complex alias: dynamicViewEntity.addAlias(entityAlias, prefix + "RelevancyWeight", "relevancyWeight", null, null, null, null); @@ -2129,7 +2129,7 @@ dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword"); dynamicViewEntity.addAlias(entityAlias, "totalRelevancy", "relevancyWeight", null, null, null, "sum"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); orderByList.add("-totalRelevancy"); fieldsToSelect.add("totalRelevancy"); List<EntityCondition> keywordOrList = new FastList.newInstance(); @@ -2154,7 +2154,7 @@ dynamicViewEntity.addAlias(entityAlias, prefix + "ProductFeatureId", "productFeatureId", null, null, null, null); dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductFeatureId", EntityOperator.EQUALS, productFeatureId)); entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, nowTimestamp))); entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, nowTimestamp)); Modified: ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java?rev=804060&r1=804059&r2=804060&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java (original) +++ ofbiz/branches/executioncontext20090812/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java Thu Aug 13 23:33:38 2009 @@ -42,7 +42,7 @@ import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.model.DynamicViewEntity; import org.ofbiz.entity.model.ModelEntity; -import org.ofbiz.entity.model.ModelKeyMap; +import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityListIterator; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.service.DispatchContext; @@ -175,7 +175,7 @@ String errMsg = null; try { - DynamicViewEntity dve = new DynamicViewEntity(); + DynamicViewEntity dve = ModelUtil.createDynamicViewEntity(); dve.addMemberEntity("PCM", "ProductCategoryMember"); dve.addAlias("PCM", "productId", null, null, null, Boolean.TRUE, null); dve.addAlias("PCM", "productCategoryId", null, null, null, Boolean.TRUE, null); @@ -227,12 +227,12 @@ Debug.logInfo("Starting makeStandAloneFromSingleVariantVirtuals", module); - DynamicViewEntity dve = new DynamicViewEntity(); + DynamicViewEntity dve = ModelUtil.createDynamicViewEntity(); dve.addMemberEntity("PVIRT", "Product"); dve.addMemberEntity("PVA", "ProductAssoc"); //dve.addMemberEntity("PVAR", "Product"); - dve.addViewLink("PVIRT", "PVA", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("productId", "productId"))); - //dve.addViewLink("PVA", "PVAR", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("productIdTo", "productId"))); + dve.addViewLink("PVIRT", "PVA", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("productId", "productId"))); + //dve.addViewLink("PVA", "PVAR", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("productIdTo", "productId"))); dve.addAlias("PVIRT", "productId", null, null, null, Boolean.TRUE, null); dve.addAlias("PVIRT", "salesDiscontinuationDate", null, null, null, null, null); dve.addAlias("PVA", "productAssocTypeId", null, null, null, null, null); Modified: ofbiz/branches/executioncontext20090812/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java?rev=804060&r1=804059&r2=804060&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java (original) +++ ofbiz/branches/executioncontext20090812/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java Thu Aug 13 23:33:38 2009 @@ -44,11 +44,10 @@ 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.model.DynamicViewEntity; -import org.ofbiz.entity.model.ModelKeyMap; +import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.model.ModelViewEntity.ComplexAlias; import org.ofbiz.entity.model.ModelViewEntity.ComplexAliasField; import org.ofbiz.entity.transaction.GenericTransactionException; @@ -140,7 +139,7 @@ public List<EntityCondition> entityConditionList = FastList.newInstance(); public List<String> orderByList = FastList.newInstance(); public List<String> fieldsToSelect = UtilMisc.toList("workEffortId"); - public DynamicViewEntity dynamicViewEntity = new DynamicViewEntity(); + public DynamicViewEntity dynamicViewEntity = ModelUtil.createDynamicViewEntity(); public boolean workEffortIdGroupBy = false; public boolean includedKeywordSearch = false; public Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); @@ -254,7 +253,7 @@ dynamicViewEntity.addMemberEntity(entityAlias, "WorkEffortKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("workEffortId")); + dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("workEffortId")); entityConditionList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); //don't add an alias for this, will be part of a complex alias: dynamicViewEntity.addAlias(entityAlias, prefix + "RelevancyWeight", "relevancyWeight", null, null, null, null); @@ -276,7 +275,7 @@ dynamicViewEntity.addMemberEntity(entityAlias, "WorkEffortKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("workEffortId")); + dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("workEffortId")); List<EntityExpr> keywordOrList = FastList.newInstance(); for (String keyword: keywordFixedOrSet) { keywordOrList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); @@ -533,7 +532,7 @@ workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "WorkEffortAssocTypeId", "workEffortAssocTypeId", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.TRUE, ModelKeyMap.makeKeyMapList("workEffortId","workEffortIdFrom")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.TRUE, ModelUtil.makeKeyMapList("workEffortId","workEffortIdFrom")); List<EntityExpr> assocConditionFromTo = FastList.newInstance(); assocConditionFromTo.add(EntityCondition.makeCondition(prefix + "WorkEffortIdTo", EntityOperator.IN, workEffortIdSet)); @@ -554,7 +553,7 @@ workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "WorkEffortAssocTypeId", "workEffortAssocTypeId", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.TRUE, ModelKeyMap.makeKeyMapList("workEffortId","workEffortIdTo")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.TRUE, ModelUtil.makeKeyMapList("workEffortId","workEffortIdTo")); List<EntityExpr> assocConditionToFrom = FastList.newInstance(); assocConditionToFrom.add(EntityCondition.makeCondition(prefix + "WorkEffortIdFrom", EntityOperator.IN, workEffortIdSet)); @@ -659,7 +658,7 @@ workEffortSearchContext.dynamicViewEntity.addMemberEntity(entityAlias, "WorkEffortReview"); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ReviewText", "reviewText", null, null, null, null); - workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("workEffortId")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("workEffortId")); workEffortSearchContext.entityConditionList.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(prefix + "ReviewText"), EntityOperator.LIKE, EntityFunction.UPPER("%" + reviewTextString + "%"))); Map<String, String> valueMap = UtilMisc.toMap("constraintName", constraintName, "infoString", this.reviewTextString); workEffortSearchContext.workEffortSearchConstraintList.add(workEffortSearchContext.getDelegator().makeValue("WorkEffortSearchConstraint", valueMap)); @@ -718,7 +717,7 @@ workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "RoleTypeId", "roleTypeId", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("workEffortId")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("workEffortId")); workEffortSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "PartyId", EntityOperator.EQUALS, partyId)); workEffortSearchContext.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, workEffortSearchContext.nowTimestamp))); @@ -825,7 +824,7 @@ workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ProductId", "productId", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("workEffortId")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("workEffortId")); workEffortSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductId", EntityOperator.IN, productIdSet)); workEffortSearchContext.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, workEffortSearchContext.nowTimestamp))); Modified: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java?rev=804060&r1=804059&r2=804060&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java (original) +++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java Thu Aug 13 23:33:38 2009 @@ -1706,7 +1706,7 @@ fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName())); } - GenericPK dummyPK = GenericPK.create(relatedEntity, fields); + GenericPK dummyPK = EntityFactory.createGenericPK(relatedEntity, fields); dummyPK.setDelegator(this); return dummyPK; } @@ -1885,7 +1885,7 @@ if (entity == null) { throw new IllegalArgumentException("[GenericDelegator.makePK] could not find entity for entityName: " + entityName); } - GenericPK pk = GenericPK.create(entity, fields); + GenericPK pk = EntityFactory.createGenericPK(entity, fields); pk.setDelegator(this); return pk; @@ -1900,7 +1900,7 @@ if (entity == null) { throw new IllegalArgumentException("[GenericDelegator.makePKSingle] could not find entity for entityName: " + entityName); } - GenericPK pk = GenericPK.create(entity, singlePkValue); + GenericPK pk = EntityFactory.createGenericPK(entity, singlePkValue); pk.setDelegator(this); return pk; @@ -2233,7 +2233,7 @@ GenericValue removedEntity = null; if (testMode) { - removedEntity = this.findOne(primaryKey.entityName, primaryKey, false); + removedEntity = this.findOne(primaryKey.getEntityName(), primaryKey, false); } int num = helper.removeByPrimaryKey(primaryKey); this.saveEntitySyncRemoveInfo(primaryKey); Added: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactory.java?rev=804060&view=auto ============================================================================== --- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactory.java (added) +++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactory.java Thu Aug 13 23:33:38 2009 @@ -0,0 +1,86 @@ +package org.ofbiz.entity; + +import java.util.Map; + +import org.ofbiz.base.util.Debug; +import org.ofbiz.entity.model.ModelEntity; + +public class EntityFactory { + + public static interface NULL {} + + public static class NullField implements NULL, Comparable<NullField> { + protected NullField() { } + + @Override + public String toString() { + return "[null-field]"; + } + + public int compareTo(NullField other) { + return this != other ? -1 : 0; + } + } + + protected static EntityObjectFactory entityFactory = null; + + public static final String module = EntityFactory.class.getName(); + + public static GenericEntity NULL_ENTITY = null; + + public static final NullField NULL_FIELD = new NullField(); + + static { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + try { + entityFactory = (EntityObjectFactory) loader.loadClass("org.ofbiz.entity.EntityFactoryImpl").newInstance(); + } catch (Exception e) { + Debug.logError(e, module); + } + NULL_ENTITY = entityFactory.createNullEntity(); + } + + /** Copy Factory Method: Creates new GenericEntity from existing GenericEntity */ + public static GenericEntity createGenericEntity(GenericEntity value) { + if (value == null) { + throw new IllegalArgumentException("Cannot create a GenericEntity with a null value parameter"); + } + return entityFactory.createGenericEntity(value); + } + + /** Creates new GenericEntity */ + public static GenericEntity createGenericEntity(ModelEntity modelEntity) { + if (modelEntity == null) { + throw new IllegalArgumentException("Cannot create a GenericEntity with a null modelEntity parameter"); + } + return entityFactory.createGenericEntity(modelEntity); + } + + /** Creates new GenericEntity from existing Map */ + public static GenericEntity createGenericEntity(ModelEntity modelEntity, Map<String, ? extends Object> fields) { + if (modelEntity == null) { + throw new IllegalArgumentException("Cannot create a GenericEntity with a null modelEntity parameter"); + } + return entityFactory.createGenericEntity(modelEntity, fields); + } + + /** Creates new GenericPK */ + public static GenericPK createGenericPK(ModelEntity modelEntity) { + return entityFactory.createGenericPK(modelEntity); + } + + /** Creates new GenericPK from existing Map */ + public static GenericPK createGenericPK(ModelEntity modelEntity, Map<String, ? extends Object> fields) { + return entityFactory.createGenericPK(modelEntity, fields); + } + + /** Creates new GenericPK from existing Map */ + public static GenericPK createGenericPK(ModelEntity modelEntity, Object singlePkValue) { + return entityFactory.createGenericPK(modelEntity, singlePkValue); + } + + /** Creates new GenericPK from existing GenericPK */ + public static GenericPK createGenericPK(GenericPK value) { + return entityFactory.createGenericPK(value); + } +} \ No newline at end of file Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactory.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactory.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactoryImpl.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactoryImpl.java?rev=804060&view=auto ============================================================================== --- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactoryImpl.java (added) +++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactoryImpl.java Thu Aug 13 23:33:38 2009 @@ -0,0 +1,91 @@ +package org.ofbiz.entity; + +import java.util.Map; + +import javolution.context.ObjectFactory; + +import org.ofbiz.entity.model.ModelEntity; + +public class EntityFactoryImpl implements EntityObjectFactory { + + @SuppressWarnings("serial") + public static class NullGenericEntity extends GenericEntityImpl implements EntityFactory.NULL { + protected NullGenericEntity() { } + + @Override + public String getEntityName() { + return "[null-entity]"; + } + @Override + public String toString() { + return "[null-entity]"; + } + } + + protected static final ObjectFactory<GenericPKImpl> genericPKFactory = new ObjectFactory<GenericPKImpl>() { + @Override + protected GenericPKImpl create() { + return new GenericPKImpl(); + } + }; + + public GenericEntity createGenericEntity(GenericEntity value) { + if (value == null) { + throw new IllegalArgumentException("Cannot create a GenericEntity with a null value parameter"); + } + GenericEntityImpl newEntity = new GenericEntityImpl(); + newEntity.init(value); + return newEntity; + } + + public GenericEntity createGenericEntity(ModelEntity modelEntity) { + if (modelEntity == null) { + throw new IllegalArgumentException("Cannot create a GenericEntity with a null modelEntity parameter"); + } + GenericEntityImpl newEntity = new GenericEntityImpl(); + newEntity.init(modelEntity); + return newEntity; + } + + public GenericEntity createGenericEntity(ModelEntity modelEntity, Map<String, ? extends Object> fields) { + if (modelEntity == null) { + throw new IllegalArgumentException("Cannot create a GenericEntity with a null modelEntity parameter"); + } + GenericEntityImpl newEntity = new GenericEntityImpl(); + newEntity.init(modelEntity, fields); + return newEntity; + } + + public GenericEntity createNullEntity() { + return new NullGenericEntity(); + } + + /** Creates new GenericPK */ + public GenericPK createGenericPK(ModelEntity modelEntity) { + GenericPKImpl newPK = genericPKFactory.object(); + newPK.init(modelEntity); + return newPK; + } + + /** Creates new GenericPK from existing Map */ + public GenericPK createGenericPK(ModelEntity modelEntity, Map<String, ? extends Object> fields) { + GenericPKImpl newPK = genericPKFactory.object(); + newPK.init(modelEntity, fields); + return newPK; + } + + /** Creates new GenericPK from existing Map */ + public GenericPK createGenericPK(ModelEntity modelEntity, Object singlePkValue) { + GenericPKImpl newPK = genericPKFactory.object(); + newPK.init(modelEntity, singlePkValue); + return newPK; + } + + /** Creates new GenericPK from existing GenericPK */ + public GenericPK createGenericPK(GenericPK value) { + GenericPKImpl newPK = genericPKFactory.object(); + newPK.init(value); + return newPK; + } + +} \ No newline at end of file Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactoryImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactoryImpl.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityFactoryImpl.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityObjectFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityObjectFactory.java?rev=804060&view=auto ============================================================================== --- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityObjectFactory.java (added) +++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityObjectFactory.java Thu Aug 13 23:33:38 2009 @@ -0,0 +1,32 @@ +package org.ofbiz.entity; + +import java.util.Map; + +import org.ofbiz.entity.model.ModelEntity; + +public interface EntityObjectFactory { + + /** Copy Factory Method: Creates new GenericEntity from existing GenericEntity */ + public GenericEntity createGenericEntity(GenericEntity value); + + /** Creates new GenericEntity */ + public GenericEntity createGenericEntity(ModelEntity modelEntity); + + /** Creates new GenericEntity from existing Map */ + public GenericEntity createGenericEntity(ModelEntity modelEntity, + Map<String, ? extends Object> fields); + + public GenericEntity createNullEntity(); + + /** Creates new GenericPK */ + public GenericPK createGenericPK(ModelEntity modelEntity); + + /** Creates new GenericPK from existing Map */ + public GenericPK createGenericPK(ModelEntity modelEntity, Map<String, ? extends Object> fields); + + /** Creates new GenericPK from existing Map */ + public GenericPK createGenericPK(ModelEntity modelEntity, Object singlePkValue); + + /** Creates new GenericPK from existing GenericPK */ + public GenericPK createGenericPK(GenericPK value); +} \ No newline at end of file Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityObjectFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityObjectFactory.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/EntityObjectFactory.java ------------------------------------------------------------------------------ svn:mime-type = text/plain |
Free forum by Nabble | Edit this page |