Class DummyContainerImpl<C extends Containerable>
- java.lang.Object
-
- com.evolveum.midpoint.prism.impl.item.DummyItem<PrismContainerValue<C>,PrismContainerDefinition<C>,PrismContainer<C>>
-
- com.evolveum.midpoint.prism.impl.item.DummyContainerImpl<C>
-
- All Implemented Interfaces:
Freezable
,Item<PrismContainerValue<C>,PrismContainerDefinition<C>>
,Itemable
,ParentVisitable
,PathVisitable
,PrismContainer<C>
,PrismContainerable<C>
,PrismContextSensitive
,Revivable
,Visitable
,DebugDumpable
,Serializable
public class DummyContainerImpl<C extends Containerable> extends DummyItem<PrismContainerValue<C>,PrismContainerDefinition<C>,PrismContainer<C>> implements PrismContainer<C>
- Author:
- semancik
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description DummyContainerImpl(PrismContainer<C> realContainer, @NotNull ItemPath path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Item<?,?> item)
Convenience method.void
addIgnoringEquivalents(@NotNull PrismContainerValue<C> newValue)
Adds a value, not looking for equivalent values.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()
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)
Class<C>
getCompileTimeClass()
Returns the static type of data represented by values of this container, if known and applicable.String
getHelp()
Returns help message defined for the item.<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.<X> X
getRealValue(Class<X> type)
Type override, also for compatibility.@NotNull Collection<C>
getRealValues()
Returns (potentially empty) collection of "real values".<X> X[]
getRealValuesArray(Class<X> type)
Type override, also for compatibility.@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)
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)
<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 class com.evolveum.midpoint.prism.impl.item.DummyItem
accept, accept, acceptParentVisitor, add, addAll, addRespectingMetadataAndCloning, applyDefinition, applyDefinition, assertDefinitions, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistenceInternal, clear, debugDump, delegate, diff, equals, equals, equals, find, freeze, getAllValues, getDefinition, getDisplayName, getElementName, getHighestId, getParent, getPath, getPrismContext, getPrismContextLocal, getUserData, getUserData, getValues, hasCompleteDefinition, hashCode, hashCode, hashCode, isEmpty, isImmutable, isIncomplete, merge, normalize, recomputeAllValues, remove, removeAll, removeRespectingMetadata, replace, replaceAll, revive, setDefinition, setElementName, setIncomplete, setParent, setPrismContext, setUserData, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
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, 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, getAllValues, getAnyValue, getAnyValue, getClonedValues, getDisplayName, getElementName, getHighestId, getParent, getPath, getPrismContextLocal, 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.PrismContainer
accept, applyDefinition, getDefinition, setDefinition
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismContainerable
getComplexTypeDefinition
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismContextSensitive
getPrismContext
-
-
-
-
Constructor Detail
-
DummyContainerImpl
public DummyContainerImpl(PrismContainer<C> realContainer, @NotNull @NotNull ItemPath path)
-
-
Method Detail
-
getCompileTimeClass
public Class<C> getCompileTimeClass()
Description copied from interface:PrismContainer
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 interfacePrismContainer<C extends Containerable>
- Specified by:
getCompileTimeClass
in interfacePrismContainerable<C extends Containerable>
-
canRepresent
public boolean canRepresent(@NotNull @NotNull Class<?> compileTimeClass)
Description copied from interface:PrismContainer
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- Specified by:
canRepresent
in interfacePrismContainer<C extends Containerable>
-
canRepresent
public boolean canRepresent(QName type)
Description copied from interface:PrismContainer
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.- Specified by:
canRepresent
in interfacePrismContainer<C extends Containerable>
-
getRealValues
@NotNull public @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>>
- Specified by:
getRealValues
in interfacePrismContainer<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.
-
addIgnoringEquivalents
public void addIgnoringEquivalents(@NotNull @NotNull PrismContainerValue<C> newValue) throws SchemaException
Description copied from interface:Item
Adds a value, not looking for equivalent values. (This means that the new value is always added, if possible.) Note that we check the cardinality of the item according to its definition, i.e. we do not allow single-valued item to contain more than one value.- Specified by:
addIgnoringEquivalents
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
- Throws:
SchemaException
-
getRealValue
@NotNull public 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>>
- Specified by:
getRealValue
in interfacePrismContainer<C extends Containerable>
-
setRealValue
public void setRealValue(C value) throws SchemaException
- Specified by:
setRealValue
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
getRealValue
public <X> X getRealValue(Class<X> type)
Description copied from interface:Item
Type override, also for compatibility.- Specified by:
getRealValue
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
-
getRealValuesArray
public <X> X[] getRealValuesArray(Class<X> type)
Description copied from interface:Item
Type override, also for compatibility.- Specified by:
getRealValuesArray
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
-
setValue
public void setValue(@NotNull @NotNull PrismContainerValue<C> value) throws SchemaException
- Specified by:
setValue
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
getValue
@NotNull public @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>>
- Specified by:
getValue
in interfacePrismContainer<C extends Containerable>
-
getValue
public PrismContainerValue<C> getValue(Long id)
- Specified by:
getValue
in interfacePrismContainer<C extends Containerable>
-
setPropertyRealValue
public <T> void setPropertyRealValue(QName propertyName, T realValue) throws SchemaException
- Specified by:
setPropertyRealValue
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
getHelp
public String getHelp()
Description copied from interface:Item
Returns help message defined for the item.Returns null if the help message cannot be determined.
The help message is fetched from the definition. If no definition (schema) is available, the help message will not be returned.
- Specified by:
getHelp
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
- Returns:
- help message for the item
-
setContainerRealValue
public <C extends Containerable> void setContainerRealValue(QName containerName, C realValue) throws SchemaException
- Specified by:
setContainerRealValue
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
setPropertyRealValues
public <T> void setPropertyRealValues(QName propertyName, T... realValues) throws SchemaException
- Specified by:
setPropertyRealValues
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
getPropertyRealValue
public <T> T getPropertyRealValue(ItemPath propertyPath, Class<T> type)
- Specified by:
getPropertyRealValue
in interfacePrismContainer<C extends Containerable>
-
add
public void add(Item<?,?> item) throws SchemaException
Description copied from interface:PrismContainer
Convenience method. Works only on single-valued containers.- Specified by:
add
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
createNewValue
public PrismContainerValue<C> createNewValue()
- Specified by:
createNewValue
in interfacePrismContainer<C extends Containerable>
-
mergeValues
public void mergeValues(PrismContainer<C> other) throws SchemaException
- Specified by:
mergeValues
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
mergeValues
public void mergeValues(Collection<PrismContainerValue<C>> otherValues) throws SchemaException
- Specified by:
mergeValues
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
mergeValue
public void mergeValue(PrismContainerValue<C> otherValue) throws SchemaException
- Specified by:
mergeValue
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
trim
public void trim()
Description copied from interface:PrismContainer
Remove all empty values- Specified by:
trim
in interfacePrismContainer<C extends Containerable>
-
findItem
public <IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findItem(QName itemQName, Class<I> type)
- Specified by:
findItem
in interfacePrismContainer<C extends Containerable>
-
findPartial
public <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>>
- Specified by:
findPartial
in interfacePrismContainer<C extends Containerable>
-
findCreateItem
public <IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findCreateItem(QName itemQName, Class<I> type, boolean create) throws SchemaException
- Specified by:
findCreateItem
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
findItem
public <IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findItem(ItemPath path, Class<I> type)
- Specified by:
findItem
in interfacePrismContainer<C extends Containerable>
-
findItem
public <IV extends PrismValue,ID extends ItemDefinition> Item<IV,ID> findItem(ItemPath path)
- Specified by:
findItem
in interfacePrismContainer<C extends Containerable>
-
containsItem
public boolean containsItem(ItemPath itemPath, boolean acceptEmptyItem) throws SchemaException
- Specified by:
containsItem
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
findCreateItem
public <IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findCreateItem(ItemPath itemPath, Class<I> type, ID itemDefinition, boolean create) throws SchemaException
- Specified by:
findCreateItem
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
findValue
public PrismContainerValue<C> findValue(long id)
- Specified by:
findValue
in interfacePrismContainer<C extends Containerable>
-
findContainer
public <T extends Containerable> PrismContainer<T> findContainer(ItemPath path)
- Specified by:
findContainer
in interfacePrismContainer<C extends Containerable>
-
findProperty
public <T> PrismProperty<T> findProperty(ItemPath path)
- Specified by:
findProperty
in interfacePrismContainer<C extends Containerable>
-
findReference
public PrismReference findReference(ItemPath path)
- Specified by:
findReference
in interfacePrismContainer<C extends Containerable>
-
findOrCreateItem
public <IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findOrCreateItem(ItemPath containerPath, Class<I> type) throws SchemaException
- Specified by:
findOrCreateItem
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
findOrCreateItem
public <IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findOrCreateItem(ItemPath containerPath, Class<I> type, ID definition) throws SchemaException
- Specified by:
findOrCreateItem
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
findOrCreateContainer
public <T extends Containerable> PrismContainer<T> findOrCreateContainer(ItemPath containerPath) throws SchemaException
- Specified by:
findOrCreateContainer
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
findOrCreateProperty
public <T> PrismProperty<T> findOrCreateProperty(ItemPath propertyPath) throws SchemaException
- Specified by:
findOrCreateProperty
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
findOrCreateReference
public PrismReference findOrCreateReference(ItemPath propertyPath) throws SchemaException
- Specified by:
findOrCreateReference
in interfacePrismContainer<C extends Containerable>
- Throws:
SchemaException
-
remove
public void remove(Item<?,?> item)
Description copied from interface:PrismContainer
Convenience method. Works only on single-valued containers.- Specified by:
remove
in interfacePrismContainer<C extends Containerable>
-
removeProperty
public void removeProperty(ItemPath path)
- Specified by:
removeProperty
in interfacePrismContainer<C extends Containerable>
-
removeContainer
public void removeContainer(ItemPath path)
- Specified by:
removeContainer
in interfacePrismContainer<C extends Containerable>
-
removeReference
public void removeReference(ItemPath path)
- Specified by:
removeReference
in interfacePrismContainer<C extends Containerable>
-
removeItem
public <IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> void removeItem(ItemPath path, Class<I> itemType)
- Specified by:
removeItem
in interfacePrismContainer<C extends Containerable>
-
createDelta
public 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>>
- Specified by:
createDelta
in interfacePrismContainer<C extends Containerable>
-
createDelta
public ContainerDelta<C> createDelta(ItemPath path)
- Specified by:
createDelta
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
- Specified by:
createDelta
in interfacePrismContainer<C extends Containerable>
-
diff
public ContainerDelta<C> diff(PrismContainer<C> other)
- Specified by:
diff
in interfacePrismContainer<C extends Containerable>
-
diff
public ContainerDelta<C> diff(PrismContainer<C> other, ParameterizedEquivalenceStrategy strategy)
- Specified by:
diff
in interfacePrismContainer<C extends Containerable>
-
diffModifications
public List<? extends ItemDelta> diffModifications(PrismContainer<C> other, ParameterizedEquivalenceStrategy strategy)
- Specified by:
diffModifications
in interfacePrismContainer<C extends Containerable>
-
createImmutableClone
public PrismContainer<C> createImmutableClone()
- Specified by:
createImmutableClone
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
- Specified by:
createImmutableClone
in interfacePrismContainer<C extends Containerable>
-
deepCloneDefinition
public PrismContainerDefinition<C> deepCloneDefinition(boolean ultraDeep, Consumer<ItemDefinition> postCloneAction)
- Specified by:
deepCloneDefinition
in interfacePrismContainer<C extends Containerable>
-
equivalent
public boolean equivalent(Object obj)
Description copied from interface:PrismContainer
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.- Specified by:
equivalent
in interfacePrismContainer<C extends Containerable>
-
clone
public PrismContainer<C> clone()
Description copied from interface:Item
Literal clone.- Specified by:
clone
in interfaceItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>>
- Specified by:
clone
in interfacePrismContainer<C extends Containerable>
- Specified by:
clone
in classDummyItem<PrismContainerValue<C extends Containerable>,PrismContainerDefinition<C extends Containerable>,PrismContainer<C extends Containerable>>
-
cloneComplex
public 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>>
- Specified by:
cloneComplex
in interfacePrismContainer<C extends Containerable>
- See Also:
CloneStrategy
-
trimDefinitionTree
public void trimDefinitionTree(Collection<? extends ItemPath> alwaysKeep)
Description copied from interface:PrismContainer
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!- Specified by:
trimDefinitionTree
in interfacePrismContainer<C extends Containerable>
-
-