|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.droplet.EmptyFormHandler atg.droplet.GenericFormHandler atg.droplet.TransactionalFormHandler
public class TransactionalFormHandler
This form handler adds transaction management capabilities while processing form
input. Typically when one is modifying RepositoryItems one should have a transaction
in place to enclose all the modifications. The SQL Repository will automatically start
and end a transaction for each setPropertyValue
call unless a transaction
is already in place. This can lead to significant performance problems and inconsistent
data, from the application's perspective, because one set could succeed and another
might fail. If the ensureTransaction
property is true, then transactions
are created, if necessary, in the beforeSet
operation and committed or rolledback
in the afterSet
method. Instances of this form handler should be request scoped,
or if session scoped, the component should be synchronized.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.droplet.GenericFormHandler |
---|
PARAM_DEFER_FORWARD_OR_REDIRECT, PARAM_USE_FORWARDS |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
TransactionalFormHandler()
Constructs an instanceof TransactionalFormHandler |
Method Summary | |
---|---|
boolean |
afterSet(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
If the TransactionDemarcation is not null, then the transaction is ended. |
boolean |
beforeSet(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Creates a new TransactionDemarcation and then begins the transaction. |
boolean |
checkFormRedirect(java.lang.String pSuccessURL,
java.lang.String pFailureURL,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
If the transaction is marked as rollback, then redirect to the FailureURL, otherwise allow the super-class behavior to perform. |
void |
commitTransaction()
This method commits the current transaction (or rolls it back if you have called setRollbackTransaction(true) since the transaction started). |
protected TransactionDemarcation |
getTransactionDemarcation()
Returns property TransactionDemarcation. |
protected int |
getTransactionStatus()
Obtain the status of the transaction associated with the current thread. |
boolean |
isEnsureTransaction()
Returns property EnsureTransaction, if false then no transaction management is performed |
protected boolean |
isRollbackTransaction()
Returns property RollbackTransaction. |
boolean |
isRollbackTransactionOnUnhandledException()
Gets the value of the isRollbackTransactionOnUnhandledException property. |
protected boolean |
isTransactionMarkedAsRollback()
Returns true if the transaction associated with the current thread is marked for rollback. |
void |
setEnsureTransaction(boolean pEnsureTransaction)
Sets property EnsureTransaction |
protected void |
setRollbackTransaction(boolean pRollbackTransaction)
Sets property RollbackTransaction |
void |
setRollbackTransactionOnUnhandledException(boolean pRollbackTransactionOnUnhandledException)
Sets the value of the isRollbackTransactionOnUnhandledException property. |
protected void |
setTransactionDemarcation(TransactionDemarcation pTransactionDemarcation)
Sets property TransactionDemarcation Previously, this method stored the TransactionDemarcation object as a member variable. |
Methods inherited from class atg.droplet.EmptyFormHandler |
---|
afterGet, beforeGet |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public TransactionalFormHandler()
Method Detail |
---|
public void setEnsureTransaction(boolean pEnsureTransaction)
public boolean isEnsureTransaction()
protected void setTransactionDemarcation(TransactionDemarcation pTransactionDemarcation)
protected TransactionDemarcation getTransactionDemarcation()
beforeSet
and afterSet
methods. This is created in the
beforeSet
method and set to null in afterSet
.
protected void setRollbackTransaction(boolean pRollbackTransaction)
protected boolean isRollbackTransaction()
afterSet
method. This defaults to false and is
reset to false in afterSet
.
public boolean beforeSet(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws DropletFormException
ensureTransaction
property is false then no transacation management
is performed.
beforeSet
in interface DropletFormHandler
beforeSet
in class GenericFormHandler
DropletFormException
public boolean afterSet(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws DropletFormException
rollbackTransaction
is set to true, otherwise the transaction is committed. If the ensureTransaction
property is false then no transacation management is performed. The transactionDemarcation
property is set to null and rollbackTransaction
property is set to false in the finally
clause of this method after the super.afterSet
method is called.
afterSet
in interface DropletFormHandler
afterSet
in class GenericFormHandler
DropletFormException
protected boolean isTransactionMarkedAsRollback()
protected int getTransactionStatus()
TransactionManager.getStatus()
throws a SystemException.public boolean checkFormRedirect(java.lang.String pSuccessURL, java.lang.String pFailureURL, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
checkFormRedirect
in class GenericFormHandler
pSuccessURL
- The URL to redirect to if there were no form errors.
If a null value is passed in, no redirect occurs.pFailureURL
- The URL to redirect to if form errors were found.
If a null value is passed in, no redirect occurs.pRequest
- the servlet's requestpResponse
- the servlet's response
javax.servlet.ServletException
- if there was an error while executing the code
java.io.IOException
- if there was an error with servlet iopublic void commitTransaction()
public boolean isRollbackTransactionOnUnhandledException()
public void setRollbackTransactionOnUnhandledException(boolean pRollbackTransactionOnUnhandledException)
pRollbackTransactionOnUnhandledException
- true if the transaction should rollback if there was an
unhandled exception thrown from a handle method.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |