public class SDOChangeSummary extends java.lang.Object implements ChangeSummary
Purpose:A change summary is used to record changes to DataObjects.
Responsibilities:
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.)
ChangeSummary.Setting
Constructor and Description |
---|
SDOChangeSummary() |
SDOChangeSummary(SDODataGraph dataGraph,
HelperContext aContext) |
SDOChangeSummary(SDODataObject dataObject,
HelperContext aContext) |
Modifier and Type | Method and Description |
---|---|
void |
beginLogging()
Clears the List of
changes and turns change logging on. |
void |
endLogging()
An implementation that requires logging may throw an UnsupportedOperationException.
|
java.util.List |
getChangedDataObjects()
Returns a list consisting of all the
data objects that have been changed while logging . |
java.util.List |
getCreated()
INTERNAL:
Return all created objects
|
java.util.List |
getCreatedXPaths()
INTERNAL:
|
DataGraph |
getDataGraph()
Returns the
data graph associated with this change summary or null. |
java.util.Map |
getDeepCopies()
INTERNAL:
|
java.util.List |
getDeleted()
INTERNAL:
Return all deleted objects
|
java.util.List |
getModified()
INTERNAL:
Return all modified objects
|
java.util.List |
getModifiedDoms()
INTERNAL:
|
java.util.Map |
getOldContainer() |
SDODataObject |
getOldContainer(DataObject dataObject)
|
java.util.Map |
getOldContainers()
INTERNAL:
|
java.util.Map |
getOldContainmentProperty() |
SDOProperty |
getOldContainmentProperty(DataObject dataObject)
Returns the value of the
containment property data object property
at the point when logging began . |
SDOSequence |
getOldSequence(DataObject dataObject)
|
java.util.Map |
getOldSequences()
INTERNAL:
Return a map of original sequences keyed on DataObject (cached values).
|
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 . |
java.util.List |
getOldValues(DataObject dataObject)
Returns a list of
settings
that represent the property values of the given dataObject
at the point when logging began . |
java.util.Map |
getOriginalElements()
INTERNAL:
|
java.util.Map |
getOriginalSequences()
INTERNAL:
Return a map of original sequences keyed on DataObject.
|
java.util.Map |
getOriginalValueStores()
INTERNAL:
Return the map of original ValueStores keyed on
|
java.lang.Object |
getPropertyInternal(DataObject dataObject,
Property property)
INTERNAL:
|
java.util.Map |
getReverseDeletedMap()
INTERNAL:
|
SDODataObject |
getRootObject()
Returns the ChangeSummary root DataObject - the object from which
changes are tracked.
|
java.util.List |
getUnsetOCProperties(DataObject dataObject)
INTERNAL:
Return a List containing all open content properties that were unset
|
java.util.Map |
getUnsetOCPropertiesMap()
INTERNAL:
Return the entire HashMap of lists of open content properties that were unset
keyed on dataObject
|
java.util.List |
getUnsetProps(DataObject dataObject)
INTERNAL:
|
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 |
isDirty(DataObject dataObject)
INTERNAL:
Return whether the
dataObject has been modified. |
boolean |
isDirty(ListWrapper aListWrapper)
INTERNAL:
Return whether the
aListWrapper has been modified. |
boolean |
isDirty(SDOSequence aSequence)
INTERNAL:
Return whether the
aSequence has been modified. |
boolean |
isLogging()
Indicates whether change logging is on (
true ) or off (false ). |
boolean |
isLoggingMapping()
INTERNAL:
Return the logging state during mapping operations
|
boolean |
isModified(DataObject dataObject)
Returns whether or not the specified data object was updated while
logging . |
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 dataObject
|
void |
resumeLogging()
INTERNAL:
Turn both logging flags back on.
|
void |
setCreated(DataObject anObject,
boolean created)
INTERNAL:
Set flag created value.
|
void |
setCreatedXPaths(java.util.List createdXPathsList)
INTERNAL:
|
boolean |
setDeleted(DataObject anObject,
boolean deleted)
INTERNAL:
Set flag modified value.
|
void |
setDeletedXPaths(java.util.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 used
|
void |
setLogging(boolean logging)
INTERNAL:
Used by CopyHelper to set logging when creating a copy of a changesummary
|
void |
setModifiedDoms(java.util.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,
java.lang.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 dataObject
|
java.lang.String |
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:
|
public SDOChangeSummary()
public SDOChangeSummary(SDODataObject dataObject, HelperContext aContext)
public SDOChangeSummary(SDODataGraph dataGraph, HelperContext aContext)
public boolean isLogging()
true
) or off (false
).isLogging
in interface ChangeSummary
true
if change logging is on.beginLogging()
,
endLogging()
public void setCreated(DataObject anObject, boolean created)
created
- flag created's new value.public boolean setDeleted(DataObject anObject, boolean deleted)
deleted
- flag modified's new value.public void setOldContainer(SDODataObject aKey, DataObject aValue)
aKey
- aValue
- voidpublic java.util.Map getOldContainers()
public void setOldContainmentProperty(SDODataObject aKey, Property aValue)
aKey
- DataObjectaValue
- Property
voidpublic void setOldSequence(SDODataObject aKey, Sequence aValue)
aKey
- DataObjectaValue
- Property
voidpublic DataGraph getDataGraph()
data graph
associated with this change summary or null.getDataGraph
in interface ChangeSummary
DataGraph.getChangeSummary()
public java.util.List getChangedDataObjects()
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
.
getChangedDataObjects
in interface ChangeSummary
isCreated(DataObject)
,
isDeleted(DataObject)
,
isModified(DataObject)
public java.util.List getModified()
public java.util.List getDeleted()
public java.util.List getCreated()
public boolean isCreated(DataObject dataObject)
logging
.
Any object that was added to the scope
but was not in the scope when logging began,
will be considered created.isCreated
in interface ChangeSummary
dataObject
- the data object in question.true
if the specified data object was created.getChangedDataObjects()
public boolean isDeleted(DataObject dataObject)
logging
.
Any object that is not in scope but was in scope when logging began
will be considered deleted.isDeleted
in interface ChangeSummary
dataObject
- the data object in question.true
if the specified data object was deleted.getChangedDataObjects()
public boolean isModified(DataObject dataObject)
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.
isModified
in interface ChangeSummary
dataObject
- the data object in question.true
if the specified data object was modified.getChangedDataObjects()
public java.util.List getOldValues(DataObject dataObject)
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.
getOldValues
in interface ChangeSummary
dataObject
- the object in question.getChangedDataObjects()
public java.util.List getUnsetProps(DataObject dataObject)
dataObject
- public java.util.Map getUnsetOCPropertiesMap()
public java.util.List getUnsetOCProperties(DataObject dataObject)
dataObject
- public void setUnsetOCProperty(DataObject dataObject, Property ocKey)
dataObject
- ocKey
- public void removeUnsetOCProperty(DataObject dataObject, Property ocKey)
dataObject
- ocKey
- public void beginLogging()
changes
and turns change logging on.
No operation occurs if logging is already on.beginLogging
in interface ChangeSummary
endLogging()
,
isLogging()
public void resumeLogging()
public void endLogging()
endLogging
in interface ChangeSummary
beginLogging()
,
isLogging()
public void pauseLogging()
public SDODataObject getRootObject()
getRootObject
in interface ChangeSummary
public ChangeSummary.Setting getOldValue(DataObject dataObject, Property property)
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
.
getOldValue
in interface ChangeSummary
dataObject
- the object in question.property
- the property of the object.getChangedDataObjects()
public SDODataObject getOldContainer(DataObject dataObject)
getOldContainer
in interface ChangeSummary
dataObject
- the object in question.public SDOProperty getOldContainmentProperty(DataObject dataObject)
containment property
data object property
at the point when logging began
.getOldContainmentProperty
in interface ChangeSummary
dataObject
- the object in question.public SDOSequence getOldSequence(DataObject dataObject)
getOldSequence
in interface ChangeSummary
dataObject
- the object in question.public void undoChanges()
undoChanges
in interface ChangeSummary
beginLogging()
,
endLogging()
,
isLogging()
public void setRootDataObject(DataObject dataObject)
dataObject
- the root of DataObject tree this ChangeSummary belongs topublic void setLogging(boolean logging)
logging
- logging statuspublic void setHelperContext(HelperContext helperContext)
helperContext
- public void setCreatedXPaths(java.util.List createdXPathsList)
createdXPathsList
- public java.util.List getCreatedXPaths()
public boolean isLoggingMapping()
public void setModifiedDoms(java.util.List modifiedDomsList)
modifiedDomsList
- public java.util.List getModifiedDoms()
public void setDeletedXPaths(java.util.List deletedXPathsList)
deletedXPathsList
- public java.util.Map getOldContainmentProperty()
public java.util.Map getOldContainer()
public boolean wasSet(DataObject dataObject, Property property)
dataObject
- property
- public java.lang.Object getPropertyInternal(DataObject dataObject, Property property)
dataObject
- property
- public void setPropertyInternal(DataObject dataObject, Property property, java.lang.Object value)
dataObject
- property
- value
- public java.util.Map getOriginalValueStores()
public boolean isDirty(DataObject dataObject)
dataObject
has been modified.dataObject
- public boolean isDirty(ListWrapper aListWrapper)
aListWrapper
has been modified.aListWrapper
- public boolean isDirty(SDOSequence aSequence)
aSequence
has been modified.aSequence
- public void unsetPropertyInternal(DataObject dataObject, Property property)
dataObject
- property
- public java.util.Map getOriginalElements()
public java.util.Map getDeepCopies()
public java.util.Map getReverseDeletedMap()
public java.util.Map getOriginalSequences()
public java.util.Map getOldSequences()
public java.lang.String toString()
toString
in class java.lang.Object