com.evolveum.midpoint.prism.delta
Class ItemDelta<V extends PrismValue>

java.lang.Object
  extended by com.evolveum.midpoint.prism.delta.ItemDelta<V>
All Implemented Interfaces:
Itemable, Visitable, DebugDumpable, Dumpable, Serializable
Direct Known Subclasses:
ContainerDelta, PropertyDelta, ReferenceDelta

public abstract class ItemDelta<V extends PrismValue>
extends Object
implements Itemable, Dumpable, DebugDumpable, Visitable, Serializable

Author:
Radovan Semancik
See Also:
Serialized Form

Field Summary
protected  ItemDefinition definition
           
protected  QName name
          Name of the property
protected  ItemPath parentPath
          Parent path of the property (path to the property container)
protected  Collection<V> valuesToAdd
           
protected  Collection<V> valuesToDelete
           
protected  Collection<V> valuesToReplace
           
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Constructor Summary
ItemDelta(ItemDefinition itemDefinition)
           
ItemDelta(ItemPath propertyPath, ItemDefinition itemDefinition)
           
ItemDelta(ItemPath parentPath, QName name, ItemDefinition itemDefinition)
           
ItemDelta(QName name, ItemDefinition itemDefinition)
           
 
Method Summary
 void accept(Visitor visitor)
           
 boolean addsAnyValue()
           
 void addValuesToAdd(Collection<V> newValues)
           
 void addValuesToAdd(V... newValues)
           
 void addValuesToDelete(Collection<V> newValues)
           
 void addValuesToDelete(V... newValues)
           
 void addValueToAdd(V newValue)
           
 void addValueToDelete(V newValue)
           
static void applyDefinition(Collection<? extends ItemDelta> deltas, PrismObjectDefinition definition)
           
 void applyDefinition(ItemDefinition definition)
           
 void applyDefinition(ItemDefinition itemDefinition, boolean force)
           
static void applyTo(Collection<? extends ItemDelta> deltas, PrismContainer propertyContainer)
           
 void applyTo(Item item)
          Apply this delta (path) to a property.
 void applyTo(PrismContainer<?> propertyContainer)
          Apply this delta (path) to a property container.
 void applyTo(PrismContainerValue<?> propertyContainerVal)
          Apply this delta (path) to a property container.
 void assertDefinitions(boolean tolarateRawValues, String sourceDescription)
           
 void assertDefinitions(String sourceDescription)
           
 void checkConsistence()
           
 void checkConsistence(boolean requireDefinition, boolean prohibitRaw)
           
static void checkConsistence(Collection<? extends ItemDelta> deltas)
           
static void checkConsistence(Collection<? extends ItemDelta> deltas, boolean requireDefinition, boolean prohibitRaw)
           
 void clear()
           
 void clearValuesToAdd()
           
 void clearValuesToDelete()
           
 void clearValuesToReplace()
           
abstract  ItemDelta<V> clone()
           
<I extends Item>
I
computeChangedItem(I oldItem)
           
 boolean contains(ItemDelta<V> other)
          Returns true if the other delta is a complete subset of this delta.
protected  void copyValues(ItemDelta<V> clone)
           
 String debugDump()
          Show the content of the object intended for diagnostics by system administrator.
 String debugDump(int indent)
           
 void distributeReplace(Collection<V> existingValues)
          Distributes the replace values of this delta to add and delete with respect to provided existing values.
 String dump()
          Show the content of the object intended for diagnostics by developer.
protected  void dumpValues(StringBuilder sb, String label, Collection<V> values, int indent)
           
 boolean equals(Object obj)
           
static
<X extends Containerable>
ContainerDelta<X>
findContainerDelta(Collection<? extends ItemDelta> deltas, ItemPath propertyPath)
           
static
<X extends Containerable>
ContainerDelta<X>
findContainerDelta(Collection<? extends ItemDelta> deltas, QName name)
           
static
<D extends ItemDelta>
D
findItemDelta(Collection<? extends ItemDelta> deltas, ItemPath propertyPath, Class<D> deltaType)
           
static
<D extends ItemDelta>
D
findItemDelta(Collection<? extends ItemDelta> deltas, QName itemName, Class<D> deltaType)
           
static Collection<? extends ItemDelta<?>> findItemDeltasSubPath(Collection<? extends ItemDelta<?>> deltas, ItemPath itemPath)
           
static PropertyDelta findPropertyDelta(Collection<? extends ItemDelta> deltas, ItemPath propertyPath)
           
static PropertyDelta findPropertyDelta(Collection<? extends ItemDelta> deltas, ItemPath parentPath, QName propertyName)
           
static PropertyDelta findPropertyDelta(Collection<? extends ItemDelta> deltas, QName propertyName)
           
