wt.container.batch
Interface TransactionContainer

All Known Implementing Classes:
TransactionContainerImpl

public interface TransactionContainer

TransactionContainers are used to link together a group of BatchContainers which are being used in a single update transaction. TransactionContainers keep a time ordered record of BatchContainer changes by recording each BatchContainer change as an Asssertion.

Example client code:

// Create the overall transaction container
TransactionContainer txnCntr = BatchContainerFactory.instantiateTransactionContainer();

// Create a main container.
BatchContainer mainContainer = BatchContainerFactory.instantiateGeneralContainer( txnCntr, "main" );

// Create a new A object.
RoleAType roleA = RoleAType.newRoleAType();

// Capture the add assertion.
mainContainer.add( roleA );

// Create a role B container.
RoleBatchContainer roleBContainer = BatchContainerFactory.instantiateRoleBatchContainer( txnCntr, "name", "assocName", "roleB", roleA );

// If roleA object already existed then pre-populate the container.
QueryResult qr = ???.navigate();
roleBContainer.populate( qr );

// Create a role B object.
RoleBType roleB = RoleBType.newRoleBType();
// Assert the existence of the new roleB object.
mainContainer.add( roleB );

// Capture in container.
roleBContainer.add( roleB );

// Make the assertions permanent.
if ( txnCntr.setTransactionResults( ??????.manager.submitTransaction( txnCntr ) ) )
{
// Loop through for bad assertions.

Enumeration enum = txnCntr.getAssertions();

while ( enum.hasMoreElements() ) {
Assertion nextAssertion = (Assertion) enum.nextElement();
if ( assertion.getException() != null )
// do something...
} // whild
} // if


Supported API: true

Extendable: false


Field Summary
static String ASSERTIONS
          Label for the attribute.
static String BATCH_CONTAINER_MAP
          Label for the attribute.
 
Method Summary
 boolean addBatchContainer(String name, BatchContainer batchContainer)
          Operation addBatchContainer is used to associate a BatchContainer with the transaction.
 boolean clearAll()
          Operation clearAll clears each associated BatchContainer and the list of Assertions.
 Enumeration getAssertions()
          Operation getAssertions returns the Assertions for the transaction.
 Enumeration getAssertionTargets()
          Return the set of assertion targets.
 BatchContainer getBatchContainer(String name)
          Operation getBatchContainer returns the BatchContainer for the specified name.
 Enumeration getBatchContainerNames()
          Operation getBatchContainerNames returns the BatchContainer name keys.
 Enumeration getBatchContainers()
          Operation getBatchContainers returns all batch containers associated with the transaction.
 boolean setTransactionResults(TransactionResult[] results)
          Operation setTransactionResults is used to record the results of submitting the assertions to a server.
 

Field Detail

BATCH_CONTAINER_MAP

public static final String BATCH_CONTAINER_MAP
Label for the attribute.

Supported API: false

See Also:
Constant Field Values

ASSERTIONS

public static final String ASSERTIONS
Label for the attribute.

Supported API: false

See Also:
Constant Field Values
Method Detail

addBatchContainer

public boolean addBatchContainer(String name,
                                 BatchContainer batchContainer)
Operation addBatchContainer is used to associate a BatchContainer with the transaction. To distinquish one BatchContainer from another the association is qualified by a name key. False is returned if no change to the TransactionContainer occurred, i.e. the BatchContainer was already contained.

Supported API: true

Parameters:
name -
batchContainer -
Returns:
boolean

getBatchContainers

public Enumeration getBatchContainers()
Operation getBatchContainers returns all batch containers associated with the transaction.

Supported API: true

Returns:
Enumeration

getBatchContainerNames

public Enumeration getBatchContainerNames()
Operation getBatchContainerNames returns the BatchContainer name keys.

Supported API: true

Returns:
Enumeration

getBatchContainer

public BatchContainer getBatchContainer(String name)
Operation getBatchContainer returns the BatchContainer for the specified name.

Supported API: true

Parameters:
name -
Returns:
BatchContainer

getAssertions

public Enumeration getAssertions()
Operation getAssertions returns the Assertions for the transaction. The enumeration is in time ordered sequence.

Supported API: true

Returns:
Enumeration

setTransactionResults

public boolean setTransactionResults(TransactionResult[] results)
Operation setTransactionResults is used to record the results of submitting the assertions to a server. If any exceptions are detected the server returnes an array of TransactionResult obejcts which indicate which Assertion failed and the associated WTException. This operation loops over the results array and attaches the exceptions to the appropriate assertion.

Supported API: true

Parameters:
results -
Returns:
boolean

clearAll

public boolean clearAll()
Operation clearAll clears each associated BatchContainer and the list of Assertions.

Supported API: true

Returns:
boolean

getAssertionTargets

public Enumeration getAssertionTargets()
Return the set of assertion targets. Targets of multiple assertions will not be replicated.

Supported API: true

Returns:
Enumeration