com.evolveum.midpoint.prism.delta
Class PropertyDelta<T>

java.lang.Object
  extended by com.evolveum.midpoint.prism.delta.ItemDelta<PrismPropertyValue<T>>
      extended by com.evolveum.midpoint.prism.delta.PropertyDelta<T>
All Implemented Interfaces:
Itemable, Visitable, DebugDumpable, Dumpable, java.io.Serializable

public class PropertyDelta<T>
extends ItemDelta<PrismPropertyValue<T>>

Relative difference (delta) of a property values.

This class describes what values are to be added, removed or replaced in the property. The delta can be either add+delete or replace, but not both. It either describes what values to add and delete from the property (add+delete) or what is the new set of values (replace). Add+delete deltas can be merged without a loss. There are ideal for multi-value properties. If replace deltas are merged, only the last value will be present. These are better suited for single-value properties.

Author:
Radovan Semancik
See Also:
ObjectDelta, Serialized Form

Field Summary
 
Fields inherited from class com.evolveum.midpoint.prism.delta.ItemDelta
definition, name, parentPath, valuesToAdd, valuesToDelete, valuesToReplace
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Constructor Summary
PropertyDelta(ItemPath propertyPath, PrismPropertyDefinition propertyDefinition)
           
PropertyDelta(ItemPath parentPath, javax.xml.namespace.QName name, PrismPropertyDefinition propertyDefinition)
           
PropertyDelta(PrismPropertyDefinition propertyDefinition)
           
PropertyDelta(javax.xml.namespace.QName name, PrismPropertyDefinition propertyDefinition)
           
 
Method Summary
 void applyDefinition(ItemDefinition definition)
           
 void applyTo(Item item)
          Apply this delta (path) to a property.
 PropertyDelta<T> clone()
           
protected  void copyValues(PropertyDelta<T> clone)
           
static
<O extends Objectable,T>
PropertyDelta<T>
createDelta(ItemPath propertyPath, java.lang.Class<O> compileTimeClass, PrismContext prismContext)
           
static
<O extends Objectable,T>
PropertyDelta<T>
createDelta(ItemPath propertyPath, PrismObjectDefinition<O> objectDefinition)
           
static
<O extends Objectable,T>
PropertyDelta<T>
createDelta(javax.xml.namespace.QName propertyName, java.lang.Class<O> compileTimeClass, PrismContext prismContext)
           
static
<O extends Objectable,T>
PropertyDelta<T>
createDelta(javax.xml.namespace.QName propertyName, PrismObjectDefinition<O> objectDefinition)
           
static
<T> PropertyDelta<T>
createModificationAddProperty(ItemPath propertyPath, PrismPropertyDefinition propertyDefinition, T... propertyValues)
           
static
<T> PropertyDelta<T>
createModificationDeleteProperty(ItemPath propertyPath, PrismPropertyDefinition propertyDefinition, T... propertyValues)
           
static
<T> PropertyDelta<T>
createModificationReplaceProperty(ItemPath propertyPath, PrismObjectDefinition<?> objectDefinition, T... propertyValues)
          Convenience method for quick creation of object deltas that replace a single object property.
static
<T> PropertyDelta<T>
createModificationReplaceProperty(ItemPath propertyPath, PrismPropertyDefinition propertyDefinition, T... propertyValues)
           
static
<T> PropertyDelta<T>
createModificationReplaceProperty(javax.xml.namespace.QName propertyName, PrismObjectDefinition<?> objectDefinition, T... propertyValues)
           
static java.util.Collection<? extends ItemDelta> createModificationReplacePropertyCollection(javax.xml.namespace.QName propertyName, PrismObjectDefinition<?> objectDefinition, java.lang.Object... propertyValues)
          Convenience method for quick creation of object deltas that replace a single object property.
static
<O extends Objectable>
PropertyDelta
createReplaceDelta(PrismContainerDefinition<O> containerDefinition, javax.xml.namespace.QName propertyName, java.lang.Object... realValues)
           
static
<O extends Objectable>
PropertyDelta<?>
createReplaceDeltaOrEmptyDelta(PrismObjectDefinition<O> objectDefinition, javax.xml.namespace.QName propertyName, java.lang.Object realValue)
           
static
<O extends Objectable>
PropertyDelta
createReplaceEmptyDelta(PrismObjectDefinition<O> objectDefinition, javax.xml.namespace.QName propertyName)
          Create delta that deletes all values of the specified property.
