Class DummyItem<V extends PrismValue,D extends ItemDefinition<?>,R extends Item<V,D>>
- java.lang.Object
-
- com.evolveum.midpoint.prism.impl.item.DummyItem<V,D,R>
-
- All Implemented Interfaces:
Freezable
,Item<V,D>
,Itemable
,ParentVisitable
,PathVisitable
,PrismContextSensitive
,Revivable
,Visitable
,DebugDumpable
,Serializable
- Direct Known Subclasses:
DummyContainerImpl
,DummyPropertyImpl
,DummyReferenceImpl
public abstract class DummyItem<V extends PrismValue,D extends ItemDefinition<?>,R extends Item<V,D>> extends Object implements Item<V,D>
- Author:
- semancik
- See Also:
- Serialized Form
-
-
Field Summary
-
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, ItemPath path, boolean recursive)
void
acceptParentVisitor(@NotNull Visitor visitor)
Accepts a visitor that visits each item/value on the way to the structure root.boolean
add(V newValue, @NotNull EquivalenceStrategy equivalenceStrategy)
Adds a value, overwriting existing one(s).boolean
addAll(Collection<V> newValues, @NotNull EquivalenceStrategy strategy)
Adds given values, with the same semantics as repeated add(..) calls.void
addRespectingMetadataAndCloning(V value, @NotNull EquivalenceStrategy strategy, EquivalenceStrategy metadataEquivalenceStrategy)
Adds a value, respecting the metadata.void
applyDefinition(D definition)
void
applyDefinition(D definition, boolean force)
void
assertDefinitions()
void
assertDefinitions(boolean tolerateRaw, Supplier<String> sourceDescriptionSupplier)
void
assertDefinitions(Supplier<String> sourceDescriptionSupplier)
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
clear()
Removes all values from the item.abstract R
clone()
Literal clone.String
debugDump(int indent)
protected R
delegate()
ItemDelta<V,D>
diff(Item<V,D> other, @NotNull ParameterizedEquivalenceStrategy strategy)
Computes a difference (delta) with the specified item using given equivalence strategy.boolean
equals(Object obj)
Compares this item to the specified object under DEFAULT_FOR_EQUALS (DATA) strategy.boolean
equals(Object obj, @NotNull EquivalenceStrategy equivalenceStrategy)
Compares this item to the specified object under given strategy.boolean
equals(Object obj, @NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)
Compares this item to the specified object under given strategy.Object
find(ItemPath path)
Returns object (Item or PrismValue) pointed to by the given path.void
freeze()
@NotNull Collection<PrismValue>
getAllValues(ItemPath path)
D
getDefinition()
Returns applicable definition.String
getDisplayName()
Returns a display name for the item.ItemName
getElementName()
Returns the name of the item.Long
getHighestId()
PrismContainerValue<?>
getParent()
Returns the parent of this item (if exists).@NotNull 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()
@NotNull 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).@NotNull List<V>
getValues()
Returns the values for this item.boolean
hasCompleteDefinition()
Returns true if this item and all contained items have definitions.int
hashCode()
Computes hash code to be used under DEFAULT_FOR_EQUALS (currently DATA) equivalence strategy.int
hashCode(@NotNull EquivalenceStrategy equivalenceStrategy)
Computes hash code to be used under given equivalence strategy.int
hashCode(@NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)
Computes hash code to be used under given equivalence strategy.boolean
isEmpty()
Normally the same asItem.hasNoValues()
.boolean
isImmutable()
boolean
isIncomplete()
Flag that indicates incomplete item.void
merge(Item<V,D> otherItem)
Merge all the values of other item to this item.void
normalize()
Currently doing nothing.void
recomputeAllValues()
Re-apply PolyString (and possible other) normalizations to the object.boolean
remove(V value, @NotNull 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<V> values, @NotNull EquivalenceStrategy strategy)
Removes all given values from the item.void
removeRespectingMetadata(V value, @NotNull EquivalenceStrategy strategy, EquivalenceStrategy metadataEquivalenceStrategy)
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.void
replace(V newValue)
Replaces all values of the item by given value.void
replaceAll(Collection<V> newValues, @NotNull EquivalenceStrategy strategy)
Replaces all values of the item by given values.void
revive(PrismContext prismContext)
TODO: Is revive necessary if prism context is static? TODO document (if it's found to be necessary)void
setDefinition(D definition)
Sets applicable item definition.void
setElementName(QName elementName)
Sets the name of the item.void
setIncomplete(boolean incomplete)
Flags the item as incomplete.void
setParent(PrismContainerValue<?> parentValue)
Sets the parent of this item.void
setPrismContext(PrismContext prismContext)
void
setUserData(String key, Object value)
Sets the user data for the given key (name).String
toString()
-
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
-
Methods inherited from interface com.evolveum.midpoint.prism.Item
add, addAll, addIgnoringEquivalents, cloneComplex, contains, contains, copy, createDelta, createDelta, createImmutableClone, diff, filterValues, filterYields, findPartial, findValue, findValue, getAnyValue, getAnyValue, getClonedValues, getHelp, getRealValue, getRealValue, getRealValues, getRealValuesArray, getRealValuesOrRawTypes, getValue, hasAnyValue, hasNoValues, hasRaw, isOperational, isRaw, isSingleValue, isSingleValueByDefinition, remove, removeIf, size, valuesStream
-
-
-
-
Method Detail
-
delegate
protected final R delegate()
-
clone
public abstract R clone()
Description copied from interface:Item
Literal clone.- Specified by:
clone
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Overrides:
clone
in classObject
-
accept
public final void accept(Visitor visitor)
- Specified by:
accept
in interfaceVisitable<V extends PrismValue>
-
hasCompleteDefinition
public final boolean hasCompleteDefinition()
Description copied from interface:Item
Returns true if this item and all contained items have definitions.- Specified by:
hasCompleteDefinition
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
getElementName
public final 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<V extends PrismValue,D extends ItemDefinition<?>>
- Specified by:
getElementName
in interfaceItemable
- Returns:
- item name TODO consider making element name obligatory
-
setElementName
public final 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<V extends PrismValue,D extends ItemDefinition<?>>
- Parameters:
elementName
- the name to set TODO consider removing this method
-
getDisplayName
public final 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<V extends PrismValue,D extends ItemDefinition<?>>
- Returns:
- display name for the item
-
isIncomplete
public final 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<V extends PrismValue,D extends ItemDefinition<?>>
-
setIncomplete
public final void setIncomplete(boolean incomplete)
Description copied from interface:Item
Flags the item as incomplete.- Specified by:
setIncomplete
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Parameters:
incomplete
- The new value- See Also:
FIXME: Should be package-visible to implementation
-
getParent
public final 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<V extends PrismValue,D extends ItemDefinition<?>>
- Returns:
- The parent if exists
-
find
public final 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<V extends PrismValue,D extends ItemDefinition<?>>
-
setParent
public final void setParent(PrismContainerValue<?> parentValue)
Description copied from interface:Item
Sets the parent of this item.- Specified by:
setParent
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Parameters:
parentValue
- The new parent
-
getPath
@NotNull public final @NotNull 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<V extends PrismValue,D extends ItemDefinition<?>>
- Specified by:
getPath
in interfaceItemable
- Returns:
- the path
-
getUserData
@NotNull public final @NotNull 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<V extends PrismValue,D extends ItemDefinition<?>>
- Returns:
- the user data map
-
getUserData
public final <T> T getUserData(String key)
Description copied from interface:Item
Returns the user data for the given key (name).- Specified by:
getUserData
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
setUserData
public final 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<V extends PrismValue,D extends ItemDefinition<?>>
-
getValues
@NotNull public final @NotNull List<V> 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<V extends PrismValue,D extends ItemDefinition<?>>
-
getDefinition
public final D getDefinition()
Description copied from interface:Item
Returns applicable definition.May return null if no definition is applicable or the definition is not known.
- Specified by:
getDefinition
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Specified by:
getDefinition
in interfaceItemable
- Returns:
- applicable definition
-
setDefinition
public final void setDefinition(D definition)
Description copied from interface:Item
Sets applicable item definition.- Specified by:
setDefinition
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Parameters:
definition
- the definition to set TODO consider removing this method
-
applyDefinition
public final void applyDefinition(D definition) throws SchemaException
- Specified by:
applyDefinition
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Throws:
SchemaException
-
isEmpty
public final boolean isEmpty()
Description copied from interface:Item
Normally the same asItem.hasNoValues()
. But a container is considered empty also if all its values (PCVs) are empty. This is a bit strange and should be revisited.- Specified by:
isEmpty
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
checkConsistenceInternal
public final void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
- Specified by:
checkConsistenceInternal
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
assertDefinitions
public final void assertDefinitions(boolean tolerateRaw, Supplier<String> sourceDescriptionSupplier) throws SchemaException
- Specified by:
assertDefinitions
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Throws:
SchemaException
-
add
public final boolean add(@NotNull V newValue, @NotNull @NotNull EquivalenceStrategy equivalenceStrategy) throws SchemaException
Description copied from interface:Item
Adds a value, overwriting existing one(s). Uses specified equivalence strategy.- Specified by:
add
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Returns:
- true if this item changed as a result of the call. This is either during real value addition or during overwriting existing value with a different one. The "difference" is taken using the DEFAULT_FOR_EQUALS (DATA) equivalence strategy.
- Throws:
SchemaException
-
accept
public final void accept(Visitor visitor, ItemPath path, boolean recursive)
- Specified by:
accept
in interfacePathVisitable
-
addAll
public final boolean addAll(Collection<V> newValues, @NotNull @NotNull EquivalenceStrategy strategy) throws SchemaException
Description copied from interface:Item
Adds given values, with the same semantics as repeated add(..) calls. For equality testing uses given strategy.- Specified by:
addAll
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really added)
- Throws:
SchemaException
-
debugDump
public final String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
addRespectingMetadataAndCloning
public void addRespectingMetadataAndCloning(V value, @NotNull @NotNull EquivalenceStrategy strategy, EquivalenceStrategy metadataEquivalenceStrategy) throws SchemaException
Description copied from interface:Item
Adds a value, respecting the metadata. I.e. if equivalent value exists, the metadata are merged. (Replacing metadata of colliding provenance, adding all the others.) If a value is to be added as a whole, it is cloned.- Specified by:
addRespectingMetadataAndCloning
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Throws:
SchemaException
-
removeRespectingMetadata
public void removeRespectingMetadata(V value, @NotNull @NotNull EquivalenceStrategy strategy, EquivalenceStrategy metadataEquivalenceStrategy)
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. Respects metadata, i.e. if value to be removed has metadata specified, this method removes only particular metadata. Only if this means that all metadata are gone, then the value is deleted.- Specified by:
removeRespectingMetadata
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
remove
public final boolean remove(V value, @NotNull @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<V extends PrismValue,D extends ItemDefinition<?>>
- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really removed)
-
removeAll
public final boolean removeAll(Collection<V> values, @NotNull @NotNull EquivalenceStrategy strategy)
Description copied from interface:Item
Removes all given values from the item. It is basically a shortcut for repeatedItem.remove(PrismValue, EquivalenceStrategy)
call.- Specified by:
removeAll
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really removed)
-
clear
public final void clear()
Description copied from interface:Item
Removes all values from the item.- Specified by:
clear
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
replaceAll
public final void replaceAll(Collection<V> newValues, @NotNull @NotNull EquivalenceStrategy strategy) throws SchemaException
Description copied from interface:Item
Replaces all values of the item by given values.- Specified by:
replaceAll
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Throws:
SchemaException
-
replace
public final void replace(V newValue) throws SchemaException
Description copied from interface:Item
Replaces all values of the item by given value.- Specified by:
replace
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Throws:
SchemaException
-
equals
public final boolean equals(Object obj)
Description copied from interface:Item
Compares this item to the specified object under DEFAULT_FOR_EQUALS (DATA) strategy.- Specified by:
equals
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Overrides:
equals
in classObject
-
equals
public final boolean equals(Object obj, @NotNull @NotNull EquivalenceStrategy equivalenceStrategy)
Description copied from interface:Item
Compares this item to the specified object under given strategy.- Specified by:
equals
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
equals
public final boolean equals(Object obj, @NotNull @NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)
Description copied from interface:Item
Compares this item to the specified object under given strategy.- Specified by:
equals
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
hashCode
public final int hashCode()
Description copied from interface:Item
Computes hash code to be used under DEFAULT_FOR_EQUALS (currently DATA) equivalence strategy.- Specified by:
hashCode
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Overrides:
hashCode
in classObject
-
hashCode
public final int hashCode(@NotNull @NotNull EquivalenceStrategy equivalenceStrategy)
Description copied from interface:Item
Computes hash code to be used under given equivalence strategy.- Specified by:
hashCode
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
hashCode
public final int hashCode(@NotNull @NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)
Description copied from interface:Item
Computes hash code to be used under given equivalence strategy.- Specified by:
hashCode
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
diff
public final ItemDelta<V,D> diff(Item<V,D> other, @NotNull @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<V extends PrismValue,D extends ItemDefinition<?>>
-
normalize
public final void normalize()
Description copied from interface:Item
Currently doing nothing.- Specified by:
normalize
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
merge
public final void merge(Item<V,D> otherItem) throws SchemaException
Description copied from interface:Item
Merge all the values of other item to this item.- Specified by:
merge
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Throws:
SchemaException
-
acceptParentVisitor
public final void acceptParentVisitor(@NotNull @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<V extends PrismValue,D extends ItemDefinition<?>>
- Specified by:
acceptParentVisitor
in interfaceParentVisitable
-
recomputeAllValues
public final void recomputeAllValues()
Description copied from interface:Item
Re-apply PolyString (and possible other) normalizations to the object.- Specified by:
recomputeAllValues
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
applyDefinition
public final void applyDefinition(D definition, boolean force) throws SchemaException
- Specified by:
applyDefinition
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Throws:
SchemaException
-
revive
public final void revive(PrismContext prismContext)
Description copied from interface:Revivable
TODO: Is revive necessary if prism context is static? TODO document (if it's found to be necessary)
-
checkConsistence
public final void checkConsistence(boolean requireDefinitions, ConsistencyCheckScope scope)
- Specified by:
checkConsistence
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
checkConsistence
public final void checkConsistence(boolean requireDefinitions, boolean prohibitRaw)
- Specified by:
checkConsistence
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
checkConsistence
public final void checkConsistence(boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
- Specified by:
checkConsistence
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
checkConsistence
public final void checkConsistence()
- Specified by:
checkConsistence
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
checkConsistence
public final void checkConsistence(ConsistencyCheckScope scope)
- Specified by:
checkConsistence
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
assertDefinitions
public final void assertDefinitions() throws SchemaException
- Specified by:
assertDefinitions
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Throws:
SchemaException
-
assertDefinitions
public final void assertDefinitions(Supplier<String> sourceDescriptionSupplier) throws SchemaException
- Specified by:
assertDefinitions
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
- Throws:
SchemaException
-
isImmutable
public final boolean isImmutable()
- Specified by:
isImmutable
in interfaceFreezable
-
getAllValues
@NotNull public final @NotNull Collection<PrismValue> getAllValues(ItemPath path)
- Specified by:
getAllValues
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
getPrismContext
public final PrismContext getPrismContext()
- Specified by:
getPrismContext
in interfacePrismContextSensitive
-
getPrismContextLocal
public final PrismContext getPrismContextLocal()
- Specified by:
getPrismContextLocal
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
setPrismContext
public final void setPrismContext(PrismContext prismContext)
- Specified by:
setPrismContext
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
getHighestId
public final Long getHighestId()
- Specified by:
getHighestId
in interfaceItem<V extends PrismValue,D extends ItemDefinition<?>>
-
-