org.openanzo.server.repository.update
Class TransactionUpdateResults

java.lang.Object
  extended by org.openanzo.server.repository.update.TransactionUpdateResults
All Implemented Interfaces:
IModelTransactionUpdates

public class TransactionUpdateResults
extends java.lang.Object
implements IModelTransactionUpdates

Tracks adds, updates, removes and errors in an update transaction. Update operations on a statement are merged so that only the final state of the statment is stored. Removed NamedGraphs are tracked seperate from statements.

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

Field Summary
 int addCount
          Statements added
 int removeCount
          Statements removed
 
Constructor Summary
TransactionUpdateResults(java.lang.Long userId, java.lang.Long timestamp, long transactionId)
          Create a new TransactionUpdateResults
 
Method Summary
 void addNamedGraph(org.openrdf.model.URI namedGraphUri, NamedGraph ng)
          Add a NamedGraph and its URI to set of NamedGraphs
 java.util.List<org.openrdf.model.Statement> getAdditionStatements()
           
 java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> getCanAdd()
          Get Cache of user's permission to add to a namedGraph
 java.lang.Boolean getCanInsertNamedGraphs()
          Cache of user's permission to insert a new namedGraph
 java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> getCanRemove()
          Cache of user's permission to remove from a namedGraph
 java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> getCanRemoveNamedGraphs()
          Cache of user's permission to remove a namedGraph
 java.util.List<org.openrdf.model.Statement> getDeletionStatements()
           
 java.io.ByteArrayOutputStream getErrorOutputStream()
          Get the errors as an outputStream to which errors can be written
 java.util.List<AnzoException> getErrors()
          Get the List of errors that occured during this transaction
 IRepositoryHandler getHandler()
          Get the IBocaHandler that handles writting udpates to client
 java.util.HashMap<java.lang.Long,java.lang.Boolean> getIsSysAdmin()
          Get Cache of user's membership in sysamin role
 java.util.HashMap<org.openrdf.model.URI,NamedGraph> getNamedGraphUpdates()
          Get the map of URIs to NamedGraphs that have been updated in this transaction
 java.io.ByteArrayOutputStream getOutputStream()
          Get the results outputStream that can be handed to a stream parser.
 long getTransactionId()
          Get the id of this transaction
 java.lang.Long getTransactionTimestamp()
          Get the timestamp when this transaction was commited
 java.lang.Long getUpdateUserId()
          Get the User that created this transaction
 void handleError(int errorNumber, int errorSubNumber, java.lang.String... errorMessageArgs)
          Handle an error by creating a AnzoException and writing error to handler
 boolean hasError()
          Return true if any errors have occurred during this transaction
 void removeNamedGraph(org.openrdf.model.URI namedGraphUri)
          Remove a NamedGraph from set of NamedGraphs
 void setCanAdd(java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> canAdd)
          Set Cache of user's permission to add to a namedGraph
 void setCanInsertNamedGraphs(java.lang.Boolean canInsertNamedGraphs)
          Set Cache of user's permission to insert a new namedGraph
 void setCanRemove(java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> canRemove)
          Set Cache of user's permission to remove from a namedGraph
 void setCanRemoveNamedGraphs(java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> canRemoveNamedGraphs)
          Set Cache of user's permission to remove a namedGraph
 void setIsSysAdmin(java.util.HashMap<java.lang.Long,java.lang.Boolean> isSysAdmin)
          Set Cache of user's membership in sysadmin role
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

addCount

public int addCount
Statements added


removeCount

public int removeCount
Statements removed

Constructor Detail

TransactionUpdateResults

public TransactionUpdateResults(java.lang.Long userId,
                                java.lang.Long timestamp,
                                long transactionId)
Create a new TransactionUpdateResults

Parameters:
userId - User who created transaction
timestamp - Timestamp when transaction occurred
transactionId - ID for transaction
Method Detail

getErrors

public java.util.List<AnzoException> getErrors()
Get the List of errors that occured during this transaction

Specified by:
getErrors in interface IModelTransactionUpdates
Returns:
List of erros that occured during this transaction

getTransactionTimestamp

public java.lang.Long getTransactionTimestamp()
Get the timestamp when this transaction was commited

Specified by:
getTransactionTimestamp in interface IModelTransactionUpdates
Returns:
Timestamp when this transaction was commited

getUpdateUserId

public java.lang.Long getUpdateUserId()
Get the User that created this transaction

Returns:
User that created this transaction

addNamedGraph

public void addNamedGraph(org.openrdf.model.URI namedGraphUri,
                          NamedGraph ng)
