Interface PrismContainer<C extends Containerable>
- All Superinterfaces:
DebugDumpable
,Freezable
,Item<PrismContainerValue<C>,
,PrismContainerDefinition<C>> Itemable
,ParentVisitable
,PathVisitable
,PrismContainerable<C>
,PrismContextSensitive
,Revivable
,Serializable
,Visitable
- All Known Subinterfaces:
PrismObject<O>
,ResourceAttributeContainer
,ValueMetadata
- All Known Implementing Classes:
com.evolveum.midpoint.prism.impl.PrismContainerImpl
,ResourceAttributeContainerImpl
Prism container groups items into logical blocks. The reason for grouping may be as simple as better understandability of data structure. But the group usually means different meaning, source or structure of the data. For example, the a container is frequently used to hold properties that are dynamic, not fixed by a static schema. Such grouping also naturally translates to XML and helps to "quarantine" such properties to avoid Unique Particle Attribute problems.
Container contains a set of (potentially multi-valued) properties, references, or inner containers. The order of properties is not significant, regardless of the fact that it may be fixed in the XML representation. In the XML representation, each element inside the container must be either property, reference, or a container.
A container is mutable.
- Author:
- Radovan Semancik
-
Field Summary
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Convenience method.void
applyDefinition
(PrismContainerDefinition<C> definition) boolean
canRepresent
(@NotNull Class<?> compileTimeClass) Returns true if values of this container can be represented as specified compile-time class.boolean
canRepresent
(QName type) Returns true if values of this container can be presented as specified type (from compile-time or runtime schema).clone()
Literal clone.cloneComplex
(CloneStrategy strategy) Complex clone with different cloning strategies.boolean
containsItem
(ItemPath itemPath, boolean acceptEmptyItem) Creates specific subclass of ItemDelta appropriate for type of item that this definition represents (e.g.createDelta
(ItemPath path) static <V extends PrismContainerValue>
voidcreateParentIfNeeded
(V value, ItemDefinition definition) deepCloneDefinition
(@NotNull DeepCloneOperation operation) diff
(PrismContainer<C> other) diff
(PrismContainer<C> other, ParameterizedEquivalenceStrategy strategy) diffModifications
(PrismContainer<C> other, ParameterizedEquivalenceStrategy strategy) boolean
equivalent
(Object obj) This method ignores some part of the object during comparison (e.g. source demarcation in values) These methods compare the "meaningful" parts of the objects.<T extends Containerable>
PrismContainer<T>findContainer
(ItemPath path) <IV extends PrismValue,
ID extends ItemDefinition<?>, I extends Item<IV, ID>>
IfindCreateItem
(ItemPath itemPath, Class<I> type, ID itemDefinition, boolean create) <IV extends PrismValue,
ID extends ItemDefinition<?>, I extends Item<IV, ID>>
IfindCreateItem
(QName itemQName, Class<I> type, boolean create) <IV extends PrismValue,
ID extends ItemDefinition<?>>
Item<IV,ID> <IV extends PrismValue,
ID extends ItemDefinition<?>, I extends Item<IV, ID>>
I<IV extends PrismValue,
ID extends ItemDefinition<?>, I extends Item<IV, ID>>
I<T extends Containerable>
PrismContainer<T>findOrCreateContainer
(ItemPath containerPath) <IV extends PrismValue,
ID extends ItemDefinition<?>, I extends Item<IV, ID>>
IfindOrCreateItem
(ItemPath containerPath, Class<I> type) <IV extends PrismValue,
ID extends ItemDefinition<?>, I extends Item<IV, ID>>
IfindOrCreateItem
(ItemPath containerPath, Class<I> type, ID definition) <T> PrismProperty<T>
findOrCreateProperty
(ItemPath propertyPath) findOrCreateReference
(ItemPath propertyPath) <IV extends PrismValue,
ID extends ItemDefinition<?>>
PartiallyResolvedItem<IV,ID> findPartial
(ItemPath path) <T> PrismProperty<T>
findProperty
(ItemPath path) findReference
(ItemPath path) findValue
(long id) Returns the static type of data represented by values of this container, if known and applicable.Returns applicable definition.<T> T
getPropertyRealValue
(ItemPath propertyPath, Class<T> type) Returns 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.@NotNull Collection<C>
Returns (potentially empty) collection of "real values".@NotNull PrismContainerValue<C>
getValue()
Returns the value, if there is only one.@NotNull List<PrismContainerValue<C>>
Returns the values for this item.void
mergeValue
(PrismContainerValue<C> otherValue) void
mergeValues
(PrismContainer<C> other) void
mergeValues
(Collection<PrismContainerValue<C>> otherValues) static <V extends Containerable>
PrismContainer<V>newInstance
(PrismContext prismContext, QName type) void
Convenience method.void
removeContainer
(ItemPath path) <IV extends PrismValue,
ID extends ItemDefinition<?>, I extends Item<IV, ID>>
voidremoveItem
(ItemPath path, Class<I> itemType) void
removeProperty
(ItemPath path) void
removeReference
(ItemPath path) <C extends Containerable>
voidsetContainerRealValue
(QName containerName, C realValue) void
setDefinition
(PrismContainerDefinition<C> definition) Sets applicable property container definition.<T> void
setPropertyRealValue
(QName propertyName, T realValue) <T> void
setPropertyRealValues
(QName propertyName, T... realValues) void
setRealValue
(C value) void
setValue
(@NotNull PrismContainerValue<C> value) void
trim()
Remove all empty valuesvoid
trimDefinitionTree
(Collection<? extends ItemPath> alwaysKeep) Optimizes (trims) definition tree by removing any definitions not corresponding to items in this container.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.Item
acceptParentVisitor, add, add, addAll, addAll, addIgnoringEquivalents, addRespectingMetadataAndCloning, applyDefinition, assertDefinitions, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistenceInternal, clear, contains, contains, copy, diff, diff, equals, equals, equals, filterValues, filterYields, find, findValue, findValue, getAllItems, getAllValues, getAnyValue, getAnyValue, getClonedValues, getDisplayName, getElementName, getHelp, getHighestId, getParent, getPath, getPrismContextLocal, getRealValue, getRealValuesArray, getRealValuesOrRawTypes, getUserData, getUserData, hasAnyValue, hasCompleteDefinition, hashCode, hashCode, hashCode, hasNoValues, hasRaw, isEmpty, isIncomplete, isOperational, isRaw, isSingleValue, isSingleValueByDefinition, merge, normalize, recomputeAllValues, remove, remove, removeAll, removeIf, removeRespectingMetadata, replace, replaceAll, setElementName, setIncomplete, setParent, setPrismContext, setUserData, size, valuesStream
Methods inherited from interface com.evolveum.midpoint.prism.PrismContainerable
getComplexTypeDefinition
Methods inherited from interface com.evolveum.midpoint.prism.PrismContextSensitive
getPrismContext
-
Method Details
-
getDefinition
PrismContainerDefinition<C> 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<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>> - Specified by:
getDefinition
in interfaceItemable
- Specified by:
getDefinition
in interfacePrismContainerable<C extends Containerable>
- Returns:
- applicable definition
-
getCompileTimeClass
Returns the static type of data represented by values of this container, if known and applicable. (There are containers that are purely dynamic, i.e. without any compile time class.)- Specified by:
getCompileTimeClass
in interfacePrismContainerable<C extends Containerable>
-
canRepresent
Returns true if values of this container can be represented as specified compile-time class. For example, PrismContainer of AbstractRoleType has: - canRepresent(AbstractRoleType.class) = true - canRepresent(FocusType.class) = true - canRepresent(ObjectType.class) = true - canRepresent(TaskType.class) = false - canRepresent(RoleType.class) = false -
canRepresent
Returns true if values of this container can be presented as specified type (from compile-time or runtime schema). In particular, returns true if type of this container or any of its supertypes match given type. -
getRealValues
Description copied from interface:Item
Returns (potentially empty) collection of "real values".- Specified by:
getRealValues
in interfaceItem<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>> - Returns:
- List of current values. The list itself is freely modifiable - it is independent on the list of values in this container. However, values themselves are directly linked to the PCVs.
-
getRealValue
Description copied from interface:Item
Returns 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.)- Specified by:
getRealValue
in interfaceItem<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>>
-
setRealValue
- Throws:
SchemaException
-
setValue
- Throws:
SchemaException
-
getValue
Description copied from interface:Item
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- Specified by:
getValue
in interfaceItem<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>>
-
getValue
-
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<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>>
-
setPropertyRealValue
- Throws:
SchemaException
-
setContainerRealValue
<C extends Containerable> void setContainerRealValue(QName containerName, C realValue) throws SchemaException - Throws:
SchemaException
-
setPropertyRealValues
- Throws:
SchemaException
-
getPropertyRealValue
-
add
Convenience method. Works only on single-valued containers.- Throws:
SchemaException
-
createNewValue
PrismContainerValue<C> createNewValue() -
mergeValues
- Throws:
SchemaException
-
mergeValues
- Throws:
SchemaException
-
mergeValue
- Throws:
SchemaException
-
trim
void trim()Remove all empty values -
setDefinition
Sets applicable property container definition.- Specified by:
setDefinition
in interfaceItem<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>> - Parameters:
definition
- the definition to set
-
applyDefinition
- Specified by:
applyDefinition
in interfaceItem<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>> - Throws:
SchemaException
-
findItem
<IV extends PrismValue,ID extends ItemDefinition<?>, I findItemI extends Item<IV, ID>> (QName itemQName, Class<I> type) -
findPartial
<IV extends PrismValue,ID extends ItemDefinition<?>> PartiallyResolvedItem<IV,ID> findPartial(ItemPath path) - Specified by:
findPartial
in interfaceItem<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>>
-
findCreateItem
<IV extends PrismValue,ID extends ItemDefinition<?>, I findCreateItemI extends Item<IV, ID>> (QName itemQName, Class<I> type, boolean create) throws SchemaException - Throws:
SchemaException
-
findItem
<IV extends PrismValue,ID extends ItemDefinition<?>, I findItemI extends Item<IV, ID>> (ItemPath path, Class<I> type) -
findItem
-
containsItem
- Throws:
SchemaException
-
findCreateItem
<IV extends PrismValue,ID extends ItemDefinition<?>, I findCreateItemI extends Item<IV, ID>> (ItemPath itemPath, Class<I> type, ID itemDefinition, boolean create) throws SchemaException - Throws:
SchemaException
-
findValue
-
findContainer
-
findProperty
-
findReference
-
findOrCreateItem
<IV extends PrismValue,ID extends ItemDefinition<?>, I findOrCreateItemI extends Item<IV, ID>> (ItemPath containerPath, Class<I> type) throws SchemaException - Throws:
SchemaException
-
findOrCreateItem
<IV extends PrismValue,ID extends ItemDefinition<?>, I findOrCreateItemI extends Item<IV, ID>> (ItemPath containerPath, Class<I> type, ID definition) throws SchemaException - Throws:
SchemaException
-
findOrCreateContainer
<T extends Containerable> PrismContainer<T> findOrCreateContainer(ItemPath containerPath) throws SchemaException - Throws:
SchemaException
-
findOrCreateProperty
- Throws:
SchemaException
-
findOrCreateReference
- Throws:
SchemaException
-
remove
Convenience method. Works only on single-valued containers. -
removeProperty
-
removeContainer
-
removeReference
-
removeItem
<IV extends PrismValue,ID extends ItemDefinition<?>, void removeItemI extends Item<IV, ID>> (ItemPath path, Class<I> itemType) -
createDelta
ContainerDelta<C> createDelta()Description copied from interface:Item
Creates specific subclass of ItemDelta appropriate for type of item that this definition represents (e.g. PropertyDelta, ContainerDelta, ...)- Specified by:
createDelta
in interfaceItem<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>>
-
createDelta
- Specified by:
createDelta
in interfaceItem<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>>
-
diff
-
diff
-
diffModifications
List<? extends ItemDelta> diffModifications(PrismContainer<C> other, ParameterizedEquivalenceStrategy strategy) -
clone
PrismContainer<C> clone()Description copied from interface:Item
Literal clone.- Specified by:
clone
in interfaceItem<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>>
-
createImmutableClone
PrismContainer<C> createImmutableClone()- Specified by:
createImmutableClone
in interfaceItem<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>>
-
cloneComplex
Description copied from interface:Item
Complex clone with different cloning strategies.- Specified by:
cloneComplex
in interfaceItem<PrismContainerValue<C extends Containerable>,
PrismContainerDefinition<C extends Containerable>> - See Also:
-
deepCloneDefinition
-
accept
- Specified by:
accept
in interfacePathVisitable
-
equivalent
This method ignores some part of the object during comparison (e.g. source demarcation in values) These methods compare the "meaningful" parts of the objects. -
newInstance
static <V extends Containerable> PrismContainer<V> newInstance(PrismContext prismContext, QName type) throws SchemaException - Throws:
SchemaException
-
createParentIfNeeded
static <V extends PrismContainerValue> void createParentIfNeeded(V value, ItemDefinition definition) throws SchemaException - Throws:
SchemaException
-
trimDefinitionTree
Optimizes (trims) definition tree by removing any definitions not corresponding to items in this container. Works recursively by sub-containers of this one. USE WITH CARE. Make sure the definitions are not shared by other objects!
-