static ReferenceDelta findReferenceModification(Collection<? extends ItemDelta> deltas, QName itemName)
           
 V getAnyValue()
           
 ItemDefinition getDefinition()
           
abstract  Class<? extends Item> getItemClass()
           
 Item<V> getItemNew()
          Returns the "new" state of the property - the state that would be after the delta is applied.
 Item<V> getItemNew(Item<V> itemOld)
          Returns the "new" state of the property - the state that would be after the delta is applied.
 QName getName()
           
 ItemPath getParentPath()
           
 ItemPath getPath()
           
 ItemPath getPath(ItemPath pathPrefix)
           
 PrismContext getPrismContext()
           
 Collection<V> getValuesToAdd()
           
 Collection<V> getValuesToDelete()
           
 Collection<V> getValuesToReplace()
           
 boolean hasCompleteDefinition()
           
 int hashCode()
           
 boolean isAdd()
           
 boolean isDelete()
           
 boolean isEmpty()
           
 boolean isRaw()
           
 boolean isReplace()
           
 boolean isValueToAdd(V value)
           
 boolean isValueToAdd(V value, boolean ignoreMetadata)
           
 boolean isValueToDelete(V value)
           
 boolean isValueToDelete(V value, boolean ignoreMetadata)
           
 boolean isValueToReplace(V value)
           
 boolean isValueToReplace(V value, boolean ignoreMetadata)
           
 void merge(ItemDelta<V> deltaToMerge)
          Merge specified delta to this delta.
 void mergeValuesToAdd(Collection<V> newValues)
           
 void mergeValuesToAdd(V[] newValues)
           
 void mergeValuesToDelete(Collection<V> newValues)
           
 void mergeValuesToDelete(V[] newValues)
           
 void mergeValuesToReplace(Collection<V> newValues)
           
 void mergeValuesToReplace(V[] newValues)
           
 void mergeValueToAdd(V newValue)
           
 void mergeValueToDelete(V newValue)
           
 void mergeValueToReplace(V newValue)
           
 ItemDelta<V> narrow(PrismObject<? extends Objectable> object)
          Filters out all delta values that are meaningless to apply.
 void normalize()
           
static
<D extends ItemDelta>
void
removeItemDelta(Collection<? extends ItemDelta> deltas, ItemPath propertyPath, Class<D> deltaType)
           
 boolean removeValueToAdd(V valueToRemove)
           
 boolean removeValueToDelete(V valueToRemove)
           
 boolean removeValueToReplace(V valueToRemove)
           
 void revive(PrismContext prismContext)
           
 void setDefinition(ItemDefinition definition)
           
 void setName(QName name)
           
 void setParentPath(ItemPath parentPath)
           
 void setValuesToReplace(Collection<V> newValues)
           
 void setValuesToReplace(V... newValues)
           
 void setValueToReplace(V newValue)
           
 void simplify()
          Transforms the delta to the simplest (and safest) form.
 PrismValueDeltaSetTriple<V> toDeltaSetTriple()
           
static
<T extends PrismValue>
PrismValueDeltaSetTriple<T>
toDeltaSetTriple(Item<T> item, ItemDelta<T> delta)
           
static
<T extends PrismValue>
PrismValueDeltaSetTriple<T>
toDeltaSetTriple(Item<T> item, ItemDelta<T> delta, boolean oldValuesValid, boolean newValuesValid)
          Deprecated. 
 PrismValueDeltaSetTriple<V> toDeltaSetTriple(Item<V> itemOld)
           
 String toString()
           
 void validate()
           
 void validate(String contextDescription)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected QName name
Name of the property


parentPath

protected ItemPath parentPath
Parent path of the property (path to the property container)


definition

protected ItemDefinition definition

valuesToReplace

protected Collection<V extends PrismValue> valuesToReplace

valuesToAdd

protected Collection<V extends PrismValue> valuesToAdd

valuesToDelete

protected Collection<V extends PrismValue> valuesToDelete
Constructor Detail

ItemDelta

public ItemDelta(ItemDefinition itemDefinition)

ItemDelta

public ItemDelta(QName name,
                 ItemDefinition itemDefinition)

ItemDelta

public ItemDelta(ItemPath parentPath,
                 QName name,
                 ItemDefinition itemDefinition)

ItemDelta

public ItemDelta(ItemPath propertyPath,
                 ItemDefinition itemDefinition)
Method Detail

getName

public QName getName()
Specified by:
getName in interface Itemable

setName

public void setName(QName name)

getParentPath

public ItemPath getParentPath()

setParentPath

public void setParentPath(ItemPath parentPath)

getPath

public ItemPath getPath()

getPath

public ItemPath getPath(ItemPath pathPrefix)
Specified by:
getPath in interface Itemable

getDefinition

