Author: jaz
Date: Thu Feb 15 14:29:03 2007 New Revision: 508207 URL: http://svn.apache.org/viewvc?view=rev&rev=508207 Log: ECA actions can now specify to run in a new transaction Modified: ofbiz/trunk/framework/service/dtd/service-eca.xsd ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java Modified: ofbiz/trunk/framework/service/dtd/service-eca.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/dtd/service-eca.xsd?view=diff&rev=508207&r1=508206&r2=508207 ============================================================================== --- ofbiz/trunk/framework/service/dtd/service-eca.xsd (original) +++ ofbiz/trunk/framework/service/dtd/service-eca.xsd Thu Feb 15 14:29:03 2007 @@ -212,6 +212,14 @@ </xs:attribute> <xs:attribute type="xs:string" name="runAsUser"/> <xs:attribute type="xs:string" name="result-map-name"/> + <xs:attribute name="new-transaction" default="false"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="true"/> + <xs:enumeration value="false"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> <xs:attribute name="result-to-context" default="true"> <xs:simpleType> <xs:restriction base="xs:token"> Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java?view=diff&rev=508207&r1=508206&r2=508207 ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java Thu Feb 15 14:29:03 2007 @@ -121,7 +121,9 @@ // 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 @@ // 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 @@ // 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); } 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?view=diff&rev=508207&r1=508206&r2=508207 ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java Thu Feb 15 14:29:03 2007 @@ -43,9 +43,10 @@ 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 @@ // 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 @@ } 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); } |
Free forum by Nabble | Edit this page |