Class DummyPropertyImpl<T>
- java.lang.Object
-
- com.evolveum.midpoint.prism.impl.item.DummyPropertyImpl<T>
-
- All Implemented Interfaces:
Item<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
,Itemable
,ParentVisitable
,PathVisitable
,PrismProperty<T>
,Revivable
,Visitable
,DebugDumpable
,Serializable
public class DummyPropertyImpl<T> extends Object implements PrismProperty<T>
- Author:
- semancik
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description DummyPropertyImpl(PrismProperty<T> realProperty, ItemPath path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(Visitor visitor)
void
accept(Visitor visitor, ItemPath path, boolean recursive)
void
acceptParentVisitor(Visitor visitor)
Accepts a visitor that visits each item/value on the way to the structure root.boolean
add(PrismPropertyValue<T> newValue)
Adds a given value, unless an equivalent one is already there.boolean
add(PrismPropertyValue<T> newValue, boolean checkUniqueness)
Adds a given value, unless an equivalent one is already there (if checkUniqueness is true).boolean
add(PrismPropertyValue<T> newValue, EquivalenceStrategy equivalenceStrategy)
Adds a given value, unless an equivalent one is already there.boolean
addAll(Collection<PrismPropertyValue<T>> newValues)
Adds given values, with the same semantics as repeated add(..) calls.boolean
addAll(Collection<PrismPropertyValue<T>> newValues, EquivalenceStrategy strategy)
Adds given values, with the same semantics as repeated add(..) calls.void
addRealValue(T valueToAdd)
void
addRealValues(T... valuesToAdd)
void
addRealValueSkipUniquenessCheck(T valueToAdd)
void
addValue(PrismPropertyValue<T> pValueToAdd)
void
addValues(Collection<PrismPropertyValue<T>> pValuesToAdd)
void
applyDefinition(PrismPropertyDefinition<T> definition)
void
applyDefinition(PrismPropertyDefinition<T> definition, boolean force)
void
assertDefinitions()
void
assertDefinitions(boolean tolerateRawValues, String sourceDescription)
void
assertDefinitions(String sourceDescription)
void
checkConsistence()
void
checkConsistence(boolean requireDefinitions, boolean prohibitRaw)
void
checkConsistence(boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
void
checkConsistence(boolean requireDefinitions, ConsistencyCheckScope scope)
void
checkConsistence(ConsistencyCheckScope scope)
void
checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
void
checkImmutability()
void
clear()
Removes all values from the item.PrismProperty<T>
clone()
Literal clone.PrismProperty<T>
cloneComplex(CloneStrategy strategy)
Complex clone with different cloning strategies.boolean
contains(PrismPropertyValue<T> value)
boolean
contains(PrismPropertyValue<T> value, EquivalenceStrategy strategy)
boolean
contains(PrismPropertyValue<T> value, EquivalenceStrategy strategy, Comparator<PrismPropertyValue<T>> comparator)
boolean
containsEquivalentValue(PrismPropertyValue<T> value)
boolean
containsEquivalentValue(PrismPropertyValue<T> value, Comparator<PrismPropertyValue<T>> comparator)
PropertyDelta<T>
createDelta()
Creates specific subclass of ItemDelta appropriate for type of item that this definition represents (e.g.PropertyDelta<T>
createDelta(ItemPath path)
String
debugDump(int indent)
boolean
deleteValue(PrismPropertyValue<T> pValueToDelete)
boolean
deleteValues(Collection<PrismPropertyValue<T>> pValuesToDelete)
ItemDelta<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
diff(Item<PrismPropertyValue<T>,PrismPropertyDefinition<T>> other, ParameterizedEquivalenceStrategy strategy)
Computes a difference (delta) with the specified item using given equivalence strategy.PropertyDelta<T>
diff(PrismProperty<T> other)
PropertyDelta<T>
diff(PrismProperty<T> other, ParameterizedEquivalenceStrategy strategy)
boolean
equals(Object obj)
Compares this item to the specified object under NOT_LITERAL strategy (if no other is pre-set).boolean
equals(Object obj, EquivalenceStrategy equivalenceStrategy)
Compares this item to the specified object under given strategy.boolean
equals(Object obj, ParameterizedEquivalenceStrategy equivalenceStrategy)
Compares this item to the specified object under given strategy.void
filterValues(Function<PrismPropertyValue<T>,Boolean> function)
Object
find(ItemPath path)
Returns object (Item or PrismValue) pointed to by the given path.<IV extends PrismValue,ID extends ItemDefinition>
PartiallyResolvedItem<IV,ID>findPartial(ItemPath path)
PrismPropertyValue<T>
findValue(PrismPropertyValue<T> value, EquivalenceStrategy strategy)
Collection<PrismValue>
getAllValues(ItemPath path)
T
getAnyRealValue()
PrismPropertyValue<T>
getAnyValue()
Returns any of the values.Collection<PrismPropertyValue<T>>
getClonedValues()
PrismPropertyDefinition<T>
getDefinition()
Returns applicable property definition.String
getDisplayName()
Returns a display name for the item.ItemName
getElementName()
Returns the name of the item.String
getHelp()
Returns help message defined for the item.Long
getHighestId()
PrismContainerValue<?>
getParent()
Returns the parent of this item (if exists).ItemPath
getPath()
Returns the path of this item (sequence of names from the "root" container or similar object to this item).PrismContext
getPrismContext()
PrismContext
getPrismContextLocal()
T
getRealValue()
Returns the "real value" (content) of this item: - value contained in PrismPropertyValue - Referencable in PrismReferenceValue - Containerable in PrismContainerValue - Objectable in PrismObjectValue Note that the real value can contain operational items.<X> X
getRealValue(Class<X> type)
Type override, also for compatibility.Collection<T>
getRealValues()
Returns (potentially empty) collection of "real values".<X> Collection<X>
getRealValues(Class<X> type)
Type override, also for compatibility.<X> X[]
getRealValuesArray(Class<X> type)
Type override, also for compatibility.Map<String,Object>
getUserData()
Returns the "user data", a map that allows attaching arbitrary named data to this item.<T> T
getUserData(String key)
Returns the user data for the given key (name).PrismPropertyValue<T>
getValue()
Returns the value, if there is only one.<X> PrismPropertyValue<X>
getValue(Class<X> type)
Type override, also for compatibility.Class<T>
getValueClass()
List<PrismPropertyValue<T>>
getValues()
Returns the values for this item.<X> List<PrismPropertyValue<X>>
getValues(Class<X> type)
Type override, also for compatibility.boolean
hasCompleteDefinition()
Returns true if this item and all contained items have proper definition.int
hashCode()
Computes hash code to be used under NOT_LITERAL equivalence strategy.int
hashCode(EquivalenceStrategy equivalenceStrategy)
Computes hash code to be used under given equivalence strategy.int
hashCode(ParameterizedEquivalenceStrategy equivalenceStrategy)
Computes hash code to be used under given equivalence strategy.boolean
hasNoValues()
boolean
hasRaw()
Returns true is at least one of the values is raw.boolean
hasRealValue(PrismPropertyValue<T> value)
boolean
isEmpty()
boolean
isImmutable()
boolean
isIncomplete()
Flag that indicates incomplete item.boolean
isOperational()
Returns true if this item is metadata item that should be ignored for metadata-insensitive comparisons and hashCode functions.boolean
isRaw()
Returns true is all the values are raw.boolean
isSingleValue()
Returns true if the item contains 0 or 1 values and (by definition) is not multivalued.void
merge(Item<PrismPropertyValue<T>,PrismPropertyDefinition<T>> otherItem)
Merge all the values of other item to this item.void
modifyUnfrozen(Runnable mutator)
void
modifyUnfrozen(Consumer<Item<PrismPropertyValue<T>,PrismPropertyDefinition<T>>> mutator)
void
normalize()
void
recomputeAllValues()
Re-apply PolyString (and possible other) normalizations to the object.boolean
remove(PrismPropertyValue<T> value)
Removes given value from the item.boolean
remove(PrismPropertyValue<T> value, EquivalenceStrategy strategy)
Removes values equivalent to given value from the item; under specified equivalence strategy OR when values represent the same value via "representsSameValue(.., lax=false)" method.boolean
removeAll(Collection<PrismPropertyValue<T>> values)
Removes all given values from the item.void
replace(PrismPropertyValue<T> newValue)
Replaces all values of the item by given value.void
replaceAll(Collection<PrismPropertyValue<T>> newValues, EquivalenceStrategy strategy)
Replaces all values of the item by given values.void
replaceValues(Collection<PrismPropertyValue<T>> valuesToReplace)
void
revive(PrismContext prismContext)
void
setDefinition(PrismPropertyDefinition<T> definition)
Sets applicable property definition.void
setElementName(QName elementName)
Sets the name of the item.void
setImmutable(boolean immutable)
void
setIncomplete(boolean incomplete)
Flags the item as incomplete.void
setParent(PrismContainerValue<?> parentValue)
Sets the parent of this item.void
setPrismContext(PrismContext prismContext)
void
setRealValue(T realValue)
void
setRealValues(T... realValues)
void
setUserData(String key, Object value)
Sets the user data for the given key (name).void
setValue(PrismPropertyValue<T> value)
Means as a short-hand for setting just a value for single-valued attributes.int
size()
Returns the number of values for this item.String
toHumanReadableString()
String
toString()
boolean
valuesEqual(Collection<PrismPropertyValue<T>> matchValues, Comparator<PrismPropertyValue<T>> comparator)
-
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.Item
diff, getRealValuesOrRawTypes
-
-
-
-
Constructor Detail
-
DummyPropertyImpl
public DummyPropertyImpl(PrismProperty<T> realProperty, @NotNull ItemPath path)
-
-
Method Detail
-
accept
public void accept(Visitor visitor, ItemPath path, boolean recursive)
- Specified by:
accept
in interfacePathVisitable
-
getDefinition
public PrismPropertyDefinition<T> getDefinition()
Description copied from interface:PrismProperty
Returns applicable property definition.May return null if no definition is applicable or the definition is not know.
- Specified by:
getDefinition
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
getDefinition
in interfaceItemable
- Specified by:
getDefinition
in interfacePrismProperty<T>
- Returns:
- applicable property definition
-
hasCompleteDefinition
public boolean hasCompleteDefinition()
Description copied from interface:Item
Returns true if this item and all contained items have proper definition.- Specified by:
hasCompleteDefinition
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
setDefinition
public void setDefinition(PrismPropertyDefinition<T> definition)
Description copied from interface:PrismProperty
Sets applicable property definition. TODO remove (method in Item is sufficient)- Specified by:
setDefinition
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
setDefinition
in interfacePrismProperty<T>
- Parameters:
definition
- the definition to set
-
getElementName
public ItemName getElementName()
Description copied from interface:Item
Returns the name of the item.The name is a QName. It uniquely defines an item.
The name may be null, but such an item will not work.
The name is the QName of XML element in the XML representation.
- Specified by:
getElementName
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
getElementName
in interfaceItemable
- Returns:
- item name TODO consider making element name obligatory
-
getValues
public <X> List<PrismPropertyValue<X>> getValues(Class<X> type)
Description copied from interface:PrismProperty
Type override, also for compatibility.- Specified by:
getValues
in interfacePrismProperty<T>
-
getValue
public PrismPropertyValue<T> getValue()
Description copied from interface:Item
Returns the value, if there is only one. Throws exception if there are more values. If there is no value, this method either: - returns null (for properties) - throws an exception (for items that can hold multiple values) - creates an empty value (for containers and references). TODO think again whether getOrCreateValue would not be better- Specified by:
getValue
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
getValue
in interfacePrismProperty<T>
-
getRealValues
@NotNull public Collection<T> getRealValues()
Description copied from interface:Item
Returns (potentially empty) collection of "real values".- Specified by:
getRealValues
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
getRealValues
in interfacePrismProperty<T>
-
setElementName
public void setElementName(QName elementName)
Description copied from interface:Item
Sets the name of the item.The name is a QName. It uniquely defines an item.
The name may be null, but such an item will not work.
The name is the QName of XML element in the XML representation.
- Specified by:
setElementName
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Parameters:
elementName
- the name to set TODO consider removing this method
-
getRealValues
public <X> Collection<X> getRealValues(Class<X> type)
Description copied from interface:PrismProperty
Type override, also for compatibility.- Specified by:
getRealValues
in interfacePrismProperty<T>
-
getAnyRealValue
public T getAnyRealValue()
- Specified by:
getAnyRealValue
in interfacePrismProperty<T>
-
getRealValue
public T getRealValue()
Description copied from interface:Item
Returns the "real value" (content) of this item: - value contained in PrismPropertyValue - Referencable in PrismReferenceValue - Containerable in PrismContainerValue - Objectable in PrismObjectValue Note that the real value can contain operational items. It can also contain container IDs (although they are not considered to be part of the real value). It does not contain information about item element name nor other metadata like origin, definition, etc. (Although e.g. Containerable can be converted back into PrismContainerValue that can be used to retrieve this information.)- Specified by:
getRealValue
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
getRealValue
in interfacePrismProperty<T>
-
getRealValue
public <X> X getRealValue(Class<X> type)
Description copied from interface:PrismProperty
Type override, also for compatibility.- Specified by:
getRealValue
in interfacePrismProperty<T>
-
getRealValuesArray
public <X> X[] getRealValuesArray(Class<X> type)
Description copied from interface:PrismProperty
Type override, also for compatibility.- Specified by:
getRealValuesArray
in interfacePrismProperty<T>
-
getValue
public <X> PrismPropertyValue<X> getValue(Class<X> type)
Description copied from interface:PrismProperty
Type override, also for compatibility.- Specified by:
getValue
in interfacePrismProperty<T>
-
setValue
public void setValue(PrismPropertyValue<T> value)
Description copied from interface:PrismProperty
Means as a short-hand for setting just a value for single-valued attributes. Will remove all existing values.- Specified by:
setValue
in interfacePrismProperty<T>
-
getDisplayName
public String getDisplayName()
Description copied from interface:Item
Returns a display name for the item.Returns null if the display name cannot be determined.
The display name is fetched from the definition. If no definition (schema) is available, the display name will not be returned.
- Specified by:
getDisplayName
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- display name for the item
-
setRealValue
public void setRealValue(T realValue)
- Specified by:
setRealValue
in interfacePrismProperty<T>
-
setRealValues
public void setRealValues(T... realValues)
- Specified by:
setRealValues
in interfacePrismProperty<T>
-
addValues
public void addValues(Collection<PrismPropertyValue<T>> pValuesToAdd)
- Specified by:
addValues
in interfacePrismProperty<T>
-
addValue
public void addValue(PrismPropertyValue<T> pValueToAdd)
- Specified by:
addValue
in interfacePrismProperty<T>
-
addRealValue
public void addRealValue(T valueToAdd)
- Specified by:
addRealValue
in interfacePrismProperty<T>
-
addRealValueSkipUniquenessCheck
public void addRealValueSkipUniquenessCheck(T valueToAdd)
- Specified by:
addRealValueSkipUniquenessCheck
in interfacePrismProperty<T>
-
addRealValues
public void addRealValues(T... valuesToAdd)
- Specified by:
addRealValues
in interfacePrismProperty<T>
-
getHelp
public String getHelp()
Description copied from interface:Item
Returns help message defined for the item.Returns null if the help message cannot be determined.
The help message is fetched from the definition. If no definition (schema) is available, the help message will not be returned.
- Specified by:
getHelp
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- help message for the item
-
deleteValues
public boolean deleteValues(Collection<PrismPropertyValue<T>> pValuesToDelete)
- Specified by:
deleteValues
in interfacePrismProperty<T>
-
deleteValue
public boolean deleteValue(PrismPropertyValue<T> pValueToDelete)
- Specified by:
deleteValue
in interfacePrismProperty<T>
-
replaceValues
public void replaceValues(Collection<PrismPropertyValue<T>> valuesToReplace)
- Specified by:
replaceValues
in interfacePrismProperty<T>
-
hasRealValue
public boolean hasRealValue(PrismPropertyValue<T> value)
- Specified by:
hasRealValue
in interfacePrismProperty<T>
-
getValueClass
public Class<T> getValueClass()
- Specified by:
getValueClass
in interfacePrismProperty<T>
-
createDelta
public PropertyDelta<T> createDelta()
Description copied from interface:Item
Creates specific subclass of ItemDelta appropriate for type of item that this definition represents (e.g. PropertyDelta, ContainerDelta, ...)- Specified by:
createDelta
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
createDelta
in interfacePrismProperty<T>
-
createDelta
public PropertyDelta<T> createDelta(ItemPath path)
- Specified by:
createDelta
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
createDelta
in interfacePrismProperty<T>
-
isIncomplete
public boolean isIncomplete()
Description copied from interface:Item
Flag that indicates incomplete item. If set to true then the values in this item are not complete. If this flag is true then it can be assumed that the object that this item represents has at least one value. This is a method how to indicate that the item really has some values, but are not here. This may be used for variety of purposes. It may indicate that the account has a password, but the password value is not revealed. This may indicate that a user has a photo, but the photo was not requested and therefore is not returned. This may be used to indicate that only part of the attribute values were returned from the search. And so on.- Specified by:
isIncomplete
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
find
public Object find(ItemPath path)
Description copied from interface:Item
Returns object (Item or PrismValue) pointed to by the given path.- Specified by:
find
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
find
in interfacePrismProperty<T>
-
findPartial
public <IV extends PrismValue,ID extends ItemDefinition> PartiallyResolvedItem<IV,ID> findPartial(ItemPath path)
- Specified by:
findPartial
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
findPartial
in interfacePrismProperty<T>
-
diff
public PropertyDelta<T> diff(PrismProperty<T> other)
- Specified by:
diff
in interfacePrismProperty<T>
-
diff
public PropertyDelta<T> diff(PrismProperty<T> other, ParameterizedEquivalenceStrategy strategy)
- Specified by:
diff
in interfacePrismProperty<T>
-
clone
public PrismProperty<T> clone()
Description copied from interface:Item
Literal clone.- Specified by:
clone
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
clone
in interfacePrismProperty<T>
- Overrides:
clone
in classObject
-
cloneComplex
public PrismProperty<T> cloneComplex(CloneStrategy strategy)
Description copied from interface:Item
Complex clone with different cloning strategies.- Specified by:
cloneComplex
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
cloneComplex
in interfacePrismProperty<T>
- See Also:
CloneStrategy
-
toString
public String toString()
- Specified by:
toString
in interfacePrismProperty<T>
- Overrides:
toString
in classObject
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
- Specified by:
debugDump
in interfacePrismProperty<T>
-
toHumanReadableString
public String toHumanReadableString()
- Specified by:
toHumanReadableString
in interfacePrismProperty<T>
-
setIncomplete
public void setIncomplete(boolean incomplete)
Description copied from interface:Item
Flags the item as incomplete.- Specified by:
setIncomplete
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Parameters:
incomplete
- The new value- See Also:
Item.isIncomplete()
-
getParent
public PrismContainerValue<?> getParent()
Description copied from interface:Item
Returns the parent of this item (if exists). Currently this has to be a PrismContainerValue.- Specified by:
getParent
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- The parent if exists
-
setParent
public void setParent(PrismContainerValue<?> parentValue)
Description copied from interface:Item
Sets the parent of this item.- Specified by:
setParent
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Parameters:
parentValue
- The new parent
-
getPath
@NotNull public ItemPath getPath()
Description copied from interface:Item
Returns the path of this item (sequence of names from the "root" container or similar object to this item). Note that if the containing object is a delta (usually a container delta), then the path- Specified by:
getPath
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
getPath
in interfaceItemable
- Returns:
- the path
-
getUserData
@NotNull public Map<String,Object> getUserData()
Description copied from interface:Item
Returns the "user data", a map that allows attaching arbitrary named data to this item.- Specified by:
getUserData
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- the user data map
-
getUserData
public <T> T getUserData(String key)
Description copied from interface:Item
Returns the user data for the given key (name).- Specified by:
getUserData
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
setUserData
public void setUserData(String key, Object value)
Description copied from interface:Item
Sets the user data for the given key (name).- Specified by:
setUserData
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
getValues
@NotNull public List<PrismPropertyValue<T>> getValues()
Description copied from interface:Item
Returns the values for this item. Although the ordering of this values is not important, and each value should be present at most once, we currently return them as a list instead of a set. TODO reconsider this- Specified by:
getValues
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
size
public int size()
Description copied from interface:Item
Returns the number of values for this item.- Specified by:
size
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
getAnyValue
public PrismPropertyValue<T> getAnyValue()
Description copied from interface:Item
Returns any of the values. Usually called when we are quite confident that there is only a single value; or we don't care which of the values we get. Does not create values if there are none.- Specified by:
getAnyValue
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
isSingleValue
public boolean isSingleValue()
Description copied from interface:Item
Returns true if the item contains 0 or 1 values and (by definition) is not multivalued.- Specified by:
isSingleValue
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
add
public boolean add(@NotNull PrismPropertyValue<T> newValue, boolean checkUniqueness) throws SchemaException
Description copied from interface:Item
Adds a given value, unless an equivalent one is already there (if checkUniqueness is true).- Specified by:
add
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if this item changed as a result of the call (i.e. if the value was really added) Note that even if checkUniqueness is false we check the cardinality of the item according to its definition, i.e. we do not allow single-valued item to contain more than one value.
- Throws:
SchemaException
-
add
public boolean add(@NotNull PrismPropertyValue<T> newValue) throws SchemaException
Description copied from interface:Item
Adds a given value, unless an equivalent one is already there. It is the same as calling add with checkUniqueness=true.- Specified by:
add
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if this item changed as a result of the call (i.e. if the value was really added)
- Throws:
SchemaException
-
add
public boolean add(@NotNull PrismPropertyValue<T> newValue, @NotNull EquivalenceStrategy equivalenceStrategy) throws SchemaException
Description copied from interface:Item
Adds a given value, unless an equivalent one is already there. It is the same as calling add with checkUniqueness=true. Uses given strategy for equivalence testing.- Specified by:
add
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if this item changed as a result of the call (i.e. if the value was really added)
- Throws:
SchemaException
-
addAll
public boolean addAll(Collection<PrismPropertyValue<T>> newValues) throws SchemaException
Description copied from interface:Item
Adds given values, with the same semantics as repeated add(..) calls.- Specified by:
addAll
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really added)
- Throws:
SchemaException
-
addAll
public boolean addAll(Collection<PrismPropertyValue<T>> newValues, EquivalenceStrategy strategy) throws SchemaException
Description copied from interface:Item
Adds given values, with the same semantics as repeated add(..) calls. For equality testing uses give strategy.- Specified by:
addAll
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really added)
- Throws:
SchemaException
-
remove
public boolean remove(PrismPropertyValue<T> value)
Description copied from interface:Item
Removes given value from the item. "Given value" currently means any value that is considered equivalent via REAL_VALUE equivalence strategy or a value that is considered "the same" via "representsSameValue(.., lax=false)" method.- Specified by:
remove
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really removed) Note that there can be more than one values removed.
-
remove
public boolean remove(PrismPropertyValue<T> value, @NotNull EquivalenceStrategy strategy)
Description copied from interface:Item
Removes values equivalent to given value from the item; under specified equivalence strategy OR when values represent the same value via "representsSameValue(.., lax=false)" method.- Specified by:
remove
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really removed)
-
removeAll
public boolean removeAll(Collection<PrismPropertyValue<T>> values)
Description copied from interface:Item
Removes all given values from the item. It is basically a shortcut for repeated remove(value) call.- Specified by:
removeAll
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really removed)
-
clear
public void clear()
Description copied from interface:Item
Removes all values from the item.- Specified by:
clear
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
replaceAll
public void replaceAll(Collection<PrismPropertyValue<T>> newValues, EquivalenceStrategy strategy) throws SchemaException
Description copied from interface:Item
Replaces all values of the item by given values.- Specified by:
replaceAll
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Throws:
SchemaException
-
replace
public void replace(PrismPropertyValue<T> newValue) throws SchemaException
Description copied from interface:Item
Replaces all values of the item by given value.- Specified by:
replace
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Throws:
SchemaException
-
equals
public boolean equals(Object obj)
Description copied from interface:Item
Compares this item to the specified object under NOT_LITERAL strategy (if no other is pre-set).- Specified by:
equals
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Overrides:
equals
in classObject
-
equals
public boolean equals(Object obj, @NotNull EquivalenceStrategy equivalenceStrategy)
Description copied from interface:Item
Compares this item to the specified object under given strategy.- Specified by:
equals
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
equals
public boolean equals(Object obj, @NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)
Description copied from interface:Item
Compares this item to the specified object under given strategy.- Specified by:
equals
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
hashCode
public int hashCode()
Description copied from interface:Item
Computes hash code to be used under NOT_LITERAL equivalence strategy.- Specified by:
hashCode
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Overrides:
hashCode
in classObject
-
hashCode
public int hashCode(@NotNull EquivalenceStrategy equivalenceStrategy)
Description copied from interface:Item
Computes hash code to be used under given equivalence strategy.- Specified by:
hashCode
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
hashCode
public int hashCode(@NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)
Description copied from interface:Item
Computes hash code to be used under given equivalence strategy.- Specified by:
hashCode
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
contains
public boolean contains(PrismPropertyValue<T> value)
- Specified by:
contains
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if the item contains a given value (by default using NOT_LITERAL strategy) Note that the "sameness" (ID-only value matching) is NOT considered here.
-
contains
public boolean contains(PrismPropertyValue<T> value, @NotNull EquivalenceStrategy strategy)
- Specified by:
contains
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if the item contains a given value under specified equivalence strategy Note that the "sameness" (ID-only value matching) is NOT considered here.
-
contains
public boolean contains(PrismPropertyValue<T> value, EquivalenceStrategy strategy, Comparator<PrismPropertyValue<T>> comparator)
- Specified by:
contains
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if the item contains a given value using comparator (if not null) or under specified equivalence strategy (if comparator is null). Note that the "sameness" (ID-only value matching) is NOT considered here.
-
containsEquivalentValue
public boolean containsEquivalentValue(PrismPropertyValue<T> value)
- Specified by:
containsEquivalentValue
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if the item contains an equivalent value (the same as
Item.containsEquivalentValue(PrismValue, Comparator)
with comparator being null)
-
containsEquivalentValue
public boolean containsEquivalentValue(PrismPropertyValue<T> value, Comparator<PrismPropertyValue<T>> comparator)
- Specified by:
containsEquivalentValue
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if the item contains an equivalent value Item value is considered to be equivalent to the given value if: 1) given value is ID-only container value and item value has the same ID, or 2) comparator is not null and it gives "equals" (0) result when comparing these values, or 3) comparator is null and values match under IGNORE_METADATA_CONSIDER_DIFFERENT_IDS strategy
-
findValue
public PrismPropertyValue<T> findValue(PrismPropertyValue<T> value, @NotNull EquivalenceStrategy strategy)
- Specified by:
findValue
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- a value of this item that is equivalent to the given one under given equivalence strategy (or null if no such value exists)
-
valuesEqual
public boolean valuesEqual(Collection<PrismPropertyValue<T>> matchValues, Comparator<PrismPropertyValue<T>> comparator)
- Specified by:
valuesEqual
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- true if the values of this item match the "matchValues" collection, under given comparator. If comparator is null the default equals(..) comparison is used.
-
diff
public ItemDelta<PrismPropertyValue<T>,PrismPropertyDefinition<T>> diff(Item<PrismPropertyValue<T>,PrismPropertyDefinition<T>> other, @NotNull ParameterizedEquivalenceStrategy strategy)
Description copied from interface:Item
Computes a difference (delta) with the specified item using given equivalence strategy. Note this method cannot accept general EquivalenceStrategy here; it needs the parameterized strategy. Compares item values only -- does NOT dive into lower levels.- Specified by:
diff
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
getClonedValues
public Collection<PrismPropertyValue<T>> getClonedValues()
- Specified by:
getClonedValues
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
normalize
public void normalize()
- Specified by:
normalize
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
merge
public void merge(Item<PrismPropertyValue<T>,PrismPropertyDefinition<T>> otherItem) throws SchemaException
Description copied from interface:Item
Merge all the values of other item to this item.- Specified by:
merge
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Throws:
SchemaException
-
acceptParentVisitor
public void acceptParentVisitor(@NotNull Visitor visitor)
Description copied from interface:Item
Accepts a visitor that visits each item/value on the way to the structure root.- Specified by:
acceptParentVisitor
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
acceptParentVisitor
in interfaceParentVisitable
-
recomputeAllValues
public void recomputeAllValues()
Description copied from interface:Item
Re-apply PolyString (and possible other) normalizations to the object.- Specified by:
recomputeAllValues
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
filterValues
public void filterValues(Function<PrismPropertyValue<T>,Boolean> function)
- Specified by:
filterValues
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
applyDefinition
public void applyDefinition(PrismPropertyDefinition<T> definition) throws SchemaException
- Specified by:
applyDefinition
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Throws:
SchemaException
-
applyDefinition
public void applyDefinition(PrismPropertyDefinition<T> definition, boolean force) throws SchemaException
- Specified by:
applyDefinition
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Throws:
SchemaException
-
revive
public void revive(PrismContext prismContext) throws SchemaException
- Specified by:
revive
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
revive
in interfaceRevivable
- Throws:
SchemaException
-
checkConsistence
public void checkConsistence(boolean requireDefinitions, ConsistencyCheckScope scope)
- Specified by:
checkConsistence
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
checkConsistence
public void checkConsistence(boolean requireDefinitions, boolean prohibitRaw)
- Specified by:
checkConsistence
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
checkConsistence
public void checkConsistence(boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
- Specified by:
checkConsistence
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
checkConsistence
public void checkConsistence()
- Specified by:
checkConsistence
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
checkConsistence
public void checkConsistence(ConsistencyCheckScope scope)
- Specified by:
checkConsistence
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
checkConsistenceInternal
public void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
- Specified by:
checkConsistenceInternal
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
assertDefinitions
public void assertDefinitions() throws SchemaException
- Specified by:
assertDefinitions
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Throws:
SchemaException
-
assertDefinitions
public void assertDefinitions(String sourceDescription) throws SchemaException
- Specified by:
assertDefinitions
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Throws:
SchemaException
-
assertDefinitions
public void assertDefinitions(boolean tolerateRawValues, String sourceDescription) throws SchemaException
- Specified by:
assertDefinitions
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Throws:
SchemaException
-
isRaw
public boolean isRaw()
Description copied from interface:Item
Returns true is all the values are raw.- Specified by:
isRaw
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
hasRaw
public boolean hasRaw()
Description copied from interface:Item
Returns true is at least one of the values is raw.- Specified by:
hasRaw
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
hasNoValues
public boolean hasNoValues()
- Specified by:
hasNoValues
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
isOperational
public boolean isOperational()
Description copied from interface:Item
Returns true if this item is metadata item that should be ignored for metadata-insensitive comparisons and hashCode functions.- Specified by:
isOperational
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
isImmutable
public boolean isImmutable()
- Specified by:
isImmutable
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
setImmutable
public void setImmutable(boolean immutable)
- Specified by:
setImmutable
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
checkImmutability
public void checkImmutability()
- Specified by:
checkImmutability
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
modifyUnfrozen
public void modifyUnfrozen(Runnable mutator)
- Specified by:
modifyUnfrozen
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
modifyUnfrozen
public void modifyUnfrozen(Consumer<Item<PrismPropertyValue<T>,PrismPropertyDefinition<T>>> mutator)
- Specified by:
modifyUnfrozen
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
getAllValues
@NotNull public Collection<PrismValue> getAllValues(ItemPath path)
- Specified by:
getAllValues
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
getPrismContext
public PrismContext getPrismContext()
- Specified by:
getPrismContext
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
getPrismContext
in interfaceItemable
-
getPrismContextLocal
public PrismContext getPrismContextLocal()
- Specified by:
getPrismContextLocal
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
setPrismContext
public void setPrismContext(PrismContext prismContext)
- Specified by:
setPrismContext
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
getHighestId
public Long getHighestId()
- Specified by:
getHighestId
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
-