diff --git a/framework/service/dtd/service-eca.xsd b/framework/service/dtd/service-eca.xsd index a21eb64d00..f85a3f9ada 100644 --- a/framework/service/dtd/service-eca.xsd +++ b/framework/service/dtd/service-eca.xsd @@ -212,6 +212,14 @@ under the License. + + + + + + + + diff --git a/framework/service/src/org/ofbiz/service/GenericDispatcher.java b/framework/service/src/org/ofbiz/service/GenericDispatcher.java index b2940147a3..c827f34cf5 100644 --- a/framework/service/src/org/ofbiz/service/GenericDispatcher.java +++ b/framework/service/src/org/ofbiz/service/GenericDispatcher.java @@ -121,7 +121,9 @@ public class GenericDispatcher extends GenericAbstractDispatcher { // clone the model service for updates ModelService cloned = new ModelService(service); cloned.requireNewTransaction = requireNewTransaction; - cloned.transactionTimeout = transactionTimeout; + if (transactionTimeout != -1) { + cloned.transactionTimeout = transactionTimeout; + } return dispatcher.runSync(this.name, cloned, context); } @@ -141,7 +143,9 @@ public class GenericDispatcher extends GenericAbstractDispatcher { // clone the model service for updates ModelService cloned = new ModelService(service); cloned.requireNewTransaction = requireNewTransaction; - cloned.transactionTimeout = transactionTimeout; + if (transactionTimeout != -1) { + cloned.transactionTimeout = transactionTimeout; + } dispatcher.runSyncIgnore(this.name, cloned, context); } @@ -153,7 +157,9 @@ public class GenericDispatcher extends GenericAbstractDispatcher { // clone the model service for updates ModelService cloned = new ModelService(service); cloned.requireNewTransaction = requireNewTransaction; - cloned.transactionTimeout = transactionTimeout; + if (transactionTimeout != -1) { + cloned.transactionTimeout = transactionTimeout; + } dispatcher.runAsync(this.name, cloned, context, requester, persist); } diff --git a/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java b/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java index 1e0af858ff..58d3384705 100644 --- a/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java +++ b/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java @@ -43,9 +43,10 @@ public class ServiceEcaAction implements java.io.Serializable { protected String resultMapName = null; protected String runAsUser = null; + protected boolean newTransaction = false; protected boolean resultToContext = true; protected boolean ignoreFailure = false; - protected boolean ignoreError = false; + protected boolean ignoreError = false; protected boolean persist = false; protected ServiceEcaAction() {} @@ -59,6 +60,7 @@ public class ServiceEcaAction implements java.io.Serializable { // default is true, so anything but false is true this.resultToContext = !"false".equals(action.getAttribute("result-to-context")); + this.newTransaction = !"false".equals(action.getAttribute("new-transaction")); this.ignoreFailure = !"false".equals(action.getAttribute("ignore-failure")); this.ignoreError = !"false".equals(action.getAttribute("ignore-error")); this.persist = "true".equals(action.getAttribute("persist")); @@ -94,7 +96,10 @@ public class ServiceEcaAction implements java.io.Serializable { } else { // standard ECA if (serviceMode.equals("sync")) { - actionResult = dispatcher.runSync(serviceName, actionContext); + if (newTransaction) + actionResult = dispatcher.runSync(serviceName, actionContext, -1, true); + else + actionResult = dispatcher.runSync(serviceName, actionContext); } else if (serviceMode.equals("async")) { dispatcher.runAsync(serviceName, actionContext, persist); }