Package com.evolveum.midpoint.prism.impl
Class PrismObjectImpl<O extends Objectable>
java.lang.Object
com.evolveum.midpoint.prism.AbstractFreezable
com.evolveum.midpoint.prism.impl.ItemImpl<PrismContainerValue<C>,PrismContainerDefinition<C>>
com.evolveum.midpoint.prism.impl.PrismContainerImpl<O>
com.evolveum.midpoint.prism.impl.PrismObjectImpl<O>
- All Implemented Interfaces:
Freezable
,Item<PrismContainerValue<O>,
,PrismContainerDefinition<O>> Itemable
,ItemDefinitionTransformer.TransformableItem
,ParentVisitable
,PathVisitable
,PrismContainer<O>
,PrismContainerable<O>
,PrismContextSensitive
,PrismObject<O>
,Revivable
,Visitable
,DebugDumpable
,Serializable
public class PrismObjectImpl<O extends Objectable>
extends PrismContainerImpl<O>
implements PrismObject<O>
Common supertype for all identity objects. Defines basic properties that each
object must have to live in our system (identifier, name).
Objects consists of identifier and name (see definition below) and a set of
properties represented as XML elements in the object's body. The attributes
are represented as first-level XML elements (tags) of the object XML
representation and may be also contained in other tags (e.g. extension,
attributes). The QName (namespace and local name) of the element holding the
property is considered to be a property name.
This class is named PrismObject instead of Object to avoid confusion with
java.lang.Object.
- Author:
- Radovan Semancik Class invariant: has at most one value (potentially empty). When making this object immutable and there's no value, we create one; in order to prevent exceptions on later getValue calls.
- See Also:
-
Field Summary
Fields inherited from class com.evolveum.midpoint.prism.impl.PrismContainerImpl
compileTimeClass
Fields inherited from class com.evolveum.midpoint.prism.impl.ItemImpl
definition, elementName, incomplete, parent, values
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
Constructor Summary
ConstructorDescriptionPrismObjectImpl
(QName name, PrismObjectDefinition<O> definition, PrismContext prismContext) PrismObjectImpl
(QName name, Class<O> compileTimeClass) PrismObjectImpl
(QName name, Class<O> compileTimeClass, PrismContext prismContext) PrismObjectImpl
(QName name, Class<O> compileTimeClass, PrismContext prismContext, PrismObjectValue<O> value) PrismObjectImpl
(QName name, Class<O> compileTimeClass, PrismObjectValue<O> value) -
Method Summary
Modifier and TypeMethodDescription<I extends Item<?,
?>>
voidaddExtensionItem
(I item) protected boolean
addInternal
(@NotNull PrismContainerValue newValue, boolean checkEquivalents, EquivalenceStrategy strategy) void
addReplaceExisting
(Item<?, ?> item) protected void
void
applyDefinition
(PrismContainerDefinition<O> definition) static <T extends Objectable>
@NotNull List<T>asObjectableList
(@NotNull List<PrismObjectImpl<T>> objects) void
checkConsistenceInternal
(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope) clone()
Literal clone.cloneComplex
(CloneStrategy strategy) Complex clone with different cloning strategies.protected void
copyValues
(CloneStrategy strategy, PrismObjectImpl<O> clone) createDelta
(ChangeType changeType) deepCloneDefinition
(@NotNull DeepCloneOperation operation) @NotNull ObjectDelta<O>
diff
(PrismObject<O> other) @NotNull ObjectDelta<O>
diff
(PrismObject<O> other, ParameterizedEquivalenceStrategy strategy) <I extends Item<?,
?>>
IfindExtensionItem
(@NotNull QName elementName) <I extends Item<?,
?>>
IfindExtensionItem
(String elementLocalName) Return display name intended for business users of midPointprotected String
Return a human readable name of this class suitable for logs.Returns applicable property container definition.getName()
getOid()
Returns Object ID (OID).Returns the parent of this item (if exists).@NotNull ItemPath
getPath()
Returns the path of this item (sequence of names from the "root" container or similar object to this item).protected Object
@NotNull PrismObjectValue<O>
getValue()
Returns the value, if there is only one.Collection<? extends ItemDelta<?,
?>> narrowModifications
(Collection<? extends ItemDelta<?, ?>> modifications, @NotNull ParameterizedEquivalenceStrategy plusStrategy, @NotNull ParameterizedEquivalenceStrategy minusStrategy, boolean assumeMissingItems) See description ofItemDelta.narrow(PrismObject, Comparator, Comparator, boolean)
method.void
<IV extends PrismValue,
ID extends ItemDefinition<?>, I extends Item<IV, ID>>
voidremoveItem
(ItemPath path, Class<I> itemType) void
void
setParent
(PrismContainerValue<?> parentValue) Sets the parent of this item.void
setValue
(@NotNull PrismContainerValue<O> value) void
setVersion
(String version) Returns short string representing identity of this object.Returns short string identification of object type.toString()
Methods inherited from class com.evolveum.midpoint.prism.impl.PrismContainerImpl
accept, add, addInternalExecution, assertDefinitions, canRepresent, canRepresent, checkDefinition, containsItem, copyValues, createDelta, createDelta, createParentIfNeeded, debugDump, diff, diff, diffModifications, equivalent, find, findContainer, findContainer, findCreateItem, findCreateItem, findItem, findItem, findItem, findOrCreateContainer, findOrCreateItem, findOrCreateItem, findOrCreateProperty, findOrCreateReference, findPartial, findProperty, findReference, findValue, getAllItems, getAllValues, getCompileTimeClass, getPropertyRealValue, getRealValue, getRealValues, getValue, hasCompleteDefinition, isEmpty, mergeValue, mergeValues, mergeValues, propagateDeepCloneDefinition, remove, removeContainer, removeProperty, removeReference, setContainerRealValue, setDefinition, setPropertyRealValue, setPropertyRealValues, setRealValue, trim, trimDefinitionTree
Methods inherited from class com.evolveum.midpoint.prism.impl.ItemImpl
accept, acceptParentVisitor, add, addAll, addForced, addIgnoringEquivalents, addRespectingMetadataAndCloning, applyDefinition, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistence, clear, copyValues, diff, equals, equals, equals, fixupDelta, getElementName, getHighestId, getPrismContext, getPrismContextLocal, getRealValue, getRealValuesArray, getUserData, getUserData, getValues, hashCode, hashCode, hashCode, isIncomplete, merge, normalize, recomputeAllValues, remove, remove, removeAll, removeRespectingMetadata, replace, replaceAll, revive, setElementName, setIncomplete, setPrismContext, setUserData, transformDefinition, valueRemoved
Methods inherited from class com.evolveum.midpoint.prism.AbstractFreezable
freeze, freeze, freezeAll, freezeNullableList, isImmutable, isMutable
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, addIgnoringEquivalents, addRespectingMetadataAndCloning, applyDefinition, assertDefinitions, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistence, clear, contains, contains, copy, diff, diff, equals, equals, equals, filterValues, filterYields, find, findValue, findValue, getAllItems, getAllValues, getAnyValue, getAnyValue, getClonedValues, getDisplayName, getElementName, getHelp, getHighestId, 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, setPrismContext, setUserData, size, valuesStream
Methods inherited from interface com.evolveum.midpoint.prism.PrismContainer
accept, add, canRepresent, canRepresent, containsItem, createDelta, createDelta, diff, diff, diffModifications, findContainer, findCreateItem, findCreateItem, findItem, findItem, findItem, findOrCreateContainer, findOrCreateItem, findOrCreateItem, findOrCreateProperty, findOrCreateReference, findPartial, findProperty, findReference, findValue, getCompileTimeClass, getPropertyRealValue, getRealValue, getRealValues, getValue, getValues, mergeValue, mergeValues, mergeValues, remove, removeContainer, removeProperty, removeReference, setContainerRealValue, setDefinition, setPropertyRealValue, setPropertyRealValues, setRealValue, trim, trimDefinitionTree
Methods inherited from interface com.evolveum.midpoint.prism.PrismContainerable
getComplexTypeDefinition
Methods inherited from interface com.evolveum.midpoint.prism.PrismContextSensitive
getPrismContext
Methods inherited from interface com.evolveum.midpoint.prism.PrismObject
equivalent, isOfType
-
Constructor Details
-
PrismObjectImpl
-
PrismObjectImpl
-
PrismObjectImpl
public PrismObjectImpl(QName name, Class<O> compileTimeClass, PrismContext prismContext, PrismObjectValue<O> value) -
PrismObjectImpl
-
PrismObjectImpl
-
-
Method Details
-
createNewValue
- Specified by:
createNewValue
in interfacePrismContainer<O extends Objectable>
- Specified by:
createNewValue
in interfacePrismObject<O extends Objectable>
- Overrides:
createNewValue
in classPrismContainerImpl<O extends Objectable>
-
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<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Specified by:
getValue
in interfacePrismContainer<O extends Objectable>
- Specified by:
getValue
in interfacePrismObject<O extends Objectable>
- Overrides:
getValue
in classPrismContainerImpl<O extends Objectable>
-
setValue
- Specified by:
setValue
in interfacePrismContainer<O extends Objectable>
- Specified by:
setValue
in interfacePrismObject<O extends Objectable>
- Overrides:
setValue
in classPrismContainerImpl<O extends Objectable>
- Throws:
SchemaException
-
addInternal
protected boolean addInternal(@NotNull @NotNull PrismContainerValue newValue, boolean checkEquivalents, EquivalenceStrategy strategy) throws SchemaException - Overrides:
addInternal
in classPrismContainerImpl<O extends Objectable>
- Throws:
SchemaException
-
getOid
Returns Object ID (OID). May return null if the object does not have an OID.- Specified by:
getOid
in interfacePrismObject<O extends Objectable>
- Returns:
- Object ID (OID)
-
setOid
- Specified by:
setOid
in interfacePrismObject<O extends Objectable>
-
getVersion
- Specified by:
getVersion
in interfacePrismObject<O extends Objectable>
-
setVersion
- Specified by:
setVersion
in interfacePrismObject<O extends Objectable>
-
getDefinition
Description copied from class:PrismContainerImpl
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<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Specified by:
getDefinition
in interfaceItemable
- Specified by:
getDefinition
in interfacePrismContainer<O extends Objectable>
- Specified by:
getDefinition
in interfacePrismContainerable<O extends Objectable>
- Specified by:
getDefinition
in interfacePrismObject<O extends Objectable>
- Overrides:
getDefinition
in classPrismContainerImpl<O extends Objectable>
- Returns:
- applicable property container definition
-
asObjectable
- Specified by:
asObjectable
in interfacePrismObject<O extends Objectable>
-
getName
- Specified by:
getName
in interfacePrismObject<O extends Objectable>
-
getExtension
- Specified by:
getExtension
in interfacePrismObject<O extends Objectable>
-
getOrCreateExtension
- Specified by:
getOrCreateExtension
in interfacePrismObject<O extends Objectable>
- Throws:
SchemaException
-
getExtensionContainerValue
- Specified by:
getExtensionContainerValue
in interfacePrismObject<O extends Objectable>
-
findExtensionItem
- Specified by:
findExtensionItem
in interfacePrismObject<O extends Objectable>
-
findExtensionItem
- Specified by:
findExtensionItem
in interfacePrismObject<O extends Objectable>
-
addExtensionItem
- Specified by:
addExtensionItem
in interfacePrismObject<O extends Objectable>
- Throws:
SchemaException
-
createExtension
- Specified by:
createExtension
in interfacePrismObject<O extends Objectable>
- Throws:
SchemaException
-
applyDefinition
- Specified by:
applyDefinition
in interfaceItem<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Specified by:
applyDefinition
in interfacePrismContainer<O extends Objectable>
- Specified by:
applyDefinition
in interfacePrismObject<O extends Objectable>
- Overrides:
applyDefinition
in classPrismContainerImpl<O extends Objectable>
- Throws:
SchemaException
-
removeItem
public <IV extends PrismValue,ID extends ItemDefinition<?>, void removeItemI extends Item<IV, ID>> (ItemPath path, Class<I> itemType) - Specified by:
removeItem
in interfacePrismContainer<O extends Objectable>
- Specified by:
removeItem
in interfacePrismObject<O extends Objectable>
- Overrides:
removeItem
in classPrismContainerImpl<O extends Objectable>
-
addReplaceExisting
- Specified by:
addReplaceExisting
in interfacePrismObject<O extends Objectable>
- Throws:
SchemaException
-
clone
Description copied from interface:Item
Literal clone.- Specified by:
clone
in interfaceItem<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Specified by:
clone
in interfacePrismContainer<O extends Objectable>
- Specified by:
clone
in interfacePrismObject<O extends Objectable>
- Overrides:
clone
in classPrismContainerImpl<O extends Objectable>
-
createImmutableClone
- Specified by:
createImmutableClone
in interfaceItem<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Specified by:
createImmutableClone
in interfacePrismContainer<O extends Objectable>
- Specified by:
createImmutableClone
in interfacePrismObject<O extends Objectable>
- Overrides:
createImmutableClone
in classPrismContainerImpl<O extends Objectable>
-
cloneComplex
Description copied from interface:Item
Complex clone with different cloning strategies.- Specified by:
cloneComplex
in interfaceItem<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Specified by:
cloneComplex
in interfacePrismContainer<O extends Objectable>
- Specified by:
cloneComplex
in interfacePrismObject<O extends Objectable>
- Overrides:
cloneComplex
in classPrismContainerImpl<O extends Objectable>
- See Also:
-
copyValues
-
deepCloneDefinition
- Specified by:
deepCloneDefinition
in interfacePrismContainer<O extends Objectable>
- Specified by:
deepCloneDefinition
in interfacePrismObject<O extends Objectable>
- Overrides:
deepCloneDefinition
in classPrismContainerImpl<O extends Objectable>
-
diff
- Specified by:
diff
in interfacePrismObject<O extends Objectable>
-
diff
@NotNull public @NotNull ObjectDelta<O> diff(PrismObject<O> other, ParameterizedEquivalenceStrategy strategy) - Specified by:
diff
in interfacePrismObject<O extends Objectable>
-
narrowModifications
public Collection<? extends ItemDelta<?,?>> narrowModifications(Collection<? extends ItemDelta<?, ?>> modifications, @NotNull @NotNull ParameterizedEquivalenceStrategy plusStrategy, @NotNull @NotNull ParameterizedEquivalenceStrategy minusStrategy, boolean assumeMissingItems) Description copied from interface:PrismObject
See description ofItemDelta.narrow(PrismObject, Comparator, Comparator, boolean)
method.- Specified by:
narrowModifications
in interfacePrismObject<O extends Objectable>
-
createDelta
- Specified by:
createDelta
in interfacePrismObject<O extends Objectable>
-
createAddDelta
- Specified by:
createAddDelta
in interfacePrismObject<O extends Objectable>
-
createModifyDelta
- Specified by:
createModifyDelta
in interfacePrismObject<O extends Objectable>
-
createDeleteDelta
- Specified by:
createDeleteDelta
in interfacePrismObject<O extends Objectable>
-
setParent
Description copied from interface:Item
Sets the parent of this item.- Specified by:
setParent
in interfaceItem<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Specified by:
setParent
in interfacePrismObject<O extends Objectable>
- Overrides:
setParent
in classItemImpl<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Parameters:
parentValue
- The new parent
-
getParent
Description copied from interface:Item
Returns the parent of this item (if exists). Currently this has to be a PrismContainerValue.- Specified by:
getParent
in interfaceItem<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Specified by:
getParent
in interfacePrismObject<O extends Objectable>
- Overrides:
getParent
in classItemImpl<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Returns:
- The parent if exists
-
getPath
Description copied from interface:Item
Returns the path of this item (sequence of names from the "root" container or similar object to this item). Note that if the containing object is a delta (usually a container delta), then the path- Specified by:
getPath
in interfaceItem<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Specified by:
getPath
in interfaceItemable
- Overrides:
getPath
in classItemImpl<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Returns:
- the path
-
getPathComponent
- Overrides:
getPathComponent
in classItemImpl<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>>
-
toString
- Overrides:
toString
in classPrismContainerImpl<O extends Objectable>
-
toDebugName
Returns short string representing identity of this object. It should container object type, OID and name. It should be presented in a form suitable for log and diagnostic messages (understandable for system administrator).- Specified by:
toDebugName
in interfacePrismObject<O extends Objectable>
-
toDebugType
Returns short string identification of object type. It should be in a form suitable for log messages. There is no requirement for the type name to be unique, but it rather has to be compact. E.g. short element names are preferred to long QNames or URIs.- Specified by:
toDebugType
in interfacePrismObject<O extends Objectable>
-
getDebugDumpClassName
Return a human readable name of this class suitable for logs.- Overrides:
getDebugDumpClassName
in classPrismContainerImpl<O extends Objectable>
-
appendDebugDumpSuffix
- Overrides:
appendDebugDumpSuffix
in classItemImpl<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>>
-
getBusinessDisplayName
Return display name intended for business users of midPoint- Specified by:
getBusinessDisplayName
in interfacePrismObject<O extends Objectable>
-
checkConsistenceInternal
public void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope) - Specified by:
checkConsistenceInternal
in interfaceItem<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>> - Overrides:
checkConsistenceInternal
in classPrismContainerImpl<O extends Objectable>
-
performFreeze
public void performFreeze()- Overrides:
performFreeze
in classItemImpl<PrismContainerValue<O extends Objectable>,
PrismContainerDefinition<O extends Objectable>>
-
cloneIfImmutable
- Specified by:
cloneIfImmutable
in interfacePrismObject<O extends Objectable>
-
asObjectableList
@NotNull public static <T extends Objectable> @NotNull List<T> asObjectableList(@NotNull @NotNull List<PrismObjectImpl<T>> objects)
-