Add a NamedGraph and its URI to set of NamedGraphs

Parameters:
namedGraphUri - URI of NamedGraph
ng - NamedGraph

removeNamedGraph

public void removeNamedGraph(org.openrdf.model.URI namedGraphUri)
Remove a NamedGraph from set of NamedGraphs

Parameters:
namedGraphUri - URI of NamedGraph

handleError

public void handleError(int errorNumber,
                        int errorSubNumber,
                        java.lang.String... errorMessageArgs)
                 throws AnzoException
Handle an error by creating a AnzoException and writing error to handler

Parameters:
errorNumber - Major code for error
errorSubNumber - Minor code for error
errorMessageArgs - Arguments for error messages
Throws:
AnzoException

getErrorOutputStream

public java.io.ByteArrayOutputStream getErrorOutputStream()
Description copied from interface: IModelTransactionUpdates
Get the errors as an outputStream to which errors can be written

Specified by:
getErrorOutputStream in interface IModelTransactionUpdates
Returns:
the errors as an outputStream to which errors can be written

hasError

public boolean hasError()
Return true if any errors have occurred during this transaction

Returns:
Return true if any errors have occurred during this transaction

getOutputStream

public java.io.ByteArrayOutputStream getOutputStream()
Description copied from interface: IModelTransactionUpdates
Get the results outputStream that can be handed to a stream parser.

Specified by:
getOutputStream in interface IModelTransactionUpdates
Returns:
the results outputStream that can be handed to a stream parser.

getTransactionId

public long getTransactionId()
Description copied from interface: IModelTransactionUpdates
Get the id of this transaction

Specified by:
getTransactionId in interface IModelTransactionUpdates
Returns:
the id of this transaction

getNamedGraphUpdates

public java.util.HashMap<org.openrdf.model.URI,NamedGraph> getNamedGraphUpdates()
Get the map of URIs to NamedGraphs that have been updated in this transaction

Returns:
Map of URIs to NamedGraphs that have been updated in this transaction

getHandler

public IRepositoryHandler getHandler()
Get the IBocaHandler that handles writting udpates to client

Returns:
IBocaHandler that handles writting udpates to client

getIsSysAdmin

public java.util.HashMap<java.lang.Long,java.lang.Boolean> getIsSysAdmin()
Get Cache of user's membership in sysamin role

Returns:
Cache of user's membership in sysamin role

getCanAdd

public java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> getCanAdd()
Get Cache of user's permission to add to a namedGraph

Returns:
Cache of user's permission to add to a namedGraph

getCanInsertNamedGraphs

public java.lang.Boolean getCanInsertNamedGraphs()
Cache of user's permission to insert a new namedGraph

Returns:
Cache of user's permission to insert a new namedGraph

getCanRemove

public java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> getCanRemove()
Cache of user's permission to remove from a namedGraph

Returns:
Cache of user's permission to remove from a namedGraph

getCanRemoveNamedGraphs

public java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> getCanRemoveNamedGraphs()
Cache of user's permission to remove a namedGraph

Returns:
Cache of user's permission to remove a namedGraph

setIsSysAdmin

public void setIsSysAdmin(java.util.HashMap<java.lang.Long,java.lang.Boolean> isSysAdmin)
Set Cache of user's membership in sysadmin role

Parameters:
isSysAdmin - Cache of user's membership in sysadmin role

setCanAdd

public void setCanAdd(java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> canAdd)
Set Cache of user's permission to add to a namedGraph

Parameters:
canAdd - Cache of user's permission to remove from a namedGraph

setCanInsertNamedGraphs

public void setCanInsertNamedGraphs(java.lang.Boolean canInsertNamedGraphs)
Set Cache of user's permission to insert a new namedGraph

Parameters:
canInsertNamedGraphs - Set Cache of user's permission to insert a new namedGraph

setCanRemove

public void setCanRemove(java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> canRemove)
Set Cache of user's permission to remove from a namedGraph

Parameters:
canRemove - Set Cache of user's permission to remove from a namedGraph

setCanRemoveNamedGraphs

public void setCanRemoveNamedGraphs(java.util.HashMap<org.openrdf.model.URI,java.lang.Boolean> canRemoveNamedGraphs)
Set Cache of user's permission to remove a namedGraph

Parameters:
canRemoveNamedGraphs - Set Cache of user's permission to remove a namedGraph

getAdditionStatements

public java.util.List<org.openrdf.model.Statement> getAdditionStatements()
Returns:
the quads

getDeletionStatements

public java.util.List<org.openrdf.model.Statement> getDeletionStatements()
Returns:
the quads


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