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>
- All Known Implementing Classes:
PrismContainerValueImpl,PrismObjectValueImpl
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 voidaccept(Visitor visitor)voidaccept(Visitor visitor, ItemPath path, boolean recursive)voidacceptParentVisitor(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.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.voidapplyDefinition(@NotNull PrismContainerDefinition<C> containerDef, boolean force)voidapplyDefinition(ItemDefinition definition, boolean force)CasContainerable()static <T extends Containerable>
TasContainerable(PrismContainerValue<T> value)CasContainerable(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, String sourceDescription)voidassertDefinitions(String sourceDescription)PrismContainer<C>asSingleValuedContainer(@NotNull QName itemName)Returns a single-valued container (with a single-valued definition) holding just this value.booleancanRepresent(Class<?> clazz)voidclear()PrismContainerValue<C>clone()Literal clone.PrismContainerValue<C>cloneComplex(CloneStrategy strategy)Complex clone with different cloning strategies.booleancontains(Item item)booleancontains(ItemName itemName)booleancontainsItem(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)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>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)PrismReferencefindOrCreateReference(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.PrismReferencefindReference(QName elementName)PrismReferencefindReferenceByCompositeObjectElementName(QName elementName)Class<C>getCompileTimeClass()@Nullable ComplexTypeDefinitiongetComplexTypeDefinition()PrismContainer<C>getContainer()PrismContainerDefinition<C>getDefinition()LonggetId()static LonggetId(PrismValue value)@NotNull Collection<QName>getItemNames()@NotNull Collection<Item<?,?>>getItems()Returns a collection of items that the property container contains.PrismContainerable<C>getParent()PrismContextgetPrismContextLocal()@NotNull Set<PrismProperty<?>>getProperties()Returns a set of properties that the property container contains.<T> TgetPropertyRealValue(QName propertyName, Class<T> type)PrismContainerValue<?>getRootValue()CgetValue()booleanhasCompleteDefinition()booleanhasNoItems()Like isEmpty but ignores presence of container value ID.static booleanidsMatch(PrismValue v1, PrismValue v2)booleanisIdOnly()static booleanisIdOnly(PrismValue value)voidkeepPaths(List<? extends ItemPath> keep)<IV extends PrismValue,ID extends ItemDefinition>
booleanmerge(Item<IV,ID> item)Merges the provided item into this item.voidmergeContent(@NotNull PrismContainerValue<?> other, @NotNull List<QName> overwrite)voidrecompute(PrismContext prismContext)<IV extends PrismValue,ID extends ItemDefinition>
voidremove(Item<IV,ID> item)voidremoveAll()voidremoveContainer(ItemPath path)voidremoveItems(List<? extends ItemPath> itemsToRemove)voidremoveOperationalItems()voidremovePaths(List<? extends ItemPath> remove)voidremoveProperty(ItemPath path)booleanremoveRawElement(Object element)voidremoveReference(ItemPath path)<IV extends PrismValue,ID extends ItemDefinition>
voidreplace(Item<IV,ID> oldItem, Item<IV,ID> newItem)voidsetId(Long id)voidsetOriginTypeRecursive(OriginType originType)Set origin type to all values and subvalues<T> voidsetPropertyRealValue(QName propertyName, T realValue, PrismContext prismContext)intsize()<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:
getParentin 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:
recomputein interfacePrismValue
-
accept
void accept(Visitor visitor)
- Specified by:
acceptin interfacePrismValue- Specified by:
acceptin interfaceVisitable<C extends Containerable>
-
accept
void accept(Visitor visitor, ItemPath path, boolean recursive)
- Specified by:
acceptin interfacePathVisitable- Specified by:
acceptin 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:
applyDefinitionin 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(String sourceDescription) throws SchemaException
- Throws:
SchemaException
-
assertDefinitions
void assertDefinitions(boolean tolerateRaw, String sourceDescription) 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
PrismContainerValue<C> cloneComplex(CloneStrategy strategy)
Description copied from interface:PrismValueComplex clone with different cloning strategies.- Specified by:
cloneComplexin 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:
getRootValuein 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:
acceptParentVisitorin interfaceParentVisitable
-
hasNoItems
boolean hasNoItems()
Like isEmpty but ignores presence of container value ID.
-
-