static PropertyDelta findPropertyDelta(java.util.Collection<? extends ItemDelta> modifications, ItemPath propertyPath)
           
static PropertyDelta findPropertyDelta(java.util.Collection<? extends ItemDelta> modifications, javax.xml.namespace.QName propertyName)
           
 T getAnyRealValue()
           
 java.lang.Class<PrismProperty> getItemClass()
           
 PrismProperty<T> getPropertyNew()
          Returns the "new" state of the property - the state that would be after the delta is applied.
 PrismProperty<T> getPropertyNew(PrismProperty<T> propertyOld)
          Returns the "new" state of the property - the state that would be after the delta is applied.
<T> java.util.Collection<PrismPropertyValue<T>>
getValues(java.lang.Class<T> type)
          Returns all values regardless of whether they are added or removed or replaced.
<P extends PrismProperty>
P
instantiateEmptyProperty()
           
 boolean isRealValueToAdd(PrismPropertyValue<?> value)
           
 boolean isRealValueToDelete(PrismPropertyValue<?> value)
           
 PropertyDelta<T> narrow(PrismObject<? extends Objectable> object)
          Filters out all delta values that are meaningless to apply.
 void setDefinition(ItemDefinition definition)
           
 
Methods inherited from class com.evolveum.midpoint.prism.delta.ItemDelta
accept, addValuesToAdd, addValuesToAdd, addValuesToDelete, addValuesToDelete, addValueToAdd, addValueToDelete, applyDefinition, applyDefinition, applyTo, applyTo, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkConsistence, clear, clearValuesToAdd, clearValuesToDelete, clearValuesToReplace, computeChangedItem, copyValues, debugDump, debugDump, distributeReplace, dump, dumpValues, equals, findContainerDelta, findContainerDelta, findItemDelta, findItemDelta, findPropertyDelta, findReferenceModification, getAnyValue, getDefinition, getItemNew, getItemNew, getName, getParentPath, getPath, getPath, getPrismContext, getValuesToAdd, getValuesToDelete, getValuesToReplace, hasCompleteDefinition, hashCode, isAdd, isDelete, isEmpty, isRaw, isReplace, isValueToAdd, isValueToDelete, isValueToReplace, merge, mergeValuesToAdd, mergeValuesToAdd, mergeValuesToDelete, mergeValuesToDelete, mergeValuesToReplace, mergeValuesToReplace, mergeValueToAdd, mergeValueToDelete, mergeValueToReplace, normalize, removeItemDelta, revive, setName, setParentPath, setValuesToReplace, setValuesToReplace, setValueToReplace, simplify, toDeltaSetTriple, toDeltaSetTriple, toDeltaSetTriple, toDeltaSetTriple, toString, validate, validate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyDelta

public PropertyDelta(PrismPropertyDefinition propertyDefinition)

PropertyDelta

public PropertyDelta(javax.xml.namespace.QName name,
                     PrismPropertyDefinition propertyDefinition)

PropertyDelta

public PropertyDelta(ItemPath parentPath,
                     javax.xml.namespace.QName name,
                     PrismPropertyDefinition propertyDefinition)

PropertyDelta

public PropertyDelta(ItemPath propertyPath,
                     PrismPropertyDefinition propertyDefinition)
Method Detail

setDefinition

public void setDefinition(ItemDefinition definition)
Overrides:
setDefinition in class ItemDelta<PrismPropertyValue<T>>

applyDefinition

public void applyDefinition(ItemDefinition definition)
                     throws SchemaException
Overrides:
applyDefinition in class ItemDelta<PrismPropertyValue<T>>
Throws:
SchemaException

getItemClass

public java.lang.Class<PrismProperty> getItemClass()
Specified by:
getItemClass in class ItemDelta<PrismPropertyValue<T>>

getValues

public <T> java.util.Collection<PrismPropertyValue<T>> getValues(java.lang.Class<T> type)
Returns all values regardless of whether they are added or removed or replaced. Useful for iterating over all the changed values.


getAnyRealValue

public T getAnyRealValue()

instantiateEmptyProperty

public <P extends PrismProperty> P instantiateEmptyProperty()

applyTo

public void applyTo(Item item)
             throws SchemaException
Description copied from class: ItemDelta
Apply this delta (path) to a property.

Overrides:
applyTo in class ItemDelta<PrismPropertyValue<T>>
Throws:
SchemaException

clone

public PropertyDelta<T> clone()
Specified by:
clone in class ItemDelta<PrismPropertyValue<T>>

copyValues

protected void copyValues(PropertyDelta<T> clone)

