Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

E28847-01


org.eclipse.persistence.sdo
Class SDOChangeSummary

java.lang.Object
  extended by org.eclipse.persistence.sdo.SDOChangeSummary


public class SDOChangeSummary
extends java.lang.Object

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.)


Field Summary
private  HelperContext aHelperContext
          Hold the context containing all helpers so that we can preserve inter-helper relationships
private  java.util.List createdList
           
private  java.util.List createdXPaths
           
private  DataGraph dataGraph
           
private  java.util.Map deepCopies
           
private  java.util.List deletedList
           
private  java.util.List deletedXPaths
          The deletedXPaths field is picked up reflectively during marshal/unmarshal operations.
private  boolean logging
           
private  boolean loggingMapping
           
private  java.util.List modifiedDoms
           
private  java.util.Map oldContainer
           
private  java.util.Map oldContainmentProperty
           
private  java.util.Map oldSequences
          Cache map of originalSequences Map<DataObject, Sequence>
private  java.util.Map oldSettings
          A HashMap of List objects keyed off SDODataObject, null key:value permitted
private  java.util.Map originalElements
           
private  java.util.Map originalSequences
          Map of originalSequence Map<DataObject, Sequence>
private  java.util.Map originalValueStores
          To implement ChangeSummary undo we require a copy of the original state of our model.
private  java.util.Map reverseDeletedMap
           
private  SDODataObject rootDataObject
           
private  java.util.Map unsetOCPropsMap
           
private  java.util.Map unsetPropsMap
           

 

Constructor Summary
SDOChangeSummary()
           
SDOChangeSummary(SDODataGraph dataGraph, HelperContext aContext)
           
SDOChangeSummary(SDODataObject dataObject, HelperContext aContext)
           

 

Method Summary
 void beginLogging()
          Clears the List of changes and turns change logging on.
private  Setting buildAndAddOldSetting(SDODataObject dataObject, Property property, java.lang.Object value, boolean isSet)
          INTERNAL:
 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
private  void getModified(SDODataObject sdoDataObject, java.util.List modifiedList)
           
 java.util.List getModifiedDoms()
          INTERNAL:
 java.util.Map getOldContainer()
           
 SDODataObject getOldContainer(DataObject dataObject)
          Returns the value of the container data object at the point when logging began.
 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)
          Returns the value of the sequence for the data object at the point when logging began.
 java.util.Map getOldSequences()
          INTERNAL: Return a map of original sequences keyed on DataObject (cached values).
 org.eclipse.persistence.sdo.SDOChangeSummary.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.
private  ChangeSummary.Setting getOldValueForChangedDataObject(DataObject dataObject, SDOProperty property)
          INTERNAL:
 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.
private  DataObject getOrCreateDeepCopy(DataObject original)
          INTERNAL:
 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
private  ChangeSummary.Setting getPropertyInOldSettings(DataObject dataObject, Property property)
          INTERNAL: Check if a property is in its DataObject's oldsetting list
 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 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
private  void resetChanges()
          INTERNAL: Called from beginLogging and undoChanges
 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:

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Field Detail

rootDataObject

private SDODataObject rootDataObject

logging

private boolean logging

loggingMapping

private boolean loggingMapping

dataGraph

private DataGraph dataGraph

createdList

private java.util.List createdList

deletedList

private java.util.List deletedList

deepCopies

private java.util.Map deepCopies

createdXPaths

private java.util.List createdXPaths

deletedXPaths

private java.util.List deletedXPaths
The deletedXPaths field is picked up reflectively during marshal/unmarshal operations.

modifiedDoms

private java.util.List modifiedDoms

unsetPropsMap

private java.util.Map unsetPropsMap

originalValueStores

private java.util.Map originalValueStores
To implement ChangeSummary undo we require a copy of the original state of our model. The originalValueStores will be populated when we start logging - it will then point to the currentValueStore while the currentValueStore will be shallow copied (its child ValueStores are shared between both ValueStores)

originalElements

private java.util.Map originalElements

oldContainer

private java.util.Map oldContainer

oldContainmentProperty

private java.util.Map oldContainmentProperty

oldSequences

private java.util.Map oldSequences
Cache map of originalSequences Map<DataObject, Sequence>

originalSequences

private java.util.Map originalSequences
Map of originalSequence Map<DataObject, Sequence>

unsetOCPropsMap

private java.util.Map unsetOCPropsMap

oldSettings

