Interface PrismContainer<C extends Containerable>
-
- All Superinterfaces:
DebugDumpable
,Item<PrismContainerValue<C>,PrismContainerDefinition<C>>
,Itemable
,ParentVisitable
,PathVisitable
,PrismContainerable<C>
,Revivable
,Serializable
,Visitable
- All Known Subinterfaces:
PrismObject<O>
,ResourceAttributeContainer
- All Known Implementing Classes:
com.evolveum.midpoint.prism.impl.PrismContainerImpl
,ResourceAttributeContainerImpl
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)
void
assertDefinitions(boolean tolarateRaw, String sourceDescription)
boolean
canRepresent(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).void
checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
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)
PrismContainerValue<C>
createNewValue()
static <V extends PrismContainerValue>
voidcreateParentIfNeeded(V value, ItemDefinition definition)
String
debugDump(int indent)
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)
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.Object
find(ItemPath path)
Returns object (Item or PrismValue) pointed to by the given path.<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)
Class<C>
getCompileTimeClass()
Returns the static type of data represented by values of this container, if known and applicable.PrismContainerDefinition<C>
getDefinition()
Returns applicable property container 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.Collection<C>
getRealValues()
Returns (potentially empty) collection of "real values".PrismContainerValue<C>
getValue()
Returns the value, if there is only one.PrismContainerValue<C>
getValue(Long id)
boolean
isEmpty()
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
setValue(PrismContainerValue<C> value)
String
toString()
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, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.prism.Item
acceptParentVisitor, add, add, add, addAll, addAll, applyDefinition, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkImmutability, clear, contains, contains, contains, containsEquivalentValue, containsEquivalentValue, diff, diff, equals, equals, equals, filterValues, findValue, getAllValues, getAnyValue, getClonedValues, getDisplayName, getElementName, getHelp, getHighestId, getParent, getPath, getPrismContext, getPrismContextLocal, getUserData, getUserData, getValues, hasCompleteDefinition, hashCode, hashCode, hashCode, hasNoValues, hasRaw, isImmutable, isIncomplete, isOperational, isRaw, isSingleValue, merge, modifyUnfrozen, modifyUnfrozen, normalize, recomputeAllValues, remove, remove, removeAll, replace, replaceAll, revive, setElementName, setImmutable, setIncomplete, setParent, setPrismContext, setUserData, size, valuesEqual
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismContainerable
getComplexTypeDefinition
-
-
-
-
Method Detail
-
getCompileTimeClass
@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 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 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>>
-
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>>
-
setValue
void setValue(@NotNull PrismContainerValue<C> value) throws SchemaException
- Throws:
SchemaException
-
getValue
@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
-
getDefinition
PrismContainerDefinition<C> getDefinition()
Returns applicable property container definition.May return null if no definition is applicable or the definition is not know.
- 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 property container definition
-
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)
-
find
Object find(ItemPath path)
Description copied from interface:Item
Returns object (Item or PrismValue) pointed to by the given path.- Specified by:
find
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
-
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>>
-
isEmpty
boolean isEmpty()
- Specified by:
isEmpty
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
-
checkConsistenceInternal
void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
- Specified by:
checkConsistenceInternal
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
-
assertDefinitions
void assertDefinitions(boolean tolarateRaw, String sourceDescription) throws SchemaException
- Specified by:
assertDefinitions
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
- Throws:
SchemaException
-
diff
ContainerDelta<C> diff(PrismContainer<C> other)
-
diff
ContainerDelta<C> diff(PrismContainer<C> other, ParameterizedEquivalenceStrategy strategy)
-
diffModifications
List<? extends ItemDelta> diffModifications(PrismContainer<C> other)
-
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>>
-
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.
-
debugDump
String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
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!
-
-