Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.4.0)

E10653-05

oracle.adfinternal.model.adapter.toplink
Class TopLinkDataControl

java.lang.Object
  extended by oracle.adf.model.adapter.AbstractImpl
      extended by oracle.adf.model.adapter.bean.UpdatableBeanDataControl
          extended by oracle.adfinternal.model.adapter.bean.DefaultUpdateableBeanDataControl
              extended by oracle.adfinternal.model.adapter.toplink.TopLinkDataControl
All Implemented Interfaces:
TopLinkADFConstants, DataControl, ManagedDataControl, TransactionalDataControl, UpdateableDataControl

public class TopLinkDataControl
extends DefaultUpdateableBeanDataControl
implements UpdateableDataControl, TransactionalDataControl, ManagedDataControl, TopLinkADFConstants

Purpose: Data control for use of TopLink within ADF.

Description: This data control abstracts the use of TopLink. It allows for a single TransactionBroker to be shared among all live objects derived from an underlying Session. This assumes a single transaction and database session (isolated or *client/1server) per user context.

See Also:
TopLinkDefinition, TransactionBroker, PersistenceManager

Field Summary
 
Fields inherited from class oracle.adf.model.adapter.bean.UpdatableBeanDataControl
_logger
 
Fields inherited from class oracle.adf.model.adapter.AbstractImpl
METHOD_CREATE, METHOD_EXECUTE, mName, SORT_CRITERIA
 
Fields inherited from interface oracle.adfinternal.model.adapter.toplink.TopLinkADFConstants
ACCESSOR_ADD_METHOD, ACCESSOR_INSERT_METHOD, ACCESSOR_REMOVE_METHOD, ASSIGN_SEQUENCE_NUMBERS_ON_CREATE, DEPLOYMENT_DESCRIPTOR_PATH, PERSIST_METHOD_NAME, PERSIST_METHOD_PARAM_NAME, SESSION_NAME, SESSIONS_XML_PATH, SHOULD_PERFORM_DELETES_FIRST, TOPLINK_DEFINITION
 
Constructor Summary
TopLinkDataControl(TransactionBroker txnBroker)
           
 
Method Summary
 void beginRequest(java.util.HashMap requestCtx)
          Implemented per the ManagedDataControl contract.
 void commitTransaction()
          Commits the transaction for this data control.
 java.lang.Object createRowData(RowContext ctx)
          Creates the object described by RowContext, adds it to the underlying provider Collection, registers it in the given transaction, and returns the newly created object.
 void endRequest(java.util.HashMap requestCtx)
          Implemented per the ManagedDataControl contract.
 oracle.toplink.sessions.UnitOfWork getAssociatedUnitOfWork()
          ADVANCED: Returns the TopLink UnitOfWork associated with this data control's transaction.
 java.lang.Object getDataProvider()
          Returns the data provider for this data control.
 java.lang.String getName()
          Returns the name of this Data Control.
 oracle.toplink.sessions.Session getSession()
          ADVANCED: Returns the TopLink Session associated with this data control's transaction.
 TransactionBroker getTransaction()
          ADVANCED: Returns the TransactionBroker associated with this data control.
 boolean invokeOperation(java.util.Map bindingContext, OperationBinding action)
          Per the Data Control contract, this method handles executing Accessors on this data control as well as operations.
 boolean isTransactionDirty()
          Indicates whether the TopLink UnitOfWork has any changes.
 java.lang.Object registerDataProvider(RowContext ctx)
          NOOP: Returns the passed in object as the registered data provider.
 void release(int flags)
          Handles releasing TopLink transactional resources when the data control is release from the binding container.
 boolean removeRowData(RowContext ctx)
          Return true if the row at the given index is removed from the the RSI associated with the given iterator-binding.
 boolean resetState()
          Resets the state of the TopLinkDataControl to it's initial state upon entering the application: a new UnitOfWork is acquired and all RSIs associated with this DataControl are reset to their initial state (old query results are invalidated as well).
 void rollbackTransaction()
          Rollsback the transaction for this data control.
 boolean setAttributeValue(AttributeContext ctx, java.lang.Object value)
          This method is called by the data binding framework when a new value is to be set on an attribute in a bean.
 void validate()
          Validates transaction if dirty.
 
Methods inherited from class oracle.adfinternal.model.adapter.bean.DefaultUpdateableBeanDataControl
release
 
Methods inherited from class oracle.adf.model.adapter.bean.UpdatableBeanDataControl
getDCHandler, resetAccessors
 
Methods inherited from class oracle.adf.model.adapter.AbstractImpl
addParameter, createAndAddNewRow, createEmptyDataSet, getAdapterContext, getDefinition, getParameterNames, getParameterValue, getSortCriteria, getStructureDef, getStructureDef, processResult, setDefinition, setName, setParameterValue, setStructureDef, shouldReexecuteOperation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.binding.DataControl
release
 

Constructor Detail

TopLinkDataControl

public TopLinkDataControl(TransactionBroker txnBroker)
Method Detail

commitTransaction

public void commitTransaction()
Commits the transaction for this data control.

Specified by:
commitTransaction in interface TransactionalDataControl

setAttributeValue

public boolean setAttributeValue(AttributeContext ctx,
                                 java.lang.Object value)
Description copied from class: DefaultUpdateableBeanDataControl
This method is called by the data binding framework when a new value is to be set on an attribute in a bean. The attribute and bean are provided in the attribute context along with other framework context information.

