Package com.evolveum.midpoint.prism
Interface PrismContainerValue<C extends Containerable>
-
- All Superinterfaces:
DebugDumpable
,Freezable
,MidpointOriginMetadata
,ParentVisitable
,PathVisitable
,PrismContextSensitive
,PrismValue
,Revivable
,Serializable
,Visitable
- All Known Subinterfaces:
PrismObjectValue<O>
public interface PrismContainerValue<C extends Containerable> extends PrismValue, ParentVisitable
- Author:
- semancik
-
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
accept(Visitor visitor)
void
accept(Visitor visitor, ItemPath path, boolean recursive)
void
acceptParentVisitor(Visitor visitor)
<IV extends PrismValue,ID extends ItemDefinition>
voidadd(Item<IV,ID> item)
<IV extends PrismValue,ID extends ItemDefinition>
voidadd(Item<IV,ID> item, boolean checkUniqueness)
Adds an item to a property container.void
addAll(Collection<? extends Item<?,?>> itemsToAdd)
Adds a collection of items to a property container.void
addAllReplaceExisting(Collection<? extends Item<?,?>> itemsToAdd)
Adds a collection of items to a property container.boolean
addRawElement(Object element)
<IV extends PrismValue,ID extends ItemDefinition>
voidaddReplaceExisting(Item<IV,ID> item)
Adds an item to a property container.void
applyDefinition(@NotNull PrismContainerDefinition<C> containerDef, boolean force)
void
applyDefinition(ItemDefinition definition, boolean force)
C
asContainerable()
static <T extends Containerable>
TasContainerable(PrismContainerValue<T> value)
C
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)
void
assertDefinitions(boolean tolerateRaw, Supplier<String> sourceDescriptionSupplier)
void
assertDefinitions(Supplier<String> sourceDescriptionSupplier)
PrismContainer<C>
asSingleValuedContainer(@NotNull QName itemName)
Returns a single-valued container (with a single-valued definition) holding just this value.boolean
canRepresent(Class<?> clazz)
void
clear()
PrismContainerValue<C>
clone()
Literal clone.PrismContainerValue<C>
cloneComplex(CloneStrategy strategy)
Complex clone with different cloning strategies.boolean
contains(Item item)
boolean
contains(ItemName itemName)
boolean
containsItem(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)
PrismContainerValue<C>
createImmutableClone()
<X> PrismProperty<X>
createProperty(PrismPropertyDefinition propertyDefinition)
<X> PrismProperty<X>
createProperty(QName propertyName)
boolean
deleteRawElement(Object element)
boolean
equivalent(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>findItem(ItemPath itemPath)
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>>
IfindItem(ItemPath itemName, Class<I> type)
<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)
PrismReference
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.PrismReference
findReference(QName elementName)
PrismReference
findReferenceByCompositeObjectElementName(QName elementName)
Class<C>
getCompileTimeClass()
@Nullable ComplexTypeDefinition
getComplexTypeDefinition()
PrismContainer<C>
getContainer()
PrismContainerDefinition<C>
getDefinition()
Long
getId()
static Long
getId(PrismValue value)
@NotNull Collection<QName>
getItemNames()
default <T> T
getItemRealValue(ItemName itemName, Class<T> type)
@NotNull Collection<Item<?,?>>
getItems()
Returns a collection of items that the property container contains.PrismContainerable<C>
getParent()
PrismContext
getPrismContextLocal()
@NotNull Set<PrismProperty<?>>
getProperties()
Returns a set of properties that the property container contains.<T> T
getPropertyRealValue(QName propertyName, Class<T> type)
PrismContainerValue<?>
getRootValue()
C
getValue()
boolean
hasCompleteDefinition()
boolean
hasNoItems()
Like isEmpty but ignores presence of container value ID.static boolean
idsMatch(PrismValue v1, PrismValue v2)
boolean
isIdOnly()
static boolean
isIdOnly(PrismValue value)
void
keepPaths(List<? extends ItemPath> keep)
<IV extends PrismValue,ID extends ItemDefinition>
booleanmerge(Item<IV,ID> item)
Merges the provided item into this item.void
mergeContent(@NotNull PrismContainerValue<?> other, @NotNull List<QName> overwrite)
void
recompute(PrismContext prismContext)
<IV extends PrismValue,ID extends ItemDefinition>
voidremove(Item<IV,ID> item)
void
removeAll()
void
removeContainer(ItemPath path)
void
removeItems(List<? extends ItemPath> itemsToRemove)
void
removeOperationalItems()
void
removePaths(List<? extends ItemPath> remove)
void
removeProperty(ItemPath path)
boolean
removeRawElement(Object element)
void
removeReference(ItemPath path)
<IV extends PrismValue,ID extends ItemDefinition>
voidreplace(Item<IV,ID> oldItem, Item<IV,ID> newItem)
void
setId(Long id)
void
setOriginTypeRecursive(OriginType originType)
Set origin type to all values and subvalues<T> void
setPropertyRealValue(QName propertyName, T realValue, PrismContext prismContext)
int
size()
<IV extends PrismValue,ID extends ItemDefinition>
booleansubtract(Item<IV,ID> item)
Subtract the provided item from this item.static <T extends Containerable>
List<PrismContainerValue<T>>toPcvList(List<T> beans)
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.prism.Freezable
checkImmutable, checkMutable, freeze, isImmutable
-
Methods inherited from interface com.evolveum.midpoint.prism.metadata.MidpointOriginMetadata
getOriginObject, getOriginType, setOriginObject, setOriginType
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismContextSensitive
getPrismContext
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismValue
applyDefinition, checkConsistenceInternal, clearParent, diff, equals, equals, find, getAllValues, getParentContainerValue, getPath, getRealClass, getRealValue, getRealValueOrRawType, getTypeName, getUserData, getUserData, getValueMetadata, getValueMetadataAsContainer, hashCode, hashCode, hasRealClass, hasValueMetadata, isEmpty, isRaw, isTransient, normalize, recompute, representsSameValue, setParent, setPrismContext, setTransient, setUserData, setValueMetadata, setValueMetadata, setValueMetadata, toHumanReadableString, valueMetadata
-
-
-
-
Method Detail
-
asContainerable
static <T extends Containerable> T asContainerable(PrismContainerValue<T> value)
-
getPrismContextLocal
PrismContext getPrismContextLocal()
-
getItems
@NotNull @Contract(pure=true) @NotNull Collection<Item<?,?>> 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
@NotNull @NotNull Set<PrismProperty<?>> 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
void setId(Long id)
-
getParent
PrismContainerable<C> getParent()
- Specified by:
getParent
in interfacePrismValue
-
getContainer
PrismContainer<C> getContainer()
-
getValue
C getValue()
-
asContainerable
@NotNull C asContainerable()
-
canRepresent
boolean canRepresent(Class<?> clazz)
-
getItemNames
@NotNull @NotNull Collection<QName> 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 SchemaException
Adds 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 SchemaException
Merges 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 SchemaException
Subtract 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 SchemaException
Adds an item to a property container. Existing value will be replaced.- Parameters:
item
- item to add.- Throws:
SchemaException
-
remove
<IV extends PrismValue,ID extends ItemDefinition> void remove(Item<IV,ID> item)
-
removeAll
void removeAll()
-
addAll
void addAll(Collection<? extends Item<?,?>> itemsToAdd) throws SchemaException
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
void addAllReplaceExisting(Collection<? extends Item<?,?>> itemsToAdd) throws SchemaException
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,ID> newItem) throws SchemaException
- Throws:
SchemaException
-
clear
void clear()
-
contains
boolean contains(Item item)
-
contains
boolean contains(ItemName itemName)
-
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
<X> PrismProperty<X> findProperty(ItemPath propertyPath)
-
findProperty
<X> PrismProperty<X> findProperty(PrismPropertyDefinition<X> propertyDefinition)
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
<X extends Containerable> PrismContainer<X> findContainer(QName containerName)
-
findReference
PrismReference findReference(QName elementName)
-
findReferenceByCompositeObjectElementName
PrismReference findReferenceByCompositeObjectElementName(QName elementName)
-
findItem
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findItem(ItemPath itemName, 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 extends Item<IV,ID>> I findItem(ItemDefinition itemDefinition, Class<I> type)
-
containsItem
boolean containsItem(ItemPath propPath, boolean acceptEmptyItem) throws SchemaException
- Throws:
SchemaException
-
createDetachedSubItem
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I createDetachedSubItem(QName name, Class<I> type, ID itemDefinition, boolean immutable) throws SchemaException
- Throws:
SchemaException
-
findOrCreateContainer
<T extends Containerable> PrismContainer<T> findOrCreateContainer(QName containerName) throws SchemaException
- Throws:
SchemaException
-
findOrCreateReference
PrismReference findOrCreateReference(QName referenceName) throws SchemaException
- 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 extends Item<IV,ID>> I findOrCreateItem(QName containerName, Class<I> type) throws SchemaException
- Throws:
SchemaException
-
findOrCreateItem
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findOrCreateItem(ItemPath path, Class<I> type, ID definition) throws SchemaException
- Throws:
SchemaException
-
findOrCreateProperty
<X> PrismProperty<X> findOrCreateProperty(ItemPath propertyPath) throws SchemaException
- Throws:
SchemaException
-
findOrCreateProperty
<X> PrismProperty<X> findOrCreateProperty(PrismPropertyDefinition propertyDef) throws SchemaException
- Throws:
SchemaException
-
createProperty
<X> PrismProperty<X> createProperty(QName propertyName) throws SchemaException
- Throws:
SchemaException
-
createProperty
<X> PrismProperty<X> createProperty(PrismPropertyDefinition propertyDefinition) throws SchemaException
- Throws:
SchemaException
-
removeProperty
void removeProperty(ItemPath path)
-
removeContainer
void removeContainer(ItemPath path)
-
removeReference
void removeReference(ItemPath path)
-
setPropertyRealValue
<T> void setPropertyRealValue(QName propertyName, T realValue, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
recompute
void recompute(PrismContext prismContext)
- Specified by:
recompute
in interfacePrismValue
-
accept
void accept(Visitor visitor)
- Specified by:
accept
in interfacePrismValue
- Specified by:
accept
in interfaceVisitable<C extends Containerable>
-
accept
void accept(Visitor visitor, ItemPath path, boolean recursive)
- Specified by:
accept
in interfacePathVisitable
- Specified by:
accept
in interfacePrismValue
-
hasCompleteDefinition
boolean hasCompleteDefinition()
-
addRawElement
boolean addRawElement(Object element) throws SchemaException
- Throws:
SchemaException
-
deleteRawElement
boolean deleteRawElement(Object element) throws SchemaException
- Throws:
SchemaException
-
removeRawElement
boolean removeRawElement(Object element)
-
applyDefinition
void applyDefinition(ItemDefinition definition, boolean force) throws SchemaException
- Specified by:
applyDefinition
in interfacePrismValue
- Throws:
SchemaException
-
applyDefinition
void applyDefinition(@NotNull @NotNull PrismContainerDefinition<C> containerDef, boolean force) throws SchemaException
- Throws:
SchemaException
-
isIdOnly
boolean isIdOnly()
-
isIdOnly
static boolean isIdOnly(PrismValue value)
-
getId
static Long getId(PrismValue value)
-
idsMatch
static boolean idsMatch(PrismValue v1, PrismValue v2)
-
assertDefinitions
void assertDefinitions(Supplier<String> sourceDescriptionSupplier) throws SchemaException
- Throws:
SchemaException
-
assertDefinitions
void assertDefinitions(boolean tolerateRaw, Supplier<String> sourceDescriptionSupplier) throws SchemaException
- Throws:
SchemaException
-
clone
PrismContainerValue<C> clone()
Description copied from interface:PrismValue
Literal clone.- Specified by:
clone
in interfacePrismValue
-
createImmutableClone
PrismContainerValue<C> createImmutableClone()
- Specified by:
createImmutableClone
in interfacePrismValue
-
cloneComplex
PrismContainerValue<C> cloneComplex(CloneStrategy strategy)
Description copied from interface:PrismValue
Complex clone with different cloning strategies.- Specified by:
cloneComplex
in interfacePrismValue
- See Also:
CloneStrategy
-
equivalent
boolean equivalent(PrismContainerValue<?> other)
-
getComplexTypeDefinition
@Nullable @Nullable ComplexTypeDefinition getComplexTypeDefinition()
-
toPcvList
static <T extends Containerable> List<PrismContainerValue<T>> toPcvList(List<T> beans)
-
asSingleValuedContainer
PrismContainer<C> asSingleValuedContainer(@NotNull @NotNull QName itemName) throws SchemaException
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
PrismContainerValue<?> getRootValue()
- Specified by:
getRootValue
in interfacePrismValue
-
asPrismContainerValues
static <C extends Containerable> List<PrismContainerValue<C>> asPrismContainerValues(List<C> containerables)
-
asContainerables
static <C extends Containerable> List<C> asContainerables(List<PrismContainerValue<C>> pcvs)
-
asContainerables
static <C extends Containerable> Collection<C> asContainerables(Collection<PrismContainerValue<C>> pcvs)
-
setOriginTypeRecursive
void setOriginTypeRecursive(OriginType originType)
Set origin type to all values and subvalues
-
keepPaths
void keepPaths(List<? extends ItemPath> keep) throws SchemaException
- Throws:
SchemaException
-
removePaths
void removePaths(List<? extends ItemPath> remove) throws SchemaException
- Throws:
SchemaException
-
removeOperationalItems
void removeOperationalItems()
-
getDefinition
PrismContainerDefinition<C> getDefinition()
-
acceptParentVisitor
void acceptParentVisitor(Visitor visitor)
- Specified by:
acceptParentVisitor
in interfaceParentVisitable
-
hasNoItems
boolean hasNoItems()
Like isEmpty but ignores presence of container value ID.
-
-