org.openanzo.model.transaction.impl
Class TransactionCommand

java.lang.Object
  extended by org.openanzo.model.transaction.impl.TransactionCommand
All Implemented Interfaces:
ITransactionCommand
Direct Known Subclasses:
RDBPersistedCommand

public class TransactionCommand
extends java.lang.Object
implements ITransactionCommand

Standard implementation of ICommand, consisting of a set of NamedGraphChangeSets for the affected graphs.

Author:
Matthew Roy ( mroy@cambridgesemantics.com )

Constructor Summary
TransactionCommand(ITransaction parentTransaction)
          Create a new command without a type
TransactionCommand(ITransaction parentTransaction, java.lang.String commandType, java.util.Set<IPrecondition> preconditions)
          Create a new command with given type, preconditions and context
 
Method Summary
 void addStatementAddition(org.openrdf.model.Statement... statements)
          Add statements to additions for the current command
 void addStatementRemoval(org.openrdf.model.Statement... statements)
          Add statements to deleted for the current command
 void delete()
          Delete the command 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... context)
          Use contents of this command to filter the statements contained within the results collection
 java.util.Collection<org.openrdf.model.URI> getAdditionContexts()
          Get the set of contexts affected by additions within this command
 java.util.Collection<org.openrdf.model.Statement> getAdditions()
          Get the set of additions within this command
 java.lang.String getCommandType()
          Get the type name for the command.
 java.util.Collection<org.openrdf.model.URI> getDeletionContexts()
          Get the set of contexts affected by deletions within this command
 java.util.Collection<org.openrdf.model.Statement> getDeletions()
          Get the set of deletions within this command
 ITransaction getParentTransaction()
          Get the parent transaction for this command.
 java.util.Set<IPrecondition> getPreconditions()
          Get the set of preconditions for this command.
 boolean isEmpty()
          Determine if this command has any additions or deletions
 void save()
          Save the command to its store.
 void setCommandType(java.lang.String commandType)
          Set the type name for this command.
 void setParentTransaction(ITransaction parentTransaction)
          Set the parent transaction for this command.
 void setPreconditions(java.util.Set<IPrecondition> preconditions)
          Set this commands preconditions to the given set.
 int sizeAdditions()
          Get the size of additions within this command
 int sizeAdditions(org.openrdf.model.Resource... context)
          Get the size of additions within this command for the given contexts
 int sizeDeletions()
          Get the size of deletions within this command
 int sizeDeletions(org.openrdf.model.Resource... context)
          Get the size of deletions for the given contexts
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionCommand

public TransactionCommand(ITransaction parentTransaction,
                          java.lang.String commandType,
                          java.util.Set<IPrecondition> preconditions)
Create a new command with given type, preconditions and context

Parameters:
parentTransaction - Parent Transaction
commandType - Type of command
preconditions - Set of preconditions for command

TransactionCommand

public TransactionCommand(ITransaction parentTransaction)
Create a new command without a type

Parameters:
parentTransaction - Parent transaction
Method Detail

getCommandType

public java.lang.String getCommandType()
Description copied from interface: ITransactionCommand
Get the type name for the command.

Specified by:
getCommandType in interface ITransactionCommand
Returns:
The command's type String.

setCommandType

public void setCommandType(java.lang.String commandType)
Description copied from interface: ITransactionCommand
Set the type name for this command.

Specified by:
setCommandType in interface ITransactionCommand
Parameters:
commandType - Command's type String

filter

public 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... context)
Description copied from interface: ITransactionCommand
Use contents of this command to filter the statements contained within the results collection

Specified by:
filter in interface ITransactionCommand
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.
context - The contexts of the statement pattern being searched on.

addStatementAddition

public void addStatementAddition(org.openrdf.model.Statement... statements)
Description copied from interface: ITransactionCommand
Add statements to additions for the current command

Specified by:
addStatementAddition in interface ITransactionCommand
Parameters:
statements - Added Statements to add to command

addStatementRemoval

public void addStatementRemoval(org.openrdf.model.Statement... statements)
Description copied from interface: ITransactionCommand
Add statements to deleted for the current command

