org.plasma.sdo.core
Class CoreChangeSummary

java.lang.Object
  extended by org.plasma.sdo.core.CoreChangeSummary
All Implemented Interfaces:
ChangeSummary, Serializable, PlasmaChangeSummary

public class CoreChangeSummary
extends Object
implements PlasmaChangeSummary, Serializable

A change summary is used to record changes to DataObjects, allowing applications to efficiently and incrementally update back-end storage when required.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface commonj.sdo.ChangeSummary
ChangeSummary.Setting
 
Constructor Summary
CoreChangeSummary(PlasmaDataGraph dataGraph)
           
 
Method Summary
 void beginLogging()
          Clears the List of changes and turns change logging on.
 void clear(DataObject dataObject)
          Removes all change information for the given data object within this change summary.
 void created(DataObject dataObject)
          Register the given data object as a created object within this change summary.
 void deleted(DataObject dataObject)
          Register the given data object as a deleted object within this change summary.
 void endLogging()
          An implementation that requires logging may throw an UnsupportedOperationException.
 List<DataObject> getChangedDataObjects()
          Returns a list consisting of all the data objects that have been changed while logging.
 DataGraph getDataGraph()
          Returns the data graph associated with this change summary or null.
 DataObject getOldContainer(DataObject dataObject)
          Returns the value of the container data object at the point when logging began.
 Property getOldContainmentProperty(DataObject dataObject)
          Returns the value of the containment property data object property at the point when logging began.
 Sequence getOldSequence(DataObject dataObject)
          Returns the value of the sequence for the data object at the point when logging began.
 ChangeSummary.Setting getOldValue(DataObject dataObject, Property property)
          Returns a setting for the specified property representing the property value of the given dataObject at the point when logging began.
 List<ChangeSummary.Setting> getOldValues(DataObject dataObject)
          Returns a list of settings that represent the property values of the given dataObject at the point when logging began.
 int getPathDepth(DataObject dataObject)
          Returns the path depth within the data graph for the given data object.
 DataObject getRootObject()
          Returns the ChangeSummary root DataObject - the object from which changes are tracked.
 boolean isCreated(DataObject dataObject)
          Returns whether or not the specified data object was created while logging.
 boolean isDeleted(DataObject dataObject)
          Returns whether or not the specified data object was deleted while logging.
 boolean isLogging()
          Indicates whether change logging is on (true) or off (false).
 boolean isModified(DataObject dataObject)
          Returns whether or not the specified data object was updated while logging.
 void modified(DataObject dataObject, Property property, Object value)
          Register the given data object as a modified object within this change summary for the given property.
 String toString()
           
 void undoChanges()
          This method is intended for use by service implementations only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CoreChangeSummary

public CoreChangeSummary(PlasmaDataGraph dataGraph)
Method Detail

created

public void created(DataObject dataObject)
Description copied from interface: PlasmaChangeSummary
Register the given data object as a created object within this change summary.

Specified by:
created in interface PlasmaChangeSummary
Parameters:
dataObject - the created data object

deleted

public void deleted(DataObject dataObject)
Description copied from interface: PlasmaChangeSummary
Register the given data object as a deleted object within this change summary.

Specified by:
deleted in interface PlasmaChangeSummary
Parameters:
dataObject - the deleted data object

modified

public void modified(DataObject dataObject,
                     Property property,
                     Object value)
Description copied from interface: PlasmaChangeSummary
Register the given data object as a modified object within this change summary for the given property.

Specified by:
modified in interface PlasmaChangeSummary
Parameters:
dataObject - the modified data object
property - the modified property
value - the previous value for the given property

clear

public void clear(DataObject dataObject)
Description copied from interface: PlasmaChangeSummary
Removes all change information for the given data object within this change summary.

Specified by:
clear in interface PlasmaChangeSummary
Parameters:
dataObject - the data object

beginLogging

public void beginLogging()
Clears the List of changes and turns change logging on. No operation occurs if logging is already on.

Specified by:
beginLogging in interface ChangeSummary
See Also:
endLogging(), isLogging()

endLogging

public void endLogging()
An implementation that requires logging may throw an UnsupportedOperationException. Turns change logging off. No operation occurs if logging is already off.

Specified by:
endLogging in interface ChangeSummary
See Also:
beginLogging(), isLogging()

getChangedDataObjects

public List<DataObject> getChangedDataObjects()
Returns a list consisting of all the data objects that have been changed while logging.

The new and modified objects in the List are references to objects associated with this ChangeSummary. The deleted objects in the List are references to objects at the time that event logging was enabled;

