Interface Item<V extends PrismValue,D extends ItemDefinition<?>> 
- All Superinterfaces:
- Cloneable,- DebugDumpable,- Freezable,- Itemable,- ParentVisitable,- PathVisitable,- PrismVisitable,- Revivable,- Serializable,- Visitable
- All Known Subinterfaces:
- PrismContainer<C>,- PrismObject<O>,- PrismProperty<T>,- PrismReference,- ShadowAssociationsContainer,- ShadowAttributesContainer,- ShadowSimpleAttribute<T>,- ValueMetadata
- All Known Implementing Classes:
- DummyContainerImpl,- DummyItem,- DummyPropertyImpl,- DummyReferenceImpl,- ItemImpl,- PrismContainerImpl,- PrismObjectImpl,- PrismPropertyImpl,- PrismReferenceImpl,- ShadowAssociation,- ShadowAssociationsContainerImpl,- ShadowAttributesContainerImpl,- ShadowReferenceAttribute,- ShadowSimpleAttributeImpl,- ValueMetadataAdapter
This is supposed to be a superclass for all items. Items are things that can appear in containers, which generally means only a property, reference and container itself. Therefore this is in fact superclass for those three definitions.
- Author:
- Radovan Semancik
- 
Field SummaryFieldsFields inherited from interface com.evolveum.midpoint.util.DebugDumpableINDENT_STRING
- 
Method SummaryModifier and TypeMethodDescriptionvoidacceptParentVisitor(@NotNull Visitor visitor) Accepts a visitor that visits each item/value on the way to the structure root.default booleanacceptVisitor(PrismVisitor visitor) Accept visitor and visits prism item or value and it's children Note: name is not accept, but accept visitor to prevent naming conflict in lambdas dynamic languages such as groovy withVisitable.accept(com.evolveum.midpoint.prism.Visitor)default booleanAdds a given value, overwriting existing one.booleanadd(V newValue, @NotNull EquivalenceStrategy strategy) Adds a value, overwriting existing one(s).default booleanaddAll(Collection<V> newValues) Adds given values, with the same semantics as repeated add(..) calls.booleanaddAll(Collection<V> newValues, @NotNull EquivalenceStrategy strategy) Adds given values, with the same semantics as repeated add(..) calls.addIgnoringEquivalents(V newValue) Adds a value, not looking for equivalent values.addRespectingMetadataAndCloning(V value, @NotNull EquivalenceStrategy strategy, EquivalenceStrategy metadataEquivalenceStrategy) Adds a value, respecting the metadata.default voidapplyDefinition(D definition) voidapplyDefinition(D definition, boolean force) Applies the definition to this item (and all its values, down to the lowest level).default voidapplyDefinitionIfMissing(D definition) voidvoidassertDefinitions(boolean tolerateRawValues, Supplier<String> sourceDescriptionSupplier) voidassertDefinitions(Supplier<String> sourceDescriptionSupplier) voidvoidcheckConsistence(boolean requireDefinitions, boolean prohibitRaw) voidcheckConsistence(boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope) voidcheckConsistence(boolean requireDefinitions, ConsistencyCheckScope scope) voidvoidcheckConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope) voidclear()Removes all values from the item.clone()Literal clone.static <T extends Item<?,?>> 
 Collection<T>cloneCollection(Collection<T> items) cloneComplex(CloneStrategy strategy) Complex clone with different cloning strategies.default booleandefault booleancontains(V value, @NotNull EquivalenceStrategy strategy) copy()Creates specific subclass of ItemDelta appropriate for type of item that this definition represents (e.g.createDelta(ItemPath path) Computes a difference (delta) with the specified item using DEFAULT_FOR_DELTA_APPLICATION (REAL_VALUE_CONSIDER_DIFFERENT_IDS) equivalence strategy.diff(Item<V, D> other, @NotNull ParameterizedEquivalenceStrategy strategy) Computes a difference (delta) with the specified item using given equivalence strategy.booleanCompares this item to the specified object under DEFAULT_FOR_EQUALS (DATA) strategy.booleanequals(Object obj, @NotNull EquivalenceStrategy equivalenceStrategy) Compares this item to the specified object under given strategy.booleanequals(Object obj, @NotNull ParameterizedEquivalenceStrategy equivalenceStrategy) Compares this item to the specified object under given strategy.default voidfilterValues(Function<V, Boolean> function) default voidfilterYields(BiFunction<V, PrismContainerValue, Boolean> function) Returns object (Item or PrismValue) pointed to by the given path.<IV extends PrismValue,ID extends ItemDefinition<?>> 
 PartiallyResolvedItem<IV,ID> findPartial(ItemPath path) default VfindValue(V value, @NotNull EquivalenceStrategy strategy) default VfindValue(V value, @NotNull Comparator<V> comparator) @NotNull Collection<Item<?,?>> getAllItems(@NotNull ItemPath path) Returns all items corresponding to the provided path.static @NotNull Collection<PrismValue>getAllValues(Item<?, ?> item, ItemPath path) @NotNull Collection<PrismValue>getAllValues(ItemPath path) Returns all values corresponding to the provided path.default VReturns any of the values.default VgetAnyValue(@NotNull ValueSelector<V> selector) Returns a value matching given selector (or null if none exists).default Collection<V>Returns applicable definition.default StringReturns a display name for the item.Returns the name of the item.default StringgetHelp()Returns help message defined for the item.default @Nullable PrismNamespaceContextReturns the namespace context for this item if available.@Nullable PrismContainerValue<?>Returns the parent of this item (if exists).@NotNull ItemPathgetPath()Returns the path of this item (sequence of names from the "root" container or similar object to this item).@Nullable ObjectReturns 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> XgetRealValue(Class<X> type) Type override, also for compatibility.@NotNull Collection<?>Returns (potentially empty) collection of "real values".default <X> @NotNull Collection<X>getRealValues(Class<X> type) Returns detached collection of real values, although the values are still _connected_ to the original item (in case of complex properties, references, and containers).<X> X[]getRealValuesArray(Class<X> type) Type override, also for compatibility.default @NotNull Collection<Object>Returns the "user data", a map that allows attaching arbitrary named data to this item.<T> TgetUserData(String key) Returns the user data for the given key (name).getValue()Returns the value, if there is only one.Returns the values for this item.static <V extends PrismValue>
 @NotNull Collection<V>default booleandefault booleanReturns true if this item and all contained items have definitions.inthashCode()Computes hash code to be used under DEFAULT_FOR_EQUALS (currently DATA) equivalence strategy.inthashCode(@NotNull EquivalenceStrategy equivalenceStrategy) Computes hash code to be used under given equivalence strategy.inthashCode(@NotNull ParameterizedEquivalenceStrategy equivalenceStrategy) Computes hash code to be used under given equivalence strategy.default booleanstatic booleanhasNoValues(Item<?, ?> item) default booleanhasRaw()Returns true is at least one of the values is raw.default booleanisEmpty()Normally the same ashasNoValues().booleanFlag that indicates incomplete item.default booleanReturns true if this item is metadata item that should be ignored for metadata-insensitive comparisons and hashCode functions.default booleanisRaw()Returns true is all the values are raw.default booleanReturns true if the item contains 0 or 1 values and (by definition) is not multivalued.default booleanvoidMerge all the values of other item to this item.voidCurrently doing nothing.voidRe-apply PolyString (and possible other) normalizations to the object.default booleanRemoves values equivalent to given value from the item.booleanremove(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.booleanremoveAll(Collection<V> values, @NotNull EquivalenceStrategy strategy) Removes all given values from the item.default voidremoveRespectingMetadata(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.voidReplaces all values of the item by given value.voidreplaceAll(Collection<V> newValues, @NotNull EquivalenceStrategy strategy) Replaces all values of the item by given values.static <T extends Item<?,?>> 
 Collection<T>resetParentCollection(Collection<T> items) Sets all parents to null.voidsetDefinition(D definition) Sets applicable item definition.voidsetElementName(QName elementName) Sets the name of the item.voidsetIncomplete(boolean incomplete) Flags the item as incomplete.voidsetParent(@Nullable PrismContainerValue<?> parentValue) Sets the parent of this item.voidsetUserData(String key, Object value) Sets the user data for the given key (name).default intsize()Returns the number of values for this item.Methods inherited from interface com.evolveum.midpoint.util.DebugDumpabledebugDump, debugDump, debugDumpLazily, debugDumpLazilyMethods inherited from interface com.evolveum.midpoint.prism.FreezablecheckImmutable, checkMutable, freeze, isImmutableMethods inherited from interface com.evolveum.midpoint.prism.PathVisitableaccept
- 
Field Details- 
KEY_NAMESPACE_CONTEXT
 
- 
- 
Method Details- 
getDefinitionD getDefinition()Returns applicable definition.May return null if no definition is applicable or the definition is not known. - Specified by:
- getDefinitionin interface- Itemable
- Returns:
- applicable definition
 
- 
hasCompleteDefinitiondefault boolean hasCompleteDefinition()Returns true if this item and all contained items have definitions.
- 
getElementNameItemName getElementName()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:
- getElementNamein interface- Itemable
- Returns:
- item name TODO consider making element name obligatory
 
- 
setElementNameSets 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. - Parameters:
- elementName- the name to set TODO consider removing this method
 
- 
setDefinitionSets applicable item definition.- Parameters:
- definition- the definition to set
 
- 
getDisplayNameReturns 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. - Returns:
- display name for the item
 
- 
getHelpReturns 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. - Returns:
- help message for the item
 
- 
isIncompleteboolean isIncomplete()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. *Behavior*: For single-valued items, the `incomplete` flag is cleared when a known value is set up (via delta or Java API). See also https://docs.evolveum.com/midpoint/devel/design/incomplete-items-4.9.1/.
- 
setIncompletevoid setIncomplete(boolean incomplete) Flags the item as incomplete. FIXME: Should be package-visible to implementation- Parameters:
- incomplete- The new value
- See Also:
 
- 
getParentReturns the parent of this item (if exists). Currently this has to be a PrismContainerValue.- Returns:
- The parent if exists
 
- 
setParentSets the parent of this item.- Parameters:
- parentValue- The new parent
 
- 
getPathReturns 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
- 
getNamespaceContextReturns the namespace context for this item if available. Namespace context is currently stored in user data with key Namespace context is stored only ifPrismParser.preserveNamespaceContext()is flag was used during parsing- Returns:
- The namespace context for this item if available.
- See Also:
 
- 
getUserDataReturns the "user data", a map that allows attaching arbitrary named data to this item.- Returns:
- the user data map
 
- 
getUserDataReturns the user data for the given key (name).
- 
setUserDataSets the user data for the given key (name).
- 
getValuesReturns 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 FIXME we should return immutable list, to avoid manipulating the values directly FIXME and maybe we should return List<? extends V> to avoid specializing the values, see ShadowAssociationValue in midPoint
- 
valuesStream
- 
sizedefault int size()Returns the number of values for this item.
- 
getAnyValueReturns 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.
- 
getValueV getValue()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
- 
getAnyValueReturns a value matching given selector (or null if none exists).
- 
getRealValueReturns 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.)
- 
getRealValueType override, also for compatibility.
- 
getRealValuesArrayType override, also for compatibility.
- 
getRealValuesReturns (potentially empty) collection of "real values". The list itself is detached, freely modifiable. (Note that the values can still embed a parent, e.g., for containers and references.)- See Also:
 
- 
getRealValuesReturns detached collection of real values, although the values are still _connected_ to the original item (in case of complex properties, references, and containers). BEWARE, it's not always possible to get the real values.
- 
getRealValuesOrRawTypes@OneUseOnly("Delta serialization") @Experimental @NotNull default @NotNull Collection<Object> getRealValuesOrRawTypes()
- 
isSingleValuedefault boolean isSingleValue()Returns true if the item contains 0 or 1 values and (by definition) is not multivalued.
- 
isSingleValueByDefinitiondefault boolean isSingleValueByDefinition()
- 
addAdds a given value, overwriting existing one. It compares values using DEFAULT_FOR_EQUALS (DATA) strategy, so it e.g. takes value metadata differences into account. It is because this method is used during parsing, internal computations (typically using generated beans), and similar situations where we expect little sophistication when it comes to value comparison. The less surprises the better.- Throws:
- SchemaException
 
- 
add@OneUseOnly("convenience") boolean add(@NotNull V newValue, @NotNull @NotNull EquivalenceStrategy strategy) throws SchemaException Adds a value, overwriting existing one(s). Uses specified equivalence strategy.- 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
 
- 
addIgnoringEquivalentsAdds a value, not looking for equivalent values. (This means that the new value is always added, if possible.) Note that 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
 
- 
addAllAdds given values, with the same semantics as repeated add(..) calls.- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really added)
- Throws:
- SchemaException
 
- 
addAllboolean addAll(Collection<V> newValues, @NotNull @NotNull EquivalenceStrategy strategy) throws SchemaException Adds given values, with the same semantics as repeated add(..) calls. For equality testing uses given strategy.- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really added)
- Throws:
- SchemaException
 
