Author: lektran
Date: Thu Nov  7 14:06:54 2013
New Revision: 1539645

URL: http://svn.apache.org/r1539645
Log:
global ECAs weren't honoring the run-as-user attribute defined on action 
elements

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java
    
ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java?rev=1539645&r1=1539644&r2=1539645&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java 
(original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java 
Thu Nov  7 14:06:54 2013
@@ -60,7 +60,7 @@ public class ServiceXaWrapper extends Ge
     }
 
     /**
-     * Sets the service to run on rollback()
+     * Sets the service to run on commit()
      * @param serviceName Name of service to run
      * @param context Context to use when running
      */
@@ -69,7 +69,7 @@ public class ServiceXaWrapper extends Ge
     }
 
     /**
-     * Sets the service to run on rollback()
+     * Sets the service to run on commit()
      * @param serviceName Name of service to run
      * @param context Context to use when running
      * @param async override default async behavior
@@ -79,7 +79,7 @@ public class ServiceXaWrapper extends Ge
     }
 
     /**
-     * Sets the service to run on rollback()
+     * Sets the service to run on commit()
      * @param serviceName Name of service to run
      * @param runAsUser UserLoginID to run as
      * @param context Context to use when running
@@ -95,14 +95,14 @@ public class ServiceXaWrapper extends Ge
 
 
     /**
-     * @return The name of the service to run on rollback()
+     * @return The name of the service to run on commit()
      */
     public String getCommitService() {
         return this.commitService;
     }
 
     /**
-     * @return The context used when running the rollback() service
+     * @return The context used when running the commit() service
      */
     public Map<String, ? extends Object> getCommitContext() {
         return this.commitContext;
@@ -124,7 +124,19 @@ public class ServiceXaWrapper extends Ge
      * @param async override default async behavior
      */
     public void setRollbackService(String serviceName, Map<String, ? extends 
Object> context, boolean async, boolean persist) {
+        this.setRollbackService(serviceName, null, context, async, persist);
+    }
+
+    /**
+     * Sets the service to run on rollback()
+     * @param serviceName Name of service to run
+     * @param runAsUser userLoginId to run the service as
+     * @param context Context to use when running
+     * @param async override default async behavior
+     */
+    public void setRollbackService(String serviceName, String runAsUser, 
Map<String, ? extends Object> context, boolean async, boolean persist) {
         this.rollbackService = serviceName;
+        this.runAsUser = runAsUser;
         this.rollbackContext = context;
         this.rollbackAsync = async;
         this.rollbackAsyncPersist = persist;

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java?rev=1539645&r1=1539644&r2=1539645&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java 
(original)
+++ 
ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java 
Thu Nov  7 14:06:54 2013
@@ -118,11 +118,11 @@ public class ServiceEcaAction implements
             // XA resource ECA
             ServiceXaWrapper xaw = new ServiceXaWrapper(dctx);
             if (eventName.equals("global-rollback")) {
-                xaw.setRollbackService(serviceName, context, 
"async".equals(serviceMode), persist); // using the actual context so we get 
updates
+                xaw.setRollbackService(serviceName, runAsUser, context, 
"async".equals(serviceMode), persist); // using the actual context so we get 
updates
             } else if (eventName.equals("global-commit")) {
-                xaw.setCommitService(serviceName, context, 
"async".equals(serviceMode), persist);   // using the actual context so we get 
updates
+                xaw.setCommitService(serviceName, runAsUser, context, 
"async".equals(serviceMode), persist);   // using the actual context so we get 
updates
             } else if (eventName.equals("global-commit-post-run")) {
-                xaw.setCommitService(serviceName, context, 
"async".equals(serviceMode), persist);   // using the actual context so we get 
updates
+                xaw.setCommitService(serviceName, runAsUser, context, 
"async".equals(serviceMode), persist);   // using the actual context so we get 
updates
             }
             try {
                 xaw.enlist();


Reply via email to