Package com.evolveum.midpoint.prism
Interface PrismContainerValue<C extends Containerable>
- All Superinterfaces:
DebugDumpable,Freezable,MidpointOriginMetadata,ParentVisitable,PathVisitable,PrismValue,PrismVisitable,Revivable,SchemaLookup.Aware,Serializable,Visitable,Walkable
- All Known Subinterfaces:
PrismContainerValueDelegator<C>,PrismObjectValue<O>
- All Known Implementing Classes:
com.evolveum.midpoint.prism.impl.PrismContainerValueImpl,ShadowAssociationValue
public interface PrismContainerValue<C extends Containerable>
extends PrismValue, ParentVisitable, Walkable
- Author:
- semancik
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classUsed when accessing an item whose definition was removed. -
Field Summary
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidacceptParentVisitor(Visitor visitor) 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)<IV extends PrismValue,ID extends ItemDefinition<?>>
void<IV extends PrismValue,ID extends ItemDefinition<?>>
voidAdds an item to a property container.voidaddAll(Collection<? extends Item<?, ?>> itemsToAdd) Adds a collection of items to a property container.voidaddAllReplaceExisting(Collection<? extends Item<?, ?>> itemsToAdd) Adds a collection of items to a property container.booleanaddRawElement(Object element) <IV extends PrismValue,ID extends ItemDefinition<?>>
voidaddReplaceExisting(Item<IV, ID> item) Adds an item to a property container.applyDefinition(@NotNull ItemDefinition<?> itemDefinition) Definition application MAY change the value (currently only for container values).applyDefinition(@NotNull ItemDefinition<?> itemDefinition, boolean force) Definition application MAY change the value (currently only for container values).applyDefinition(@NotNull PrismContainerDefinition<C> containerDef, boolean force) static <T extends Containerable>
TasContainerable(PrismContainerValue<T> value) asContainerable(Class<C> requiredClass) static <C extends Containerable>
Collection<C>asContainerables(Collection<PrismContainerValue<C>> pcvs) static <C extends Containerable>
List<C>asContainerables(List<PrismContainerValue<C>> pcvs) static <C extends Containerable>
List<PrismContainerValue<C>>asPrismContainerValues(List<C> containerables) voidassertDefinitions(boolean tolerateRaw, Supplier<String> sourceDescriptionSupplier) voidassertDefinitions(Supplier<String> sourceDescriptionSupplier) asSingleValuedContainer(@NotNull QName itemName) Returns a single-valued container (with a single-valued definition) holding just this value.booleancanRepresent(Class<?> clazz) default voidcheckNothingExceptFor(QName... allowedItemNames) For simplicity, everything must be qualified: names to check, and existing names.voidclear()clone()Literal clone.cloneComplex(@NotNull CloneStrategy strategy) Complex clone with different cloning strategies.booleanbooleanbooleancontainsItem(ItemPath propPath, boolean acceptEmptyItem) static <C extends Containerable>
booleancontainsRealValue(Collection<PrismContainerValue<C>> cvalCollection, PrismContainerValue<C> cval) <IV extends PrismValue,ID extends ItemDefinition<?>, I extends Item<IV, ID>>
IcreateDetachedSubItem(QName name, Class<I> type, ID itemDefinition, boolean immutable) <X> PrismProperty<X>createProperty(PrismPropertyDefinition<X> propertyDefinition) <X> PrismProperty<X>createProperty(QName propertyName) booleandeleteRawElement(Object element) booleanequivalent(PrismContainerValue<?> other) <X extends Containerable>
PrismContainer<X>findContainer(QName containerName) <IV extends PrismValue,ID extends ItemDefinition<?>, I extends Item<IV, ID>>
IfindItem(ItemDefinition itemDefinition, Class<I> type) default <IV extends PrismValue,ID extends ItemDefinition<?>>
Item<IV,ID> <IV extends PrismValue,ID extends ItemDefinition<?>, I extends Item<IV, ID>>
I<T extends Containerable>
PrismContainer<T>findOrCreateContainer(QName containerName) <IV extends PrismValue,ID extends ItemDefinition<?>, I extends Item<IV, ID>>
IfindOrCreateItem(ItemPath path, Class<I> type, ID definition) <IV extends PrismValue,ID extends ItemDefinition<?>>
Item<IV,ID> findOrCreateItem(QName containerName) <IV extends PrismValue,ID extends ItemDefinition<?>, I extends Item<IV, ID>>
IfindOrCreateItem(QName containerName, Class<I> type) <X> PrismProperty<X>findOrCreateProperty(ItemPath propertyPath) <X> PrismProperty<X>findOrCreateProperty(PrismPropertyDefinition propertyDef) findOrCreateReference(QName referenceName) <IV extends PrismValue,ID extends ItemDefinition<?>>
PartiallyResolvedItem<IV,ID> findPartial(ItemPath path) <X> PrismProperty<X>findProperty(ItemPath propertyPath) <X> PrismProperty<X>findProperty(PrismPropertyDefinition<X> propertyDefinition) Finds a specific property in the container by definition.findReference(QName elementName) @Nullable ComplexTypeDefinitiongetId()static LonggetId(PrismValue value) @NotNull Collection<QName>default <T> TgetItemRealValue(ItemName itemName, Class<T> type) @NotNull Collection<Item<?,?>> getItems()Returns a collection of items that the property container contains.@NotNull Set<PrismProperty<?>>Returns a set of properties that the property container contains.<T> TgetPropertyRealValue(QName propertyName, Class<T> type) @NotNull PrismContainerValue<?>getValue()booleanReturns true if all contained items have complete definitions.booleanLike isEmpty but ignores presence of container value ID.static booleanidsMatch(PrismValue v1, PrismValue v2) booleanisIdOnly()static booleanisIdOnly(PrismValue value) void<IV extends PrismValue,ID extends ItemDefinition<?>>
booleanMerges the provided item into this item.voidmergeContent(@NotNull PrismContainerValue<?> other, @NotNull List<QName> overwrite) voidrecompute(PrismContext prismContext) <IV extends PrismValue,ID extends ItemDefinition<?>>
voidvoidvoidremoveContainer(ItemPath path) voidremoveItem(@NotNull ItemPath path) Useful when removing something without the knowledge of its kind.voidremoveItems(List<? extends ItemPath> itemsToRemove) BEWARE!!voidremoveMetadataFromPaths(List<? extends ItemPath> pathsToRemoveMetadata) Remove metadata from specified paths Can also remove metadata from the object on which it's called, if the paths contains a "root" path (e.g.voidvoidremovePaths(List<? extends ItemPath> remove) voidremoveProperty(ItemPath path) booleanremoveRawElement(Object element) voidremoveReference(ItemPath path) <IV extends PrismValue,ID extends ItemDefinition<?>>
voiddefault SchemaLookupvoidvoidsetOriginTypeRecursive(OriginType originType) Set origin type to all values and subvalues<T> voidsetPropertyRealValue(QName propertyName, T realValue) intsize()<IV extends PrismValue,ID extends ItemDefinition<?>>
booleanSubtract the provided item from this item.static <T extends Containerable>
List<PrismContainerValue<T>>Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDump, debugDumpLazily, debugDumpLazilyMethods inherited from interface com.evolveum.midpoint.prism.Freezable
checkImmutable, checkMutable, freeze, isImmutableMethods inherited from interface com.evolveum.midpoint.prism.metadata.MidpointOriginMetadata
getOriginObject, getOriginType, setOriginObject, setOriginTypeMethods inherited from interface com.evolveum.midpoint.prism.PrismValue
applyDefinitionLegacy, applyDefinitionLegacy, checkConsistenceInternal, clearParent, cloneIfImmutable, deleteValueMetadata, diff, equals, equals, find, getAllItems, getAllValues, getNearestValueOfType, getParentContainerValue, getPath, getRealClass, getRealValue, getRealValueIfExists, getRealValueOrRawType, getRootObjectable, getSchemaContext, getTypeName, getUserData, getUserData, getValueMetadata, getValueMetadataAsContainer, getValueMetadataIfExists, hashCode, hashCode, hasRealClass, hasValueMetadata, isEmpty, isObjectable, isOfType, isRaw, isTransient, normalize, recompute, representsSameValue, setParent, setTransient, setUserData, setValueMetadata, setValueMetadata, setValueMetadata, toHumanReadableString
-
Method Details
-
asContainerable
-
getItems
Returns a collection of items that the property container contains. The items may be properties or inner property containers.Returned collection is mutable, but the caller should NOT modify it. Instead - e.g. if it needs to remove values - it should call remove() method.
- Returns:
- collection of items that the property container contains.
-
size
int size() -
getProperties
Returns a set of properties that the property container contains.Returned set is immutable! Any change to it will be ignored.
This method costs a bit, as the set of properties needs to be created. Consider using other methods if possible.
- Returns:
- set of properties that the property container contains.
-
getId
Long getId() -
setId
-
getParent
PrismContainerable<C> getParent()- Specified by:
getParentin interfacePrismValue
-
getContainer
PrismContainer<C> getContainer() -
getValue
C getValue() -
asContainerable
-
getCompileTimeClass
-
canRepresent
-
asContainerable
-
getItemNames
-
add
<IV extends PrismValue,ID extends ItemDefinition<?>> void add(Item<IV, ID> item) throws SchemaException- Throws:
SchemaException
-
add
<IV extends PrismValue,ID extends ItemDefinition<?>> void add(Item<IV, ID> item, boolean checkUniqueness) throws SchemaExceptionAdds an item to a property container.- Parameters:
item- item to add.- Throws:
IllegalArgumentException- an attempt to add value that already existsSchemaException
-
merge
<IV extends PrismValue,ID extends ItemDefinition<?>> boolean merge(Item<IV, ID> item) throws SchemaExceptionMerges the provided item into this item. The values are joined together. Returns true if new item or value was added.- Throws:
SchemaException
-
subtract
<IV extends PrismValue,ID extends ItemDefinition<?>> boolean subtract(Item<IV, ID> item) throws SchemaExceptionSubtract the provided item from this item. The values of the provided item are deleted from this item. Returns true if this item was changed.- Throws:
SchemaException
-
addReplaceExisting
<IV extends PrismValue,ID extends ItemDefinition<?>> void addReplaceExisting(Item<IV, ID> item) throws SchemaExceptionAdds an item to a property container. Existing value will be replaced.- Parameters:
item- item to add.- Throws:
SchemaException
-
remove
-
removeAll
void removeAll() -
addAll
Adds a collection of items to a property container.- Parameters:
itemsToAdd- items to add- Throws:
IllegalArgumentException- an attempt to add value that already existsSchemaException
-
addAllReplaceExisting
Adds a collection of items to a property container. Existing values will be replaced.- Parameters:
itemsToAdd- items to add- Throws:
SchemaException
-
replace
<IV extends PrismValue,ID extends ItemDefinition<?>> void replace(Item<IV, ID> oldItem, Item<IV, throws SchemaExceptionID> newItem) - Throws:
SchemaException
-
clear
void clear() -
contains
-
contains
-
containsRealValue
static <C extends Containerable> boolean containsRealValue(Collection<PrismContainerValue<C>> cvalCollection, PrismContainerValue<C> cval) -
findPartial
<IV extends PrismValue,ID extends ItemDefinition<?>> PartiallyResolvedItem<IV,ID> findPartial(ItemPath path) -
findProperty
-
findProperty
Finds a specific property in the container by definition.Returns null if nothing is found.
- Parameters:
propertyDefinition- property definition to find.- Returns:
- found property or null
-
findContainer
-
findReference
-
findItem
<IV extends PrismValue,ID extends ItemDefinition<?>, I findItemI extends Item<IV, ID>> (ItemPath itemPath, Class<I> type) -
findItem
default <IV extends PrismValue,ID extends ItemDefinition<?>> Item<IV,ID> findItem(ItemPath itemPath) -
findItem
<IV extends PrismValue,ID extends ItemDefinition<?>, I findItemI extends Item<IV, ID>> (ItemDefinition itemDefinition, Class<I> type) -
containsItem
- Throws:
SchemaException
-
createDetachedSubItem
<IV extends PrismValue,ID extends ItemDefinition<?>, I createDetachedSubItemI extends Item<IV, ID>> (QName name, Class<I> type, ID itemDefinition, boolean immutable) throws SchemaException, PrismContainerValue.RemovedItemDefinitionException -
findOrCreateContainer
<T extends Containerable> PrismContainer<T> findOrCreateContainer(QName containerName) throws SchemaException - Throws:
SchemaException
-
findOrCreateReference
- Throws:
SchemaException
-
findOrCreateItem
<IV extends PrismValue,ID extends ItemDefinition<?>> Item<IV,ID> findOrCreateItem(QName containerName) throws SchemaException - Throws:
SchemaException
-
findOrCreateItem
<IV extends PrismValue,ID extends ItemDefinition<?>, I findOrCreateItemI extends Item<IV, ID>> (QName containerName, Class<I> type) throws SchemaException - Throws:
SchemaException
-
findOrCreateItem
<IV extends PrismValue,ID extends ItemDefinition<?>, I findOrCreateItemI extends Item<IV, ID>> (ItemPath path, Class<I> type, ID definition) throws SchemaException - Throws:
SchemaException
-
findOrCreateProperty
- Throws:
SchemaException
-
findOrCreateProperty
<X> PrismProperty<X> findOrCreateProperty(PrismPropertyDefinition propertyDef) throws SchemaException - Throws:
SchemaException
-
createProperty
- Throws:
SchemaException
-
createProperty
<X> PrismProperty<X> createProperty(PrismPropertyDefinition<X> propertyDefinition) throws SchemaException - Throws:
SchemaException
-
removeItem
Useful when removing something without the knowledge of its kind. -
removeProperty
-
removeContainer
-
removeReference
-
setPropertyRealValue
- Throws:
SchemaException
-
getPropertyRealValue
-
getItemRealValue
-
recompute
- Specified by:
recomputein interfacePrismValue
-
accept
- Specified by:
acceptin interfacePrismValue- Specified by:
acceptin interfaceVisitable<C extends Containerable>
-
accept
- Specified by:
acceptin interfacePathVisitable- Specified by:
acceptin interfacePrismValue
-
hasCompleteDefinition
boolean hasCompleteDefinition()Returns true if all contained items have complete definitions. (Currently does not check the definition of this value itself.) -
addRawElement
- Throws:
SchemaException
-
deleteRawElement
- Throws:
SchemaException
-
removeRawElement
-
applyDefinition
PrismContainerValue<C> applyDefinition(@NotNull @NotNull ItemDefinition<?> itemDefinition) throws SchemaException Description copied from interface:PrismValueDefinition application MAY change the value (currently only for container values). The caller must deal with that. To be seen if this is a good idea. But probably so, because there are various situations when the definition application changes the nature of a prism value (midPoint shadow associations are currently the only places) but of prism items (midPoint attributes and associations need this; and it must be worked around for now).- Specified by:
applyDefinitionin interfacePrismValue- Throws:
SchemaException
-
applyDefinition
PrismContainerValue<C> applyDefinition(@NotNull @NotNull ItemDefinition<?> itemDefinition, boolean force) throws SchemaException Description copied from interface:PrismValueDefinition application MAY change the value (currently only for container values). The caller must deal with that.- Specified by:
applyDefinitionin interfacePrismValue- Throws:
SchemaException
-
applyDefinition
PrismContainerValue<C> applyDefinition(@NotNull @NotNull PrismContainerDefinition<C> containerDef, boolean force) throws SchemaException - Throws:
SchemaException
-
isIdOnly
boolean isIdOnly() -
isIdOnly
-
getId
-
idsMatch
-
assertDefinitions
- Throws:
SchemaException
-
assertDefinitions
void assertDefinitions(boolean tolerateRaw, Supplier<String> sourceDescriptionSupplier) throws SchemaException - Throws:
SchemaException
-
clone
PrismContainerValue<C> clone()Description copied from interface:PrismValueLiteral clone.- Specified by:
clonein interfacePrismValue
-
createImmutableClone
PrismContainerValue<C> createImmutableClone()- Specified by:
createImmutableClonein interfacePrismValue
-
cloneComplex
Description copied from interface:PrismValueComplex clone with different cloning strategies.- Specified by:
cloneComplexin interfacePrismValue- See Also:
-
equivalent
-
getComplexTypeDefinition
-
toPcvList
-
asSingleValuedContainer
Returns a single-valued container (with a single-valued definition) holding just this value.- Parameters:
itemName- Item name for newly-created container.- Throws:
SchemaException
-
mergeContent
void mergeContent(@NotNull @NotNull PrismContainerValue<?> other, @NotNull @NotNull List<QName> overwrite) throws SchemaException - Throws:
SchemaException
-
getRootValue
- Specified by:
getRootValuein interfacePrismValue
-
asPrismContainerValues
static <C extends Containerable> List<PrismContainerValue<C>> asPrismContainerValues(List<C> containerables) -
asContainerables
-
asContainerables
static <C extends Containerable> Collection<C> asContainerables(Collection<PrismContainerValue<C>> pcvs) -
setOriginTypeRecursive
Set origin type to all values and subvalues -
keepPaths
- Throws:
SchemaException
-
removePaths
- Throws:
SchemaException
-
removeMetadataFromPaths
Remove metadata from specified paths Can also remove metadata from the object on which it's called, if the paths contains a "root" path (e.g.ItemPath.fromString("/")).- Parameters:
pathsToRemoveMetadata- the paths to items on which metadata should be removed.- Throws:
SchemaException
-
removeItems
BEWARE!! Assumes the container has no parent! Otherwise item.getPath() provides wrong values. -
removeOperationalItems
void removeOperationalItems() -
getDefinition
PrismContainerDefinition<C> getDefinition() -
acceptParentVisitor
- Specified by:
acceptParentVisitorin interfaceParentVisitable
-
hasNoItems
boolean hasNoItems()Like isEmpty but ignores presence of container value ID. -
checkNothingExceptFor
For simplicity, everything must be qualified: names to check, and existing names. -
schemaLookup
- Specified by:
schemaLookupin interfacePrismValue- Specified by:
schemaLookupin interfaceSchemaLookup.Aware
-
acceptVisitor
Description 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 interfacePrismValue- Specified by:
acceptVisitorin interfacePrismVisitable- Returns:
- return value of
PrismVisitor.visit(PrismVisitable)invocation for this visitable.
-