org.openanzo.model.transaction
Interface ITransaction

All Known Implementing Classes:
RDBPersistedTransaction, Transaction

public interface ITransaction

An ITransaction is the main work unit of a Transaction. It is made up of a series of ITransactionCommands

Author:
Joe Betz, Matthew Roy ( mroy@cambridgesemantics.com )

Method Summary
 void delete()
          Delete the transaction from its store.
 void filter(java.util.Collection<org.openrdf.model.Statement> results, org.openrdf.model.Resource s, org.openrdf.model.URI p, org.openrdf.model.Value o, org.openrdf.model.Resource... contexts)
          Use contents of ITransaction to filter the statements contained within the results collection
 int getCommandCount()
          Get the number of the commands within this transaction.
 java.util.List<ITransactionCommand> getCommands()
          Get a List of all the commands within this transaction.
 ITransactionCommand getCurrentCommand(boolean create)
          Get the current command if one exists, and create if empty and create flag is true
 long getId()
           
 ITransactionQueue getTransactionQueue()
          Get the transactionQueue that this transaction is associated with.
 java.lang.Long getTransactionTimestamp()
          Get the transaction's timestamp
 boolean isEmpty()
          Does this transaction have any commands
 ITransactionCommand nextCommand(java.lang.String commandType)
          Add a new command with the given type, and set it as the currentCommand for this transaction.
 void redo()
          Redo the last command undone.
 void save()
          Save the transaction to its store.
 void setId(long id)
          Set the unique id for this transaction, useful when dealing with server transactions.
 void setTransactionQueue(ITransactionQueue transactionQueue)
          Set the transaction queue that this transaction will be associated with.
 void setTransactionTimestamp(java.lang.Long transactionTimestamp)
          Set the transaction's timestamp
 void undo()
          Undo the last command.
 

Method Detail

getId

long getId()
Returns:
the unique id for this transaction, useful when dealing with server transactions.

setId

void setId(long id)
Set the unique id for this transaction, useful when dealing with server transactions.

Parameters:
id - unique if for this transaction

getTransactionTimestamp

java.lang.Long getTransactionTimestamp()
Get the transaction's timestamp

Returns:
the transaction's timestamp

setTransactionTimestamp

void setTransactionTimestamp(java.lang.Long transactionTimestamp)
Set the transaction's timestamp

Parameters:
transactionTimestamp - Timestamp for transaction

delete

void delete()
            throws AnzoException
Delete the transaction from its store.

Throws:
AnzoException - if there is an error deleting tranaction

save

void save()
          throws AnzoException
Save the transaction to its store.

Throws:
AnzoException - if there is an error saving tranaction

nextCommand

ITransactionCommand nextCommand(java.lang.String commandType)
Add a new command with the given type, and set it as the currentCommand for this transaction.

Parameters:
commandType - The CommandType for the new command
Returns:
The newly create command

getCommandCount

int getCommandCount()
Get the number of the commands within this transaction.

Returns:
the number of the commands within this transaction

getCommands

java.util.List<ITransactionCommand> getCommands()
Get a List of all the commands within this transaction.

Returns:
List of all the commands within this transaction

getCurrentCommand

ITransactionCommand getCurrentCommand(boolean create)
Get the current command if one exists, and create if empty and create flag is true

Parameters:
create - Whether to create a new command if one doesn't exist.
Returns:
current command, or new command if create flag is true

getTransactionQueue

ITransactionQueue getTransactionQueue()
Get the transactionQueue that this transaction is associated with.

Returns:
transactionQueue that this transaction is associated with

setTransactionQueue

void setTransactionQueue(ITransactionQueue transactionQueue)
Set the transaction queue that this transaction will be associated with.

Parameters:
transactionQueue - to which this transaction belongs

filter

void filter(java.util.Collection<org.openrdf.model.Statement> results,
            org.openrdf.model.Resource s,
            org.openrdf.model.URI p,
            org.openrdf.model.Value o,
            org.openrdf.model.Resource... contexts)
Use contents of ITransaction to filter the statements contained within the results collection

Parameters:
results - The collection to overlay with the additions and deletions within this transaction.
s - The subject of the statement pattern being searched on.
p - The property of the statement pattern being searched on.
o - The object of the statement pattern being searched on.
contexts - The contexts of the statement pattern being searched on.

undo

void undo()
          throws AnzoException
Undo the last command. This consists of removing the command from the transaction queue.

Throws:
AnzoException - if there was an error undoing transaction

redo

void redo()
          throws AnzoException
Redo the last command undone. This consists of placing the command back on the transaction queue.

Throws:
AnzoException - if there was an error redoing transaction

isEmpty

boolean isEmpty()
Does this transaction have any commands

Returns:
True if this transaction has any commands


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.