public ItemDefinition getDefinition()
Specified by:
getDefinition in interface Itemable

setDefinition

public void setDefinition(ItemDefinition definition)

accept

public void accept(Visitor visitor)
Specified by:
accept in interface Visitable

applyDefinition

public void applyDefinition(ItemDefinition definition)
                     throws SchemaException
Throws:
SchemaException

applyDefinition

public static void applyDefinition(Collection<? extends ItemDelta> deltas,
                                   PrismObjectDefinition definition)
                            throws SchemaException
Throws:
SchemaException

hasCompleteDefinition

public boolean hasCompleteDefinition()

getPrismContext

public PrismContext getPrismContext()
Specified by:
getPrismContext in interface Itemable

getItemClass

public abstract Class<? extends Item> getItemClass()

getValuesToAdd

public Collection<V> getValuesToAdd()

clearValuesToAdd

public void clearValuesToAdd()

getValuesToDelete

public Collection<V> getValuesToDelete()

clearValuesToDelete

public void clearValuesToDelete()

getValuesToReplace

public Collection<V> getValuesToReplace()

clearValuesToReplace

public void clearValuesToReplace()

addValuesToAdd

public void addValuesToAdd(Collection<V> newValues)

addValuesToAdd

public void addValuesToAdd(V... newValues)

addValueToAdd

public void addValueToAdd(V newValue)

removeValueToAdd

public boolean removeValueToAdd(V valueToRemove)

removeValueToDelete

public boolean removeValueToDelete(V valueToRemove)

removeValueToReplace

public boolean removeValueToReplace(V valueToRemove)

mergeValuesToAdd

public void mergeValuesToAdd(Collection<V> newValues)

mergeValuesToAdd

public void mergeValuesToAdd(V[] newValues)

mergeValueToAdd

public void mergeValueToAdd(V newValue)

addValuesToDelete

public void addValuesToDelete(Collection<V> newValues)

addValuesToDelete

public void addValuesToDelete(V... newValues)

addValueToDelete

public void addValueToDelete(V newValue)

mergeValuesToDelete

public void mergeValuesToDelete(Collection<V> newValues)

mergeValuesToDelete

public void mergeValuesToDelete(V[] newValues)

mergeValueToDelete

public void mergeValueToDelete(V newValue)

setValuesToReplace

public void setValuesToReplace(Collection<V> newValues)

setValuesToReplace

public void setValuesToReplace(V... newValues)

setValueToReplace

public void setValueToReplace(V newValue)

mergeValuesToReplace

public void mergeValuesToReplace(Collection<V> newValues)

mergeValuesToReplace

public void mergeValuesToReplace(V[] newValues)

mergeValueToReplace

public void mergeValueToReplace(V newValue)

isValueToAdd

public boolean isValueToAdd(V value)

isValueToAdd

public boolean isValueToAdd(V value,
                            boolean ignoreMetadata)

isValueToDelete

public boolean isValueToDelete(V value)

isValueToDelete

public boolean isValueToDelete(V value,
                               boolean ignoreMetadata)

isValueToReplace

public boolean isValueToReplace(V value)

isValueToReplace

public boolean isValueToReplace(V value,
                                boolean ignoreMetadata)

getAnyValue

public V getAnyValue()

isEmpty

public boolean isEmpty()

addsAnyValue

public boolean addsAnyValue()

normalize

public void normalize()

isReplace

public boolean isReplace()

isAdd

public boolean isAdd()

isDelete

public boolean isDelete()

clear

public void clear()

findPropertyDelta

public static PropertyDelta findPropertyDelta(Collection<? extends ItemDelta> deltas,
                                              QName propertyName)

findPropertyDelta

public static PropertyDelta findPropertyDelta(Collection<? extends ItemDelta> deltas,
                                              ItemPath parentPath,
                                              QName propertyName)

findPropertyDelta

public static PropertyDelta findPropertyDelta(Collection<? extends ItemDelta> deltas,
                                              ItemPath propertyPath)

findContainerDelta

public static <X extends Containerable> ContainerDelta<X> findContainerDelta(Collection<? extends ItemDelta> deltas,
                                                                             ItemPath propertyPath)

findContainerDelta

public static <X extends Containerable> ContainerDelta<X> findContainerDelta(Collection<? extends ItemDelta> deltas,
                                                                             QName name)

findItemDelta

public static <D extends ItemDelta> D findItemDelta(Collection<? extends ItemDelta> deltas,
                                                    ItemPath propertyPath,
                                                    Class<D> deltaType)

findItemDeltasSubPath

public static Collection<? extends ItemDelta<?>> findItemDeltasSubPath(Collection<? extends ItemDelta<?>> deltas,
                                                                       ItemPath itemPath)

findItemDelta