- 
removeRemoves values equivalent to given value from the item. Note we use REAL_VALUE_CONSIDER_DIFFERENT_IDS strategy that ignores value metadata and operational data. This may or may not be good! TODO reconsider
- 
removeRemoves values equivalent to given value from the item; under specified equivalence strategy OR when values represent the same value via "representsSameValue(.., lax=false)" method.- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really removed)
 
- 
removeIf
- 
addRespectingMetadataAndCloningItemModifyResult<V> addRespectingMetadataAndCloning(V value, @NotNull @NotNull EquivalenceStrategy strategy, EquivalenceStrategy metadataEquivalenceStrategy) throws SchemaException 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.- Throws:
- SchemaException
 
- 
removeRespectingMetadataItemModifyResult<V> removeRespectingMetadata(V value, @NotNull @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. 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.- Returns:
- null if value was removed, otherwise value which was modified.
 
- 
removeAllRemoves all given values from the item. It is basically a shortcut for repeatedremove(PrismValue, EquivalenceStrategy)call.- Returns:
- true if this item changed as a result of the call (i.e. if at least one value was really removed)
 
- 
clearvoid clear()Removes all values from the item.
- 
replaceAllvoid replaceAll(Collection<V> newValues, @NotNull @NotNull EquivalenceStrategy strategy) throws SchemaException Replaces all values of the item by given values.- Throws:
- SchemaException
 
- 
replaceReplaces all values of the item by given value.- Throws:
- SchemaException
 
- 
equalsCompares this item to the specified object under DEFAULT_FOR_EQUALS (DATA) strategy.
- 
equalsCompares this item to the specified object under given strategy.
- 
equalsCompares this item to the specified object under given strategy.
- 
hashCodeint hashCode()Computes hash code to be used under DEFAULT_FOR_EQUALS (currently DATA) equivalence strategy.
- 
hashCodeComputes hash code to be used under given equivalence strategy.
- 
hashCodeComputes hash code to be used under given equivalence strategy.
- 
contains- Returns:
- true if the item contains a given value (by default using DEFAULT_FOR_EQUALS i.e. DATA strategy) Note that the "sameness" (ID-only value matching) is NOT considered here.
 
- 
contains- 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.
 
- 
findValue- Returns:
- a value of this item that is equivalent to the given one under given equivalence strategy (or null if no such value exists)
 
- 
findValue- Returns:
- a value of this item that is equivalent to the given one under given comparator (or null if no such value exists)
 
- 
diffComputes a difference (delta) with the specified item using DEFAULT_FOR_DELTA_APPLICATION (REAL_VALUE_CONSIDER_DIFFERENT_IDS) equivalence strategy. Compares item values only -- does NOT dive into lower levels.
- 
diffComputes 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.
- 
getClonedValues
- 
normalizevoid normalize()Currently doing nothing.
- 
mergeMerge all the values of other item to this item.- Throws:
- SchemaException
 
- 
findReturns object (Item or PrismValue) pointed to by the given path.
- 
findPartial<IV extends PrismValue,ID extends ItemDefinition<?>> PartiallyResolvedItem<IV,ID> findPartial(ItemPath path) 
- 
createDeltaCreates specific subclass of ItemDelta appropriate for type of item that this definition represents (e.g. PropertyDelta, ContainerDelta, ...)
- 
createDelta
- 
acceptParentVisitorAccepts a visitor that visits each item/value on the way to the structure root.- Specified by:
- acceptParentVisitorin interface- ParentVisitable
 
- 
recomputeAllValuesvoid recomputeAllValues()Re-apply PolyString (and possible other) normalizations to the object.
- 
filterValues
- 
filterYields
- 
applyDefinition- Throws:
- SchemaException
 
- 
applyDefinitionIfMissing- Throws:
- SchemaException
 
- 
applyDefinitionApplies the definition to this item (and all its values, down to the lowest level). It may even convert the values, e.g. from their raw (unparsed) form to the parsed one, or - for resource attributes - betweenStringandPolyStringvalues (due to the normalization).- Throws:
- SchemaException
 
- 
copy
- 
cloneLiteral clone.
- 
createImmutableClone
- 
cloneComplexComplex clone with different cloning strategies.- See Also:
 
- 
cloneCollection
- 
resetParentCollectionSets all parents to null. This is good if the items are to be "transplanted" into a different Containerable.
- 
checkConsistence
- 
checkConsistencevoid checkConsistence(boolean requireDefinitions, boolean prohibitRaw) 
- 
checkConsistence
- 
checkConsistencevoid checkConsistence()
- 
checkConsistence
- 
checkConsistenceInternalvoid checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope) 
- 
assertDefinitions- Throws:
- SchemaException
 