Specified by:
addStatementRemoval in interface ITransactionCommand
Parameters:
statements - Deleted Statements to add to command

delete

public void delete()
            throws AnzoException
Description copied from interface: ITransactionCommand
Delete the command from its store.

Specified by:
delete in interface ITransactionCommand
Throws:
AnzoException - if there is an error deleting command

save

public void save()
          throws AnzoException
Description copied from interface: ITransactionCommand
Save the command to its store.

Specified by:
save in interface ITransactionCommand
Throws:
AnzoException - if there is an error saving command

isEmpty

public boolean isEmpty()
Description copied from interface: ITransactionCommand
Determine if this command has any additions or deletions

Specified by:
isEmpty in interface ITransactionCommand
Returns:
True if this command has any additions or deletions

getParentTransaction

public ITransaction getParentTransaction()
Description copied from interface: ITransactionCommand
Get the parent transaction for this command.

Specified by:
getParentTransaction in interface ITransactionCommand
Returns:
the parent transaction for this command.

setParentTransaction

public void setParentTransaction(ITransaction parentTransaction)
Description copied from interface: ITransactionCommand
Set the parent transaction for this command.

Specified by:
setParentTransaction in interface ITransactionCommand

getPreconditions

public java.util.Set<IPrecondition> getPreconditions()
Description copied from interface: ITransactionCommand
Get the set of preconditions for this command.

Specified by:
getPreconditions in interface ITransactionCommand
Returns:
the set of preconditions for this command.
See Also:
IPrecondition

setPreconditions

public void setPreconditions(java.util.Set<IPrecondition> preconditions)
Description copied from interface: ITransactionCommand
Set this commands preconditions to the given set.

Specified by:
setPreconditions in interface ITransactionCommand
Parameters:
preconditions - Set of preconditions that are evaluated on the server

getAdditions

public java.util.Collection<org.openrdf.model.Statement> getAdditions()
Description copied from interface: ITransactionCommand
Get the set of additions within this command

Specified by:
getAdditions in interface ITransactionCommand
Returns:
the set of additions within this command

getDeletions

public java.util.Collection<org.openrdf.model.Statement> getDeletions()
Description copied from interface: ITransactionCommand
Get the set of deletions within this command

Specified by:
getDeletions in interface ITransactionCommand
Returns:
the set of deletions within this command

sizeAdditions

public int sizeAdditions(org.openrdf.model.Resource... context)
Description copied from interface: ITransactionCommand
Get the size of additions within this command for the given contexts

Specified by:
sizeAdditions in interface ITransactionCommand
Parameters:
context - Contexts to determine size
Returns:
the size of additions within this command for the given contexts

sizeDeletions

public int sizeDeletions(org.openrdf.model.Resource... context)
Description copied from interface: ITransactionCommand
Get the size of deletions for the given contexts

Specified by:
sizeDeletions in interface ITransactionCommand
Parameters:
context - Contexts to determine size
Returns:
the size of deletions for the given contexts

sizeAdditions

public int sizeAdditions()
Description copied from interface: ITransactionCommand
Get the size of additions within this command

Specified by:
sizeAdditions in interface ITransactionCommand
Returns:
the size of additions within this command

sizeDeletions

public int sizeDeletions()
Description copied from interface: ITransactionCommand
Get the size of deletions within this command

Specified by:
sizeDeletions in interface ITransactionCommand
Returns:
the size of deletions within this command

getAdditionContexts

public java.util.Collection<org.openrdf.model.URI> getAdditionContexts()
Description copied from interface: ITransactionCommand
Get the set of contexts affected by additions within this command

Specified by:
getAdditionContexts in interface ITransactionCommand
Returns:
the set of contexts affected by additions within this command

getDeletionContexts

public java.util.Collection<org.openrdf.model.URI> getDeletionContexts()
Description copied from interface: ITransactionCommand
Get the set of contexts affected by deletions within this command

Specified by:
getDeletionContexts in interface ITransactionCommand
Returns:
the set of contexts affected by deletions within this command


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