Class PropertyDeltaImpl<T>
- java.lang.Object
-
- 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>
,Itemable
,PathVisitable
,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, estimatedOldValues, fullPath, 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(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 <T> PropertyDelta<T>
createModificationReplaceProperty(ItemPath path, PrismPropertyDefinition propertyDefinition, T... propertyValues)
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.<T> Collection<PrismPropertyValue<T>>
getValues(Class<T> 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)
boolean
isRedundant(PrismObject<? extends Objectable> object, MatchingRule<T> matchingRule, boolean assumeMissingItems)
PropertyDelta<T>
narrow(PrismObject<? extends Objectable> object, boolean assumeMissingItems)
Filters out all delta values that are meaningless to apply.PropertyDelta<T>
narrow(PrismObject<? extends Objectable> object, MatchingRule<T> matchingRule, boolean assumeMissingItems)
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, applyTo, applyTo, applyToMatchingPath, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkImmutability, checkMutability, clear, clearValuesToAdd, clearValuesToDelete, clearValuesToReplace, cloneWithChangedParentPath, contains, contains, containsEquivalentValue, copyValues, createReverseDelta, debugDump, distributeReplace, dumpValues, equals, equivalent, filterValues, findValueToAddOrReplace, foreach, getAnyValue, getDefinition, getElementName, getEstimatedOldValues, getItemNew, getItemNew, getItemNewMatchingPath, getParentPath, getPath, getPrismContext, getSubDelta, getValueChanges, getValuesToAdd, getValuesToDelete, getValuesToReplace, hasCompleteDefinition, hashCode, isAdd, isApplicableTo, isDelete, isEmpty, isImmutable, isInFactEmpty, isRaw, isRedundant, isRedundant, isReplace, isValueEquivalent, isValueToAdd, isValueToAdd, isValueToDelete, isValueToDelete, isValueToReplace, isValueToReplace, merge, mergeValuesToAdd, mergeValuesToAdd, mergeValuesToDelete, mergeValuesToDelete, mergeValuesToReplace, mergeValuesToReplace, mergeValueToAdd, mergeValueToDelete, mergeValueToReplace, narrow, normalize, removeValueToAdd, removeValueToDelete, removeValueToReplace, resetValuesToAdd, resetValuesToDelete, resetValuesToReplace, revive, setDefinition, setElementName, setEstimatedOldValues, setImmutable, setOriginTypeRecursive, setParentPath, setValuesToReplace, setValuesToReplace, setValueToReplace, setValueToReplace, simplify, size, toDeltaSetTriple, toDeltaSetTriple, toString, validate, validate, validateValues, validateValues
-
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.delta.ItemDelta
accept, accept, accept, addEstimatedOldValue, addEstimatedOldValues, addEstimatedOldValues, addsAnyValue, addToReplaceDelta, addValuesToAdd, addValuesToAdd, addValuesToDelete, addValuesToDelete, addValueToAdd, addValueToDelete, addValueToReplace, applyDefinition, applyTo, applyTo, applyTo, applyTo, applyToMatchingPath, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, clear, clearValuesToAdd, clearValuesToDelete, clearValuesToReplace, cloneWithChangedParentPath, contains, contains, createReverseDelta, debugDump, distributeReplace, equals, equivalent, filterValues, findValueToAddOrReplace, foreach, getAnyValue, getDefinition, getElementName, getEstimatedOldValues, getItemNew, getItemNew, getItemNewMatchingPath, getParentPath, getPath, getPrismContext, getSubDelta, getValueChanges, getValuesToAdd, getValuesToDelete, getValuesToReplace, hasCompleteDefinition, isAdd, isApplicableTo, isDelete, isEmpty, isImmutable, isInFactEmpty, isRaw, isRedundant, isRedundant, isReplace, isValueToAdd, isValueToAdd, isValueToDelete, isValueToDelete, isValueToReplace, isValueToReplace, merge, mergeValuesToAdd, mergeValuesToAdd, mergeValuesToDelete, mergeValuesToDelete, mergeValuesToReplace, mergeValuesToReplace, mergeValueToAdd, mergeValueToDelete, mergeValueToReplace, narrow, normalize, removeValueToAdd, removeValueToDelete, removeValueToReplace, resetValuesToAdd, resetValuesToDelete, resetValuesToReplace, revive, setElementName, setEstimatedOldValues, setImmutable, setOriginTypeRecursive, setParentPath, setValuesToReplace, setValuesToReplace, setValueToReplace, setValueToReplace, simplify, size, toDeltaSetTriple, toDeltaSetTriple, toString, validate, validate, validateValues, validateValues
-
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 <T> Collection<PrismPropertyValue<T>> getValues(Class<T> 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
-
narrow
public PropertyDelta<T> narrow(PrismObject<? extends Objectable> object, 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.- Specified by:
narrow
in interfaceItemDelta<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
narrow
in interfacePropertyDelta<T>
- Overrides:
narrow
in classItemDeltaImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
assumeMissingItems
- Assumes that some items in the object may be missing. So replacing them by null or deleting some values from them cannot be narrowed out.
-
narrow
public PropertyDelta<T> narrow(PrismObject<? extends Objectable> object, MatchingRule<T> matchingRule, boolean assumeMissingItems)
- Specified by:
narrow
in interfacePropertyDelta<T>
-
isRedundant
public boolean isRedundant(PrismObject<? extends Objectable> object, MatchingRule<T> matchingRule, boolean assumeMissingItems)
- Specified by:
isRedundant
in interfacePropertyDelta<T>
-
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(ItemPath path, 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>
-
-