- 
assertDefinitions- Throws:
- SchemaException
 
- 
assertDefinitionsvoid assertDefinitions(boolean tolerateRawValues, Supplier<String> sourceDescriptionSupplier) throws SchemaException - Throws:
- SchemaException
 
- 
isRawdefault boolean isRaw()Returns true is all the values are raw.
- 
hasRawdefault boolean hasRaw()Returns true is at least one of the values is raw.
- 
isEmptydefault boolean isEmpty()Normally the same ashasNoValues(). But a container is considered empty also if all its values (PCVs) are empty. This is a bit strange and should be revisited.
- 
hasNoValuesdefault boolean hasNoValues()
- 
hasAnyValuedefault boolean hasAnyValue()
- 
hasNoValues
- 
isOperationaldefault boolean isOperational()Returns true if this item is metadata item that should be ignored for metadata-insensitive comparisons and hashCode functions.
- 
getValues
- 
getAllValuesReturns all values corresponding to the provided path. The path may contain ambiguous segments (e.g. `assignment/targetRef` when there are more assignments). Limitations: . The path can contain only name segments and the "identifier" (`#`) segment - at least for now. No ID segments. . There are no guarantees about duplicate values. They may or may not be present in the returned collections. . The caller should not modify the returned collection in any way. Note to implementors: Please take care about the performance of this method.
- 
getAllValues
- 
getAllItemsReturns all items corresponding to the provided path. This is an analogue togetAllValues(ItemPath). The only difference here is that `#` segment is not allowed, as it does not correspond to an item. (Shouldn't these methods be rather called findAllValues/findAllItems?)
- 
getHighestIdLong getHighestId()
- 
acceptVisitorDescription copied from interface:PrismVisitableAccept visitor and visits prism item or value and it's children Note: name is not accept, but accept visitor to prevent naming conflict in lambdas dynamic languages such as groovy withVisitable.accept(com.evolveum.midpoint.prism.Visitor)- Specified by:
- acceptVisitorin interface- PrismVisitable
- Returns:
- return value of PrismVisitor.visit(PrismVisitable)invocation for this visitable.
 
 
-