You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2013/11/07 15:16:37 UTC

svn commit: r1539651 - in /ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service: ServiceXaWrapper.java eca/ServiceEcaAction.java

Author: lektran
Date: Thu Nov  7 14:16:37 2013
New Revision: 1539651

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

Modified:
    ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java
    ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java

Modified: ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java?rev=1539651&r1=1539650&r2=1539651&view=diff
==============================================================================
--- ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java (original)
+++ ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java Thu Nov  7 14:16:37 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/branches/release13.07/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java?rev=1539651&r1=1539650&r2=1539651&view=diff
==============================================================================
--- ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java (original)
+++ ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java Thu Nov  7 14:16:37 2013
@@ -66,7 +66,7 @@ public class ServiceEcaAction implements
         this.serviceMode = action.getAttribute("mode");
         this.runAsUser = action.getAttribute("run-as-user");
         // support the old, inconsistent attribute name
-        if (UtilValidate.isEmail(this.runAsUser)) this.runAsUser = action.getAttribute("runAsUser");
+        if (UtilValidate.isEmpty(this.runAsUser)) this.runAsUser = action.getAttribute("runAsUser");
         this.resultMapName = action.getAttribute("result-map-name");
 
         // default is true, so anything but false is true
@@ -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();