Author: lektran Date: Thu Nov 7 14:30:49 2013 New Revision: 1539658 URL: http://svn.apache.org/r1539658 Log: Merged from trunk r1539645: global ECAs weren't honoring the run-as-user attribute defined on action elements
Modified: ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java Modified: ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java?rev=1539658&r1=1539657&r2=1539658&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java (original) +++ ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/ServiceXaWrapper.java Thu Nov 7 14:30:49 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/release12.04/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java?rev=1539658&r1=1539657&r2=1539658&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java (original) +++ ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java Thu Nov 7 14:30:49 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();