org.electrocodeogram.cpc.core.api.data.extension
Interface ICloneModificationHistoryExtension

All Superinterfaces:
java.lang.Cloneable, ICloneDataElement, ICloneObjectExtension, java.io.Serializable
All Known Subinterfaces:
IStoreCloneModificationHistoryExtension

public interface ICloneModificationHistoryExtension
extends ICloneObjectExtension

Extension object which is used by the IStoreProvider to attach CloneDiff data of all modifications since the last event on generation of CloneModificationEvents and which can also be used to retrieve a list of all modifications made to a clone since its creation.

The IStoreProvider will also process this extension for all calls to IStoreProvider.addClone(IClone) or IStoreProvider.updateClone(IClone, UpdateMode).
Any CloneDiff objects present will be added to the internal modification history of the store provider and can be retrieved by a call to IStoreProvider.getFullCloneObjectExtension(ICloneObject, Class) at any time.

This extension is persisted and lazily restored, see ICloneObjectExtensionLazyMultiStatefulObject.

Used by the IStoreProvider and the CPC Notification module.

Important: All implementations of this interface also need to implement IStoreCloneModificationHistoryExtension!

Author:
vw
See Also:
IStoreCloneModificationHistoryExtension, IStoreProvider.getFullCloneObjectExtension(ICloneObject, Class), IStoreProvider.releaseWriteLock(), IStoreProvider.LockMode, IStoreProvider.addClone(IClone), IStoreProvider.updateClone(IClone, UpdateMode), CloneDiff, CloneModificationEvent, ICloneObjectExtensionLazyMultiStatefulObject

Method Summary
 void addCloneDiff(CloneDiff cloneDiff)
          Adds a new CloneDiff object to this clone modification history extension.
 void addCloneDiffs(java.util.List<CloneDiff> cloneDiffs)
          Adds a list of new CloneDiff objects to this clone modification history extension.
 void addCloneDiffs(java.util.SortedSet<CloneDiff> cloneDiffs)
          Adds a list of new CloneDiff objects to this clone modification history extension.
 void clearCloneDiffs()
          Removes all CloneDiff objects from this clone modification history extension.
 java.util.List<CloneDiff> getCloneDiffs()
          Yields a list of all modifications (CloneDiffs) made to this clone object.
 java.util.List<CloneDiff> getCloneDiffsForTransaction()
          Yields a list of all modifications (CloneDiffs) made to this clone object since the last call of IStoreCloneModificationHistoryExtension.endOfTransaction().
 java.util.Date getValidCreationDate()
          Returns the the next valid creation date for use in a CloneDiff element for this extension.
 
Methods inherited from interface org.electrocodeogram.cpc.core.api.data.ICloneObjectExtension
clone, getExtensionInterfaceClass, isPartial, setParentUuid, toString
 
Methods inherited from interface org.electrocodeogram.cpc.core.api.data.ICloneDataElement
isSealed, seal
 

Method Detail

getCloneDiffs

java.util.List<CloneDiff> getCloneDiffs()
Yields a list of all modifications (CloneDiffs) made to this clone object.
The returned list or its contents may not be modified in any way.

Returns:
a list of clone diffs, may not be modified, may be empty, never null.

getCloneDiffsForTransaction

java.util.List<CloneDiff> getCloneDiffsForTransaction()
Yields a list of all modifications (CloneDiffs) made to this clone object since the last call of IStoreCloneModificationHistoryExtension.endOfTransaction().
This means the list contains all CloneDiffs which were added to this extension since the last CloneModificationEvent in which this clone was marked as modified.
The returned list or its contents may not be modified in any way.

Returns:
a list of clone diffs, may not be modified, may be empty, never null.

getValidCreationDate

java.util.Date getValidCreationDate()
Returns the the next valid creation date for use in a CloneDiff element for this extension.

This is either the current time or, if another CloneDiff element with that creation date already exists, the current time incremented by a couple of milliseconds.

This is important in order for a user of this extension to ensure that no two CloneDiff elements with the same creation date are added.

Returns:
valid creation date for a CloneDiff element, never null.

addCloneDiff

void addCloneDiff(CloneDiff cloneDiff)
Adds a new CloneDiff object to this clone modification history extension.
CloneDiffs may only be added in correct time order (youngest first).

Parameters:
cloneDiff - the clone diff to add, never null.
Throws:
java.lang.IllegalArgumentException - if cloneDiff is younger than the oldest existing CloneDiff element.

addCloneDiffs

void addCloneDiffs(java.util.List<CloneDiff> cloneDiffs)
Adds a list of new CloneDiff objects to this clone modification history extension.
CloneDiffs may only be added in correct time order (youngest first).

Parameters:
cloneDiffs - a list of CloneDiff objects to add, never null.
Throws:
java.lang.IllegalArgumentException - if an added cloneDiff is younger than the oldest existing CloneDiff element.

addCloneDiffs

void addCloneDiffs(java.util.SortedSet<CloneDiff> cloneDiffs)
Adds a list of new CloneDiff objects to this clone modification history extension.
CloneDiffs may only be added in correct time order (youngest first).

Parameters:
cloneDiffs - a sorted set of CloneDiff objects to add, never null.
Throws:
java.lang.IllegalArgumentException - if an added cloneDiff is younger than the oldest existing CloneDiff element.

clearCloneDiffs

void clearCloneDiffs()
                     throws java.lang.IllegalStateException
Removes all CloneDiff objects from this clone modification history extension.
This method may only be used if this extension was fully loaded (ICloneObjectExtension.isPartial() is false).

This method is typically used when the clone history is either to be completely purged or to be replaced by some composite diffs.

Throws:
java.lang.IllegalStateException - is ICloneObjectExtension.isPartial() is true.