com.evolveum.midpoint.schema.delta
Class ObjectDelta<T extends ObjectType>

java.lang.Object
  extended by com.evolveum.midpoint.schema.delta.ObjectDelta<T>
All Implemented Interfaces:
DebugDumpable, Dumpable

public class ObjectDelta<T extends ObjectType>
extends java.lang.Object
implements Dumpable, DebugDumpable

Relative difference (delta) of the object.

This class describes how the object changes. It can describe either object addition, modification of deletion.

Addition described complete new (absolute) state of the object.

Modification contains a set property deltas that describe relative changes to individual properties

Deletion does not contain anything. It only marks object for deletion.

The OID is mandatory for modification and deletion.

Author:
Radovan Semancik
See Also:
PropertyDelta

Field Summary
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Constructor Summary
ObjectDelta(java.lang.Class<T> objectTypeClass, ChangeType changeType)
           
 
Method Summary
 void addModification(PropertyDelta propertyDelta)
           
 void applyTo(MidPointObject<T> mpObject)
          Applies this object delta to specified object, returns updated object.
 ObjectDelta<T> clone()
          Semi-deep clone.
 MidPointObject<T> computeChangedObject(MidPointObject<T> objectOld)
          Applies this object delta to specified object, returns updated object.
static
<T extends ObjectType>
ObjectDelta<T>
createDelta(ObjectModificationType objectModification, ObjectDefinition<T> objDef)
           
static
<T extends ObjectType>
ObjectDelta<T>
createDelta(ObjectModificationType objectModification, Schema schema, java.lang.Class<T> type)
          Creates new delta from the ObjectModificationType (XML).
 java.lang.String debugDump()
          Show the content of the object intended for diagnostics by system administrator.
 java.lang.String debugDump(int indent)
           
 java.lang.String dump()
          Show the content of the object intended for diagnostics by developer.
 ChangeType getChangeType()
           
 java.util.Collection<PropertyDelta> getModifications()
           
 MidPointObject<T> getObjectToAdd()
           
 java.lang.Class<T> getObjectTypeClass()
           
 java.lang.String getOid()
           
 PropertyDelta getPropertyDelta(PropertyPath propertyPath)
           
 PropertyDelta getPropertyDelta(PropertyPath parentPath, javax.xml.namespace.QName propertyName)
           
 PropertyDelta getPropertyDelta(javax.xml.namespace.QName propertyName)
          Top-level path is assumed.
 boolean isEmpty()
           
 void merge(ObjectDelta<T> deltaToMerge)
          Merge provided delta into this delta.
 void setChangeType(ChangeType changeType)
           
 void setObjectToAdd(MidPointObject<T> objectToAdd)
           
 void setObjectTypeClass(java.lang.Class<T> objectTypeClass)
           
 void setOid(java.lang.String oid)
           
 void swallow(PropertyDelta newPropertyDelta)
          Incorporates the property delta into the existing property deltas (regardless of the change type).
 ObjectModificationType toObjectModificationType()
          Converts this delta to ObjectModificationType (XML).
 java.lang.String toString()
           
static
<T extends ObjectType>
ObjectDelta<T>
union(ObjectDelta<T>... deltas)
          Union of several object deltas.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectDelta

public ObjectDelta(java.lang.Class<T> objectTypeClass,
                   ChangeType changeType)
Method Detail

getChangeType

public ChangeType getChangeType()

setChangeType

public void setChangeType(ChangeType changeType)

getOid

public java.lang.String getOid()

setOid

public void setOid(java.lang.String oid)

getObjectToAdd

public MidPointObject<T> getObjectToAdd()

setObjectToAdd

public void setObjectToAdd(MidPointObject<T> objectToAdd)

getModifications

public java.util.Collection<PropertyDelta> getModifications()

addModification

public void addModification(PropertyDelta propertyDelta)

getPropertyDelta

public PropertyDelta getPropertyDelta(PropertyPath propertyPath)

getObjectTypeClass

public java.lang.Class<T> getObjectTypeClass()

setObjectTypeClass

public void setObjectTypeClass(java.lang.Class<T> objectTypeClass)

getPropertyDelta

public PropertyDelta getPropertyDelta(javax.xml.namespace.QName propertyName)
Top-level path is assumed.


getPropertyDelta

public PropertyDelta getPropertyDelta(PropertyPath parentPath,
                                      javax.xml.namespace.QName propertyName)

isEmpty

public boolean isEmpty()

clone

public ObjectDelta<T> clone()
Semi-deep clone.

Overrides:
clone in class java.lang.Object

merge

public void merge(ObjectDelta<T> deltaToMerge)
Merge provided delta into this delta. This delta is assumed to be chronologically earlier.


union

public static <T extends ObjectType> ObjectDelta<T> union(ObjectDelta<T>... deltas)
Union of several object deltas. The deltas are merged to create a single delta that contains changes from all the deltas.


applyTo

public void applyTo(MidPointObject<T> mpObject)
Applies this object delta to specified object, returns updated object. It modifies the provided object.


computeChangedObject

public MidPointObject<T> computeChangedObject(MidPointObject<T> objectOld)
Applies this object delta to specified object, returns updated object. It leaves the original object unchanged.

Parameters:
objectOld - object before change
Returns:
object with applied changes or null if the object should not exit (was deleted)

createDelta

public static <T extends ObjectType> ObjectDelta<T> createDelta(ObjectModificationType objectModification,
                                                                Schema schema,
                                                                java.lang.Class<T> type)
                                                     throws SchemaException
Creates new delta from the ObjectModificationType (XML). Object type and schema are used to locate definitions needed to convert properties from XML.

Throws:
SchemaException

createDelta

public static <T extends ObjectType> ObjectDelta<T> createDelta(ObjectModificationType objectModification,
                                                                ObjectDefinition<T> objDef)
                                                     throws SchemaException
Throws:
SchemaException

toObjectModificationType

public ObjectModificationType toObjectModificationType()
                                                throws SchemaException
Converts this delta to ObjectModificationType (XML).

Throws:
SchemaException

swallow

public void swallow(PropertyDelta newPropertyDelta)
Incorporates the property delta into the existing property deltas (regardless of the change type).


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

debugDump

public java.lang.String debugDump()
Description copied from interface: DebugDumpable
Show the content of the object intended for diagnostics by system administrator. The out put should be suitable to use in system logs at "debug" level. It may be multi-line, but in that case it should be well indented and quite terse. As it is intended to be used by system administrator, it should not use any developer terms such as class names, exceptions or stack traces.

Specified by:
debugDump in interface DebugDumpable
Returns:
content of the object intended for diagnostics by system administrator.

debugDump

public java.lang.String debugDump(int indent)
Specified by:
debugDump in interface DebugDumpable

dump

public java.lang.String dump()
Description copied from interface: Dumpable
Show the content of the object intended for diagnostics by developer. The content may be multi-line, in case of hierarchical objects it may be intended. The use of this method may not be efficient. It is not supposed to be used in normal operation. However, it is very useful in tests or in case of dumping objects in severe error situations.

Specified by:
dump in interface Dumpable
Returns:
content of the object intended for diagnostics.


Copyright © 2012 evolveum. All Rights Reserved.