Each changed object must have exactly one of the following methods return true: isCreated, isDeleted, or isModified.

Specified by:
getChangedDataObjects in interface ChangeSummary
Returns:
a list of changed data objects.
See Also:
isCreated(DataObject), isDeleted(DataObject), isModified(DataObject)

getDataGraph

public DataGraph getDataGraph()
Returns the data graph associated with this change summary or null.

Specified by:
getDataGraph in interface ChangeSummary
Returns:
the data graph.
See Also:
DataGraph.getChangeSummary()

getOldContainer

public DataObject getOldContainer(DataObject dataObject)
Returns the value of the container data object at the point when logging began.

Specified by:
getOldContainer in interface ChangeSummary
Parameters:
dataObject - the object in question.
Returns:
the old container data object.

getOldContainmentProperty

public Property getOldContainmentProperty(DataObject dataObject)
Returns the value of the containment property data object property at the point when logging began.

Specified by:
getOldContainmentProperty in interface ChangeSummary
Parameters:
dataObject - the object in question.
Returns:
the old containment property.

getOldSequence

public Sequence getOldSequence(DataObject dataObject)
Returns the value of the sequence for the data object at the point when logging began.

Specified by:
getOldSequence in interface ChangeSummary
Parameters:
dataObject - the object in question.
Returns:
the old containment property.

getOldValue

public ChangeSummary.Setting getOldValue(DataObject dataObject,
                                         Property property)
Returns a setting for the specified property representing the property value of the given dataObject at the point when logging began.

Returns null if the property was not modified and has not been deleted.

Specified by:
getOldValue in interface ChangeSummary
Parameters:
dataObject - the object in question.
property - the property of the object.
Returns:
the Setting for the specified property.
See Also:
getChangedDataObjects()

getOldValues

public List<ChangeSummary.Setting> getOldValues(DataObject dataObject)
Returns a list of settings that represent the property values of the given dataObject at the point when logging began.

In the case of a deleted object, the List will include settings for all the Properties.

An old value setting indicates the value at the point logging begins. A setting is only produced for modified objects if either the old value differs from the current value or if the isSet differs from the current value.

No settings are produced for created objects.

Specified by:
getOldValues in interface ChangeSummary
Parameters:
dataObject - the object in question.
Returns:
a list of settings.
See Also:
getChangedDataObjects()

getRootObject

public DataObject getRootObject()
Returns the ChangeSummary root DataObject - the object from which changes are tracked. When a DataGraph is used, this is the same as getDataGraph().getRootObject().

Specified by:
getRootObject in interface ChangeSummary
Returns:
the ChangeSummary root DataObject

isCreated

public boolean isCreated(DataObject dataObject)
Returns whether or not the specified data object was created while logging. Any object that was added to the scope but was not in the scope when logging began, will be considered created.

Specified by:
isCreated in interface ChangeSummary
Parameters:
dataObject - the data object in question.
Returns:
true if the specified data object was created.
See Also:
getChangedDataObjects()

isModified

public boolean isModified(DataObject dataObject)
Returns whether or not the specified data object was updated while logging. An object that was contained in the scope when logging began and remains in the scope when logging ends will be considered potentially modified.

An object considered modified must have at least one old value setting.

Specified by:
isModified in interface ChangeSummary
Parameters:
dataObject - the data object in question.
Returns:
true if the specified data object was modified.
See Also:
getChangedDataObjects()

isDeleted

public boolean isDeleted(DataObject dataObject)
Returns whether or not the specified data object was deleted while logging. Any object that is not in scope but was in scope when logging began will be considered deleted.

Specified by:
isDeleted in interface ChangeSummary
Parameters:
dataObject - the data object in question.
Returns:
true if the specified data object was deleted.
See Also:
getChangedDataObjects()

getPathDepth

public int getPathDepth(DataObject dataObject)
Description copied from interface: PlasmaChangeSummary
Returns the path depth within the data graph for the given data object.

Specified by:
getPathDepth in interface PlasmaChangeSummary
Parameters:
dataObject - the data object
Returns:
the path depth

isLogging

public boolean isLogging()
Indicates whether change logging is on (true) or off (false).

Specified by:
isLogging in interface ChangeSummary
Returns:
true if change logging is on.
See Also:
beginLogging(), endLogging()

undoChanges

public void undoChanges()
This method is intended for use by service implementations only. Undoes all changes in the log to restore the tree of DataObjects to its original state when logging began. isLogging() is unchanged. The log is cleared.

Specified by:
undoChanges in interface ChangeSummary
See Also:
beginLogging(), endLogging(), isLogging()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All rights reserved.