Class PropertyDeltaImpl<T>
- java.lang.Object
-
- com.evolveum.midpoint.prism.AbstractFreezable
-
- com.evolveum.midpoint.prism.impl.delta.ItemDeltaImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
- com.evolveum.midpoint.prism.impl.delta.PropertyDeltaImpl<T>
-
- All Implemented Interfaces:
ItemDelta<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
,PropertyDelta<T>
,Freezable
,Itemable
,PathVisitable
,PrismContextSensitive
,Visitable
,DebugDumpable
,Foreachable<PrismPropertyValue<T>>
,Serializable
public class PropertyDeltaImpl<T> extends ItemDeltaImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>> implements PropertyDelta<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.impl.delta.ItemDeltaImpl
definition, elementName, parentPath, valuesToAdd, valuesToDelete, valuesToReplace
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description PropertyDeltaImpl(ItemPath propertyPath, PrismPropertyDefinition<T> propertyDefinition, PrismContext prismContext)
PropertyDeltaImpl(ItemPath itemPath, QName name, PrismPropertyDefinition<T> propertyDefinition, PrismContext prismContext)
PropertyDeltaImpl(PrismPropertyDefinition<T> propertyDefinition, PrismContext prismContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRealValuesToAdd(Collection<T> newValues)
void
addRealValuesToAdd(T... newValues)
void
addRealValuesToDelete(Collection<T> values)
void
addRealValuesToDelete(T... newValues)
PropertyDeltaImpl<T>
clone()
protected void
copyValues(PropertyDeltaImpl<T> clone)
static <O extends Objectable>
PropertyDeltacreateAddDelta(PrismContainerDefinition<O> containerDefinition, QName propertyName, Object... realValues)
static <O extends Objectable>
PropertyDeltacreateDeleteDelta(PrismContainerDefinition<O> containerDefinition, QName propertyName, Object... realValues)
static <O extends Objectable,T>
PropertyDelta<T>createDelta(ItemPath propertyPath, PrismObjectDefinition<O> objectDefinition)
static <O extends Objectable,T>
PropertyDelta<T>createDelta(ItemPath propertyPath, Class<O> compileTimeClass, PrismContext prismContext)
static <T> PropertyDelta<T>
createModificationAddProperty(ItemPath propertyPath, PrismObjectDefinition<?> objectDefinition, T... propertyValues)
static <T> PropertyDelta<T>
createModificationAddProperty(ItemPath propertyPath, PrismPropertyDefinition propertyDefinition, T... propertyValues)
static <T> PropertyDelta<T>
createModificationDeleteProperty(ItemPath propertyPath, PrismObjectDefinition<?> objectDefinition, T... propertyValues)
static <T> PropertyDelta<T>
createModificationDeleteProperty(ItemPath propertyPath, PrismPropertyDefinition propertyDefinition, T... propertyValues)
static <T> PropertyDelta<T>
createModificationReplaceProperty(@NotNull ItemPath path, @NotNull PrismPropertyDefinition propertyDefinition, T... propertyValues)
static <T> PropertyDelta<T>
createModificationReplaceProperty(ItemPath propertyPath, PrismObjectDefinition<?> objectDefinition, Collection<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 Collection<? extends ItemDelta<?,?>>
createModificationReplacePropertyCollection(QName propertyName, PrismObjectDefinition<?> objectDefinition, Object... propertyValues)
Convenience method for quick creation of object deltas that replace a single object property.static <O extends Objectable,T>
PropertyDelta<T>createReplaceDelta(PrismContainerDefinition<O> containerDefinition, QName propertyName, PrismPropertyValue<T>... pValues)
static <O extends Objectable,T>
PropertyDelta<T>createReplaceDelta(PrismContainerDefinition<O> containerDefinition, QName propertyName, T... realValues)
static <O extends Objectable,T>
PropertyDelta<T>createReplaceDeltaOrEmptyDelta(PrismObjectDefinition<O> objectDefinition, QName propertyName, T realValue)
static <O extends Objectable>
PropertyDeltacreateReplaceEmptyDelta(PrismObjectDefinition<O> objectDefinition, ItemPath propertyPath)
Create delta that deletes all values of the specified property.T
getAnyRealValue()
Class<PrismProperty>
getItemClass()
PrismPropertyDefinition<T>
getPropertyDefinition()
PrismProperty<T>
getPropertyNewMatchingPath()
Returns the "new" state of the property - the state that would be after the delta is applied.PrismProperty<T>
getPropertyNewMatchingPath(PrismProperty<T> propertyOld)
Returns the "new" state of the property - the state that would be after the delta is applied.<V> Collection<PrismPropertyValue<V>>
getValues(Class<V> type)
Returns all values regardless of whether they are added or removed or replaced.<P extends PrismProperty>
PinstantiateEmptyProperty()
boolean
isApplicableToType(Item item)
boolean
isRealValueToAdd(PrismPropertyValue<?> value)
boolean
isRealValueToDelete(PrismPropertyValue<?> value)
PropertyDelta<T>
narrow(@NotNull PrismObject<? extends Objectable> object, @NotNull Comparator<PrismPropertyValue<T>> plusComparator, @NotNull Comparator<PrismPropertyValue<T>> minusComparator, boolean assumeMissingItems)
Filters out all delta values that are meaningless to apply.void
setPropertyDefinition(PrismPropertyDefinition<T> propertyDefinition)
void
setRealValuesToReplace(T... newValues)
-
Methods inherited from class com.evolveum.midpoint.prism.impl.delta.ItemDeltaImpl
accept, accept, accept, addEstimatedOldValue, addEstimatedOldValues, addEstimatedOldValues, addsAnyValue, addToReplaceDelta, addValuesToAdd, addValuesToAdd, addValuesToDelete, addValuesToDelete, addValueToAdd, addValueToDelete, addValueToReplace, applyDefinition, applyDefinition, applyTo, applyTo, applyToMatchingPath, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, clear, clearValuesToAdd, clearValuesToDelete, clearValuesToReplace, cloneWithChangedParentPath, contains, contains, copyValues, createReverseDelta, debugDump, distributeReplace, dumpValues, equals, equivalent, filterValues, filterYields, findValueToAddOrReplace, foreach, getAnyValue, getDefinition, getElementName, getEstimatedOldValues, getItemNew, getItemNew, getItemNewMatchingPath, getParentPath, getPath, getPrismContext, getSubDelta, getValueChanges, getValuesToAdd, getValuesToDelete, getValuesToReplace, hasCompleteDefinition, hashCode, isAdd, isApplicableTo, isDelete, isEmpty, isLiterallyEmpty, isRaw, isRedundant, isReplace, isValueEquivalent, isValueToAdd, isValueToDelete, isValueToReplace, merge, mergeValuesToAdd, mergeValuesToAdd, mergeValuesToDelete, mergeValuesToDelete, mergeValuesToReplace, mergeValuesToReplace, mergeValueToAdd, mergeValueToDelete, mergeValueToReplace, normalize, removeValueToAdd, removeValueToDelete, removeValueToReplace, resetValuesToAdd, resetValuesToDelete, resetValuesToReplace, revive, setDefinition, setElementName, setEstimatedOldValues, setOriginTypeRecursive, setParentPath, setValuesToReplace, setValuesToReplace, setValueToReplace, setValueToReplace, simplify, size, toDeltaSetTriple, toString, validate, validate, validateValues, validateValues
-
Methods inherited from class com.evolveum.midpoint.prism.AbstractFreezable
freeze, freeze, freezeAll, freezeNullableList, isImmutable, isMutable, performFreeze
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.prism.Freezable
checkImmutable, checkMutable, freeze
-
Methods inherited from interface com.evolveum.midpoint.prism.delta.ItemDelta
accept, accept, accept, addEstimatedOldValue, addEstimatedOldValues, addEstimatedOldValues, addsAnyValue, addToReplaceDelta, addValuesToAdd, addValuesToAdd, addValuesToDelete, addValuesToDelete, addValueToAdd, addValueToDelete, addValueToReplace, applyDefinition, applyTo, applyTo, applyToMatchingPath, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, clear, clearValuesToAdd, clearValuesToDelete, clearValuesToReplace, cloneWithChangedParentPath, contains, contains, createReverseDelta, debugDump, distributeReplace, equals, equivalent, filterValues, filterYields, findValueToAddOrReplace, foreach, getAnyValue, getDefinition, getElementName, getEstimatedOldValues, getItemNew, getItemNew, getItemNewMatchingPath, getParentPath, getPath, getRealValuesToAdd, getRealValuesToDelete, getRealValuesToReplace, getSubDelta, getValueChanges, getValuesToAdd, getValuesToDelete, getValuesToReplace, hasCompleteDefinition, isAdd, isApplicableTo, isDelete, isEmpty, isImmutable, isLiterallyEmpty, isOperational, isRaw, isRedundant, isReplace, isValueToAdd, isValueToDelete, isValueToReplace, merge, mergeValuesToAdd, mergeValuesToAdd, mergeValuesToDelete, mergeValuesToDelete, mergeValuesToReplace, mergeValuesToReplace, mergeValueToAdd, mergeValueToDelete, mergeValueToReplace, normalize, removeValueToAdd, removeValueToDelete, removeValueToReplace, resetValuesToAdd, resetValuesToDelete, resetValuesToReplace, revive, setElementName, setEstimatedOldValues, setOriginTypeRecursive, setParentPath, setValuesToReplace, setValuesToReplace, setValueToReplace, setValueToReplace, simplify, size, toDeltaSetTriple, toString, validate, validate, validateValues, validateValues
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismContextSensitive
getPrismContext
-
Methods inherited from interface com.evolveum.midpoint.prism.delta.PropertyDelta
applyDefinition, setDefinition
-
-
-
-
Constructor Detail
-
PropertyDeltaImpl
public PropertyDeltaImpl(PrismPropertyDefinition<T> propertyDefinition, PrismContext prismContext)
-
PropertyDeltaImpl
public PropertyDeltaImpl(ItemPath itemPath, QName name, PrismPropertyDefinition<T> propertyDefinition, PrismContext prismContext)
-
PropertyDeltaImpl
public PropertyDeltaImpl(ItemPath propertyPath, PrismPropertyDefinition<T> propertyDefinition, PrismContext prismContext)
-
-
Method Detail
-
getPropertyDefinition
public PrismPropertyDefinition<T> getPropertyDefinition()
- Specified by:
getPropertyDefinition
in interfacePropertyDelta<T>
-
setPropertyDefinition
public void setPropertyDefinition(PrismPropertyDefinition<T> propertyDefinition)
- Specified by:
setPropertyDefinition
in interfacePropertyDelta<T>
-
getItemClass
public Class<PrismProperty> getItemClass()
- Specified by:
getItemClass
in interfaceItemDelta<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
getItemClass
in interfacePropertyDelta<T>
- Specified by:
getItemClass
in classItemDeltaImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
getValues
public <V> Collection<PrismPropertyValue<V>> getValues(Class<V> type)
Returns all values regardless of whether they are added or removed or replaced. Useful for iterating over all the changed values.- Specified by:
getValues
in interfacePropertyDelta<T>
-
getAnyRealValue
public T getAnyRealValue()
- Specified by:
getAnyRealValue
in interfacePropertyDelta<T>
-
instantiateEmptyProperty
public <P extends PrismProperty> P instantiateEmptyProperty()
- Specified by:
instantiateEmptyProperty
in interfacePropertyDelta<T>
-
isApplicableToType
public boolean isApplicableToType(Item item)
- Specified by:
isApplicableToType
in interfacePropertyDelta<T>
- Specified by:
isApplicableToType
in classItemDeltaImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
clone
public PropertyDeltaImpl<T> clone()
- Specified by:
clone
in interfaceItemDelta<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
clone
in interfacePropertyDelta<T>
- Specified by:
clone
in classItemDeltaImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
copyValues
protected void copyValues(PropertyDeltaImpl<T> clone)
-
createReplaceDelta
public static <O extends Objectable,T> PropertyDelta<T> createReplaceDelta(PrismContainerDefinition<O> containerDefinition, QName propertyName, T... realValues)
-
createReplaceDelta
public static <O extends Objectable,T> PropertyDelta<T> createReplaceDelta(PrismContainerDefinition<O> containerDefinition, QName propertyName, PrismPropertyValue<T>... pValues)
-
createAddDelta
public static <O extends Objectable> PropertyDelta createAddDelta(PrismContainerDefinition<O> containerDefinition, QName propertyName, Object... realValues)
-
createDeleteDelta
public static <O extends Objectable> PropertyDelta createDeleteDelta(PrismContainerDefinition<O> containerDefinition, QName propertyName, Object... realValues)
-
createReplaceEmptyDelta
public static <O extends Objectable> PropertyDelta createReplaceEmptyDelta(PrismObjectDefinition<O> objectDefinition, ItemPath propertyPath)
Create delta that deletes all values of the specified property.
-
createReplaceDeltaOrEmptyDelta
public static <O extends Objectable,T> PropertyDelta<T> createReplaceDeltaOrEmptyDelta(PrismObjectDefinition<O> objectDefinition, QName propertyName, T realValue)
-
isRealValueToAdd
public boolean isRealValueToAdd(PrismPropertyValue<?> value)
- Specified by:
isRealValueToAdd
in interfacePropertyDelta<T>
-
isRealValueToDelete
public boolean isRealValueToDelete(PrismPropertyValue<?> value)
- Specified by:
isRealValueToDelete
in interfacePropertyDelta<T>
-
getPropertyNewMatchingPath
public PrismProperty<T> getPropertyNewMatchingPath() throws SchemaException
Returns the "new" state of the property - the state that would be after the delta is applied.- Specified by:
getPropertyNewMatchingPath
in interfacePropertyDelta<T>
- Throws:
SchemaException
-
getPropertyNewMatchingPath
public PrismProperty<T> getPropertyNewMatchingPath(PrismProperty<T> propertyOld) throws SchemaException
Returns the "new" state of the property - the state that would be after the delta is applied.- Specified by:
getPropertyNewMatchingPath
in interfacePropertyDelta<T>
- Throws:
SchemaException
-
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(ItemPath propertyPath, Class<O> compileTimeClass, PrismContext prismContext)
-
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, PrismObjectDefinition<?> objectDefinition, Collection<T> propertyValues)
-
createModificationReplaceProperty
public static <T> PropertyDelta<T> createModificationReplaceProperty(@NotNull @NotNull ItemPath path, @NotNull @NotNull PrismPropertyDefinition propertyDefinition, T... propertyValues)
-
createModificationAddProperty
public static <T> PropertyDelta<T> createModificationAddProperty(ItemPath propertyPath, PrismPropertyDefinition propertyDefinition, T... propertyValues)
-
createModificationAddProperty
public static <T> PropertyDelta<T> createModificationAddProperty(ItemPath propertyPath, PrismObjectDefinition<?> objectDefinition, T... propertyValues)
-
createModificationDeleteProperty
public static <T> PropertyDelta<T> createModificationDeleteProperty(ItemPath propertyPath, PrismPropertyDefinition propertyDefinition, T... propertyValues)
-
createModificationDeleteProperty
public static <T> PropertyDelta<T> createModificationDeleteProperty(ItemPath propertyPath, PrismObjectDefinition<?> objectDefinition, T... propertyValues)
-
createModificationReplacePropertyCollection
public static Collection<? extends ItemDelta<?,?>> createModificationReplacePropertyCollection(QName propertyName, PrismObjectDefinition<?> objectDefinition, 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.
-
setRealValuesToReplace
@SafeVarargs public final void setRealValuesToReplace(T... newValues)
- Specified by:
setRealValuesToReplace
in interfacePropertyDelta<T>
-
addRealValuesToAdd
@SafeVarargs public final void addRealValuesToAdd(T... newValues)
- Specified by:
addRealValuesToAdd
in interfacePropertyDelta<T>
-
addRealValuesToDelete
@SafeVarargs public final void addRealValuesToDelete(T... newValues)
- Specified by:
addRealValuesToDelete
in interfacePropertyDelta<T>
-
addRealValuesToAdd
public final void addRealValuesToAdd(Collection<T> newValues)
- Specified by:
addRealValuesToAdd
in interfacePropertyDelta<T>
-
addRealValuesToDelete
public final void addRealValuesToDelete(Collection<T> values)
- Specified by:
addRealValuesToDelete
in interfacePropertyDelta<T>
-
narrow
public PropertyDelta<T> narrow(@NotNull @NotNull PrismObject<? extends Objectable> object, @NotNull @NotNull Comparator<PrismPropertyValue<T>> plusComparator, @NotNull @NotNull Comparator<PrismPropertyValue<T>> minusComparator, boolean assumeMissingItems)
Description copied from class:ItemDeltaImpl
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. Returns null if the delta is not needed at all. See description on the interface.- Specified by:
narrow
in interfaceItemDelta<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
narrow
in interfacePropertyDelta<T>
- Overrides:
narrow
in classItemDeltaImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
plusComparator
- Comparator we want to use when determining skippability of values being added.minusComparator
- Comparator we want to use when determining skippability of values being deleted.
-
-