public static <D extends ItemDelta> D findItemDelta(Collection<? extends ItemDelta> deltas,
                                                    QName itemName,
                                                    Class<D> deltaType)

findReferenceModification

public static ReferenceDelta findReferenceModification(Collection<? extends ItemDelta> deltas,
                                                       QName itemName)

removeItemDelta

public static <D extends ItemDelta> void removeItemDelta(Collection<? extends ItemDelta> deltas,
                                                         ItemPath propertyPath,
                                                         Class<D> deltaType)

narrow

public ItemDelta<V> narrow(PrismObject<? extends Objectable> object)
Filters out all delta values that are meaningless to apply. E.g. removes all values to add that the property already has, removes all values to delete that the property does not have, etc.


validate

public void validate()
              throws SchemaException
Throws:
SchemaException

validate

public void validate(String contextDescription)
              throws SchemaException
Throws:
SchemaException

checkConsistence

public static void checkConsistence(Collection<? extends ItemDelta> deltas)

checkConsistence

public static void checkConsistence(Collection<? extends ItemDelta> deltas,
                                    boolean requireDefinition,
                                    boolean prohibitRaw)

checkConsistence

public void checkConsistence()

checkConsistence

public void checkConsistence(boolean requireDefinition,
                             boolean prohibitRaw)

distributeReplace

public void distributeReplace(Collection<V> existingValues)
Distributes the replace values of this delta to add and delete with respect to provided existing values.


merge

public void merge(ItemDelta<V> deltaToMerge)
Merge specified delta to this delta. This delta is assumed to be chronologically earlier, delta provided in the parameter is chronilogically later.


simplify

public void simplify()
Transforms the delta to the simplest (and safest) form. E.g. it will transform add delta for single-value properties to replace delta.


applyTo

public void applyTo(PrismContainer<?> propertyContainer)
             throws SchemaException
Apply this delta (path) to a property container.

Throws:
SchemaException

applyTo

public static void applyTo(Collection<? extends ItemDelta> deltas,
                           PrismContainer propertyContainer)
                    throws SchemaException
Throws:
SchemaException

applyTo

public void applyTo(PrismContainerValue<?> propertyContainerVal)
             throws SchemaException
Apply this delta (path) to a property container.

Throws:
SchemaException

applyTo

public void applyTo(Item item)
             throws SchemaException
Apply this delta (path) to a property.

Throws:
SchemaException

computeChangedItem

public <I extends Item> I computeChangedItem(I oldItem)
                                  throws SchemaException
Throws:
SchemaException

getItemNew

public Item<V> getItemNew()
                                      throws SchemaException
Returns the "new" state of the property - the state that would be after the delta is applied.

Throws:
SchemaException

getItemNew

public Item<V> getItemNew(Item<V> itemOld)
                                      throws SchemaException
Returns the "new" state of the property - the state that would be after the delta is applied.

Throws:
SchemaException

contains

public boolean contains(ItemDelta<V> other)
Returns true if the other delta is a complete subset of this delta. I.e. if all the statements of the other delta are already contained in this delta. As a consequence it also returns true if the two deltas are equal.


clone

public abstract ItemDelta<V> clone()
Overrides:
clone in class Object

copyValues

protected void copyValues(ItemDelta<V> clone)

toDeltaSetTriple

@Deprecated
public static <T extends PrismValue> PrismValueDeltaSetTriple<T> toDeltaSetTriple(Item<T> item,
                                                                                             ItemDelta<T> delta,
                                                                                             boolean oldValuesValid,
                                                                                             boolean newValuesValid)
Deprecated. 


toDeltaSetTriple

public static <T extends PrismValue> PrismValueDeltaSetTriple<T> toDeltaSetTriple(Item<T> item,
                                                                                  ItemDelta<T> delta)

toDeltaSetTriple

public PrismValueDeltaSetTriple<V> toDeltaSetTriple()

toDeltaSetTriple

public PrismValueDeltaSetTriple<V> toDeltaSetTriple(Item<V> itemOld)

assertDefinitions

public void assertDefinitions(String sourceDescription)
                       throws SchemaException
Throws:
SchemaException

assertDefinitions

public void assertDefinitions(boolean tolarateRawValues,
                              String sourceDescription)
                       throws SchemaException
Throws:
SchemaException

isRaw

public boolean isRaw()

revive

public void revive(PrismContext prismContext)

applyDefinition

public void applyDefinition(ItemDefinition itemDefinition,
                            boolean force)
                     throws SchemaException
Throws:
SchemaException

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

debugDump

public 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 String debugDump(int indent)
Specified by:
debugDump in interface DebugDumpable

dump

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

dumpValues

protected void dumpValues(StringBuilder sb,
                          String label,
                          Collection<V> values,
                          int indent)


Copyright © 2013 evolveum. All Rights Reserved.