private java.util.Map oldSettings
A HashMap of List objects keyed off SDODataObject, null key:value permitted

reverseDeletedMap

private java.util.Map reverseDeletedMap

aHelperContext

private HelperContext aHelperContext
Hold the context containing all helpers so that we can preserve inter-helper relationships

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).
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 java.util.Map getOldContainers()
INTERNAL:
Returns:

setOldContainmentProperty

public void setOldContainmentProperty(SDODataObject aKey,
                                      Property aValue)
INTERNAL:
Parameters:
aKey - DataObject
aValue - Property void

setOldSequence

public void setOldSequence(SDODataObject aKey,
                           Sequence aValue)
INTERNAL:
Parameters:
aKey - DataObject
aValue - Property void

getDataGraph

public DataGraph getDataGraph()
Returns the data graph associated with this change summary or null.
Returns:
the data graph.
See Also:
DataGraph#getChangeSummary

getChangedDataObjects

public java.util.List 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.

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

getModified

private void getModified(SDODataObject sdoDataObject,
                         java.util.List modifiedList)

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(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.
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 while logging. Any object that is not in scope but was in scope when logging began will be considered deleted.
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 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.

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

getOldValues

public 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.

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.

Parameters:
dataObject - the object in question.
Returns:
a list of settings.
See Also:
getChangedDataObjects()

getUnsetProps

public java.util.List getUnsetProps(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(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 of changes and turns change logging on. No operation occurs if logging is already on.
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.
See Also:
beginLogging(), isLogging()

pauseLogging

public void pauseLogging()
INTERNAL: Turn both logging flags on.

resetChanges

private void resetChanges()
INTERNAL: Called from beginLogging and undoChanges

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().
Returns:
the ChangeSummary root DataObject

getOldValue

public org.eclipse.persistence.sdo.SDOChangeSummary.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.

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

getOldValueForChangedDataObject

private ChangeSummary.Setting getOldValueForChangedDataObject(DataObject dataObject,
                                                              SDOProperty property)
INTERNAL:
Parameters:
dataObject - which is not null and not created and is dirty in the scope of this changesummary
property -
Returns:
new or already existing Setting

buildAndAddOldSetting

private Setting buildAndAddOldSetting(SDODataObject dataObject,
                                      Property property,
                                      java.lang.Object value,
                                      boolean isSet)
INTERNAL:
Parameters:
dataObject -
property -
value -
isSet -
Returns:

getOldContainer

public SDODataObject getOldContainer(DataObject dataObject)
Returns the value of the container data object at the point when logging began.
Parameters:
dataObject - the object in question.
Returns:
the old container data object.

getOldContainmentProperty

public SDOProperty getOldContainmentProperty(DataObject dataObject)
Returns the value of the containment property data object property at the point when logging began.
Parameters:
dataObject - the object in question.
Returns:
the old containment property.

getOldSequence

public SDOSequence getOldSequence(DataObject dataObject)
Returns the value of the sequence for the data object at the point when logging began.
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.
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

getPropertyInOldSettings

private ChangeSummary.Setting getPropertyInOldSettings(DataObject dataObject,
                                                       Property property)
INTERNAL: Check if a property is in its DataObject's oldsetting list
Parameters:
dataObject - property's owner
property - property to be checked
Returns:
property's Setting if this property is in list

setHelperContext

public void setHelperContext(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(DataObject dataObject,
                      Property property)
INTERNAL:
Parameters:
dataObject -
property -
Returns:

getPropertyInternal

public java.lang.Object getPropertyInternal(DataObject dataObject,
                                            Property property)
INTERNAL:
Parameters:
dataObject -
property -
Returns:

setPropertyInternal

public void setPropertyInternal(DataObject dataObject,
                                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(DataObject dataObject)
INTERNAL: Return whether the dataObject has been modified.
Parameters:
dataObject -
Returns:

unsetPropertyInternal

public void unsetPropertyInternal(DataObject dataObject,
                                  Property property)
INTERNAL:
Parameters:
dataObject -
property -

getOriginalElements

public java.util.Map getOriginalElements()
INTERNAL:
Returns:
Map of original elements, key and value are both listwrappers

getOrCreateDeepCopy

private DataObject getOrCreateDeepCopy(DataObject original)
INTERNAL:
Parameters:
original -
Returns:

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:
toString in class java.lang.Object

Skip navigation links

Copyright © 1998, 2012, Oracle. All Rights Reserved.