- java.lang.Object
-
- org.eclipse.persistence.sdo.SDOChangeSummary
-
- All Implemented Interfaces:
ChangeSummary
public class SDOChangeSummary extends Object implements ChangeSummary
Purpose: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.)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface commonj.sdo.ChangeSummary
ChangeSummary.Setting
-
-
Constructor Summary
Constructors Constructor Description SDOChangeSummary()
SDOChangeSummary(SDODataGraph dataGraph, HelperContext aContext)
SDOChangeSummary(SDODataObject dataObject, HelperContext aContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginLogging()
Clears the List ofchanges
and turns change logging on.void
endLogging()
An implementation that requires logging may throw an UnsupportedOperationException.List
getChangedDataObjects()
Returns a list consisting of all thedata objects
that have been changed whilelogging
.List
getCreated()
INTERNAL: Return all created objectsList
getCreatedXPaths()
INTERNAL:DataGraph
getDataGraph()
Returns thedata graph
associated with this change summary or null.Map
getDeepCopies()
INTERNAL:List
getDeleted()
INTERNAL: Return all deleted objectsList
getModified()
INTERNAL: Return all modified objectsList
getModifiedDoms()
INTERNAL:Map
getOldContainer()
SDODataObject
getOldContainer(DataObject dataObject)
Map
getOldContainers()
INTERNAL:Map
getOldContainmentProperty()
SDOProperty
getOldContainmentProperty(DataObject dataObject)
Returns the value of thecontainment property
data object property at the point when loggingbegan
.SDOSequence
getOldSequence(DataObject dataObject)
Map
getOldSequences()
INTERNAL: Return a map of original sequences keyed on DataObject (cached values).ChangeSummary.Setting
getOldValue(DataObject dataObject, Property property)
List
getOldValues(DataObject dataObject)
Map
getOriginalElements()
INTERNAL:Map
getOriginalSequences()
INTERNAL: Return a map of original sequences keyed on DataObject.Map
getOriginalValueStores()
INTERNAL: Return the map of original ValueStores keyed onObject
getPropertyInternal(DataObject dataObject, Property property)
INTERNAL:Map
getReverseDeletedMap()
INTERNAL:SDODataObject
getRootObject()
Returns the ChangeSummary root DataObject - the object from which changes are tracked.List
getUnsetOCProperties(DataObject dataObject)
INTERNAL: Return a List containing all open content properties that were unsetMap
getUnsetOCPropertiesMap()
INTERNAL: Return the entire HashMap of lists of open content properties that were unset keyed on dataObjectList
getUnsetProps(DataObject dataObject)
INTERNAL:boolean
isCreated(DataObject dataObject)
Returns whether or not the specified data object was created whilelogging
.boolean
isDeleted(DataObject dataObject)
Returns whether or not the specified data object was deleted whilelogging
.boolean
isDirty(DataObject dataObject)
INTERNAL: Return whether thedataObject
has been modified.boolean
isDirty(ListWrapper aListWrapper)
INTERNAL: Return whether theaListWrapper
has been modified.boolean
isDirty(SDOSequence aSequence)
INTERNAL: Return whether theaSequence
has been modified.boolean
isLogging()
Indicates whether change logging is on (true
) or off (false
).boolean
isLoggingMapping()
INTERNAL: Return the logging state during mapping operationsboolean
isModified(DataObject dataObject)
Returns whether or not the specified data object was updated whilelogging
.void
pauseLogging()
INTERNAL: Turn both logging flags on.void
removeUnsetOCProperty(DataObject dataObject, Property ocKey)
INTERNAL: Delete an open content property from the list of unset oc properties keyed on dataObjectvoid
resumeLogging()
INTERNAL: Turn both logging flags back on.void
setCreated(DataObject anObject, boolean created)
INTERNAL: Set flag created value.void
setCreatedXPaths(List createdXPathsList)
INTERNAL:boolean
setDeleted(DataObject anObject, boolean deleted)
INTERNAL: Set flag modified value.void
setDeletedXPaths(List deletedXPathsList)
INTERNAL: The deletedXPaths field is picked up reflectively during marshal/unmarshal operations.void
setHelperContext(HelperContext helperContext)
INTERNAL: Set the helperContext if the default SDOChangeSummary constructor was usedvoid
setLogging(boolean logging)
INTERNAL: Used by CopyHelper to set logging when creating a copy of a changesummaryvoid
setModifiedDoms(List modifiedDomsList)
INTERNAL:void
setOldContainer(SDODataObject aKey, DataObject aValue)
INTERNAL:void
setOldContainmentProperty(SDODataObject aKey, Property aValue)
INTERNAL:void
setOldSequence(SDODataObject aKey, Sequence aValue)
INTERNAL:void
setPropertyInternal(DataObject dataObject, Property property, Object value)
INTERNAL:void
setRootDataObject(DataObject dataObject)
INTERNAL: Set the root DataObject for this ChangeSummary.void
setUnsetOCProperty(DataObject dataObject, Property ocKey)
INTERNAL: Add an open content property that has been unset to the list keyed on dataObjectString
toString()
INTERNAL: Return the string representation of the receiver.void
undoChanges()
This method is intended for use by service implementations only.void
unsetPropertyInternal(DataObject dataObject, Property property)
INTERNAL:boolean
wasSet(DataObject dataObject, Property property)
INTERNAL:
-
-
-
Constructor Detail
-
SDOChangeSummary
public SDOChangeSummary()
-
SDOChangeSummary
public SDOChangeSummary(SDODataObject dataObject, HelperContext aContext)
-
SDOChangeSummary
public SDOChangeSummary(SDODataGraph dataGraph, HelperContext aContext)
-
-
Method Detail
-
isLogging
public boolean isLogging()
Indicates whether change logging is on (true
) or off (false
).- Specified by:
isLogging
in interfaceChangeSummary
- Returns:
true
if change logging is on.- See Also:
beginLogging()
,endLogging()
-
setCreated
public void setCreated(DataObject anObject, boolean created)
INTERNAL: Set flag created value.- Parameters:
created
- flag created's new value.
-
setDeleted
public boolean setDeleted(DataObject anObject, boolean deleted)
INTERNAL: Set flag modified value.- Parameters:
deleted
- flag modified's new value.
-
setOldContainer
public void setOldContainer(SDODataObject aKey, DataObject aValue)
INTERNAL:- Parameters:
aKey
-aValue
- void
-
getOldContainers
public Map getOldContainers()
INTERNAL:- Returns:
-
setOldContainmentProperty
public void setOldContainmentProperty(SDODataObject aKey, Property aValue)
INTERNAL:- Parameters:
aKey
- DataObjectaValue
- Property void
-
setOldSequence
public void setOldSequence(SDODataObject aKey, Sequence aValue)
INTERNAL:- Parameters:
aKey
- DataObjectaValue
- Property void
-
getDataGraph
public DataGraph getDataGraph()
Returns thedata graph
associated with this change summary or null.- Specified by:
getDataGraph
in interfaceChangeSummary
- Returns:
- the data graph.
- See Also:
DataGraph.getChangeSummary()
-
getChangedDataObjects
public List getChangedDataObjects()
Returns a list consisting of all thedata objects
that have been changed whilelogging
.The
new
andmodified
objects in the List are references to objects associated with this ChangeSummary. Thedeleted
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
, orisModified
.- Specified by:
getChangedDataObjects
in interfaceChangeSummary
- Returns:
- a list of changed data objects.
- See Also:
isCreated(DataObject)
,isDeleted(DataObject)
,isModified(DataObject)
-
getModified
public List getModified()
INTERNAL: Return all modified objects- Returns:
- Set
-
getDeleted
public List getDeleted()
INTERNAL: Return all deleted objects- Returns:
- Set
-
getCreated
public List getCreated()
INTERNAL: Return all created objects- Returns:
- Set
-
isCreated
public boolean isCreated(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:
isCreated
in interfaceChangeSummary
- Parameters:
dataObject
- the data object in question.- Returns:
true
if the specified data object was created.- See Also:
getChangedDataObjects()
-
isDeleted
public boolean isDeleted(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:
isDeleted
in interfaceChangeSummary
- Parameters:
dataObject
- the data object in question.- Returns:
true
if the specified data object was deleted.- See Also:
getChangedDataObjects()
-
isModified
public boolean isModified(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:
isModified
in interfaceChangeSummary
- Parameters:
dataObject
- the data object in question.- Returns:
true
if the specified data object was modified.- See Also:
getChangedDataObjects()
-
getOldValues
public List getOldValues(DataObject dataObject)
Returns a list ofsettings
that represent the property values of the givendataObject
at the point when loggingbegan
.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 interfaceChangeSummary
- Parameters:
dataObject
- the object in question.- Returns:
- a list of settings.
- See Also:
getChangedDataObjects()
-
getUnsetProps
public List getUnsetProps(DataObject dataObject)
INTERNAL:- Parameters:
dataObject
-- Returns:
-
getUnsetOCPropertiesMap
public Map getUnsetOCPropertiesMap()
INTERNAL: Return the entire HashMap of lists of open content properties that were unset keyed on dataObject- Returns:
-
getUnsetOCProperties
public List getUnsetOCProperties(DataObject dataObject)
INTERNAL: Return a List containing all open content properties that were unset- Parameters:
dataObject
-- Returns:
-
setUnsetOCProperty
public void setUnsetOCProperty(DataObject dataObject, 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(DataObject dataObject, 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 ofchanges
and turns change logging on. No operation occurs if logging is already on.- Specified by:
beginLogging
in interfaceChangeSummary
- 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:
endLogging
in interfaceChangeSummary
- 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:
getRootObject
in interfaceChangeSummary
- Returns:
- the ChangeSummary root DataObject
-
getOldValue
public ChangeSummary.Setting getOldValue(DataObject dataObject, Property property)
Returns asetting
for the specified property representing the property value of the givendataObject
at the point when loggingbegan
.Returns null if the property was not modified and has not been
deleted
.- Specified by:
getOldValue
in interfaceChangeSummary
- 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(DataObject dataObject)
- Specified by:
getOldContainer
in interfaceChangeSummary
- Parameters:
dataObject
- the object in question.- Returns:
- the old container data object.
-
getOldContainmentProperty
public SDOProperty getOldContainmentProperty(DataObject dataObject)
Returns the value of thecontainment property
data object property at the point when loggingbegan
.- Specified by:
getOldContainmentProperty
in interfaceChangeSummary
- Parameters:
dataObject
- the object in question.- Returns:
- the old containment property.
-
getOldSequence
public SDOSequence getOldSequence(DataObject dataObject)
- Specified by:
getOldSequence
in interfaceChangeSummary
- 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:
undoChanges
in interfaceChangeSummary
- See Also:
beginLogging()
,endLogging()
,isLogging()
-
setRootDataObject
public void setRootDataObject(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(HelperContext helperContext)
INTERNAL: Set the helperContext if the default SDOChangeSummary constructor was used- Parameters:
helperContext
-
-
setCreatedXPaths
public void setCreatedXPaths(List createdXPathsList)
INTERNAL:- Parameters:
createdXPathsList
-
-
getCreatedXPaths
public List getCreatedXPaths()
INTERNAL:- Returns:
-
isLoggingMapping
public boolean isLoggingMapping()
INTERNAL: Return the logging state during mapping operations- Returns:
- logging state
-
setModifiedDoms
public void setModifiedDoms(List modifiedDomsList)
INTERNAL:- Parameters:
modifiedDomsList
-
-
getModifiedDoms
public List getModifiedDoms()
INTERNAL:- Returns:
-
setDeletedXPaths
public void setDeletedXPaths(List deletedXPathsList)
INTERNAL: The deletedXPaths field is picked up reflectively during marshal/unmarshal operations.- Parameters:
deletedXPathsList
-
-
getOldContainmentProperty
public Map getOldContainmentProperty()
-
getOldContainer
public Map getOldContainer()
-
wasSet
public boolean wasSet(DataObject dataObject, Property property)
INTERNAL:- Parameters:
dataObject
-property
-- Returns:
-
getPropertyInternal
public Object getPropertyInternal(DataObject dataObject, Property property)
INTERNAL:- Parameters:
dataObject
-property
-- Returns:
-
setPropertyInternal
public void setPropertyInternal(DataObject dataObject, Property property, Object value)
INTERNAL:- Parameters:
dataObject
-property
-value
-
-
getOriginalValueStores
public Map getOriginalValueStores()
INTERNAL: Return the map of original ValueStores keyed on- Returns:
-
isDirty
public boolean isDirty(DataObject dataObject)
INTERNAL: Return whether thedataObject
has been modified.- Parameters:
dataObject
-- Returns:
-
isDirty
public boolean isDirty(ListWrapper aListWrapper)
INTERNAL: Return whether theaListWrapper
has been modified.- Parameters:
aListWrapper
-- Returns:
-
isDirty
public boolean isDirty(SDOSequence aSequence)
INTERNAL: Return whether theaSequence
has been modified.- Parameters:
aSequence
-- Returns:
-
unsetPropertyInternal
public void unsetPropertyInternal(DataObject dataObject, Property property)
INTERNAL:- Parameters:
dataObject
-property
-
-
getOriginalElements
public Map getOriginalElements()
INTERNAL:- Returns:
- Map of original elements, key and value are both listwrappers
-
getDeepCopies
public Map getDeepCopies()
INTERNAL:- Returns:
- Map of deep copies of DataObjects key is original dataobject
-
getReverseDeletedMap
public Map getReverseDeletedMap()
INTERNAL:- Returns:
- Map of deep copies of DataObjects key is copy of dataobject
-
getOriginalSequences
public Map getOriginalSequences()
INTERNAL: Return a map of original sequences keyed on DataObject.- Returns:
- Map of old Sequences
-
getOldSequences
public 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
-
-