Return true if the base framework should skip any further processing of this attribute set. Otherwise return false so that framework can perform a set or put of the attribute value based on introspection.

Specified by:
setAttributeValue in interface UpdateableDataControl
Overrides:
setAttributeValue in class DefaultUpdateableBeanDataControl

createRowData

public java.lang.Object createRowData(RowContext ctx)
Creates the object described by RowContext, adds it to the underlying provider Collection, registers it in the given transaction, and returns the newly created object.

Specified by:
createRowData in interface UpdateableDataControl
Overrides:
createRowData in class DefaultUpdateableBeanDataControl
Parameters:
ctx - - description of the Row to create
Returns:
A data object for the new row.

isTransactionDirty

public boolean isTransactionDirty()
Indicates whether the TopLink UnitOfWork has any changes.

Specified by:
isTransactionDirty in interface TransactionalDataControl
Returns:
true if transaction is dirty, false otherwise.

registerDataProvider

public java.lang.Object registerDataProvider(RowContext ctx)
NOOP: Returns the passed in object as the registered data provider. Since all objects are either registered from the outset or explicit calls are made to associate the object with the transaction, this method always returns the object contained in the row context.

Specified by:
registerDataProvider in interface UpdateableDataControl
Overrides:
registerDataProvider in class DefaultUpdateableBeanDataControl
Parameters:
ctx - Context of the row to be modified or removed.
Returns:
The data object that the row represents.

removeRowData

public boolean removeRowData(RowContext ctx)
Return true if the row at the given index is removed from the the RSI associated with the given iterator-binding. In addition, this method goes into the provider underlying collection removes the object contained in the Row, and marks the object to be deleted in the given transaction.

Specified by:
removeRowData in interface UpdateableDataControl
Overrides:
removeRowData in class DefaultUpdateableBeanDataControl
Parameters:
ctx - Context of the row to be removed.
Returns:
true if the operation is sucessful, false otherwise.

rollbackTransaction

public void rollbackTransaction()
Rollsback the transaction for this data control. The side effect of this method call is that all data controls sharing the same transaction will be commited and have their transactional state reset as well.

Specified by:
rollbackTransaction in interface TransactionalDataControl
See Also:
DCDataControl.rollbackTransaction()()

resetState

public boolean resetState()
Resets the state of the TopLinkDataControl to it's initial state upon entering the application: a new UnitOfWork is acquired and all RSIs associated with this DataControl are reset to their initial state (old query results are invalidated as well). Calls to this method will also recurse to all TopLinkDataControls that share the same TX space in the application.

Specified by:
resetState in interface ManagedDataControl
Returns:
whether this call has been deferred to the end of the web request.

validate

public void validate()
Description copied from class: DefaultUpdateableBeanDataControl
Validates transaction if dirty.

Specified by:
validate in interface UpdateableDataControl
Overrides:
validate in class DefaultUpdateableBeanDataControl

getDataProvider

public java.lang.Object getDataProvider()
Returns the data provider for this data control. In the case of TopLink, the data provider is the data control itself.

Specified by:
getDataProvider in interface DataControl
Overrides:
getDataProvider in class UpdatableBeanDataControl
Returns:
The underlying business service object.

getName

public java.lang.String getName()
Returns the name of this Data Control.

Specified by:
getName in interface DataControl
Overrides:
getName in class UpdatableBeanDataControl

invokeOperation

public boolean invokeOperation(java.util.Map bindingContext,
                               OperationBinding action)
Per the Data Control contract, this method handles executing Accessors on this data control as well as operations. In terms of TopLink, this entails initializing and creating empty Accessors for all defined on the Data Control. Also TopLink queries are executed through this method.

Specified by:
invokeOperation in interface DataControl
Overrides:
invokeOperation in class UpdatableBeanDataControl
Returns:
true if this datacontrol has handled this action, false if the action should be interpreted in the bindings framework or in the caller.

release

public void release(int flags)
Handles releasing TopLink transactional resources when the data control is release from the binding container.


beginRequest

public void beginRequest(java.util.HashMap requestCtx)
Implemented per the ManagedDataControl contract. Tracks when this data control begins an application request.

Specified by:
beginRequest in interface ManagedDataControl
Parameters:
requestCtx - a HashMap representing request context.

endRequest

public void endRequest(java.util.HashMap requestCtx)
Implemented per the ManagedDataControl contract. Tracks when this data control has ended an application request.

Specified by:
endRequest in interface ManagedDataControl
Parameters:
requestCtx - a HashMap representing request context.

getTransaction

public TransactionBroker getTransaction()
ADVANCED: Returns the TransactionBroker associated with this data control.


getAssociatedUnitOfWork

public oracle.toplink.sessions.UnitOfWork getAssociatedUnitOfWork()
ADVANCED: Returns the TopLink UnitOfWork associated with this data control's transaction. Use care when accessing this UnitOfWork as any transactional state management activities will make the transactional state of this data control inconsistent.


getSession

public oracle.toplink.sessions.Session getSession()
ADVANCED: Returns the TopLink Session associated with this data control's transaction. Use care when accessing this Session as any transactional state management activities will make the transactional state of this data control inconsistent.


Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.4.0)

E10653-05

Copyright © 1997, 2011, Oracle. All rights reserved.