Class SDOChangeSummary
- java.lang.Object
-
- org.eclipse.persistence.sdo.SDOChangeSummary
-
- All Implemented Interfaces:
commonj.sdo.ChangeSummary
public class SDOChangeSummary extends java.lang.Object implements commonj.sdo.ChangeSummaryPurpose:A change summary is used to record changes to DataObjects.
Responsibilities:
- Track changes to DataObjects that are within the scope of this ChangeSummary (based on the root object of the Changesummary).
- Track if those DataObjects are created, modified or deleted.
- Return the values at the time that ChangeSummary logging was turned on for DataObjects in scope.
This class is implemented as a Memento (283) [GOF - Gamma, Helm, Johnson, Vlissides] Design Pattern.
(Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.)
The class also realizes some aspects of the Command (233) Pattern - the undo-able operation part (from the first change).
(Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undo-able operations.)
-
-
Constructor Summary
Constructors Constructor Description SDOChangeSummary()SDOChangeSummary(SDODataGraph dataGraph, commonj.sdo.helper.HelperContext aContext)SDOChangeSummary(SDODataObject dataObject, commonj.sdo.helper.HelperContext aContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginLogging()Clears the List ofchangesand turns change logging on.voidendLogging()An implementation that requires logging may throw an UnsupportedOperationException.java.util.ListgetChangedDataObjects()Returns a list consisting of all thedata objectsthat have been changed whilelogging.java.util.ListgetCreated()INTERNAL: Return all created objectsjava.util.ListgetCreatedXPaths()INTERNAL:commonj.sdo.DataGraphgetDataGraph()Returns thedata graphassociated with this change summary or null.java.util.MapgetDeepCopies()INTERNAL:java.util.ListgetDeleted()INTERNAL: Return all deleted objectsjava.util.ListgetModified()INTERNAL: Return all modified objectsjava.util.ListgetModifiedDoms()INTERNAL:java.util.MapgetOldContainer()SDODataObjectgetOldContainer(commonj.sdo.DataObject dataObject)Returns the value of thecontainerdata object at the point when loggingbegan.java.util.MapgetOldContainers()INTERNAL:java.util.MapgetOldContainmentProperty()SDOPropertygetOldContainmentProperty(commonj.sdo.DataObject dataObject)Returns the value of thecontainment propertydata object property at the point when loggingbegan.SDOSequencegetOldSequence(commonj.sdo.DataObject dataObject)Returns the value of thesequencefor the data object at the point when loggingbegan.java.util.MapgetOldSequences()INTERNAL: Return a map of original sequences keyed on DataObject (cached values).commonj.sdo.ChangeSummary.SettinggetOldValue(commonj.sdo.DataObject dataObject, commonj.sdo.Property property)Returns asettingfor the specified property representing the property value of the givendataObjectat the point when loggingbegan.java.util.ListgetOldValues(commonj.sdo.DataObject dataObject)Returns a list ofsettingsthat represent the property values of the givendataObjectat the point when loggingbegan.java.util.MapgetOriginalElements()INTERNAL:java.util.MapgetOriginalSequences()INTERNAL: Return a map of original sequences keyed on DataObject.java.util.MapgetOriginalValueStores()INTERNAL: Return the map of original ValueStores keyed onjava.lang.ObjectgetPropertyInternal(commonj.sdo.DataObject dataObject, commonj.sdo.Property property)INTERNAL:java.util.MapgetReverseDeletedMap()INTERNAL:SDODataObjectgetRootObject()Returns the ChangeSummary root DataObject - the object from which changes are tracked.java.util.ListgetUnsetOCProperties(commonj.sdo.DataObject dataObject)INTERNAL: Return a List containing all open content properties that were unsetjava.util.MapgetUnsetOCPropertiesMap()INTERNAL: Return the entire HashMap of lists of open content properties that were unset keyed on dataObjectjava.util.ListgetUnsetProps(commonj.sdo.DataObject dataObject)INTERNAL:booleanisCreated(commonj.sdo.DataObject dataObject)Returns whether or not the specified data object was created whilelogging.booleanisDeleted(commonj.sdo.DataObject dataObject)Returns whether or not the specified data object was deleted whilelogging.booleanisDirty(commonj.sdo.DataObject dataObject)INTERNAL: Return whether thedataObjecthas been modified.booleanisDirty(ListWrapper aListWrapper)INTERNAL: Return whether theaListWrapperhas been modified.booleanisDirty(SDOSequence aSequence)INTERNAL: Return whether theaSequencehas been modified.booleanisLogging()Indicates whether change logging is on (true) or off (false).booleanisLoggingMapping()INTERNAL: Return the logging state during mapping operationsbooleanisModified(commonj.sdo.DataObject dataObject)Returns whether or not the specified data object was updated whilelogging.voidpauseLogging()INTERNAL: Turn both logging flags on.voidremoveUnsetOCProperty(commonj.sdo.DataObject dataObject, commonj.sdo.Property ocKey)INTERNAL: Delete an open content property from the list of unset oc properties keyed on dataObjectvoidresumeLogging()INTERNAL: Turn both logging flags back on.voidsetCreated(commonj.sdo.DataObject anObject, boolean created)INTERNAL: Set flag created value.voidsetCreatedXPaths(java.util.List createdXPathsList)INTERNAL:booleansetDeleted(commonj.sdo.DataObject anObject, boolean deleted)INTERNAL: Set flag modified value.voidsetDeletedXPaths(java.util.List deletedXPathsList)INTERNAL: The deletedXPaths field is picked up reflectively during marshal/unmarshal operations.voidsetHelperContext(commonj.sdo.helper.HelperContext helperContext)INTERNAL: Set the helperContext if the default SDOChangeSummary constructor was usedvoidsetLogging(boolean logging)INTERNAL: Used by CopyHelper to set logging when creating a copy of a changesummaryvoidsetModifiedDoms(java.util.List modifiedDomsList)INTERNAL:voidsetOldContainer(SDODataObject aKey, commonj.sdo.DataObject aValue)INTERNAL:voidsetOldContainmentProperty(SDODataObject aKey, commonj.sdo.Property aValue)INTERNAL:voidsetOldSequence(SDODataObject aKey, commonj.sdo.Sequence aValue)INTERNAL:voidsetPropertyInternal(commonj.sdo.DataObject dataObject, commonj.sdo.Property property, java.lang.Object value)INTERNAL:voidsetRootDataObject(commonj.sdo.DataObject dataObject)INTERNAL: Set the root DataObject for this ChangeSummary.voidsetUnsetOCProperty(commonj.sdo.DataObject dataObject, commonj.sdo.Property ocKey)INTERNAL: Add an open content property that has been unset to the list keyed on dataObjectjava.lang.StringtoString()INTERNAL: Return the string representation of the receiver.voidundoChanges()This method is intended for use by service implementations only.voidunsetPropertyInternal(commonj.sdo.DataObject dataObject, commonj.sdo.Property property)INTERNAL:booleanwasSet(commonj.sdo.DataObject dataObject, commonj.sdo.Property property)INTERNAL:
-
-
-
Constructor Detail
-
SDOChangeSummary
public SDOChangeSummary()
-
SDOChangeSummary
public SDOChangeSummary(SDODataObject dataObject, commonj.sdo.helper.HelperContext aContext)
-
SDOChangeSummary
public SDOChangeSummary(SDODataGraph dataGraph, commonj.sdo.helper.HelperContext aContext)
-
-
Method Detail
-
isLogging
public boolean isLogging()
Indicates whether change logging is on (true) or off (false).- Specified by:
isLoggingin interfacecommonj.sdo.ChangeSummary- Returns:
trueif change logging is on.- See Also:
beginLogging(),endLogging()
-
setCreated
public void setCreated(commonj.sdo.DataObject anObject, boolean created)INTERNAL: Set flag created value.- Parameters:
created- flag created's new value.
-
setDeleted
public boolean setDeleted(commonj.sdo.DataObject anObject, boolean deleted)INTERNAL: Set flag modified value.- Parameters:
deleted- flag modified's new value.
-
setOldContainer
public void setOldContainer(SDODataObject aKey, commonj.sdo.DataObject aValue)
INTERNAL:- Parameters:
aKey-aValue- void
-
getOldContainers
public java.util.Map getOldContainers()
INTERNAL:- Returns:
-
setOldContainmentProperty
public void setOldContainmentProperty(SDODataObject aKey, commonj.sdo.Property aValue)
INTERNAL:- Parameters:
aKey- DataObjectaValue- Property void
-
setOldSequence
public void setOldSequence(SDODataObject aKey, commonj.sdo.Sequence aValue)
INTERNAL:- Parameters:
aKey- DataObjectaValue- Property void
-
getDataGraph
public commonj.sdo.DataGraph getDataGraph()
Returns thedata graphassociated with this change summary or null.- Specified by:
getDataGraphin interfacecommonj.sdo.ChangeSummary- Returns:
- the data graph.
- See Also:
DataGraph.getChangeSummary()
-
getChangedDataObjects
public java.util.List getChangedDataObjects()
Returns a list consisting of all thedata objectsthat have been changed whilelogging.The
newandmodifiedobjects in the List are references to objects associated with this ChangeSummary. Thedeletedobjects 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, orisModified.- Specified by:
getChangedDataObjectsin interfacecommonj.sdo.ChangeSummary- Returns:
- a list of changed data objects.
- See Also:
isCreated(DataObject),isDeleted(DataObject),isModified(DataObject)
-
getModified
public java.util.List getModified()
INTERNAL: Return all modified objects- Returns:
- Set
-
getDeleted
public java.util.List getDeleted()
INTERNAL: Return all deleted objects- Returns:
- Set
-
getCreated
public java.util.List getCreated()
INTERNAL: Return all created objects- Returns:
- Set
-
isCreated
public boolean isCreated(commonj.sdo.DataObject dataObject)
Returns whether or not the specified data object was created whilelogging. Any object that was added to the scope but was not in the scope when logging began, will be considered created.- Specified by:
isCreatedin interfacecommonj.sdo.ChangeSummary- Parameters:
dataObject- the data object in question.- Returns:
trueif the specified data object was created.- See Also:
getChangedDataObjects()
-
isDeleted
public boolean isDeleted(commonj.sdo.DataObject dataObject)
Returns whether or not the specified data object was deleted whilelogging. Any object that is not in scope but was in scope when logging began will be considered deleted.- Specified by:
isDeletedin interfacecommonj.sdo.ChangeSummary- Parameters:
dataObject- the data object in question.- Returns:
trueif the specified data object was deleted.- See Also:
getChangedDataObjects()
-
isModified
public boolean isModified(commonj.sdo.DataObject dataObject)
Returns whether or not the specified data object was updated whilelogging. 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:
isModifiedin interfacecommonj.sdo.ChangeSummary- Parameters:
dataObject- the data object in question.- Returns:
trueif the specified data object was modified.- See Also:
getChangedDataObjects()
-
getOldValues
public java.util.List getOldValues(commonj.sdo.DataObject dataObject)
Returns a list ofsettingsthat represent the property values of the givendataObjectat the point when loggingbegan.In the case of a
deletedobject, 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
modifiedobjects if either the old value differs from the current value or if the isSet differs from the current value.No settings are produced for
createdobjects.- Specified by:
getOldValuesin interfacecommonj.sdo.ChangeSummary- Parameters:
dataObject- the object in question.- Returns:
- a list of settings.
- See Also:
getChangedDataObjects()
-
getUnsetProps
public java.util.List getUnsetProps(commonj.sdo.DataObject dataObject)
INTERNAL:- Parameters:
dataObject-- Returns:
-
getUnsetOCPropertiesMap
public java.util.Map getUnsetOCPropertiesMap()
INTERNAL: Return the entire HashMap of lists of open content properties that were unset keyed on dataObject- Returns:
-
getUnsetOCProperties
public java.util.List getUnsetOCProperties(commonj.sdo.DataObject dataObject)
INTERNAL: Return a List containing all open content properties that were unset- Parameters:
dataObject-- Returns:
-
setUnsetOCProperty
public void setUnsetOCProperty(commonj.sdo.DataObject dataObject, commonj.sdo.Property ocKey)INTERNAL: Add an open content property that has been unset to the list keyed on dataObject- Parameters:
dataObject-ocKey-
-
removeUnsetOCProperty
public void removeUnsetOCProperty(commonj.sdo.DataObject dataObject, commonj.sdo.Property ocKey)INTERNAL: Delete an open content property from the list of unset oc properties keyed on dataObject- Parameters:
dataObject-ocKey-
-
beginLogging
public void beginLogging()
Clears the List ofchangesand turns change logging on. No operation occurs if logging is already on.- Specified by:
beginLoggingin interfacecommonj.sdo.ChangeSummary- See Also:
endLogging(),isLogging()
-
resumeLogging
public void resumeLogging()
INTERNAL: Turn both logging flags back on.
-
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:
endLoggingin interfacecommonj.sdo.ChangeSummary- See Also:
beginLogging(),isLogging()
-
pauseLogging
public void pauseLogging()
INTERNAL: Turn both logging flags on.
-
getRootObject
public SDODataObject 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:
getRootObjectin interfacecommonj.sdo.ChangeSummary- Returns:
- the ChangeSummary root DataObject
-
getOldValue
public commonj.sdo.ChangeSummary.Setting getOldValue(commonj.sdo.DataObject dataObject, commonj.sdo.Property property)Returns asettingfor the specified property representing the property value of the givendataObjectat the point when loggingbegan.Returns null if the property was not modified and has not been
deleted.- Specified by:
getOldValuein interfacecommonj.sdo.ChangeSummary- Parameters:
dataObject- the object in question.property- the property of the object.- Returns:
- the Setting for the specified property.
- See Also:
getChangedDataObjects()
-
getOldContainer
public SDODataObject getOldContainer(commonj.sdo.DataObject dataObject)
Returns the value of thecontainerdata object at the point when loggingbegan.- Specified by:
getOldContainerin interfacecommonj.sdo.ChangeSummary- Parameters:
dataObject- the object in question.- Returns:
- the old container data object.
-
getOldContainmentProperty
public SDOProperty getOldContainmentProperty(commonj.sdo.DataObject dataObject)
Returns the value of thecontainment propertydata object property at the point when loggingbegan.- Specified by:
getOldContainmentPropertyin interfacecommonj.sdo.ChangeSummary- Parameters:
dataObject- the object in question.- Returns:
- the old containment property.
-
getOldSequence
public SDOSequence getOldSequence(commonj.sdo.DataObject dataObject)
Returns the value of thesequencefor the data object at the point when loggingbegan.- Specified by:
getOldSequencein interfacecommonj.sdo.ChangeSummary- Parameters:
dataObject- the object in question.- Returns:
- the old containment property.
-
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:
undoChangesin interfacecommonj.sdo.ChangeSummary- See Also:
beginLogging(),endLogging(),isLogging()
-
setRootDataObject
public void setRootDataObject(commonj.sdo.DataObject dataObject)
INTERNAL: Set the root DataObject for this ChangeSummary.- Parameters:
dataObject- the root of DataObject tree this ChangeSummary belongs to
-
setLogging
public void setLogging(boolean logging)
INTERNAL: Used by CopyHelper to set logging when creating a copy of a changesummary- Parameters:
logging- logging status
-
setHelperContext
public void setHelperContext(commonj.sdo.helper.HelperContext helperContext)
INTERNAL: Set the helperContext if the default SDOChangeSummary constructor was used- Parameters:
helperContext-
-
setCreatedXPaths
public void setCreatedXPaths(java.util.List createdXPathsList)
INTERNAL:- Parameters:
createdXPathsList-
-
getCreatedXPaths
public java.util.List getCreatedXPaths()
INTERNAL:- Returns:
-
isLoggingMapping
public boolean isLoggingMapping()
INTERNAL: Return the logging state during mapping operations- Returns:
- logging state
-
setModifiedDoms
public void setModifiedDoms(java.util.List modifiedDomsList)
INTERNAL:- Parameters:
modifiedDomsList-
-
getModifiedDoms
public java.util.List getModifiedDoms()
INTERNAL:- Returns:
-
setDeletedXPaths
public void setDeletedXPaths(java.util.List deletedXPathsList)
INTERNAL: The deletedXPaths field is picked up reflectively during marshal/unmarshal operations.- Parameters:
deletedXPathsList-
-
getOldContainmentProperty
public java.util.Map getOldContainmentProperty()
-
getOldContainer
public java.util.Map getOldContainer()
-
wasSet
public boolean wasSet(commonj.sdo.DataObject dataObject, commonj.sdo.Property property)INTERNAL:- Parameters:
dataObject-property-- Returns:
-
getPropertyInternal
public java.lang.Object getPropertyInternal(commonj.sdo.DataObject dataObject, commonj.sdo.Property property)INTERNAL:- Parameters:
dataObject-property-- Returns:
-
setPropertyInternal
public void setPropertyInternal(commonj.sdo.DataObject dataObject, commonj.sdo.Property property, java.lang.Object value)INTERNAL:- Parameters:
dataObject-property-value-
-
getOriginalValueStores
public java.util.Map getOriginalValueStores()
INTERNAL: Return the map of original ValueStores keyed on- Returns:
-
isDirty
public boolean isDirty(commonj.sdo.DataObject dataObject)
INTERNAL: Return whether thedataObjecthas been modified.- Parameters:
dataObject-- Returns:
-
isDirty
public boolean isDirty(ListWrapper aListWrapper)
INTERNAL: Return whether theaListWrapperhas been modified.- Parameters:
aListWrapper-- Returns:
-
isDirty
public boolean isDirty(SDOSequence aSequence)
INTERNAL: Return whether theaSequencehas been modified.- Parameters:
aSequence-- Returns:
-
unsetPropertyInternal
public void unsetPropertyInternal(commonj.sdo.DataObject dataObject, commonj.sdo.Property property)INTERNAL:- Parameters:
dataObject-property-
-
getOriginalElements
public java.util.Map getOriginalElements()
INTERNAL:- Returns:
- Map of original elements, key and value are both listwrappers
-
getDeepCopies
public java.util.Map getDeepCopies()
INTERNAL:- Returns:
- Map of deep copies of DataObjects key is original dataobject
-
getReverseDeletedMap
public java.util.Map getReverseDeletedMap()
INTERNAL:- Returns:
- Map of deep copies of DataObjects key is copy of dataobject
-
getOriginalSequences
public java.util.Map getOriginalSequences()
INTERNAL: Return a map of original sequences keyed on DataObject.- Returns:
- Map of old Sequences
-
getOldSequences
public java.util.Map getOldSequences()
INTERNAL: Return a map of original sequences keyed on DataObject (cached values).- Returns:
- Map of old Sequences that have deep copies of all DataObjects
-
toString
public java.lang.String toString()
INTERNAL: Return the string representation of the receiver.- Overrides:
toStringin classjava.lang.Object
-
-