Author: adrianc
Date: Fri Aug 14 18:09:43 2009 New Revision: 804313 URL: http://svn.apache.org/viewvc?rev=804313&view=rev Log: Second pass at extracting interfaces in the entity component. Next step is moving interfaces, etc to framework/api. Added: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactory.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactoryImpl.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelObjectFactory.java (with props) ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelViewEntityImpl.java Modified: ofbiz/branches/executioncontext20090812/applications/order/src/org/ofbiz/order/order/OrderLookupServices.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/model/DynamicViewEntityImpl.java ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelReader.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/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/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=804313&r1=804312&r2=804313&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 Fri Aug 14 18:09:43 2009 @@ -26,11 +26,9 @@ import org.ofbiz.entity.GenericValue; 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.model.ModelFactory; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; -import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.security.Security; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -90,11 +88,11 @@ } // dynamic view entity - DynamicViewEntity dve = ModelUtil.createDynamicViewEntity(); + DynamicViewEntity dve = ModelFactory.createDynamicViewEntity(); dve.addMemberEntity("OH", "OrderHeader"); dve.addAliasAll("OH", ""); // no prefix - dve.addRelation("one-nofk", "", "OrderType", UtilMisc.toList(ModelUtil.createModelKeyMap("orderTypeId", "orderTypeId"))); - dve.addRelation("one-nofk", "", "StatusItem", UtilMisc.toList(ModelUtil.createModelKeyMap("statusId", "statusId"))); + dve.addRelation("one-nofk", "", "OrderType", UtilMisc.toList(ModelFactory.createModelKeyMap("orderTypeId", "orderTypeId"))); + dve.addRelation("one-nofk", "", "StatusItem", UtilMisc.toList(ModelFactory.createModelKeyMap("statusId", "statusId"))); // start the lookup String orderId = (String) context.get("orderId"); @@ -275,7 +273,7 @@ dve.addMemberEntity("OISG", "OrderItemShipGroup"); dve.addAlias("OISG", "shipmentMethodTypeId"); dve.addAlias("OISG", "carrierPartyId"); - dve.addViewLink("OH", "OISG", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "OISG", Boolean.FALSE, UtilMisc.toList(ModelFactory.createModelKeyMap("orderId", "orderId"))); if (UtilValidate.isNotEmpty(carrierPartyId )) { paramList.add("carrierPartyId=" + carrierPartyId); @@ -296,8 +294,8 @@ dve.addAlias("OPP", "orderPaymentPreferenceId"); dve.addAlias("PGR", "gatewayAvsResult"); dve.addAlias("PGR", "gatewayScoreResult"); - dve.addViewLink("OH", "OPP", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); - dve.addViewLink("OPP", "PGR", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderPaymentPreferenceId", "orderPaymentPreferenceId"))); + dve.addViewLink("OH", "OPP", Boolean.FALSE, UtilMisc.toList(ModelFactory.createModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OPP", "PGR", Boolean.FALSE, UtilMisc.toList(ModelFactory.createModelKeyMap("orderPaymentPreferenceId", "orderPaymentPreferenceId"))); } if (UtilValidate.isNotEmpty(gatewayAvsResult)) { @@ -315,7 +313,7 @@ dve.addMemberEntity("OT", "OrderRole"); dve.addAlias("OT", "partyId"); dve.addAlias("OT", "roleTypeId"); - dve.addViewLink("OH", "OT", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "OT", Boolean.FALSE, UtilMisc.toList(ModelFactory.createModelKeyMap("orderId", "orderId"))); } if (UtilValidate.isNotEmpty(partyId)) { @@ -350,7 +348,7 @@ dve.addAlias("OI", "productId"); dve.addAlias("OI", "budgetId"); dve.addAlias("OI", "quoteId"); - dve.addViewLink("OH", "OI", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "OI", Boolean.FALSE, UtilMisc.toList(ModelFactory.createModelKeyMap("orderId", "orderId"))); } if (UtilValidate.isNotEmpty(correspondingPoId)) { @@ -423,7 +421,7 @@ dve.addAlias("OP", "billingAccountId"); dve.addAlias("OP", "finAccountId"); dve.addAlias("OP", "paymentMethodId"); - dve.addViewLink("OH", "OP", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "OP", Boolean.FALSE, UtilMisc.toList(ModelFactory.createModelKeyMap("orderId", "orderId"))); } // search by billing account ID @@ -442,7 +440,7 @@ if (UtilValidate.isNotEmpty(cardNumber)) { dve.addMemberEntity("CC", "CreditCard"); dve.addAlias("CC", "cardNumber"); - dve.addViewLink("OP", "CC", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("paymentMethodId", "paymentMethodId"))); + dve.addViewLink("OP", "CC", Boolean.FALSE, UtilMisc.toList(ModelFactory.createModelKeyMap("paymentMethodId", "paymentMethodId"))); paramList.add("cardNumber=" + cardNumber); conditions.add(makeExpr("cardNumber", cardNumber)); @@ -452,7 +450,7 @@ if (UtilValidate.isNotEmpty(accountNumber)) { dve.addMemberEntity("EF", "EftAccount"); dve.addAlias("EF", "accountNumber"); - dve.addViewLink("OP", "EF", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("paymentMethodId", "paymentMethodId"))); + dve.addViewLink("OP", "EF", Boolean.FALSE, UtilMisc.toList(ModelFactory.createModelKeyMap("paymentMethodId", "paymentMethodId"))); paramList.add("accountNumber=" + accountNumber); conditions.add(makeExpr("accountNumber", accountNumber)); @@ -468,13 +466,13 @@ dve.addMemberEntity("II", "ItemIssuance"); dve.addAlias("II", "shipmentId"); dve.addAlias("II", "inventoryItemId"); - dve.addViewLink("OH", "II", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "II", Boolean.FALSE, UtilMisc.toList(ModelFactory.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(ModelUtil.createModelKeyMap("inventoryItemId", "inventoryItemId"))); + dve.addViewLink("II", "IV", Boolean.FALSE, UtilMisc.toList(ModelFactory.createModelKeyMap("inventoryItemId", "inventoryItemId"))); } } @@ -503,7 +501,7 @@ if (UtilValidate.isNotEmpty(hasBackOrders)) { dve.addMemberEntity("IR", "OrderItemShipGrpInvRes"); dve.addAlias("IR", "quantityNotAvailable"); - dve.addViewLink("OH", "IR", Boolean.FALSE, UtilMisc.toList(ModelUtil.createModelKeyMap("orderId", "orderId"))); + dve.addViewLink("OH", "IR", Boolean.FALSE, UtilMisc.toList(ModelFactory.createModelKeyMap("orderId", "orderId"))); paramList.add("hasBackOrders=" + hasBackOrders); if ("Y".equals(hasBackOrders)) { @@ -529,8 +527,8 @@ dve.addAlias("OCM", "contactMechId"); dve.addAlias("OCM", "contactMechPurposeTypeId"); dve.addAlias("PA", "countryGeoId"); - dve.addViewLink("OH", "OCM", Boolean.FALSE, ModelUtil.makeKeyMapList("orderId")); - dve.addViewLink("OCM", "PA", Boolean.FALSE, ModelUtil.makeKeyMapList("contactMechId")); + dve.addViewLink("OH", "OCM", Boolean.FALSE, ModelFactory.makeKeyMapList("orderId")); + dve.addViewLink("OCM", "PA", Boolean.FALSE, ModelFactory.makeKeyMapList("contactMechId")); EntityConditionList exprs = null; if ("Y".equals(includeCountry)) { 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=804313&r1=804312&r2=804313&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 Fri Aug 14 18:09:43 2009 @@ -44,8 +44,7 @@ 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.ModelFactory; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; import org.ofbiz.entity.util.EntityTypeUtil; @@ -1067,15 +1066,15 @@ paramList = paramList + "&lookupFlag=" + lookupFlag + "&showAll=" + showAll + "&extInfo=" + extInfo; // create the dynamic view entity - DynamicViewEntity dynamicView = ModelUtil.createDynamicViewEntity(); + DynamicViewEntity dynamicView = ModelFactory.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", ModelUtil.makeKeyMapList("partyTypeId")); - dynamicView.addRelation("many", "", "UserLogin", ModelUtil.makeKeyMapList("partyId")); + dynamicView.addRelation("one-nofk", "", "PartyType", ModelFactory.makeKeyMapList("partyTypeId")); + dynamicView.addRelation("many", "", "UserLogin", ModelFactory.makeKeyMapList("partyId")); // define the main condition & expression list List<EntityCondition> andExprs = FastList.newInstance(); @@ -1095,7 +1094,7 @@ dynamicView.addMemberEntity("PRSHP", "PartyRelationship"); dynamicView.addAlias("PRSHP", "partyIdTo"); dynamicView.addAlias("PRSHP", "partyRelationshipTypeId"); - dynamicView.addViewLink("PT", "PRSHP", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId", "partyIdTo")); + dynamicView.addViewLink("PT", "PRSHP", Boolean.FALSE, ModelFactory.makeKeyMapList("partyId", "partyIdTo")); List<String> ownerPartyIds = (List) context.get("ownerPartyIds"); EntityCondition relationshipCond = null; if (UtilValidate.isEmpty(ownerPartyIds)) { @@ -1155,7 +1154,7 @@ // modify the dynamic view dynamicView.addMemberEntity("UL", "UserLogin"); dynamicView.addAlias("UL", "userLoginId"); - dynamicView.addViewLink("PT", "UL", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); + dynamicView.addViewLink("PT", "UL", Boolean.FALSE, ModelFactory.makeKeyMapList("partyId")); // add the expr andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.LIKE, EntityFunction.UPPER("%"+userLoginId+"%"))); @@ -1174,7 +1173,7 @@ // modify the dynamic view dynamicView.addMemberEntity("PG", "PartyGroup"); dynamicView.addAlias("PG", "groupName"); - dynamicView.addViewLink("PT", "PG", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); + dynamicView.addViewLink("PT", "PG", Boolean.FALSE, ModelFactory.makeKeyMapList("partyId")); // add the expr andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("groupName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+groupName+"%"))); @@ -1191,7 +1190,7 @@ dynamicView.addMemberEntity("PE", "Person"); dynamicView.addAlias("PE", "firstName"); dynamicView.addAlias("PE", "lastName"); - dynamicView.addViewLink("PT", "PE", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); + dynamicView.addViewLink("PT", "PE", Boolean.FALSE, ModelFactory.makeKeyMapList("partyId")); fieldsToSelect.add("firstName"); fieldsToSelect.add("lastName"); @@ -1222,7 +1221,7 @@ // add role to view dynamicView.addMemberEntity("PR", "PartyRole"); dynamicView.addAlias("PR", "roleTypeId"); - dynamicView.addViewLink("PT", "PR", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); + dynamicView.addViewLink("PT", "PR", Boolean.FALSE, ModelFactory.makeKeyMapList("partyId")); // add the expr andExprs.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, roleTypeId)); @@ -1245,7 +1244,7 @@ // add role to view dynamicView.addMemberEntity("II", "InventoryItem"); dynamicView.addAlias("II", "ownerPartyId"); - dynamicView.addViewLink("PT", "II", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId", "ownerPartyId")); + dynamicView.addViewLink("PT", "II", Boolean.FALSE, ModelFactory.makeKeyMapList("partyId", "ownerPartyId")); } if (UtilValidate.isNotEmpty(inventoryItemId)) { paramList = paramList + "&inventoryItemId=" + inventoryItemId; @@ -1283,8 +1282,8 @@ dynamicView.addAlias("PA", "stateProvinceGeoId"); dynamicView.addAlias("PA", "countryGeoId"); dynamicView.addAlias("PA", "postalCode"); - dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); - dynamicView.addViewLink("PC", "PA", Boolean.FALSE, ModelUtil.makeKeyMapList("contactMechId")); + dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelFactory.makeKeyMapList("partyId")); + dynamicView.addViewLink("PC", "PA", Boolean.FALSE, ModelFactory.makeKeyMapList("contactMechId")); // filter on address1 String address1 = (String) context.get("address1"); @@ -1334,8 +1333,8 @@ dynamicView.addMemberEntity("CM", "ContactMech"); dynamicView.addAlias("PC", "contactMechId"); dynamicView.addAlias("CM", "infoString"); - dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); - dynamicView.addViewLink("PC", "CM", Boolean.FALSE, ModelUtil.makeKeyMapList("contactMechId")); + dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelFactory.makeKeyMapList("partyId")); + dynamicView.addViewLink("PC", "CM", Boolean.FALSE, ModelFactory.makeKeyMapList("contactMechId")); // filter on infoString String infoString = (String) context.get("infoString"); @@ -1358,8 +1357,8 @@ dynamicView.addAlias("TM", "countryCode"); dynamicView.addAlias("TM", "areaCode"); dynamicView.addAlias("TM", "contactNumber"); - dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelUtil.makeKeyMapList("partyId")); - dynamicView.addViewLink("PC", "TM", Boolean.FALSE, ModelUtil.makeKeyMapList("contactMechId")); + dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelFactory.makeKeyMapList("partyId")); + dynamicView.addViewLink("PC", "TM", Boolean.FALSE, ModelFactory.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=804313&r1=804312&r2=804313&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 Fri Aug 14 18:09:43 2009 @@ -42,8 +42,7 @@ import org.ofbiz.entity.condition.EntityExpr; 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.ModelFactory; import org.ofbiz.entity.util.EntityListIterator; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -874,8 +873,8 @@ } } - DynamicViewEntity salesUsageViewEntity = ModelUtil.createDynamicViewEntity(); - DynamicViewEntity productionUsageViewEntity = ModelUtil.createDynamicViewEntity(); + DynamicViewEntity salesUsageViewEntity = ModelFactory.createDynamicViewEntity(); + DynamicViewEntity productionUsageViewEntity = ModelFactory.createDynamicViewEntity(); if (! UtilValidate.isEmpty(checkTime)) { // Construct a dynamic view entity to search against for sales usage quantities @@ -883,9 +882,9 @@ salesUsageViewEntity.addMemberEntity("OH", "OrderHeader"); salesUsageViewEntity.addMemberEntity("ItIss", "ItemIssuance"); salesUsageViewEntity.addMemberEntity("InvIt", "InventoryItem"); - 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.addViewLink("OI", "OH", Boolean.valueOf(false), ModelFactory.makeKeyMapList("orderId")); + salesUsageViewEntity.addViewLink("OI", "ItIss", Boolean.valueOf(false), ModelFactory.makeKeyMapList("orderId", "orderId", "orderItemSeqId", "orderItemSeqId")); + salesUsageViewEntity.addViewLink("ItIss", "InvIt", Boolean.valueOf(false), ModelFactory.makeKeyMapList("inventoryItemId")); salesUsageViewEntity.addAlias("OI", "productId"); salesUsageViewEntity.addAlias("OH", "statusId"); salesUsageViewEntity.addAlias("OH", "orderTypeId"); @@ -898,8 +897,8 @@ productionUsageViewEntity.addMemberEntity("WEIA", "WorkEffortInventoryAssign"); productionUsageViewEntity.addMemberEntity("WE", "WorkEffort"); productionUsageViewEntity.addMemberEntity("II", "InventoryItem"); - productionUsageViewEntity.addViewLink("WEIA", "WE", Boolean.valueOf(false), ModelUtil.makeKeyMapList("workEffortId")); - productionUsageViewEntity.addViewLink("WEIA", "II", Boolean.valueOf(false), ModelUtil.makeKeyMapList("inventoryItemId")); + productionUsageViewEntity.addViewLink("WEIA", "WE", Boolean.valueOf(false), ModelFactory.makeKeyMapList("workEffortId")); + productionUsageViewEntity.addViewLink("WEIA", "II", Boolean.valueOf(false), ModelFactory.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=804313&r1=804312&r2=804313&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 Fri Aug 14 18:09:43 2009 @@ -49,9 +49,8 @@ import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.config.EntityConfigUtil; import org.ofbiz.entity.model.DynamicViewEntity; -import org.ofbiz.entity.model.ModelUtil; -import org.ofbiz.entity.model.ModelViewEntity.ComplexAlias; -import org.ofbiz.entity.model.ModelViewEntity.ComplexAliasField; +import org.ofbiz.entity.model.ModelFactory; +import org.ofbiz.entity.model.ModelViewEntity.*; import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityFindOptions; @@ -144,7 +143,7 @@ public List<EntityCondition> entityConditionList = FastList.newInstance(); public List<String> orderByList = FastList.newInstance(); public List<String> fieldsToSelect = UtilMisc.toList("mainProductId"); - public DynamicViewEntity dynamicViewEntity = ModelUtil.createDynamicViewEntity(); + public DynamicViewEntity dynamicViewEntity = ModelFactory.createDynamicViewEntity(); public boolean productIdGroupBy = false; public boolean includedKeywordSearch = false; public Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); @@ -186,7 +185,7 @@ this.visitId = visitId; dynamicViewEntity.addMemberEntity("PROD", "Product"); dynamicViewEntity.addMemberEntity("PRODCI", "ProductCalculatedInfo"); - dynamicViewEntity.addViewLink("PROD", "PRODCI", Boolean.TRUE, ModelUtil.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", "PRODCI", Boolean.TRUE, ModelFactory.makeKeyMapList("productId")); } public GenericDelegator getDelegator() { @@ -270,7 +269,7 @@ Debug.logInfo("Finished initial setup of keywords, doingBothAndOr=" + doingBothAndOr + ", andKeywordFixedSet=" + andKeywordFixedSet + "\n keywordFixedOrSetAndList=" + keywordFixedOrSetAndList, module); - ComplexAlias relevancyComplexAlias = new ComplexAlias("+"); + ComplexAlias relevancyComplexAlias = ModelFactory.createComplexAlias("+"); if (andKeywordFixedSet.size() > 0) { // add up the relevancyWeight fields from all keyword member entities for a total to sort by @@ -282,7 +281,7 @@ dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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); @@ -290,7 +289,7 @@ if (doingBothAndOr) { dynamicViewEntity.addAlias(entityAlias, prefix + "RelevancyWeight", "relevancyWeight", null, null, Boolean.TRUE, null); } - relevancyComplexAlias.addComplexAliasMember(new ComplexAliasField(entityAlias, "relevancyWeight", null, null)); + relevancyComplexAlias.addComplexAliasMember(ModelFactory.createComplexAliasField(entityAlias, "relevancyWeight", null, null)); } //TODO: find out why Oracle and other dbs don't like the query resulting from this and fix: productIdGroupBy = true; @@ -308,7 +307,7 @@ dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.makeKeyMapList("productId")); List<EntityCondition> keywordOrList = FastList.newInstance(); for (String keyword: keywordFixedOrSet) { keywordOrList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); @@ -318,7 +317,7 @@ productIdGroupBy = true; if (doingBothAndOr) { - relevancyComplexAlias.addComplexAliasMember(new ComplexAliasField(entityAlias, "relevancyWeight", null, "sum")); + relevancyComplexAlias.addComplexAliasMember(ModelFactory.createComplexAliasField(entityAlias, "relevancyWeight", null, "sum")); } else { dynamicViewEntity.addAlias(entityAlias, "totalRelevancy", "relevancyWeight", null, null, null, "sum"); } @@ -361,7 +360,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, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +376,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, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +395,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, ModelUtil.makeKeyMapList("productId")); - this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productFeatureId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelFactory.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 +417,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, ModelUtil.makeKeyMapList("productId")); - this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productFeatureId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelFactory.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 +471,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, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +485,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, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +503,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, ModelUtil.makeKeyMapList("productId")); - this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productFeatureId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelFactory.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 +525,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, ModelUtil.makeKeyMapList("productId")); - this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productFeatureId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelFactory.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 +546,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, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +562,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, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +580,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, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +596,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, ModelUtil.makeKeyMapList("productId")); + this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +844,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, ModelUtil.makeKeyMapList("productId")); + productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +1518,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, ModelUtil.makeKeyMapList("productId")); + context.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.makeKeyMapList("productId")); context.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPriceTypeId", EntityOperator.EQUALS, productPriceTypeId)); context.entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductPricePurposeId", EntityOperator.EQUALS, "PURCHASE")); @@ -1582,7 +1581,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, ModelUtil.makeKeyMapList("productId")); + productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +1675,7 @@ productSearchContext.dynamicViewEntity.addMemberEntity(entityAlias, "SupplierProduct"); productSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "SupplierPartyId", "partyId", null, null, null, null); - productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); + productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +1812,7 @@ productSearchContext.entityConditionList.add(EntityCondition.makeCondition(prefix + "GoodIdentificationValue", operator, goodIdentificationValue)); } - productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); + productSearchContext.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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 +1991,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(ModelUtil.createModelKeyMap("productId", "productId"))); + productSearchContext.dynamicViewEntity.addViewLink("PROD", "SPPRC", Boolean.TRUE, UtilMisc.toList(ModelFactory.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 +2061,7 @@ List entityConditionList = new FastList.newInstance(); List orderByList = new FastList.newInstance(); List fieldsToSelect = UtilMisc.toList("productId"); - DynamicViewEntity dynamicViewEntity = ModelUtil.createDynamicViewEntity(); + DynamicViewEntity dynamicViewEntity = ModelFactory.createDynamicViewEntity(); dynamicViewEntity.addMemberEntity("PROD", "Product"); dynamicViewEntity.addAlias("PROD", "productName"); boolean productIdGroupBy = false; @@ -2088,7 +2087,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, ModelUtil.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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)); @@ -2101,7 +2100,7 @@ if (keywordList.size() > 0) { if (isAnd) { // add up the relevancyWeight fields from all keyword member entities for a total to sort by - ComplexAlias complexAlias = new ComplexAlias("+"); + ComplexAlias complexAlias = ModelFactory.createComplexAlias("+"); for (String keyword: keywordList) { // make index based values and increment @@ -2111,11 +2110,11 @@ dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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); - complexAlias.addComplexAliasMember(new ComplexAliasField(entityAlias, "relevancyWeight")); + complexAlias.addComplexAliasMember(ModelFactory.createComplexAliasField(entityAlias, "relevancyWeight")); } dynamicViewEntity.addAlias(null, "totalRelevancy", null, null, null, null, null, complexAlias); orderByList.add("-totalRelevancy"); @@ -2129,7 +2128,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, ModelUtil.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.makeKeyMapList("productId")); orderByList.add("-totalRelevancy"); fieldsToSelect.add("totalRelevancy"); List<EntityCondition> keywordOrList = new FastList.newInstance(); @@ -2154,7 +2153,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, ModelUtil.makeKeyMapList("productId")); + dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelFactory.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=804313&r1=804312&r2=804313&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 Fri Aug 14 18:09:43 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.ModelUtil; +import org.ofbiz.entity.model.ModelFactory; 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 = ModelUtil.createDynamicViewEntity(); + DynamicViewEntity dve = ModelFactory.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 = ModelUtil.createDynamicViewEntity(); + DynamicViewEntity dve = ModelFactory.createDynamicViewEntity(); dve.addMemberEntity("PVIRT", "Product"); dve.addMemberEntity("PVA", "ProductAssoc"); //dve.addMemberEntity("PVAR", "Product"); - 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.addViewLink("PVIRT", "PVA", Boolean.FALSE, UtilMisc.toList(ModelFactory.createModelKeyMap("productId", "productId"))); + //dve.addViewLink("PVA", "PVAR", Boolean.FALSE, UtilMisc.toList(ModelFactory.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=804313&r1=804312&r2=804313&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 Fri Aug 14 18:09:43 2009 @@ -47,9 +47,9 @@ import org.ofbiz.entity.condition.EntityFunction; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.model.DynamicViewEntity; +import org.ofbiz.entity.model.ModelFactory; import org.ofbiz.entity.model.ModelUtil; -import org.ofbiz.entity.model.ModelViewEntity.ComplexAlias; -import org.ofbiz.entity.model.ModelViewEntity.ComplexAliasField; +import org.ofbiz.entity.model.ModelViewEntity.*; import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityFindOptions; @@ -139,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 = ModelUtil.createDynamicViewEntity(); + public DynamicViewEntity dynamicViewEntity = ModelFactory.createDynamicViewEntity(); public boolean workEffortIdGroupBy = false; public boolean includedKeywordSearch = false; public Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); @@ -241,7 +241,7 @@ Debug.logInfo("Finished initial setup of keywords, doingBothAndOr=" + doingBothAndOr + ", andKeywordFixedSet=" + andKeywordFixedSet + "\n keywordFixedOrSetAndList=" + keywordFixedOrSetAndList, module); - ComplexAlias relevancyComplexAlias = new ComplexAlias("+"); + ComplexAlias relevancyComplexAlias = ModelFactory.createComplexAlias("+"); if (andKeywordFixedSet.size() > 0) { // add up the relevancyWeight fields from all keyword member entities for a total to sort by @@ -253,11 +253,11 @@ dynamicViewEntity.addMemberEntity(entityAlias, "WorkEffortKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("workEffortId")); + dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelFactory.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); - relevancyComplexAlias.addComplexAliasMember(new ComplexAliasField(entityAlias, "relevancyWeight", null, null)); + relevancyComplexAlias.addComplexAliasMember(ModelFactory.createComplexAliasField(entityAlias, "relevancyWeight", null, null)); } //TODO: find out why Oracle and other dbs don't like the query resulting from this and fix: workEffortIdGroupBy = true; @@ -275,7 +275,7 @@ dynamicViewEntity.addMemberEntity(entityAlias, "WorkEffortKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelUtil.makeKeyMapList("workEffortId")); + dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelFactory.makeKeyMapList("workEffortId")); List<EntityExpr> keywordOrList = FastList.newInstance(); for (String keyword: keywordFixedOrSet) { keywordOrList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); @@ -285,7 +285,7 @@ workEffortIdGroupBy = true; if (doingBothAndOr) { - relevancyComplexAlias.addComplexAliasMember(new ComplexAliasField(entityAlias, "relevancyWeight", null, "sum")); + relevancyComplexAlias.addComplexAliasMember(ModelFactory.createComplexAliasField(entityAlias, "relevancyWeight", null, "sum")); } else { dynamicViewEntity.addAlias(entityAlias, "totalRelevancy", "relevancyWeight", null, null, null, "sum"); } @@ -532,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, ModelUtil.makeKeyMapList("workEffortId","workEffortIdFrom")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.TRUE, ModelFactory.makeKeyMapList("workEffortId","workEffortIdFrom")); List<EntityExpr> assocConditionFromTo = FastList.newInstance(); assocConditionFromTo.add(EntityCondition.makeCondition(prefix + "WorkEffortIdTo", EntityOperator.IN, workEffortIdSet)); @@ -553,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, ModelUtil.makeKeyMapList("workEffortId","workEffortIdTo")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.TRUE, ModelFactory.makeKeyMapList("workEffortId","workEffortIdTo")); List<EntityExpr> assocConditionToFrom = FastList.newInstance(); assocConditionToFrom.add(EntityCondition.makeCondition(prefix + "WorkEffortIdFrom", EntityOperator.IN, workEffortIdSet)); @@ -658,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, ModelUtil.makeKeyMapList("workEffortId")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelFactory.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)); @@ -717,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, ModelUtil.makeKeyMapList("workEffortId")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelFactory.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))); @@ -824,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, ModelUtil.makeKeyMapList("workEffortId")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelFactory.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/model/DynamicViewEntityImpl.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntityImpl.java?rev=804313&r1=804312&r2=804313&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntityImpl.java (original) +++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntityImpl.java Fri Aug 14 18:09:43 2009 @@ -25,11 +25,10 @@ import java.util.Map; import org.ofbiz.entity.GenericDelegator; -import org.ofbiz.entity.model.ModelViewEntity.ComplexAliasMember; -import org.ofbiz.entity.model.ModelViewEntity.ModelAlias; -import org.ofbiz.entity.model.ModelViewEntity.ModelAliasAll; -import org.ofbiz.entity.model.ModelViewEntity.ModelMemberEntity; -import org.ofbiz.entity.model.ModelViewEntity.ModelViewLink; +import org.ofbiz.entity.model.ModelViewEntity; +import org.ofbiz.entity.model.ModelViewEntity.*; +import org.ofbiz.entity.model.ModelViewEntityImpl.*; + /** * This class is used for declaring Dynamic View Entities, to be used and thrown away. * A special method exists on the GenericDelegator to accept a DynamicViewEntity instead @@ -73,7 +72,7 @@ * @see org.ofbiz.entity.model.DynamicViewEntity#makeModelViewEntity(org.ofbiz.entity.GenericDelegator) */ public ModelViewEntity makeModelViewEntity(GenericDelegator delegator) { - ModelViewEntity modelViewEntity = new ModelViewEntity(this, delegator.getModelReader()); + ModelViewEntity modelViewEntity = new ModelViewEntityImpl(this, delegator.getModelReader()); return modelViewEntity; } @@ -150,7 +149,7 @@ * @see org.ofbiz.entity.model.DynamicViewEntity#addMemberEntity(java.lang.String, java.lang.String) */ public void addMemberEntity(String entityAlias, String entityName) { - ModelMemberEntity modelMemberEntity = new ModelMemberEntity(entityAlias, entityName); + ModelMemberEntity modelMemberEntity = new ModelMemberEntityImpl(entityAlias, entityName); this.memberModelMemberEntities.put(entityAlias, modelMemberEntity); } @@ -165,7 +164,7 @@ * @see org.ofbiz.entity.model.DynamicViewEntity#addAliasAll(java.lang.String, java.lang.String) */ public void addAliasAll(String entityAlias, String prefix) { - ModelAliasAll aliasAll = new ModelAliasAll(entityAlias, prefix); + ModelAliasAll aliasAll = new ModelAliasAllImpl(entityAlias, prefix); this.aliasAlls.add(aliasAll); } @@ -201,7 +200,7 @@ throw new IllegalArgumentException("name cannot be null in call to DynamicViewEntity.addAlias"); } - ModelAlias alias = new ModelAlias(entityAlias, name, field, colAlias, primKey, groupBy, function); + ModelAlias alias = new ModelAliasImpl(entityAlias, name, field, colAlias, primKey, groupBy, function); if (complexAliasMember != null) { alias.setComplexAliasMember(complexAliasMember); } @@ -219,7 +218,7 @@ * @see org.ofbiz.entity.model.DynamicViewEntity#addViewLink(java.lang.String, java.lang.String, java.lang.Boolean, java.util.List) */ public void addViewLink(String entityAlias, String relEntityAlias, Boolean relOptional, List<ModelKeyMap> modelKeyMaps) { - ModelViewLink modelViewLink = new ModelViewLink(entityAlias, relEntityAlias, relOptional, modelKeyMaps); + ModelViewLink modelViewLink = new ModelViewLinkImpl(entityAlias, relEntityAlias, relOptional, modelKeyMaps); this.viewLinks.add(modelViewLink); } Added: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactory.java?rev=804313&view=auto ============================================================================== --- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactory.java (added) +++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactory.java Fri Aug 14 18:09:43 2009 @@ -0,0 +1,83 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.entity.model; + +import java.util.List; + +import org.ofbiz.base.util.*; +import org.ofbiz.entity.model.ModelViewEntity.*; + +import org.w3c.dom.Element; + +public class ModelFactory { + + public static final String module = ModelFactory.class.getName(); + + public static ModelObjectFactory modelFactory = null; + + static { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + try { + modelFactory = (ModelObjectFactory) loader.loadClass("org.ofbiz.entity.model.ModelFactoryImpl").newInstance(); + } catch (Exception e) { + Debug.logError(e, module); + } + } + + public static List<ModelKeyMap> makeKeyMapList(String fieldName1) { + return modelFactory.makeKeyMapList(fieldName1); + } + + public static List<ModelKeyMap> makeKeyMapList(String fieldName1, String relFieldName1) { + return modelFactory.makeKeyMapList(fieldName1, relFieldName1); + } + + public static List<ModelKeyMap> makeKeyMapList(String fieldName1, String relFieldName1, String fieldName2, String relFieldName2) { + return modelFactory.makeKeyMapList(fieldName1, relFieldName1, fieldName2, relFieldName2); + } + + public static List<ModelKeyMap> makeKeyMapList(String fieldName1, String relFieldName1, String fieldName2, String relFieldName2, String fieldName3, String relFieldName3) { + return modelFactory.makeKeyMapList(fieldName1, relFieldName1, fieldName2, relFieldName2, fieldName3, relFieldName3); + } + + public static ModelKeyMap createModelKeyMap(String fieldName, String relFieldName) { + return modelFactory.createModelKeyMap(fieldName, relFieldName); + } + + public static DynamicViewEntity createDynamicViewEntity() { + return modelFactory.createDynamicViewEntity(); + } + + public static ComplexAlias createComplexAlias(String operator) { + return modelFactory.createComplexAlias(operator); + } + + public static ComplexAlias createComplexAlias(Element complexAliasElement) { + return modelFactory.createComplexAlias(complexAliasElement); + } + + public static ComplexAliasMember createComplexAliasField(Element complexAliasFieldElement) { + return modelFactory.createComplexAliasField(complexAliasFieldElement); + } + + public static ComplexAliasMember createComplexAliasField(String entityAlias, String field, String defaultValue, String function) { + return modelFactory.createComplexAliasField(entityAlias, field, defaultValue, function); + } + +} Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactory.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactory.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactoryImpl.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactoryImpl.java?rev=804313&view=auto ============================================================================== --- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactoryImpl.java (added) +++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactoryImpl.java Fri Aug 14 18:09:43 2009 @@ -0,0 +1,75 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.entity.model; + +import java.util.List; + +import org.ofbiz.base.util.*; +import org.ofbiz.entity.model.ModelViewEntity.*; +import org.ofbiz.entity.model.ModelViewEntityImpl.*; + +import org.w3c.dom.Element; + +public class ModelFactoryImpl implements ModelObjectFactory { + + public static final String module = ModelFactoryImpl.class.getName(); + + public ComplexAlias createComplexAlias(Element complexAliasElement) { + return new ComplexAliasImpl(complexAliasElement); + } + + public ComplexAlias createComplexAlias(String operator) { + return new ComplexAliasImpl(operator); + } + + public ComplexAliasMember createComplexAliasField(Element complexAliasFieldElement) { + return new ComplexAliasField(complexAliasFieldElement); + } + + public ComplexAliasMember createComplexAliasField(String entityAlias, String field, String defaultValue, String function) { + return new ComplexAliasField(entityAlias, field, defaultValue, function); + } + + public DynamicViewEntity createDynamicViewEntity() { + return new DynamicViewEntityImpl(); + } + + public ModelKeyMap createModelKeyMap(String fieldName, String relFieldName) { + return new ModelKeyMapImpl(fieldName, relFieldName); + } + + public List<ModelKeyMap> makeKeyMapList(String fieldName1) { + return UtilMisc.toList((ModelKeyMap)new ModelKeyMapImpl(fieldName1, null)); + } + + public List<ModelKeyMap> makeKeyMapList(String fieldName1, String relFieldName1) { + return UtilMisc.toList((ModelKeyMap)new ModelKeyMapImpl(fieldName1, relFieldName1)); + } + + public List<ModelKeyMap> makeKeyMapList(String fieldName1, String relFieldName1, String fieldName2, String relFieldName2) { + return UtilMisc.toList((ModelKeyMap)new ModelKeyMapImpl(fieldName1, relFieldName1), + (ModelKeyMap)new ModelKeyMapImpl(fieldName2, relFieldName2)); + } + + public List<ModelKeyMap> makeKeyMapList(String fieldName1, String relFieldName1, String fieldName2, String relFieldName2, String fieldName3, String relFieldName3) { + return UtilMisc.toList((ModelKeyMap)new ModelKeyMapImpl(fieldName1, relFieldName1), + (ModelKeyMap)new ModelKeyMapImpl(fieldName2, relFieldName2), + (ModelKeyMap)new ModelKeyMapImpl(fieldName3, relFieldName3)); + } +} Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactoryImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactoryImpl.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelFactoryImpl.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelObjectFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelObjectFactory.java?rev=804313&view=auto ============================================================================== --- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelObjectFactory.java (added) +++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelObjectFactory.java Fri Aug 14 18:09:43 2009 @@ -0,0 +1,34 @@ +package org.ofbiz.entity.model; + +import java.util.List; + +import org.ofbiz.entity.model.ModelViewEntity.*; +import org.w3c.dom.Element; + +public interface ModelObjectFactory { + + public List<ModelKeyMap> makeKeyMapList(String fieldName1); + + public List<ModelKeyMap> makeKeyMapList(String fieldName1, + String relFieldName1); + + public List<ModelKeyMap> makeKeyMapList(String fieldName1, + String relFieldName1, String fieldName2, String relFieldName2); + + public List<ModelKeyMap> makeKeyMapList(String fieldName1, + String relFieldName1, String fieldName2, String relFieldName2, + String fieldName3, String relFieldName3); + + public ModelKeyMap createModelKeyMap(String fieldName, String relFieldName); + + public DynamicViewEntity createDynamicViewEntity(); + + public ComplexAlias createComplexAlias(String operator); + + public ComplexAlias createComplexAlias(Element complexAliasElement); + + public ComplexAliasMember createComplexAliasField(Element complexAliasFieldElement); + + public ComplexAliasMember createComplexAliasField(String entityAlias, String field, String defaultValue, String function); + +} \ No newline at end of file Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelObjectFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelObjectFactory.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelObjectFactory.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelReader.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelReader.java?rev=804313&r1=804312&r2=804313&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelReader.java (original) +++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelReader.java Fri Aug 14 18:09:43 2009 @@ -556,7 +556,7 @@ ModelEntity createModelViewEntity(Element entityElement, UtilTimer utilTimer, ModelInfo def) { if (entityElement == null) return null; this.numViewEntities++; - ModelViewEntity entity = new ModelViewEntity(this, entityElement, utilTimer, def); + ModelViewEntity entity = new ModelViewEntityImpl(this, entityElement, utilTimer, def); return entity; } Modified: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java?rev=804313&r1=804312&r2=804313&view=diff ============================================================================== --- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java (original) +++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java Fri Aug 14 18:09:43 2009 @@ -19,9 +19,6 @@ package org.ofbiz.entity.model; import java.io.*; -import java.util.List; - -import javolution.util.FastList; import org.ofbiz.base.util.*; @@ -295,46 +292,4 @@ return "invalid-" + sqlTypeName + ":" + length + ":" + precision; } } - - // ======= ModelKeyMap Convenience Oriented Factory Methods ======= // - - public static List<ModelKeyMap> makeKeyMapList(String fieldName1) { - return UtilMisc.toList(createModelKeyMap(fieldName1, null)); - } - - public static List<ModelKeyMap> makeKeyMapList(String fieldName1, String relFieldName1) { - return UtilMisc.toList(createModelKeyMap(fieldName1, relFieldName1)); - } - - public static List<ModelKeyMap> makeKeyMapList(String fieldName1, String relFieldName1, String fieldName2, String relFieldName2) { - List<ModelKeyMap> modelKeyMapList = FastList.newInstance(); - modelKeyMapList.add(createModelKeyMap(fieldName1, relFieldName1)); - modelKeyMapList.add(createModelKeyMap(fieldName2, relFieldName2)); - return modelKeyMapList; - } - - public static List<ModelKeyMap> makeKeyMapList(String fieldName1, String relFieldName1, String fieldName2, String relFieldName2, String fieldName3, String relFieldName3) { - List<ModelKeyMap> modelKeyMapList = FastList.newInstance(); - modelKeyMapList.add(createModelKeyMap(fieldName1, relFieldName1)); - modelKeyMapList.add(createModelKeyMap(fieldName2, relFieldName2)); - modelKeyMapList.add(createModelKeyMap(fieldName3, relFieldName3)); - return modelKeyMapList; - } - - public static ModelKeyMap createModelKeyMap(String fieldName, String relFieldName) { - ModelKeyMap modelKeyMap = null; - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - try { - modelKeyMap = (ModelKeyMap) loader.loadClass("org.ofbiz.entity.model.ModelKeyMapImpl").newInstance(); - } catch (Exception e) { - Debug.logError(e, module); - } - modelKeyMap.setFieldName(fieldName); - modelKeyMap.setRelFieldName(UtilXml.checkEmpty(relFieldName, fieldName)); - return modelKeyMap; - } - - public static DynamicViewEntity createDynamicViewEntity() { - return new DynamicViewEntityImpl(); - } } |
Free forum by Nabble | Edit this page |