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:
DummyContainerImpl
,PrismContainerImpl
,PrismObjectImpl
,ResourceAttributeContainerImpl
,ValueMetadataAdapter
public interface PrismContainer<C extends Containerable> extends Item<PrismContainerValue<C>,PrismContainerDefinition<C>>, PrismContainerable<C>
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
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description void
accept(Visitor visitor, ItemPath path, boolean recursive)
void
add(Item<?,?> item)
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).PrismContainer<C>
clone()
Literal clone.PrismContainer<C>
cloneComplex(CloneStrategy strategy)
Complex clone with different cloning strategies.boolean
containsItem(ItemPath itemPath, boolean acceptEmptyItem)
ContainerDelta<C>
createDelta()
Creates specific subclass of ItemDelta appropriate for type of item that this definition represents (e.g.ContainerDelta<C>
createDelta(ItemPath path)
PrismContainer<C>
createImmutableClone()
PrismContainerValue<C>
createNewValue()
static <V extends PrismContainerValue>
voidcreateParentIfNeeded(V value, ItemDefinition definition)
PrismContainerDefinition<C>
deepCloneDefinition(boolean ultraDeep, Consumer<ItemDefinition> postCloneAction)
ContainerDelta<C>
diff(PrismContainer<C> other)
ContainerDelta<C>
diff(PrismContainer<C> other, ParameterizedEquivalenceStrategy strategy)
List<? extends ItemDelta>
diffModifications(PrismContainer<C> other, ParameterizedEquivalenceStrategy strategy)
boolean
equivalent(Object obj)
This method ignores some part of the object during comparison (e.g.<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>findItem(ItemPath path)
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>>
IfindItem(ItemPath path, Class<I> type)
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>>
IfindItem(QName itemQName, Class<I> type)
<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)
PrismReference
findOrCreateReference(ItemPath propertyPath)
<IV extends PrismValue,ID extends ItemDefinition>
PartiallyResolvedItem<IV,ID>findPartial(ItemPath path)
<T> PrismProperty<T>
findProperty(ItemPath path)
PrismReference
findReference(ItemPath path)
PrismContainerValue<C>
findValue(long id)
@Nullable Class<C>
getCompileTimeClass()
Returns the static type of data represented by values of this container, if known and applicable.PrismContainerDefinition<C>
getDefinition()
Returns applicable definition.<T> T
getPropertyRealValue(ItemPath propertyPath, Class<T> type)
C
getRealValue()
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>
getRealValues()
Returns (potentially empty) collection of "real values".@NotNull PrismContainerValue<C>
getValue()
Returns the value, if there is only one.PrismContainerValue<C>
getValue(Long id)
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
remove(Item<?,?> item)
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, diff, diff, equals, equals, equals, filterValues, filterYields, find, findValue, findValue, getAllValues, getAnyValue, getAnyValue, getClonedValues, getDisplayName, getElementName, getHelp, getHighestId, getParent, getPath, getPrismContextLocal, getRealValue, getRealValuesArray, getRealValuesOrRawTypes, getUserData, getUserData, getValues, 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 Detail
-
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
@Nullable @Nullable Class<C> 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
boolean canRepresent(@NotNull @NotNull Class<?> compileTimeClass)
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
boolean canRepresent(QName type)
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
@NotNull @NotNull Collection<C> 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
@NotNull C 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
void setRealValue(C value) throws SchemaException
- Throws:
SchemaException
-
setValue
void setValue(@NotNull @NotNull PrismContainerValue<C> value) throws SchemaException
- Throws:
SchemaException
-
getValue
@NotNull @NotNull PrismContainerValue<C> 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
PrismContainerValue<C> getValue(Long id)
-
setPropertyRealValue
<T> void setPropertyRealValue(QName propertyName, T realValue) throws SchemaException
- Throws:
SchemaException
-
setContainerRealValue
<C extends Containerable> void setContainerRealValue(QName containerName, C realValue) throws SchemaException
- Throws:
SchemaException
-
setPropertyRealValues
<T> void setPropertyRealValues(QName propertyName, T... realValues) throws SchemaException
- Throws:
SchemaException
-
add
void add(Item<?,?> item) throws SchemaException
Convenience method. Works only on single-valued containers.- Throws:
SchemaException
-
createNewValue
PrismContainerValue<C> createNewValue()
-
mergeValues
void mergeValues(PrismContainer<C> other) throws SchemaException
- Throws:
SchemaException
-
mergeValues
void mergeValues(Collection<PrismContainerValue<C>> otherValues) throws SchemaException
- Throws:
SchemaException
-
mergeValue
void mergeValue(PrismContainerValue<C> otherValue) throws SchemaException
- Throws:
SchemaException
-
trim
void trim()
Remove all empty values
-
setDefinition
void setDefinition(PrismContainerDefinition<C> definition)
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
void applyDefinition(PrismContainerDefinition<C> definition) throws SchemaException
- Specified by:
applyDefinition
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
- Throws:
SchemaException
-
findItem
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findItem(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 extends Item<IV,ID>> I findCreateItem(QName itemQName, Class<I> type, boolean create) throws SchemaException
- Throws:
SchemaException
-
findItem
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findItem(ItemPath path, Class<I> type)
-
findItem
<IV extends PrismValue,ID extends ItemDefinition> Item<IV,ID> findItem(ItemPath path)
-
containsItem
boolean containsItem(ItemPath itemPath, boolean acceptEmptyItem) throws SchemaException
- Throws:
SchemaException
-
findCreateItem
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findCreateItem(ItemPath itemPath, Class<I> type, ID itemDefinition, boolean create) throws SchemaException
- Throws:
SchemaException
-
findValue
PrismContainerValue<C> findValue(long id)
-
findContainer
<T extends Containerable> PrismContainer<T> findContainer(ItemPath path)
-
findProperty
<T> PrismProperty<T> findProperty(ItemPath path)
-
findReference
PrismReference findReference(ItemPath path)
-
findOrCreateItem
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findOrCreateItem(ItemPath containerPath, Class<I> type) throws SchemaException
- Throws:
SchemaException
-
findOrCreateItem
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findOrCreateItem(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
<T> PrismProperty<T> findOrCreateProperty(ItemPath propertyPath) throws SchemaException
- Throws:
SchemaException
-
findOrCreateReference
PrismReference findOrCreateReference(ItemPath propertyPath) throws SchemaException
- Throws:
SchemaException
-
remove
void remove(Item<?,?> item)
Convenience method. Works only on single-valued containers.
-
removeProperty
void removeProperty(ItemPath path)
-
removeContainer
void removeContainer(ItemPath path)
-
removeReference
void removeReference(ItemPath path)
-
removeItem
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> void removeItem(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
ContainerDelta<C> createDelta(ItemPath path)
- Specified by:
createDelta
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
-
diff
ContainerDelta<C> diff(PrismContainer<C> other)
-
diff
ContainerDelta<C> diff(PrismContainer<C> other, ParameterizedEquivalenceStrategy strategy)
-
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
PrismContainer<C> cloneComplex(CloneStrategy strategy)
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:
CloneStrategy
-
deepCloneDefinition
PrismContainerDefinition<C> deepCloneDefinition(boolean ultraDeep, Consumer<ItemDefinition> postCloneAction)
-
accept
void accept(Visitor visitor, ItemPath path, boolean recursive)
- Specified by:
accept
in interfacePathVisitable
-
equivalent
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.
-
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
void trimDefinitionTree(Collection<? extends ItemPath> alwaysKeep)
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!
-
-