org.sandev.basics.structs
Class AggregateUpdate

java.lang.Object
  extended byorg.sandev.basics.structs.AggregateUpdate
All Implemented Interfaces:
SandMessage, SandTransmitMessage, SandVerbMessage

public class AggregateUpdate
extends java.lang.Object
implements SandVerbMessage

An AggregateUpdate holds an array of update messages which must be executed together as a single transaction. The updates are performed in order, and either succeed or fail as a single transaction.

To specify reference relationships between new instances, or between existing instances and new instances, use temporary uniqueID values. Any value below TEMPIDTHRESHOLD is considered temporary, and will be remapped by the DataManager preserving the defined relationships.

The updates are performed in the order they are given.


Field Summary
protected  int sandTransmissionCount
          Counter value to aid in tracking sent messages.
protected  long sandTransmitAuthID
          User ID for authorization context of this message.
protected  java.lang.String sandTransmitErrorMessage
          Full description of the error message, and any accompanying information.
protected  int sandTransmitStatus
          Status of the message.
protected  SandUpdateMessage[] updates
          The updates comprising this transaction
 
Fields inherited from interface org.sandev.basics.structs.SandTransmitMessage
APPERROR_NODE_UNAVAILABLE, APPERROR_NODE_UNKNOWN, APPERROR_NODE_UNREACHABLE, STATUS_APPERROR, STATUS_NORMAL, STATUS_SANDERROR, STATUS_SYSERROR
 
Constructor Summary
AggregateUpdate()
          Default constructor.
 
Method Summary
 void addUpdate(SandUpdateMessage element)
           
 SandCollectionMessage getCollectionMessage()
          There is no collection form for an AggregateUpdate so this returns null.
 long getNextTempID()
          Return a new temporary uniqueID value for use in creation of a new instance.
 long getNextTempID(java.util.List updMsgs)
          Works just like the no args version of the method, but also traverses all updates in the given list.
 SandQueryMessage getQueryMessage()
          There is no query form for an AggregateUpdate so this returns null.
 int getSandTransmissionCount()
          accessor for sandTransmissionCount
 long getSandTransmitAuthID()
          accessor for sandTransmitAuthID
 java.lang.String getSandTransmitErrorMessage()
          accessor for sandTransmitErrorMessage
 int getSandTransmitStatus()
          accesor for sandTransmitstatus
 java.lang.String getShortName()
          Return the short name for this message class.
 SandStructMessage getStructMessage()
          There is no struct form for an AggregateUpdate so this returns null.
 SandUpdateMessage getUpdateMessage()
          There is no update form for an AggregateUpdate so this returns null.
 SandUpdateMessage[] getUpdates()
          accessor for updates
 boolean isEquivalent(SandMessage sm)
          We don't yet know of a need for equality checking of aggregate updates, so this method always returns false.
 void setSandTransmissionCount(int val)
          mutator for sandTransmissionCount
 void setSandTransmitAuthID(long id)
          mutator for sandTransmitAuthID
 void setSandTransmitErrorMessage(java.lang.String errmsg)
          mutator for sandTransmitErrorMessage
 void setSandTransmitStatus(int status)
          mutator for sandTransmitstatus
 void setUpdates(SandUpdateMessage[] msgs)
          mutator for updates
 java.lang.String toString()
          Return a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sandTransmitStatus

protected int sandTransmitStatus
Status of the message. Possible values are defined in SandTransmitMessage.


sandTransmitErrorMessage

protected java.lang.String sandTransmitErrorMessage
Full description of the error message, and any accompanying information.


sandTransmitAuthID

protected long sandTransmitAuthID
User ID for authorization context of this message.


sandTransmissionCount

protected int sandTransmissionCount
Counter value to aid in tracking sent messages.


updates

protected SandUpdateMessage[] updates
The updates comprising this transaction

Constructor Detail

AggregateUpdate

public AggregateUpdate()
Default constructor. Does nothing.

Method Detail

isEquivalent

public boolean isEquivalent(SandMessage sm)
We don't yet know of a need for equality checking of aggregate updates, so this method always returns false.

Specified by:
isEquivalent in interface SandMessage

getShortName

public java.lang.String getShortName()
Return the short name for this message class.

Specified by:
getShortName in interface SandMessage

getQueryMessage

public SandQueryMessage getQueryMessage()
There is no query form for an AggregateUpdate so this returns null.

Specified by:
getQueryMessage in interface SandMessage

getCollectionMessage

public SandCollectionMessage getCollectionMessage()
There is no collection form for an AggregateUpdate so this returns null.

Specified by:
getCollectionMessage in interface SandMessage

getUpdateMessage

public SandUpdateMessage getUpdateMessage()
There is no update form for an AggregateUpdate so this returns null.

Specified by:
getUpdateMessage in interface SandMessage

getStructMessage

public SandStructMessage getStructMessage()
There is no struct form for an AggregateUpdate so this returns null.

Specified by:
getStructMessage in interface SandMessage

getSandTransmitStatus

public int getSandTransmitStatus()
accesor for sandTransmitstatus

Specified by:
getSandTransmitStatus in interface SandTransmitMessage

setSandTransmitStatus

public void setSandTransmitStatus(int status)
mutator for sandTransmitstatus

Specified by:
setSandTransmitStatus in interface SandTransmitMessage

getSandTransmitErrorMessage

public java.lang.String getSandTransmitErrorMessage()
accessor for sandTransmitErrorMessage

Specified by:
getSandTransmitErrorMessage in interface SandTransmitMessage

setSandTransmitErrorMessage

public void setSandTransmitErrorMessage(java.lang.String errmsg)
mutator for sandTransmitErrorMessage

Specified by:
setSandTransmitErrorMessage in interface SandTransmitMessage

getSandTransmitAuthID

public long getSandTransmitAuthID()
accessor for sandTransmitAuthID

Specified by:
getSandTransmitAuthID in interface SandTransmitMessage

setSandTransmitAuthID

public void setSandTransmitAuthID(long id)
mutator for sandTransmitAuthID

Specified by:
setSandTransmitAuthID in interface SandTransmitMessage

getSandTransmissionCount

public int getSandTransmissionCount()
accessor for sandTransmissionCount

Specified by:
getSandTransmissionCount in interface SandTransmitMessage

setSandTransmissionCount

public void setSandTransmissionCount(int val)
mutator for sandTransmissionCount

Specified by:
setSandTransmissionCount in interface SandTransmitMessage

getUpdates

public SandUpdateMessage[] getUpdates()
accessor for updates


setUpdates

public void setUpdates(SandUpdateMessage[] msgs)
mutator for updates


addUpdate

public void addUpdate(SandUpdateMessage element)

toString

public java.lang.String toString()
Return a string representation of this object. This returns the results of toString for all component update objects separated by newlines.


getNextTempID

public long getNextTempID()
Return a new temporary uniqueID value for use in creation of a new instance. This returns one plus the highest current temporary ID in use.


getNextTempID

public long getNextTempID(java.util.List updMsgs)
Works just like the no args version of the method, but also traverses all updates in the given list. It's a common pattern to accumulate updates in an ArrayList or similar container while doing interim work. This utility allows you to consider those updates in addition to the current updates when generating a new temporary ID.