svn commit: r585851 - in /ofbiz/trunk/framework/service/src/org/ofbiz/service: ModelPermission.java ServiceDispatcher.java ServiceUtil.java mail/JavaMailContainer.java semaphore/ServiceSemaphore.java test/ServiceEngineTestServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r585851 - in /ofbiz/trunk/framework/service/src/org/ofbiz/service: ModelPermission.java ServiceDispatcher.java ServiceUtil.java mail/JavaMailContainer.java semaphore/ServiceSemaphore.java test/ServiceEngineTestServices.java

doogie-3
Author: doogie
Date: Wed Oct 17 21:08:11 2007
New Revision: 585851

URL: http://svn.apache.org/viewvc?rev=585851&view=rev
Log:
Use the varargs variants in the delegator.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java?rev=585851&r1=585850&r2=585851&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java Wed Oct 17 21:08:11 2007
@@ -94,7 +94,7 @@
         GenericDelegator delegator = userLogin.getDelegator();
         List partyRoles = null;
         try {
-            partyRoles = delegator.findByAnd("PartyRole", UtilMisc.toMap("roleTypeId", nameOrRole, "partyId", userLogin.get("partyId")));
+            partyRoles = delegator.findByAnd("PartyRole", "roleTypeId", nameOrRole, "partyId", userLogin.get("partyId"));
         } catch (GenericEntityException e) {
             Debug.logError(e, "Unable to lookup PartyRole records", module);
         }

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=585851&r1=585850&r2=585851&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Wed Oct 17 21:08:11 2007
@@ -852,7 +852,7 @@
                 //The old way: GenericValue newUserLogin = getLoginObject(service, localName, userLogin.getString("userLoginId"), userLogin.getString("currentPassword"), (Locale) context.get("locale"));
                 GenericValue newUserLogin = null;
                 try {
-                    newUserLogin = this.getDelegator().findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", userLogin.get("userLoginId")));
+                    newUserLogin = this.getDelegator().findByPrimaryKeyCache("UserLogin", "userLoginId", userLogin.get("userLoginId"));
                 } catch (GenericEntityException e) {
                     Debug.logError(e, "Error looking up service authentication UserLogin: " + e.toString(), module);
                     // leave newUserLogin null, will be handled below

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=585851&r1=585850&r2=585851&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java Wed Oct 17 21:08:11 2007
@@ -457,7 +457,7 @@
                             boolean beganTx3 = false;
                             try {
                                 beganTx3 = TransactionUtil.begin();
-                                delegator.removeByAnd("RuntimeData", UtilMisc.toMap("runtimeDataId", runtimeId));
+                                delegator.removeByAnd("RuntimeData", "runtimeDataId", runtimeId);
 
                             } catch (GenericEntityException e) {
                                 Debug.logInfo("Cannot remove runtime data for ID: " + runtimeId, module);
@@ -588,7 +588,7 @@
         GenericDelegator delegator = dctx.getDelegator();
         if (runAsUser != null) {
             try {
-                GenericValue runAs = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", runAsUser));
+                GenericValue runAs = delegator.findByPrimaryKeyCache("UserLogin", "userLoginId", runAsUser);
                 if (runAs != null) {
                     userLogin = runAs;
                 }

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java?rev=585851&r1=585850&r2=585851&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java Wed Oct 17 21:08:11 2007
@@ -96,7 +96,7 @@
         // load the userLogin object
         String runAsUser = ContainerConfig.getPropertyValue(cfg, "run-as-user", "system");
         try {
-            this.userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", runAsUser));
+            this.userLogin = delegator.findByPrimaryKey("UserLogin", "userLoginId", runAsUser);
         } catch (GenericEntityException e) {
             Debug.logError(e, "Unable to load run-as-user UserLogin; cannot start container", module);
             return false;

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java?rev=585851&r1=585850&r2=585851&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java Wed Oct 17 21:08:11 2007
@@ -103,7 +103,7 @@
         GenericValue semaphore;
 
         try {
-            semaphore = delegator.findByPrimaryKey("ServiceSemaphore", UtilMisc.toMap("serviceName", model.name));
+            semaphore = delegator.findByPrimaryKey("ServiceSemaphore", "serviceName", model.name);
         } catch (GenericEntityException e) {
             throw new SemaphoreFailException(e);
         }

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java?rev=585851&r1=585850&r2=585851&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java Wed Oct 17 21:08:11 2007
@@ -72,7 +72,7 @@
 
         try {
             // grab entity SVCLRT_A by changing, then wait, then find and change SVCLRT_B
-            GenericValue testingTypeA = delegator.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVCLRT_A"));
+            GenericValue testingTypeA = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVCLRT_A");
             testingTypeA.set("description", "New description for SVCLRT_A");
             testingTypeA.store();
             
@@ -81,12 +81,12 @@
             UtilMisc.staticWait(100);
 
             Debug.logInfo("In testServiceDeadLockRetryThreadA done with wait, updating SVCLRT_B", module);
-            GenericValue testingTypeB = delegator.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVCLRT_B"));
+            GenericValue testingTypeB = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVCLRT_B");
             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.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVCLRT_AONLY"));
+            GenericValue testingTypeAOnly = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVCLRT_AONLY");
             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) {
@@ -106,7 +106,7 @@
 
         try {
             // grab entity SVCLRT_B by changing, then wait, then change SVCLRT_A
-            GenericValue testingTypeB = delegator.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVCLRT_B"));
+            GenericValue testingTypeB = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVCLRT_B");
             testingTypeB.set("description", "New description for SVCLRT_B");
             testingTypeB.store();
             
@@ -115,12 +115,12 @@
             UtilMisc.staticWait(100);
 
             Debug.logInfo("In testServiceDeadLockRetryThreadB done with wait, updating SVCLRT_A", module);
-            GenericValue testingTypeA = delegator.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVCLRT_A"));
+            GenericValue testingTypeA = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVCLRT_A");
             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.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVCLRT_BONLY"));
+            GenericValue testingTypeAOnly = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVCLRT_BONLY");
             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) {
@@ -170,7 +170,7 @@
 
         try {
             // grab entity SVCLWTRT by changing, then wait a LONG time, ie more than the wait timeout
-            GenericValue testingType = delegator.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVCLWTRT"));
+            GenericValue testingType = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVCLWTRT");
             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();
 
@@ -201,7 +201,7 @@
             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.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVCLWTRT"));
+            GenericValue testingType = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVCLWTRT");
             testingType.set("description", "New description for SVCLWTRT from Waiter service, this is the value that should be there.");
             testingType.store();
             
@@ -242,7 +242,7 @@
         LocalDispatcher dispatcher = dctx.getDispatcher();
         try {
             // grab entity SVCLWTRTCR by changing, then wait a LONG time, ie more than the wait timeout
-            GenericValue testingType = delegator.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVCLWTRTCR"));
+            GenericValue testingType = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVCLWTRTCR");
             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();
 
@@ -272,7 +272,7 @@
             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.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVCLWTRTCR"));
+            GenericValue testingType = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVCLWTRTCR");
             testingType.set("description", "New description for SVCLWTRTCR from Lock Wait Timeout Lock Waiter, this is the value that should be there.");
             testingType.store();
             
@@ -307,7 +307,7 @@
         LocalDispatcher dispatcher = dctx.getDispatcher();
         try {
             // change the SVC_SRBO value first to test that the rollback really does revert/reset
-            GenericValue testingType = delegator.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVC_SRBO"));
+            GenericValue testingType = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVC_SRBO");
             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();
             
@@ -351,7 +351,7 @@
         GenericDelegator delegator = dctx.getDelegator();
 
         try {
-            GenericValue testingType = delegator.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVC_SECAGC"));
+            GenericValue testingType = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVC_SECAGC");
             testingType.set("description", "New description for SVC_SECAGC, what it should be after the global-commit test");
             testingType.store();
         } catch (GenericEntityException e) {
@@ -370,7 +370,7 @@
         GenericDelegator delegator = dctx.getDelegator();
 
         try {
-            GenericValue testingType = delegator.findByPrimaryKey("TestingType", UtilMisc.toMap("testingTypeId", "SVC_SECAGR"));
+            GenericValue testingType = delegator.findByPrimaryKey("TestingType", "testingTypeId", "SVC_SECAGR");
             testingType.set("description", "New description for SVC_SECAGR, what it should be after the global-rollback test");
             testingType.store();
         } catch (GenericEntityException e) {