Modified: ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/login/LoginServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/login/LoginServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/login/LoginServices.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/login/LoginServices.java Thu Oct 30 06:10:58 2014 @@ -50,6 +50,7 @@ import org.ofbiz.entity.transaction.Gene import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.security.Security; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.LocalDispatcher; @@ -493,7 +494,7 @@ public class LoginServices { GenericValue party = null; try { - party = delegator.findOne("Party", false, "partyId", partyId); + party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, "", module); } @@ -609,7 +610,7 @@ public class LoginServices { GenericValue userLoginToUpdate = null; try { - userLoginToUpdate = delegator.findOne("UserLogin", false, "userLoginId", userLoginId); + userLoginToUpdate = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errorMessage", e.getMessage()); errMsg = UtilProperties.getMessage(resource,"loginservices.could_not_change_password_read_failure", messageMap, locale); @@ -724,7 +725,7 @@ public class LoginServices { if (UtilValidate.isNotEmpty(partyId)) { //GenericValue party = null; //try { - // party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false); + // party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); //} catch (GenericEntityException e) { // Debug.logWarning(e, "", module); //} @@ -746,7 +747,7 @@ public class LoginServices { // check to see if there's a matching login and use it if it's for the same party try { - newUserLogin = delegator.findOne("UserLogin", false, "userLoginId", userLoginId); + newUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, "", module); Map<String, String> messageMap = UtilMisc.toMap("errorMessage", e.getMessage()); @@ -834,7 +835,7 @@ public class LoginServices { GenericValue userLoginToUpdate = null; try { - userLoginToUpdate = delegator.findOne("UserLogin", false, "userLoginId", userLoginId); + userLoginToUpdate = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errorMessage", e.getMessage()); errMsg = UtilProperties.getMessage(resource,"loginservices.could_not_change_password_read_failure", messageMap, locale);
Modified: ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java Thu Oct 30 06:10:58 2014 @@ -26,6 +26,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityConditionSubSelect; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.testtools.EntityTestCase; +import org.ofbiz.entity.util.EntityQuery; public class EntityCryptoTestSuite extends EntityTestCase { public EntityCryptoTestSuite(String name) { @@ -40,11 +41,11 @@ public class EntityCryptoTestSuite exten // Ensure that null values are passed thru unencrypted. delegator.create("TestingCrypto", UtilMisc.toMap("testingCryptoId", "1", "testingCryptoTypeId", "BASIC")); - GenericValue entity = delegator.findOne("TestingCrypto", UtilMisc.toMap("testingCryptoId", "1"), false); + GenericValue entity = EntityQuery.use(delegator).from("TestingCrypto").where("testingCryptoId", "1").queryOne(); assertNull(entity.getString("unencryptedValue")); assertNull(entity.getString("encryptedValue")); assertNull(entity.getString("saltedEncryptedValue")); - GenericValue view = delegator.findOne("TestingCryptoRawView", UtilMisc.toMap("testingCryptoId", "1"), false); + GenericValue view = EntityQuery.use(delegator).from("TestingCryptoRawView").where("testingCryptoId", "1").queryOne(); assertNull(view.getString("unencryptedValue")); assertNull(view.getString("encryptedValue")); assertNull(view.getString("saltedEncryptedValue")); Modified: ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java Thu Oct 30 06:10:58 2014 @@ -161,7 +161,7 @@ public final class EntityCrypto { GenericValue keyValue = null; try { - keyValue = delegator.findOne("EntityKeyStore", false, "keyName", hashedKeyName); + keyValue = EntityQuery.use(delegator).from("EntityKeyStore").where("keyName", hashedKeyName).queryOne(); } catch (GenericEntityException e) { throw new EntityCryptoException(e); } Modified: ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java Thu Oct 30 06:10:58 2014 @@ -55,7 +55,7 @@ public class EntityUtilProperties implem // find system property try { - GenericValue systemProperty = delegator.findOne("SystemProperty", UtilMisc.toMap("systemResourceId", resource, "systemPropertyId", name), true); + GenericValue systemProperty = EntityQuery.use(delegator).from("SystemProperty").where("systemResourceId", resource, "systemPropertyId", name).cache().queryOne(); if (systemProperty != null) { String systemPropertyValue = systemProperty.getString("systemPropertyValue"); if (UtilValidate.isNotEmpty(systemPropertyValue)) { Modified: ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/cache/EntityCacheServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/cache/EntityCacheServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/cache/EntityCacheServices.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/cache/EntityCacheServices.java Thu Oct 30 06:10:58 2014 @@ -29,6 +29,7 @@ import org.ofbiz.entity.GenericPK; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.util.DistributedCacheClear; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entityext.EntityServiceFactory; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -57,7 +58,7 @@ public class EntityCacheServices impleme public GenericValue getAuthUserLogin() { GenericValue userLogin = null; try { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), true); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Error finding the userLogin for distributed cache clear", module); } Modified: ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java Thu Oct 30 06:10:58 2014 @@ -47,6 +47,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.model.ModelEntity; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.security.Security; import org.ofbiz.service.ServiceUtil; @@ -276,7 +277,7 @@ public class EntityPermissionChecker { int privilegeEnumSeq = -1; if (UtilValidate.isNotEmpty(privilegeEnumId)) { - GenericValue privEnum = delegator.findOne("Enumeration", UtilMisc.toMap("enumId", privilegeEnumId), true); + GenericValue privEnum = EntityQuery.use(delegator).from("Enumeration").where("enumId", privilegeEnumId).cache().queryOne(); if (privEnum != null) { String sequenceId = privEnum.getString("sequenceId"); try { @@ -296,7 +297,7 @@ public class EntityPermissionChecker { String targetPrivilegeEnumId = entity.getString("privilegeEnumId"); if (UtilValidate.isNotEmpty(targetPrivilegeEnumId)) { int targetPrivilegeEnumSeq = -1; - GenericValue privEnum = delegator.findOne("Enumeration", UtilMisc.toMap("enumId", privilegeEnumId), true); + GenericValue privEnum = EntityQuery.use(delegator).from("Enumeration").where("enumId", privilegeEnumId).cache().queryOne(); if (privEnum != null) { String sequenceId = privEnum.getString("sequenceId"); try { @@ -1001,7 +1002,7 @@ public class EntityPermissionChecker { privilegeEnumId = currentValue.getString(this.privilegeFieldName); } if (UtilValidate.isNotEmpty(privilegeEnumId)) { - GenericValue privEnum = delegator.findOne("Enumeration", UtilMisc.toMap("enumId", privilegeEnumId), true); + GenericValue privEnum = EntityQuery.use(delegator).from("Enumeration").where("enumId", privilegeEnumId).cache().queryOne(); if (privEnum != null) { String sequenceId = privEnum.getString("sequenceId"); try { @@ -1293,7 +1294,7 @@ public class EntityPermissionChecker { if (entity.get("createdByUserLogin") != null) { String userLoginIdCB = (String)entity.get("createdByUserLogin"); try { - GenericValue userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginIdCB), true); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginIdCB).cache().queryOne(); if (userLogin != null) { String partyIdCB = userLogin.getString("partyId"); if (partyIdCB != null) { @@ -1358,7 +1359,7 @@ public class EntityPermissionChecker { int privilegeEnumSeq = -1; if (UtilValidate.isNotEmpty(privilegeEnumId)) { - GenericValue privEnum = delegator.findOne("Enumeration", UtilMisc.toMap("enumId", privilegeEnumId), true); + GenericValue privEnum = EntityQuery.use(delegator).from("Enumeration").where("enumId", privilegeEnumId).cache().queryOne(); if (privEnum != null) { String sequenceId = privEnum.getString("sequenceId"); try { Modified: ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java Thu Oct 30 06:10:58 2014 @@ -49,6 +49,7 @@ import org.ofbiz.entity.serialize.XmlSer import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entityext.EntityGroupUtil; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GeneralServiceException; @@ -163,7 +164,7 @@ public class EntitySyncContext { } try { - this.entitySync = delegator.findOne("EntitySync", false, "entitySyncId", this.entitySyncId); + this.entitySync = EntityQuery.use(delegator).from("EntitySync").where("entitySyncId", this.entitySyncId).queryOne(); if (this.entitySync == null) { throw new SyncAbortException("Not running EntitySync [" + entitySyncId + "], no record found with that ID."); } Modified: ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/ServiceUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/ServiceUtil.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/ServiceUtil.java Thu Oct 30 06:10:58 2014 @@ -49,6 +49,7 @@ import org.ofbiz.entity.transaction.Gene import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.security.Security; import org.ofbiz.service.config.ServiceConfigUtil; @@ -624,7 +625,7 @@ public class ServiceUtil { Delegator delegator = dctx.getDelegator(); if (UtilValidate.isNotEmpty(runAsUser)) { try { - GenericValue runAs = delegator.findOne("UserLogin", true, "userLoginId", runAsUser); + GenericValue runAs = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", runAsUser).cache().queryOne(); if (runAs != null) { userLogin = runAs; } Modified: ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java Thu Oct 30 06:10:58 2014 @@ -29,6 +29,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.util.EntityQuery; /** TemporalExpression persistence worker. */ public class TemporalExpressionWorker { @@ -61,7 +62,7 @@ public class TemporalExpressionWorker { if (UtilValidate.isEmpty(tempExprId)) { throw new IllegalArgumentException("tempExprId argument cannot be empty"); } - GenericValue exprValue = delegator.findOne("TemporalExpression", UtilMisc.toMap("tempExprId", tempExprId), true); + GenericValue exprValue = EntityQuery.use(delegator).from("TemporalExpression").where("tempExprId", tempExprId).cache().queryOne(); if (UtilValidate.isEmpty(exprValue)) { throw new IllegalArgumentException("tempExprId argument invalid - expression not found"); } Modified: ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java Thu Oct 30 06:10:58 2014 @@ -50,6 +50,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ServiceContainer; @@ -108,7 +109,7 @@ public class JavaMailContainer implement // load the userLogin object String runAsUser = ContainerConfig.getPropertyValue(cfg, "run-as-user", "system"); try { - this.userLogin = delegator.findOne("UserLogin", false, "userLoginId", runAsUser); + this.userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", runAsUser).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Unable to load run-as-user UserLogin; cannot start container", module); return false; Modified: ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java Thu Oct 30 06:10:58 2014 @@ -29,6 +29,7 @@ import org.ofbiz.entity.GenericEntityExc import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.ModelService; import org.ofbiz.service.job.JobManager; @@ -120,7 +121,7 @@ public class ServiceSemaphore { GenericValue semaphore; try { - semaphore = delegator.findOne("ServiceSemaphore", false, "serviceName", model.name); + semaphore = EntityQuery.use(delegator).from("ServiceSemaphore").where("serviceName", model.name).queryOne(); } catch (GenericEntityException e) { throw new SemaphoreFailException(e); } Modified: ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java Thu Oct 30 06:10:58 2014 @@ -31,6 +31,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.transaction.TransactionUtil; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericResultWaiter; import org.ofbiz.service.GenericServiceException; @@ -75,7 +76,7 @@ public class ServiceEngineTestServices { Locale locale = (Locale) context.get("locale"); try { // grab entity SVCLRT_A by changing, then wait, then find and change SVCLRT_B - GenericValue testingTypeA = delegator.findOne("TestingType", false, "testingTypeId", "SVCLRT_A"); + GenericValue testingTypeA = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVCLRT_A").queryOne(); testingTypeA.set("description", "New description for SVCLRT_A"); testingTypeA.store(); @@ -84,12 +85,12 @@ public class ServiceEngineTestServices { Thread.sleep(100); Debug.logInfo("In testServiceDeadLockRetryThreadA done with wait, updating SVCLRT_B", module); - GenericValue testingTypeB = delegator.findOne("TestingType", false, "testingTypeId", "SVCLRT_B"); + GenericValue testingTypeB = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVCLRT_B").queryOne(); testingTypeB.set("description", "New description for SVCLRT_B"); testingTypeB.store(); Debug.logInfo("In testServiceDeadLockRetryThreadA done with updating SVCLRT_B, updating SVCLRT_AONLY", module); - GenericValue testingTypeAOnly = delegator.findOne("TestingType", false, "testingTypeId", "SVCLRT_AONLY"); + GenericValue testingTypeAOnly = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVCLRT_AONLY").queryOne(); testingTypeAOnly.set("description", "New description for SVCLRT_AONLY; this is only changed by thread A so if it doesn't match something happened to thread A!"); testingTypeAOnly.store(); } catch (GenericEntityException e) { @@ -107,7 +108,7 @@ public class ServiceEngineTestServices { Locale locale = (Locale) context.get("locale"); try { // grab entity SVCLRT_B by changing, then wait, then change SVCLRT_A - GenericValue testingTypeB = delegator.findOne("TestingType", false, "testingTypeId", "SVCLRT_B"); + GenericValue testingTypeB = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVCLRT_B").queryOne(); testingTypeB.set("description", "New description for SVCLRT_B"); testingTypeB.store(); @@ -116,12 +117,12 @@ public class ServiceEngineTestServices { Thread.sleep(100); Debug.logInfo("In testServiceDeadLockRetryThreadB done with wait, updating SVCLRT_A", module); - GenericValue testingTypeA = delegator.findOne("TestingType", false, "testingTypeId", "SVCLRT_A"); + GenericValue testingTypeA = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVCLRT_A").queryOne(); testingTypeA.set("description", "New description for SVCLRT_A"); testingTypeA.store(); Debug.logInfo("In testServiceDeadLockRetryThreadA done with updating SVCLRT_A, updating SVCLRT_BONLY", module); - GenericValue testingTypeAOnly = delegator.findOne("TestingType", false, "testingTypeId", "SVCLRT_BONLY"); + GenericValue testingTypeAOnly = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVCLRT_BONLY").queryOne(); testingTypeAOnly.set("description", "New description for SVCLRT_BONLY; this is only changed by thread B so if it doesn't match something happened to thread B!"); testingTypeAOnly.store(); } catch (GenericEntityException e) { @@ -169,7 +170,7 @@ public class ServiceEngineTestServices { Locale locale = (Locale) context.get("locale"); try { // grab entity SVCLWTRT by changing, then wait a LONG time, ie more than the wait timeout - GenericValue testingType = delegator.findOne("TestingType", false, "testingTypeId", "SVCLWTRT"); + GenericValue testingType = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVCLWTRT").queryOne(); testingType.set("description", "New description for SVCLWTRT from the GRABBER service, this should be replaced by Waiter service in the service engine auto-retry"); testingType.store(); @@ -198,7 +199,7 @@ public class ServiceEngineTestServices { Debug.logInfo("In testServiceLockWaitTimeoutRetryWaiter about to update SVCLWTRT, wait starts here", module); // TRY grab entity SVCLWTRT by looking up and changing, should get a lock wait timeout exception because of the Grabber thread - GenericValue testingType = delegator.findOne("TestingType", false, "testingTypeId", "SVCLWTRT"); + GenericValue testingType = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVCLWTRT").queryOne(); testingType.set("description", "New description for SVCLWTRT from Waiter service, this is the value that should be there."); testingType.store(); @@ -238,7 +239,7 @@ public class ServiceEngineTestServices { Locale locale = (Locale) context.get("locale"); try { // grab entity SVCLWTRTCR by changing, then wait a LONG time, ie more than the wait timeout - GenericValue testingType = delegator.findOne("TestingType", false, "testingTypeId", "SVCLWTRTCR"); + GenericValue testingType = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVCLWTRTCR").queryOne(); testingType.set("description", "New description for SVCLWTRTCR from Lock Wait Timeout Lock GRABBER, this should be replaced by the one in the Waiter service."); testingType.store(); @@ -267,7 +268,7 @@ public class ServiceEngineTestServices { Debug.logInfo("In testServiceLockWaitTimeoutRetryCantRecoverWaiter updating SVCLWTRTCR", module); // TRY grab entity SVCLWTRTCR by looking up and changing, should get a lock wait timeout exception because of the Grabber thread - GenericValue testingType = delegator.findOne("TestingType", false, "testingTypeId", "SVCLWTRTCR"); + GenericValue testingType = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVCLWTRTCR").queryOne(); testingType.set("description", "New description for SVCLWTRTCR from Lock Wait Timeout Lock Waiter, this is the value that should be there."); testingType.store(); @@ -303,7 +304,7 @@ public class ServiceEngineTestServices { Locale locale = (Locale) context.get("locale"); try { // change the SVC_SRBO value first to test that the rollback really does revert/reset - GenericValue testingType = delegator.findOne("TestingType", false, "testingTypeId", "SVC_SRBO"); + GenericValue testingType = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVC_SRBO").queryOne(); testingType.set("description", "New description for SVC_SRBO; this should be reset on the rollback, if this is in the db then the test failed"); testingType.store(); @@ -346,7 +347,7 @@ public class ServiceEngineTestServices { Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); try { - GenericValue testingType = delegator.findOne("TestingType", false, "testingTypeId", "SVC_SECAGC"); + GenericValue testingType = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVC_SECAGC").queryOne(); testingType.set("description", "New description for SVC_SECAGC, what it should be after the global-commit test"); testingType.store(); } catch (GenericEntityException e) { @@ -365,7 +366,7 @@ public class ServiceEngineTestServices { Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); try { - GenericValue testingType = delegator.findOne("TestingType", false, "testingTypeId", "SVC_SECAGR"); + GenericValue testingType = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "SVC_SECAGR").queryOne(); testingType.set("description", "New description for SVC_SECAGR, what it should be after the global-rollback test"); testingType.store(); } catch (GenericEntityException e) { Modified: ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java Thu Oct 30 06:10:58 2014 @@ -29,6 +29,7 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.webapp.control.ConfigXMLReader; import org.ofbiz.webapp.control.ConfigXMLReader.ControllerConfig; import org.ofbiz.webapp.control.ConfigXMLReader.RequestMap; @@ -85,7 +86,7 @@ public final class OfbizUrlBuilder { Assert.notNull("delegator", delegator); String webSiteId = WebAppUtil.getWebSiteId(webAppInfo); if (webSiteId != null) { - GenericValue webSiteValue = delegator.findOne("WebSite", UtilMisc.toMap("webSiteId", webSiteId), true); + GenericValue webSiteValue = EntityQuery.use(delegator).from("WebSite").where("webSiteId", webSiteId).cache().queryOne(); if (webSiteValue != null) { webSiteProps = WebSiteProperties.from(webSiteValue); } Modified: ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java Thu Oct 30 06:10:58 2014 @@ -36,6 +36,7 @@ import org.ofbiz.entity.GenericEntityExc import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.serialize.XmlSerializer; import org.ofbiz.entity.transaction.TransactionUtil; +import org.ofbiz.entity.util.EntityQuery; /** * HttpSessionListener that gathers and tracks various information and statistics @@ -77,7 +78,7 @@ public class ControlEventListener implem GenericValue visit = (GenericValue) session.getAttribute("visit"); if (visit != null) { Delegator delegator = visit.getDelegator(); - visit = delegator.findOne("Visit", UtilMisc.toMap("visitId", visit.get("visitId")), false); + visit = EntityQuery.use(delegator).from("Visit").where("visitId", visit.get("visitId")).queryOne(); if (visit != null) { visit.set("thruDate", new Timestamp(session.getLastAccessedTime())); visit.store(); Modified: ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Thu Oct 30 06:10:58 2014 @@ -66,6 +66,7 @@ import org.ofbiz.entity.model.ModelEntit import org.ofbiz.entity.serialize.XmlSerializer; import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.security.Security; import org.ofbiz.security.SecurityConfigurationException; @@ -185,7 +186,7 @@ public class LoginWorker { try { beganTransaction = TransactionUtil.begin(); - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", userLoginId); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); if (userLogin == null) { Debug.logError("Could not find UserLogin record for setLoggedOut with userLoginId [" + userLoginId + "]", module); } else { @@ -757,7 +758,7 @@ public class LoginWorker { if (autoUserLoginId != null) { Debug.logInfo("Running autoLogin check.", module); try { - GenericValue autoUserLogin = delegator.findOne("UserLogin", false, "userLoginId", autoUserLoginId); + GenericValue autoUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", autoUserLoginId).queryOne(); GenericValue person = null; GenericValue group = null; if (autoUserLogin != null) { @@ -765,8 +766,8 @@ public class LoginWorker { ModelEntity modelUserLogin = autoUserLogin.getModelEntity(); if (modelUserLogin.isField("partyId")) { - person = delegator.findOne("Person", false, "partyId", autoUserLogin.getString("partyId")); - group = delegator.findOne("PartyGroup", false, "partyId", autoUserLogin.getString("partyId")); + person = EntityQuery.use(delegator).from("Person").where("partyId", autoUserLogin.getString("partyId")).queryOne(); + group = EntityQuery.use(delegator).from("PartyGroup").where("partyId", autoUserLogin.getString("partyId")).queryOne(); } } if (person != null) { @@ -827,7 +828,7 @@ public class LoginWorker { public static String loginUserWithUserLoginId(HttpServletRequest request, HttpServletResponse response, String userLoginId) { Delegator delegator = (Delegator) request.getAttribute("delegator"); try { - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", userLoginId); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); if (userLogin != null) { String enabled = userLogin.getString("enabled"); if (enabled == null || "Y".equals(enabled)) { @@ -941,7 +942,7 @@ public class LoginWorker { //Debug.logInfo("Looking up userLogin from CN: " + userLoginId, module); // CN should match the userLoginId - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", userLoginId); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); if (userLogin != null) { String enabled = userLogin.getString("enabled"); if (enabled == null || "Y".equals(enabled)) { Modified: ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Thu Oct 30 06:10:58 2014 @@ -51,6 +51,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.webapp.OfbizUrlBuilder; import org.ofbiz.webapp.event.EventFactory; import org.ofbiz.webapp.event.EventHandler; @@ -271,7 +272,7 @@ public class RequestHandler { String webSiteId = WebSiteWorker.getWebSiteId(request); if (webSiteId != null) { try { - GenericValue webSite = delegator.findOne("WebSite", UtilMisc.toMap("webSiteId", webSiteId), true); + GenericValue webSite = EntityQuery.use(delegator).from("WebSite").where("webSiteId", webSiteId).cache().queryOne(); if (webSite != null) enableHttps = webSite.getBoolean("enableHttps"); } catch (GenericEntityException e) { Debug.logWarning(e, "Problems with WebSite entity; using global defaults", module); Modified: ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java Thu Oct 30 06:10:58 2014 @@ -36,6 +36,7 @@ import org.ofbiz.entity.DelegatorFactory import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.model.ModelEntity; +import org.ofbiz.entity.util.EntityQuery; import com.ibm.icu.util.Calendar; @@ -474,7 +475,7 @@ public class ServerHitBin { // check for type data before running. GenericValue serverHitType = null; - serverHitType = delegator.findOne("ServerHitType", UtilMisc.toMap("hitTypeId", ServerHitBin.typeIds[this.type]), true); + serverHitType = EntityQuery.use(delegator).from("ServerHitType").where("hitTypeId", ServerHitBin.typeIds[this.type]).cache().queryOne(); if (serverHitType == null) { // datamodel data not loaded; not storing hit. Debug.logWarning("The datamodel data has not been loaded; cannot find hitTypeId '" + ServerHitBin.typeIds[this.type] + " not storing ServerHit.", module); @@ -488,7 +489,7 @@ public class ServerHitBin { return; } String visitId = visit.getString("visitId"); - visit = delegator.findOne("Visit", UtilMisc.toMap("visitId", visitId), false); + visit = EntityQuery.use(delegator).from("Visit").where("visitId", visitId).queryOne(); if (visit == null) { // GenericValue stored in client session does not exist in database. Debug.logInfo("The Visit GenericValue stored in the client session does not exist in the database, not storing server hit.", module); Modified: ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java Thu Oct 30 06:10:58 2014 @@ -35,6 +35,7 @@ import org.ofbiz.entity.DelegatorFactory import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.model.ModelEntity; +import org.ofbiz.entity.util.EntityQuery; /** * Handles saving and maintaining visit information @@ -164,7 +165,7 @@ public class VisitHandler { // sometimes these values get stale, so check it before we use it try { - GenericValue checkVisitor = delegator.findOne("Visitor", false, "visitorId", visitorId); + GenericValue checkVisitor = EntityQuery.use(delegator).from("Visitor").where("visitorId", visitorId).queryOne(); if (checkVisitor == null) { GenericValue newVisitor = delegator.create("Visitor", "visitorId", visitorId); session.setAttribute("visitor", newVisitor); @@ -247,7 +248,7 @@ public class VisitHandler { } } else { try { - visitor = delegator.findOne("Visitor", false, "visitorId", cookieVisitorId); + visitor = EntityQuery.use(delegator).from("Visitor").where("visitorId", cookieVisitorId).queryOne(); if (visitor == null) { // looks like we have an ID that doesn't exist in our database, so we'll create a new one visitor = delegator.makeValue("Visitor"); Modified: ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java Thu Oct 30 06:10:58 2014 @@ -28,6 +28,7 @@ import org.ofbiz.base.util.UtilPropertie import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; /** * Web site properties. @@ -67,7 +68,7 @@ public final class WebSiteProperties { if (delegator != null) { String webSiteId = WebSiteWorker.getWebSiteId(request); if (webSiteId != null) { - GenericValue webSiteValue = delegator.findOne("WebSite", UtilMisc.toMap("webSiteId", webSiteId), true); + GenericValue webSiteValue = EntityQuery.use(delegator).from("WebSite").where("webSiteId", webSiteId).cache().queryOne(); if (webSiteValue != null) { if (webSiteValue.get("httpPort") != null) { httpPort = webSiteValue.getString("httpPort"); Modified: ofbiz/branches/json-integration-refactoring/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java Thu Oct 30 06:10:58 2014 @@ -30,6 +30,7 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.widget.menu.MenuStringRenderer; import org.ofbiz.widget.menu.ModelMenuItem; import org.xml.sax.SAXException; @@ -67,7 +68,7 @@ public class HtmlMenuWrapperImage extend for (ModelMenuItem menuItem : modelMenu.getMenuItemList()) { String contentId = menuItem.getAssociatedContentId(dummyMap); //if (Debug.infoOn()) Debug.logInfo("in init, contentId:" + contentId, module); - GenericValue webSitePublishPoint = delegator.findOne("WebSitePublishPoint", UtilMisc.toMap("contentId", contentId), true); + GenericValue webSitePublishPoint = EntityQuery.use(delegator).from("WebSitePublishPoint").where("contentId", contentId).cache().queryOne(); String menuItemName = menuItem.getName(); //if (Debug.infoOn()) Debug.logInfo("in init, menuItemName:" + menuItemName, module); //if (Debug.infoOn()) Debug.logInfo("in init, webSitePublishPoint:" + webSitePublishPoint, module); Modified: ofbiz/branches/json-integration-refactoring/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Thu Oct 30 06:10:58 2014 @@ -46,6 +46,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.widget.ModelWidget; import org.ofbiz.widget.ModelWidgetAction; import org.ofbiz.widget.PortalPageWorker; @@ -1045,7 +1046,7 @@ public abstract class ModelScreenWidget if (UtilValidate.isEmpty(expandedDataResourceId)) { if (UtilValidate.isNotEmpty(expandedContentId)) { - content = delegator.findOne("Content", UtilMisc.toMap("contentId", expandedContentId), true); + content = EntityQuery.use(delegator).from("Content").where("contentId", expandedContentId).cache().queryOne(); } else { String errMsg = "contentId is empty."; Debug.logError(errMsg, module); @@ -1062,7 +1063,7 @@ public abstract class ModelScreenWidget GenericValue dataResource = null; if (UtilValidate.isNotEmpty(expandedDataResourceId)) { - dataResource = delegator.findOne("DataResource", UtilMisc.toMap("dataResourceId", expandedDataResourceId), true); + dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", expandedDataResourceId).cache().queryOne(); } String mimeTypeId = null; @@ -1621,7 +1622,7 @@ public abstract class ModelScreenWidget portalPage = PortalPageWorker.getPortalPage(expandedPortalPageId, context); } else { - portalPage = delegator.findOne("PortalPage", UtilMisc.toMap("portalPageId", expandedPortalPageId), true); + portalPage = EntityQuery.use(delegator).from("PortalPage").where("portalPageId", expandedPortalPageId).cache().queryOne(); } if (portalPage == null) { String errMsg = "Could not find PortalPage with portalPageId [" + expandedPortalPageId + "] "; Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/cmssite/data/CmsSiteDemoData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/cmssite/data/CmsSiteDemoData.xml?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/cmssite/data/CmsSiteDemoData.xml (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/cmssite/data/CmsSiteDemoData.xml Thu Oct 30 06:10:58 2014 @@ -101,7 +101,7 @@ under the License. <Content contentId="CMSS_DEMO_HOME" contentTypeId="DOCUMENT" decoratorContentId="CMSS_DEC" contentName="CMS Site Demo Home Page" dataResourceId="CMSS_DEMO_HOME"/> <ContentPurpose contentId="CMSS_DEMO_HOME" contentPurposeTypeId="SECTION"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_HOME" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="demoHome"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_HOME" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00" mapKey="demoHome"/> <WebSiteContent webSiteId="CmsSite" contentId="CMSS_DEMO_HOME" webSiteContentTypeId="DEFAULT_PAGE" fromDate="2001-01-01 00:00:00"/> <!-- yet another demo page --> @@ -114,7 +114,7 @@ under the License. </ElectronicText> <Content contentId="CMSS_DEMO_PAGE1" contentTypeId="DOCUMENT" decoratorContentId="CMSS_DEC" contentName="CMS Site Demo Page 1" dataResourceId="CMSS_DEMO_PAGE1"/> <ContentPurpose contentId="CMSS_DEMO_PAGE1" contentPurposeTypeId="SECTION"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_PAGE1" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="demoPage1"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_PAGE1" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00" mapKey="demoPage1"/> <DataResource dataResourceId="CMSS_DEMO_PAGE1_1" dataResourceTypeId="SHORT_TEXT" objectInfo="Sub-content 1"/> <Content contentId="CMSS_DEMO_PAGE1_1" contentTypeId="DOCUMENT" contentName="CMS Site Demo Page 1_1" dataResourceId="CMSS_DEMO_PAGE1_1"/> <ContentPurpose contentId="CMSS_DEMO_PAGE1_1" contentPurposeTypeId="SECTION"/> @@ -130,16 +130,16 @@ under the License. <DataResource dataResourceId="CMSS_DEMO_SCREEN" dataResourceTypeId="URL_RESOURCE" dataTemplateTypeId="SCREEN_COMBINED" objectInfo="component://cmssite/widget/CmssiteScreens.xml#testScreen"/> <Content contentId="CMSS_DEMO_SCREEN" contentTypeId="DOCUMENT" contentName="CMS Site Demo screen/decorator example" dataResourceId="CMSS_DEMO_SCREEN"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_SCREEN" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_SCREEN" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00"/> <DataResource dataResourceId="CMSS_DEMO_BLOG" dataResourceTypeId="URL_RESOURCE" dataTemplateTypeId="SCREEN_COMBINED" objectInfo="component://cmssite/widget/CmssiteScreens.xml#blogScreen"/> <Content contentId="CMSS_DEMO_BLOG" contentTypeId="DOCUMENT" contentName="CMS Site Demo blog screen example" dataResourceId="CMSS_DEMO_BLOG"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_BLOG" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_BLOG" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00"/> <DataResource dataResourceId="CMSS_DEMO_TPL_DATA" localeString="en" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="data xml file" mimeTypeId="text/xml" isPublic="Y"/> <DataResource dataResourceId="CMSS_DEMO_TPL_TEMPL" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="FTL" statusId="CTNT_IN_PROGRESS" dataResourceName="demo xml templ" mimeTypeId="text/html" isPublic="Y" /> <Content contentId="CMSS_DEMO_TPL_DATA" contentTypeId="DOCUMENT" templateDataResourceId="CMSS_DEMO_TPL_TEMPL" dataResourceId="CMSS_DEMO_TPL_DATA" statusId="CTNT_IN_PROGRESS" contentName="Demo xml data + ftl template file" mimeTypeId="text/html"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_TPL_DATA" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="CMSS_DEMO_TPL_DATA" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00"/> <ElectronicText dataResourceId="CMSS_DEMO_TPL_DATA"> <textData><![CDATA[ <root> @@ -194,7 +194,7 @@ under the License. <DataResource dataResourceId="OFBIZ_HOME" dataResourceTypeId="URL_RESOURCE" dataTemplateTypeId="SCREEN_COMBINED" objectInfo="component://cmssite/widget/OfbizsiteScreens.xml#main"/> <Content contentId="OFBIZ_HOME" contentTypeId="DOCUMENT" contentName="OFBiz Site Home Page" dataResourceId="OFBIZ_HOME"/> - <ContentAssoc contentId="OFBIZ_PPOINT" contentIdTo="OFBIZ_HOME" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="demoHome"/> + <ContentAssoc contentId="OFBIZ_PPOINT" contentIdTo="OFBIZ_HOME" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00" mapKey="demoHome"/> <WebSiteContent webSiteId="OfbizSite" contentId="OFBIZ_HOME" webSiteContentTypeId="DEFAULT_PAGE" fromDate="2001-01-01 00:00:00"/> <!-- documents website --> @@ -219,8 +219,8 @@ under the License. <ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_U_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="PUBLIC_DOCS" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="documents"/> - <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_PDF" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="documents"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="PUBLIC_DOCS" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_HTML" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00" mapKey="documents"/> + <ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_PDF" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-01-01 00:00:00" mapKey="documents"/> </entity-engine-xml> Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/cmssite/template/cms/MainDecorator.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/cmssite/template/cms/MainDecorator.ftl?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/cmssite/template/cms/MainDecorator.ftl (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/cmssite/template/cms/MainDecorator.ftl Thu Oct 30 06:10:58 2014 @@ -16,10 +16,11 @@ KIND, either express or implied. See th specific language governing permissions and limitations under the License. --> - +<#if decoratedContent??> ${(decoratedContent.subcontent.htmlHead)?default((thisContent.subcontent.htmlHead)!)} ${(decoratedContent.subcontent.header)?default((thisContent.subcontent.header)!)} ${decoratedContent} ${(decoratedContent.subcontent.footer)?default((thisContent.subcontent.footer)!)} +</#if> \ No newline at end of file Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java Thu Oct 30 06:10:58 2014 @@ -47,6 +47,7 @@ import org.ofbiz.base.util.UtilXml; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.shoppingcart.ShoppingCart; import org.ofbiz.party.contact.ContactHelper; @@ -69,7 +70,7 @@ public class EbayHelper { if (UtilValidate.isNotEmpty(productStoreId)) { GenericValue eBayConfig = null; try { - eBayConfig = delegator.findOne("EbayConfig", false, UtilMisc.toMap("productStoreId", productStoreId)); + eBayConfig = EntityQuery.use(delegator).from("EbayConfig").where(UtilMisc.toMap("productStoreId", productStoreId)).queryOne(); } catch (GenericEntityException e) { String errMsg = UtilProperties.getMessage(resource, "buildEbayConfig.unableToFindEbayConfig" + e.getMessage(), locale); return ServiceUtil.returnError(errMsg); @@ -171,7 +172,7 @@ public class EbayHelper { String partyId = "_NA_"; String shipmentMethodTypeId = "NO_SHIPPING"; try { - GenericValue ebayShippingMethod = delegator.findOne("EbayShippingMethod", UtilMisc.toMap("shipmentMethodName", shippingService, "productStoreId", productStoreId), false); + GenericValue ebayShippingMethod = EntityQuery.use(delegator).from("EbayShippingMethod").where("shipmentMethodName", shippingService, "productStoreId", productStoreId).queryOne(); if (UtilValidate.isNotEmpty(ebayShippingMethod)) { partyId = ebayShippingMethod.getString("carrierPartyId"); shipmentMethodTypeId = ebayShippingMethod.getString("shipmentMethodTypeId"); @@ -516,7 +517,7 @@ public class EbayHelper { GenericValue postalAddress; try { // get the postal address for this contact mech - postalAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", contactMechId), false); + postalAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", contactMechId).queryOne(); // match values to compare by modifying them the same way they // were when they were created @@ -622,7 +623,7 @@ public class EbayHelper { titleFirstWord = title.substring(0, title.indexOf(' ')); } if (UtilValidate.isNotEmpty(titleFirstWord)) { - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", titleFirstWord), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", titleFirstWord).queryOne(); if (UtilValidate.isNotEmpty(product)) { productId = product.getString("productId"); } Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java Thu Oct 30 06:10:58 2014 @@ -43,6 +43,7 @@ import org.ofbiz.entity.GenericEntityExc import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityComparisonOperator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.order.OrderChangeHelper; import org.ofbiz.order.shoppingcart.CheckOutHelper; @@ -992,7 +993,7 @@ public class EbayOrderServices { if (productStoreId == null) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productStoreIdIsMandatory", locale)); } else { - GenericValue productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), false); + GenericValue productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).queryOne(); if (productStore != null) { defaultCurrencyUomId = productStore.getString("defaultCurrencyUomId"); payToPartyId = productStore.getString("payToPartyId"); @@ -1150,7 +1151,7 @@ public class EbayOrderServices { // if we get a party, check its contact information. if (UtilValidate.isNotEmpty(partyId)) { Debug.logInfo("Found existing party associated to the eBay buyer: " + partyId, module); - GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false); + GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, shippingAddressCtx); String emailBuyer = (String) context.get("emailBuyer"); @@ -1261,7 +1262,7 @@ public class EbayOrderServices { private static void addItem(ShoppingCart cart, Map<String, Object> orderItem, LocalDispatcher dispatcher, Delegator delegator, int groupIdx) throws GeneralException { String productId = (String) orderItem.get("productId"); - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (UtilValidate.isEmpty(product)) { String productMissingMsg = "The product having ID (" + productId + ") is misssing in the system."; orderImportFailureMessageList.add(productMissingMsg); Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java Thu Oct 30 06:10:58 2014 @@ -39,6 +39,7 @@ import org.ofbiz.base.util.UtilXml; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityComparisonOperator; @@ -141,7 +142,7 @@ public class ImportOrdersFromEbay { if (UtilValidate.isNotEmpty(orderId)) { // Get the order header and verify if this order has been imported // from eBay (i.e. sales channel = EBAY_CHANNEL and externalId is set) - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader == null) { Debug.logError("Cannot find order with orderId [" + orderId + "]", module); return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.errorRetrievingOrderFromOrderId", locale)); @@ -600,7 +601,7 @@ public class ImportOrdersFromEbay { if (productStoreId == null) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productStoreIdIsMandatory", locale)); } else { - GenericValue productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), false); + GenericValue productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).queryOne(); if (productStore != null) { defaultCurrencyUomId = productStore.getString("defaultCurrencyUomId"); payToPartyId = productStore.getString("payToPartyId"); @@ -658,7 +659,7 @@ public class ImportOrdersFromEbay { if (UtilValidate.isEmpty(productId)) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productIdNotAvailable", locale)); } else { - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (UtilValidate.isEmpty(product)) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productIdDoesNotExist", locale)); } @@ -735,7 +736,7 @@ public class ImportOrdersFromEbay { if (UtilValidate.isNotEmpty(partyAttribute)) { partyId = (String) partyAttribute.get("partyId"); Debug.logInfo("Found existing party associated to the eBay buyer: " + partyId, module); - GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false); + GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, parameters); String emailBuyer = (String) parameters.get("emailBuyer"); Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java Thu Oct 30 06:10:58 2014 @@ -28,6 +28,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -90,7 +91,7 @@ public class EbayBestOfferAutoPref { Map<String, Object> ebayCondition11 = UtilMisc.<String, Object>toMap("userLogin", userLogin); ebayCondition11.put("acceptanceCondition", condition11); - GenericValue productStorePref = delegator.findOne("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_BEST_OFFER"), false); + GenericValue productStorePref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_BEST_OFFER").queryOne(); if (UtilValidate.isEmpty(productStorePref)) { String prefCondId1 = delegator.getNextSeqId("EbayProductStorePrefCond"); String parentPrefCondId = prefCondId1; Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java Thu Oct 30 06:10:58 2014 @@ -42,6 +42,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -196,7 +197,7 @@ public class EbayEvents { for (String productId : productIds) { AddItemCall addItemCall = new AddItemCall(apiContext); ItemType item = new ItemType(); - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); item.setTitle(product.getString("internalName")); item.setCurrency(CurrencyCodeType.USD); String productDescription = ""; @@ -544,7 +545,7 @@ public class EbayEvents { EbayStoreSiteFacade sf = null; // find is exiting product and set category into item in additem call try { - if (UtilValidate.isNotEmpty(delegator.findOne("Product", UtilMisc.toMap("productId", productId), false))) { + if (UtilValidate.isNotEmpty(EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne())) { ApiContext apiContext = getApiContext(request); Map<String,Object> addItemObject = getAddItemListingObject(request, apiContext); List<Map<String,Object>> addItemlist = UtilGenerics.checkList(addItemObject.get("itemListing")); Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java Thu Oct 30 06:10:58 2014 @@ -23,6 +23,7 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import java.util.*; @@ -80,7 +81,7 @@ public class EbayFeedback { FeedbackDetailType[] feedback = feedbackCall.getFeedback(); if (feedback != null) { String partyId = null; - GenericValue userLoginEx = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userID), false); + GenericValue userLoginEx = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userID).queryOne(); if (userLoginEx == null) { //Party GenericValue party = delegator.makeValue("Party"); @@ -109,7 +110,7 @@ public class EbayFeedback { //convert to ofbiz String contentId = feedback[i].getFeedbackID(); Date eBayDateTime = feedback[i].getCommentTime().getTime(); - GenericValue contentCheck = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false); + GenericValue contentCheck = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne(); if (contentCheck != null) { continue; } Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java Thu Oct 30 06:10:58 2014 @@ -55,6 +55,7 @@ import org.ofbiz.ebay.ProductsExportToEb import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -281,7 +282,7 @@ public class EbayStore { if (ebayParentCategoryId != null) { List<GenericValue> productCategoryRollupList = delegator.findByAnd("ProductCategoryRollup", UtilMisc.toMap("parentProductCategoryId", productCategory.getString("productCategoryId")), UtilMisc.toList("sequenceNum ASC"), false); for (GenericValue productCategoryRollup : productCategoryRollupList) { - productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryRollup.getString("productCategoryId")), false); + productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryRollup.getString("productCategoryId")).queryOne(); StoreCustomCategoryType childCategoryType = new StoreCustomCategoryType(); String ebayChildCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator, productCategory.getString("productCategoryId"), context.get("partyId").toString()); if (ebayChildCategoryId == null) { @@ -324,7 +325,7 @@ public class EbayStore { if (ebayParentCategoryId != null) { List<GenericValue> productChildCategoryRollupList = delegator.findByAnd("ProductCategoryRollup", UtilMisc.toMap("parentProductCategoryId",productParentCategoryRollup.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"), false); for (GenericValue productChildCategoryRollup : productChildCategoryRollupList) { - productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productChildCategoryRollup.getString("productCategoryId")), false); + productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productChildCategoryRollup.getString("productCategoryId")).queryOne(); StoreCustomCategoryType childCategoryType = new StoreCustomCategoryType(); String ebayChildCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator,productCategory.getString("productCategoryId"),context.get("partyId").toString()); if (ebayChildCategoryId == null) { @@ -523,7 +524,7 @@ public class EbayStore { //UtilXml.addChildElementValue(StoreCategoriesElem, "Country", (String)context.get("country"), storeDocument); GenericValue category = null; if (UtilValidate.isNotEmpty(context.get("prodCatalogId"))) { - category = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId), true); + category = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryId).cache().queryOne(); } String categoryName = category.getString("productCategoryId").toString(); if (category.getString("categoryName").toString() != null) { @@ -1545,7 +1546,7 @@ public class EbayStore { Map<String, Object> eBayConfigResult = EbayHelper.buildEbayConfig(context, delegator); Map<String, Object> response = null; try { - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", context.get("productId").toString()), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", context.get("productId").toString()).queryOne(); int intAtp = 1; String facilityId = ""; if (UtilValidate.isNotEmpty(context.get("requireEbayInventory")) && "on".equals(context.get("requireEbayInventory").toString())) { @@ -2464,7 +2465,7 @@ public class EbayStore { public static boolean checkExistProduct(Delegator delegator, String productId) { boolean checkResult = false; try { - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if(UtilValidate.isNotEmpty(product)) { checkResult = true; }