[OFBiz] SVN: r5941 -
trunk/framework/widget/src/org/ofbiz/widget/screen
jonesde at svn.ofbiz.org
jonesde at svn.ofbiz.org
Sun Oct 9 18:15:48 EDT 2005
Author: jonesde
Date: 2005-10-09 17:15:45 -0500 (Sun, 09 Oct 2005)
New Revision: 5941
Modified:
trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java
Log:
Applied patch from Jacopo to support for a TRANSACTION_TIMEOUT screen widget parameter taken from the parameters Map, so it can be put in anything from the web.xml file to passed in the HTTP request as a parameter; Jira #OFBIZ-514
Modified: trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java 2005-10-09 21:44:32 UTC (rev 5940)
+++ trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java 2005-10-09 22:15:45 UTC (rev 5941)
@@ -96,8 +96,29 @@
// wrap the whole screen rendering in a transaction, should improve performance in querying and such
boolean beganTransaction = false;
+ Map parameters = (Map)context.get("parameters");
+ int transactionTimeout = -1;
+ if (parameters != null) {
+ String transactionTimeoutPar = (String) parameters.get("TRANSACTION_TIMEOUT");
+ if (transactionTimeoutPar != null) {
+ try {
+ transactionTimeout = Integer.parseInt(transactionTimeoutPar);
+ } catch(NumberFormatException nfe) {
+ String msg = "TRANSACTION_TIMEOUT parameter for screen [" + this.name + "] is invalid and it will be ignored: " + nfe.toString();
+ Debug.logWarning(msg, module);
+ }
+ }
+ }
try {
- beganTransaction = TransactionUtil.begin();
+ // 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);
+ }
// render the screen, starting with the top-level section
this.section.renderWidgetString(writer, context, screenStringRenderer);
More information about the Svn
mailing list