Author: jonesde
Date: Wed Feb 2 07:28:57 2011 New Revision: 1066355 URL: http://svn.apache.org/viewvc?rev=1066355&view=rev Log: Added a use-transaction attribute to the screen definition, defaults to true (which is what the screen widget did before), and allows avoiding the overhead of a transaction in a screen by setting it to false Modified: ofbiz/trunk/framework/widget/dtd/widget-screen.xsd ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java Modified: ofbiz/trunk/framework/widget/dtd/widget-screen.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-screen.xsd?rev=1066355&r1=1066354&r2=1066355&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-screen.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-screen.xsd Wed Feb 2 07:28:57 2011 @@ -40,6 +40,14 @@ under the License. <xs:documentation>Transaction timeout in seconds</xs:documentation> </xs:annotation> </xs:attribute> + <xs:attribute name="use-transaction" default="true"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="true"/> + <xs:enumeration value="false"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> <xs:attribute name="use-cache" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java?rev=1066355&r1=1066354&r2=1066355&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java Wed Feb 2 07:28:57 2011 @@ -52,6 +52,7 @@ public class ModelScreen extends ModelWi protected String sourceLocation; protected FlexibleStringExpander transactionTimeoutExdr; protected Map<String, ModelScreen> modelScreenMap; + protected boolean useTransaction; protected boolean useCache; protected ModelScreenWidget.Section section; @@ -66,6 +67,7 @@ public class ModelScreen extends ModelWi this.sourceLocation = sourceLocation; this.transactionTimeoutExdr = FlexibleStringExpander.getInstance(screenElement.getAttribute("transaction-timeout")); this.modelScreenMap = modelScreenMap; + this.useTransaction = "true".equals(screenElement.getAttribute("use-transaction")); this.useCache = "true".equals(screenElement.getAttribute("use-cache")); // read in the section, which will read all sub-widgets too @@ -381,11 +383,13 @@ public class ModelScreen extends ModelWi // If transaction timeout is not present (i.e. is equal to -1), the default transaction timeout is used // If transaction timeout is present, use it to start the transaction // If transaction timeout is set to zero, no transaction is started - if (transactionTimeout < 0) { - beganTransaction = TransactionUtil.begin(); - } - if (transactionTimeout > 0) { - beganTransaction = TransactionUtil.begin(transactionTimeout); + if (useTransaction) { + if (transactionTimeout < 0) { + beganTransaction = TransactionUtil.begin(); + } + if (transactionTimeout > 0) { + beganTransaction = TransactionUtil.begin(transactionTimeout); + } } // render the screen, starting with the top-level section |
Free forum by Nabble | Edit this page |