Class ItemDeltaImpl<V extends PrismValue,D extends ItemDefinition>
- java.lang.Object
-
- com.evolveum.midpoint.prism.AbstractFreezable
-
- com.evolveum.midpoint.prism.impl.delta.ItemDeltaImpl<V,D>
-
- All Implemented Interfaces:
ItemDelta<V,D>
,Freezable
,Itemable
,PathVisitable
,PrismContextSensitive
,Visitable
,DebugDumpable
,Foreachable<V>
,Serializable
- Direct Known Subclasses:
ContainerDeltaImpl
,PropertyDeltaImpl
,ReferenceDeltaImpl
public abstract class ItemDeltaImpl<V extends PrismValue,D extends ItemDefinition> extends AbstractFreezable implements ItemDelta<V,D>
- Author:
- Radovan Semancik
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected D
definition
Definition of the item.protected ItemName
elementName
Name of the propertyprotected ItemPath
parentPath
Parent path of the item (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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
accept(Visitor visitor)
void
accept(Visitor visitor, boolean includeOldValues)
void
accept(Visitor visitor, ItemPath path, boolean recursive)
void
addEstimatedOldValue(V newValue)
void
addEstimatedOldValues(Collection<V> newValues)
void
addEstimatedOldValues(V... newValues)
boolean
addsAnyValue()
void
addToReplaceDelta()
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)
void
addValueToReplace(V newValue)
void
applyDefinition(D definition)
void
applyDefinition(D itemDefinition, boolean force)
void
applyTo(@NotNull Item item)
void
applyTo(PrismContainerValue containerValue)
void
applyToMatchingPath(@NotNull Item item)
Applies delta to item.void
assertDefinitions(boolean tolerateRawValues, Supplier<String> sourceDescriptionSupplier)
void
assertDefinitions(Supplier<String> sourceDescriptionSupplier)
void
checkConsistence()
void
checkConsistence(boolean requireDefinition, boolean prohibitRaw, ConsistencyCheckScope scope)
void
checkConsistence(ConsistencyCheckScope scope)
void
clear()
void
clearValuesToAdd()
void
clearValuesToDelete()
void
clearValuesToReplace()
abstract ItemDeltaImpl<V,D>
clone()
ItemDeltaImpl<V,D>
cloneWithChangedParentPath(ItemPath newParentPath)
boolean
contains(ItemDelta<V,D> other)
Returns true if the other delta is a complete subset of this delta.boolean
contains(ItemDelta<V,D> other, EquivalenceStrategy strategy)
Returns true if the other delta is a complete subset of this delta.protected void
copyValues(ItemDeltaImpl<V,D> clone)
ItemDelta<V,D>
createReverseDelta()
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.protected void
dumpValues(StringBuilder sb, String label, Collection<V> values, int indent)
boolean
equals(Object obj)
boolean
equivalent(ItemDelta other)
Deltas are equivalent if they have the same result when applied to an object.void
filterValues(Function<V,Boolean> function)
void
filterYields(BiFunction<V,PrismContainerValue,Boolean> function)
V
findValueToAddOrReplace(V value)
void
foreach(Processor<V> processor)
Will call processor for every element in the instance.V
getAnyValue()
D
getDefinition()
ItemName
getElementName()
Collection<V>
getEstimatedOldValues()
Returns estimated state of the old value before the delta is applied.abstract Class<? extends Item>
getItemClass()
Item<V,D>
getItemNew()
Returns the "new" state of the property - the state that would be after the delta is applied.Item<V,D>
getItemNew(Item<V,D> itemOld)
Returns the "new" state of the property - the state that would be after the delta is applied.Item<V,D>
getItemNewMatchingPath(Item<V,D> itemOld)
Returns the "new" state of the property - the state that would be after the delta is applied.ItemPath
getParentPath()
@NotNull ItemPath
getPath()
PrismContext
getPrismContext()
ItemDelta<?,?>
getSubDelta(ItemPath path)
Collection<V>
getValueChanges(PlusMinusZero mode)
Collection<V>
getValuesToAdd()
Collection<V>
getValuesToDelete()
Collection<V>
getValuesToReplace()
boolean
hasCompleteDefinition()
int
hashCode()
boolean
isAdd()
boolean
isApplicableTo(Item item)
protected abstract boolean
isApplicableToType(Item item)
boolean
isDelete()
boolean
isEmpty()
boolean
isLiterallyEmpty()
The original semantics ofItemDelta.isEmpty()
method: returns true if all of values to add, delete, replace are null.boolean
isRaw()
boolean
isRedundant(PrismObject<? extends Objectable> object, @NotNull ParameterizedEquivalenceStrategy strategy, boolean assumeMissingItems)
Checks if the delta is redundant w.r.t.boolean
isReplace()
protected boolean
isValueEquivalent(V a, V b, ParameterizedEquivalenceStrategy strategy)
boolean
isValueToAdd(V value)
boolean
isValueToDelete(V value)
boolean
isValueToReplace(V value)
void
merge(ItemDelta<V,D> 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,D>
narrow(@NotNull PrismObject<? extends Objectable> object, @NotNull Comparator<V> plusComparator, @NotNull Comparator<V> minusComparator, boolean assumeMissingItems)
Filters out all delta values that are meaningless to apply.void
normalize()
boolean
removeValueToAdd(PrismValue valueToRemove)
boolean
removeValueToDelete(PrismValue valueToRemove)
boolean
removeValueToReplace(PrismValue valueToRemove)
void
resetValuesToAdd()
void
resetValuesToDelete()
void
resetValuesToReplace()
void
revive(PrismContext prismContext)
void
setDefinition(D definition)
void
setElementName(QName elementName)
void
setEstimatedOldValues(Collection<V> estimatedOldValues)
void
setOriginTypeRecursive(OriginType originType)
Set origin type to all values and subvaluesvoid
setParentPath(ItemPath parentPath)
void
setValuesToReplace(Collection<V> newValues)
void
setValuesToReplace(V... newValues)
void
setValueToReplace()
Sets empty value to replace.void
setValueToReplace(V newValue)
void
simplify()
Transforms the delta to the simplest (and safest) form.int
size()
PrismValueDeltaSetTriple<V>
toDeltaSetTriple(Item<V,D> itemOld)
String
toString()
void
validate()
void
validate(String contextDescription)
void
validateValues(ItemDeltaValidator<V> validator)
void
validateValues(ItemDeltaValidator<V> validator, Collection<V> oldValues)
-
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
getRealValuesToAdd, getRealValuesToDelete, getRealValuesToReplace, isImmutable
-
-
-
-
Field Detail
-
elementName
protected ItemName elementName
Name of the property
-
parentPath
protected ItemPath parentPath
Parent path of the item (path to the property container)
-
definition
protected D extends ItemDefinition definition
Definition of the item.
-
valuesToReplace
protected Collection<V extends PrismValue> valuesToReplace
-
valuesToAdd
protected Collection<V extends PrismValue> valuesToAdd
-
valuesToDelete
protected Collection<V extends PrismValue> valuesToDelete
-
-
Method Detail
-
getElementName
public ItemName getElementName()
- Specified by:
getElementName
in interfaceItemable
- Specified by:
getElementName
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
setElementName
public void setElementName(QName elementName)
- Specified by:
setElementName
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
getParentPath
public ItemPath getParentPath()
- Specified by:
getParentPath
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
setParentPath
public void setParentPath(ItemPath parentPath)
- Specified by:
setParentPath
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
getPath
@NotNull public @NotNull ItemPath getPath()
- Specified by:
getPath
in interfaceItemable
- Specified by:
getPath
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
getDefinition
public D getDefinition()
- Specified by:
getDefinition
in interfaceItemable
- Specified by:
getDefinition
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
setDefinition
public void setDefinition(D definition)
- Specified by:
setDefinition
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
accept
public void accept(Visitor visitor)
- Specified by:
accept
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Specified by:
accept
in interfaceVisitable<V extends PrismValue>
-
accept
public void accept(Visitor visitor, boolean includeOldValues)
- Specified by:
accept
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
size
public int size()
- Specified by:
size
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
accept
public void accept(Visitor visitor, ItemPath path, boolean recursive)
- Specified by:
accept
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Specified by:
accept
in interfacePathVisitable
-
applyDefinition
public void applyDefinition(D definition) throws SchemaException
- Specified by:
applyDefinition
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
hasCompleteDefinition
public boolean hasCompleteDefinition()
- Specified by:
hasCompleteDefinition
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
getPrismContext
public PrismContext getPrismContext()
- Specified by:
getPrismContext
in interfacePrismContextSensitive
-
getItemClass
public abstract Class<? extends Item> getItemClass()
- Specified by:
getItemClass
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
getValuesToAdd
public Collection<V> getValuesToAdd()
- Specified by:
getValuesToAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
clearValuesToAdd
public void clearValuesToAdd()
- Specified by:
clearValuesToAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
getValuesToDelete
public Collection<V> getValuesToDelete()
- Specified by:
getValuesToDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
clearValuesToDelete
public void clearValuesToDelete()
- Specified by:
clearValuesToDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
getValuesToReplace
public Collection<V> getValuesToReplace()
- Specified by:
getValuesToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
clearValuesToReplace
public void clearValuesToReplace()
- Specified by:
clearValuesToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
addValuesToAdd
public void addValuesToAdd(Collection<V> newValues)
- Specified by:
addValuesToAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
addValuesToAdd
public void addValuesToAdd(V... newValues)
- Specified by:
addValuesToAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
addValueToAdd
public void addValueToAdd(V newValue)
- Specified by:
addValueToAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
removeValueToAdd
public boolean removeValueToAdd(PrismValue valueToRemove)
- Specified by:
removeValueToAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
removeValueToDelete
public boolean removeValueToDelete(PrismValue valueToRemove)
- Specified by:
removeValueToDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
removeValueToReplace
public boolean removeValueToReplace(PrismValue valueToRemove)
- Specified by:
removeValueToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
mergeValuesToAdd
public void mergeValuesToAdd(Collection<V> newValues)
- Specified by:
mergeValuesToAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
mergeValuesToAdd
public void mergeValuesToAdd(V[] newValues)
- Specified by:
mergeValuesToAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
mergeValueToAdd
public void mergeValueToAdd(V newValue)
- Specified by:
mergeValueToAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
addValuesToDelete
public void addValuesToDelete(Collection<V> newValues)
- Specified by:
addValuesToDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
addValuesToDelete
public void addValuesToDelete(V... newValues)
- Specified by:
addValuesToDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
addValueToDelete
public void addValueToDelete(V newValue)
- Specified by:
addValueToDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
isValueEquivalent
protected boolean isValueEquivalent(V a, V b, ParameterizedEquivalenceStrategy strategy)
-
mergeValuesToDelete
public void mergeValuesToDelete(Collection<V> newValues)
- Specified by:
mergeValuesToDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
mergeValuesToDelete
public void mergeValuesToDelete(V[] newValues)
- Specified by:
mergeValuesToDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
mergeValueToDelete
public void mergeValueToDelete(V newValue)
- Specified by:
mergeValueToDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
resetValuesToAdd
public void resetValuesToAdd()
- Specified by:
resetValuesToAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
resetValuesToDelete
public void resetValuesToDelete()
- Specified by:
resetValuesToDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
resetValuesToReplace
public void resetValuesToReplace()
- Specified by:
resetValuesToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
setValuesToReplace
public void setValuesToReplace(Collection<V> newValues)
- Specified by:
setValuesToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
setValuesToReplace
public void setValuesToReplace(V... newValues)
- Specified by:
setValuesToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
setValueToReplace
public void setValueToReplace()
Sets empty value to replace. This efficiently means removing all values.- Specified by:
setValueToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
setValueToReplace
public void setValueToReplace(V newValue)
- Specified by:
setValueToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
addValueToReplace
public void addValueToReplace(V newValue)
- Specified by:
addValueToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
mergeValuesToReplace
public void mergeValuesToReplace(Collection<V> newValues)
- Specified by:
mergeValuesToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
mergeValuesToReplace
public void mergeValuesToReplace(V[] newValues)
- Specified by:
mergeValuesToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
mergeValueToReplace
public void mergeValueToReplace(V newValue)
- Specified by:
mergeValueToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
isValueToAdd
public boolean isValueToAdd(V value)
- Specified by:
isValueToAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
isValueToDelete
public boolean isValueToDelete(V value)
- Specified by:
isValueToDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
isValueToReplace
public boolean isValueToReplace(V value)
- Specified by:
isValueToReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
getAnyValue
public V getAnyValue()
- Specified by:
getAnyValue
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
isLiterallyEmpty
public boolean isLiterallyEmpty()
Description copied from interface:ItemDelta
The original semantics ofItemDelta.isEmpty()
method: returns true if all of values to add, delete, replace are null. TODO is this really needed?- Specified by:
isLiterallyEmpty
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
addsAnyValue
public boolean addsAnyValue()
- Specified by:
addsAnyValue
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
foreach
public void foreach(Processor<V> processor)
Description copied from interface:Foreachable
Will call processor for every element in the instance. This is NOT recursive. E.g. in case of collection of collections the processor will NOT be called for elements of the inner collections. If you need recursion please have a look at Visitor.- Specified by:
foreach
in interfaceForeachable<V extends PrismValue>
- Specified by:
foreach
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
getEstimatedOldValues
public Collection<V> getEstimatedOldValues()
Returns estimated state of the old value before the delta is applied. This information is not entirely reliable. The state might change between the value is read and the delta is applied. This is property is optional and even if provided it is only for for informational purposes.If this method returns null then it should be interpreted as "I do not know". In that case the delta has no information about the old values. If this method returns empty collection then it should be interpreted that we know that there were no values in this item before the delta was applied.
- Specified by:
getEstimatedOldValues
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Returns:
- estimated state of the old value before the delta is applied (may be null).
-
setEstimatedOldValues
public void setEstimatedOldValues(Collection<V> estimatedOldValues)
- Specified by:
setEstimatedOldValues
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
addEstimatedOldValues
public void addEstimatedOldValues(Collection<V> newValues)
- Specified by:
addEstimatedOldValues
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
addEstimatedOldValues
public void addEstimatedOldValues(V... newValues)
- Specified by:
addEstimatedOldValues
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
addEstimatedOldValue
public void addEstimatedOldValue(V newValue)
- Specified by:
addEstimatedOldValue
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
normalize
public void normalize()
- Specified by:
normalize
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
isReplace
public boolean isReplace()
- Specified by:
isReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
isAdd
public boolean isAdd()
- Specified by:
isAdd
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
isDelete
public boolean isDelete()
- Specified by:
isDelete
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
clear
public void clear()
- Specified by:
clear
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
narrow
public ItemDelta<V,D> narrow(@NotNull @NotNull PrismObject<? extends Objectable> object, @NotNull @NotNull Comparator<V> plusComparator, @NotNull @NotNull Comparator<V> minusComparator, boolean assumeMissingItems)
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<V extends PrismValue,D extends ItemDefinition>
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.
-
isRedundant
public boolean isRedundant(PrismObject<? extends Objectable> object, @NotNull @NotNull ParameterizedEquivalenceStrategy strategy, boolean assumeMissingItems)
Description copied from interface:ItemDelta
Checks if the delta is redundant w.r.t. current state of the object. I.e. if it changes the current object state.- Specified by:
isRedundant
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
assumeMissingItems
- Assumes that some items in the object may be missing. So delta that replaces them by null
-
validate
public void validate() throws SchemaException
- Specified by:
validate
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
validate
public void validate(String contextDescription) throws SchemaException
- Specified by:
validate
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
validateValues
public void validateValues(ItemDeltaValidator<V> validator) throws SchemaException
- Specified by:
validateValues
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
validateValues
public void validateValues(ItemDeltaValidator<V> validator, Collection<V> oldValues)
- Specified by:
validateValues
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
checkConsistence
public void checkConsistence()
- Specified by:
checkConsistence
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
checkConsistence
public void checkConsistence(ConsistencyCheckScope scope)
- Specified by:
checkConsistence
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
checkConsistence
public void checkConsistence(boolean requireDefinition, boolean prohibitRaw, ConsistencyCheckScope scope)
- Specified by:
checkConsistence
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
distributeReplace
public void distributeReplace(Collection<V> existingValues)
Distributes the replace values of this delta to add and delete with respect to provided existing values. TODO reconsider equivalence strategy!- Specified by:
distributeReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
merge
public void merge(ItemDelta<V,D> deltaToMerge)
Merge specified delta to this delta. This delta is assumed to be chronologically earlier, delta provided in the parameter is chronologically later.TODO do we expect that the paths of "this" delta and deltaToMerge are the same? From the code it seems so.
- Specified by:
merge
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
getValueChanges
public Collection<V> getValueChanges(PlusMinusZero mode)
- Specified by:
getValueChanges
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
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.- Specified by:
simplify
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
applyTo
public void applyTo(PrismContainerValue containerValue) throws SchemaException
- Specified by:
applyTo
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
applyTo
public void applyTo(@NotNull @NotNull Item item) throws SchemaException
- Specified by:
applyTo
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
applyToMatchingPath
public void applyToMatchingPath(@NotNull @NotNull Item item) throws SchemaException
Applies delta to item. Assumes that path of the delta and path of the item matches (does not do path checks).- Specified by:
applyToMatchingPath
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
getSubDelta
public ItemDelta<?,?> getSubDelta(ItemPath path)
- Specified by:
getSubDelta
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
isApplicableTo
public boolean isApplicableTo(Item item)
- Specified by:
isApplicableTo
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
isApplicableToType
protected abstract boolean isApplicableToType(Item item)
-
getItemNew
public Item<V,D> getItemNew() throws SchemaException
Returns the "new" state of the property - the state that would be after the delta is applied.WARNING: Output of this method should be used for preview only. It should NOT be placed into prism structures. Not even cloned. This method may return dummy items or similar items that are not usable. Values in the items should be OK, but they may need cloning.
- Specified by:
getItemNew
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
getItemNew
public Item<V,D> getItemNew(Item<V,D> itemOld) throws SchemaException
Returns the "new" state of the property - the state that would be after the delta is applied.WARNING: Output of this method should be used for preview only. It should NOT be placed into prism structures. Not even cloned. This method may return dummy items or similar items that are not usable. Values in the items should be OK, but they may need cloning.
- Specified by:
getItemNew
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
getItemNewMatchingPath
public Item<V,D> getItemNewMatchingPath(Item<V,D> itemOld) throws SchemaException
Returns the "new" state of the property - the state that would be after the delta is applied.WARNING: This is supposed to work only if the paths of the the delta and the item matches. E.g. it is NOT usable for application of subdeltas to containers.
- Specified by:
getItemNewMatchingPath
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
contains
public boolean contains(ItemDelta<V,D> 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.- Specified by:
contains
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
contains
public boolean contains(ItemDelta<V,D> other, EquivalenceStrategy strategy)
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.- Specified by:
contains
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
filterValues
public void filterValues(Function<V,Boolean> function)
- Specified by:
filterValues
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
filterYields
public void filterYields(BiFunction<V,PrismContainerValue,Boolean> function)
- Specified by:
filterYields
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
clone
public abstract ItemDeltaImpl<V,D> clone()
- Specified by:
clone
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Overrides:
clone
in classObject
-
cloneWithChangedParentPath
public ItemDeltaImpl<V,D> cloneWithChangedParentPath(ItemPath newParentPath)
- Specified by:
cloneWithChangedParentPath
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
copyValues
protected void copyValues(ItemDeltaImpl<V,D> clone)
-
toDeltaSetTriple
public PrismValueDeltaSetTriple<V> toDeltaSetTriple(Item<V,D> itemOld) throws SchemaException
- Specified by:
toDeltaSetTriple
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
assertDefinitions
public void assertDefinitions(Supplier<String> sourceDescriptionSupplier) throws SchemaException
- Specified by:
assertDefinitions
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
assertDefinitions
public void assertDefinitions(boolean tolerateRawValues, Supplier<String> sourceDescriptionSupplier) throws SchemaException
- Specified by:
assertDefinitions
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
isRaw
public boolean isRaw()
- Specified by:
isRaw
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
revive
public void revive(PrismContext prismContext) throws SchemaException
- Specified by:
revive
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
applyDefinition
public void applyDefinition(D itemDefinition, boolean force) throws SchemaException
- Specified by:
applyDefinition
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Throws:
SchemaException
-
equivalent
public boolean equivalent(ItemDelta other)
Deltas are equivalent if they have the same result when applied to an object. I.e. meta-data and other "decorations" such as old values are not considered in this comparison.- Specified by:
equivalent
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Overrides:
equals
in classObject
-
toString
public String toString()
- Specified by:
toString
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
- Overrides:
toString
in classObject
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
- Specified by:
debugDump
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
dumpValues
protected void dumpValues(StringBuilder sb, String label, Collection<V> values, int indent)
-
addToReplaceDelta
public void addToReplaceDelta()
- Specified by:
addToReplaceDelta
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
createReverseDelta
public ItemDelta<V,D> createReverseDelta()
- Specified by:
createReverseDelta
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
findValueToAddOrReplace
public V findValueToAddOrReplace(V value)
- Specified by:
findValueToAddOrReplace
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
setOriginTypeRecursive
public void setOriginTypeRecursive(OriginType originType)
Set origin type to all values and subvalues- Specified by:
setOriginTypeRecursive
in interfaceItemDelta<V extends PrismValue,D extends ItemDefinition>
-
-