createReplaceDelta

public static <O extends Objectable> PropertyDelta createReplaceDelta(PrismContainerDefinition<O> containerDefinition,
                                                                      javax.xml.namespace.QName propertyName,
                                                                      java.lang.Object... realValues)

createReplaceEmptyDelta

public static <O extends Objectable> PropertyDelta createReplaceEmptyDelta(PrismObjectDefinition<O> objectDefinition,
                                                                           javax.xml.namespace.QName propertyName)
Create delta that deletes all values of the specified property.


createReplaceDeltaOrEmptyDelta

public static <O extends Objectable> PropertyDelta<?> createReplaceDeltaOrEmptyDelta(PrismObjectDefinition<O> objectDefinition,
                                                                                     javax.xml.namespace.QName propertyName,
                                                                                     java.lang.Object realValue)

isRealValueToAdd

public boolean isRealValueToAdd(PrismPropertyValue<?> value)

isRealValueToDelete

public boolean isRealValueToDelete(PrismPropertyValue<?> value)

getPropertyNew

public PrismProperty<T> getPropertyNew()
                                throws SchemaException
Returns the "new" state of the property - the state that would be after the delta is applied.

Throws:
SchemaException

getPropertyNew

public PrismProperty<T> getPropertyNew(PrismProperty<T> propertyOld)
                                throws SchemaException
Returns the "new" state of the property - the state that would be after the delta is applied.

Throws:
SchemaException

narrow

public PropertyDelta<T> narrow(PrismObject<? extends Objectable> object)
Description copied from class: ItemDelta
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.

Overrides:
narrow in class ItemDelta<PrismPropertyValue<T>>

createDelta

public static <O extends Objectable,T> PropertyDelta<T> createDelta(javax.xml.namespace.QName propertyName,
                                                                    PrismObjectDefinition<O> objectDefinition)

createDelta

public static <O extends Objectable,T> PropertyDelta<T> createDelta(ItemPath propertyPath,
                                                                    PrismObjectDefinition<O> objectDefinition)

createDelta

public static <O extends Objectable,T> PropertyDelta<T> createDelta(javax.xml.namespace.QName propertyName,
                                                                    java.lang.Class<O> compileTimeClass,
                                                                    PrismContext prismContext)

createDelta

public static <O extends Objectable,T> PropertyDelta<T> createDelta(ItemPath propertyPath,
                                                                    java.lang.Class<O> compileTimeClass,
                                                                    PrismContext prismContext)

createModificationReplaceProperty

public static <T> PropertyDelta<T> createModificationReplaceProperty(javax.xml.namespace.QName propertyName,
                                                                     PrismObjectDefinition<?> objectDefinition,
                                                                     T... propertyValues)

createModificationReplaceProperty

public static <T> PropertyDelta<T> createModificationReplaceProperty(ItemPath propertyPath,
                                                                     PrismObjectDefinition<?> objectDefinition,
                                                                     T... propertyValues)
Convenience method for quick creation of object deltas that replace a single object property. This is used quite often to justify a separate method.


createModificationReplaceProperty

public static <T> PropertyDelta<T> createModificationReplaceProperty(ItemPath propertyPath,
                                                                     PrismPropertyDefinition propertyDefinition,
                                                                     T... propertyValues)

createModificationAddProperty

public static <T> PropertyDelta<T> createModificationAddProperty(ItemPath propertyPath,
                                                                 PrismPropertyDefinition propertyDefinition,
                                                                 T... propertyValues)

createModificationDeleteProperty

public static <T> PropertyDelta<T> createModificationDeleteProperty(ItemPath propertyPath,
                                                                    PrismPropertyDefinition propertyDefinition,
                                                                    T... propertyValues)

createModificationReplacePropertyCollection

public static java.util.Collection<? extends ItemDelta> createModificationReplacePropertyCollection(javax.xml.namespace.QName propertyName,
                                                                                                    PrismObjectDefinition<?> objectDefinition,
                                                                                                    java.lang.Object... propertyValues)
Convenience method for quick creation of object deltas that replace a single object property. This is used quite often to justify a separate method.


findPropertyDelta

public static PropertyDelta findPropertyDelta(java.util.Collection<? extends ItemDelta> modifications,
                                              ItemPath propertyPath)

findPropertyDelta

public static PropertyDelta findPropertyDelta(java.util.Collection<? extends ItemDelta> modifications,
                                              javax.xml.namespace.QName propertyName)


Copyright © 2012 evolveum. All Rights Reserved.