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:
- Serialized Form
-
-
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, immutable, incomplete, parent, values
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description PrismObjectImpl(QName name, PrismObjectDefinition<O> definition, PrismContext prismContext)
PrismObjectImpl(QName name, Class<O> compileTimeClass)
PrismObjectImpl(QName name, Class<O> compileTimeClass, PrismContext prismContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <I extends Item>
voidaddExtensionItem(I item)
protected boolean
addInternal(@NotNull PrismContainerValue newValue, boolean checkEquivalents, EquivalenceStrategy strategy)
void
addReplaceExisting(Item<?,?> item)
protected void
appendDebugDumpSuffix(StringBuilder sb)
void
applyDefinition(PrismContainerDefinition<O> definition)
O
asObjectable()
static <T extends Objectable>
@NotNull List<T>asObjectableList(@NotNull List<PrismObjectImpl<T>> objects)
void
checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
PrismObject<O>
clone()
Literal clone.PrismObjectImpl<O>
cloneComplex(CloneStrategy strategy)
Complex clone with different cloning strategies.PrismObject<O>
cloneIfImmutable()
protected void
copyValues(CloneStrategy strategy, PrismObjectImpl<O> clone)
ObjectDelta<O>
createAddDelta()
ObjectDelta<O>
createDeleteDelta()
ObjectDelta<O>
createDelta(ChangeType changeType)
PrismContainer<?>
createExtension()
PrismObject<O>
createImmutableClone()
ObjectDelta<O>
createModifyDelta()
PrismObjectValue<O>
createNewValue()
PrismObjectDefinition<O>
deepCloneDefinition(boolean ultraDeep, Consumer<ItemDefinition> postCloneAction)
@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)
String
getBusinessDisplayName()
Return display name intended for business users of midPointprotected String
getDebugDumpClassName()
Return a human readable name of this class suitable for logs.PrismObjectDefinition<O>
getDefinition()
Returns applicable property container definition.PrismContainer<?>
getExtension()
PrismContainerValue<?>
getExtensionContainerValue()
PolyString
getName()
String
getOid()
Returns Object ID (OID).PrismContainer<?>
getOrCreateExtension()
PrismContainerValue<?>
getParent()
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
getPathComponent()
@NotNull PrismObjectValue<O>
getValue()
Returns the value, if there is only one.String
getVersion()
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
performFreeze()
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>>
voidremoveItem(ItemPath path, Class<I> itemType)
void
setOid(String oid)
void
setParent(PrismContainerValue<?> parentValue)
Sets the parent of this item.void
setValue(@NotNull PrismContainerValue<O> value)
void
setVersion(String version)
String
toDebugName()
Returns short string representing identity of this object.String
toDebugType()
Returns short string identification of object type.String
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, 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, getAllValues, 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, getAllValues, getAnyValue, getAnyValue, getClonedValues, getDisplayName, getElementName, getHelp, getHighestId, 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, 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, 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 Detail
-
PrismObjectImpl
public PrismObjectImpl(QName name, Class<O> compileTimeClass, PrismContext prismContext)
-
PrismObjectImpl
public PrismObjectImpl(QName name, PrismObjectDefinition<O> definition, PrismContext prismContext)
-
-
Method Detail
-
createNewValue
public PrismObjectValue<O> 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
@NotNull public @NotNull PrismObjectValue<O> 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
public void setValue(@NotNull @NotNull PrismContainerValue<O> value) throws SchemaException
- 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
public String 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
public void setOid(String oid)
- Specified by:
setOid
in interfacePrismObject<O extends Objectable>
-
getVersion
public String getVersion()
- Specified by:
getVersion
in interfacePrismObject<O extends Objectable>
-
setVersion
public void setVersion(String version)
- Specified by:
setVersion
in interfacePrismObject<O extends Objectable>
-
getDefinition
public PrismObjectDefinition<O> 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
@NotNull public O asObjectable()
- Specified by:
asObjectable
in interfacePrismObject<O extends Objectable>
-
getName
public PolyString getName()
- Specified by:
getName
in interfacePrismObject<O extends Objectable>
-
getExtension
public PrismContainer<?> getExtension()
- Specified by:
getExtension
in interfacePrismObject<O extends Objectable>
-
getOrCreateExtension
public PrismContainer<?> getOrCreateExtension() throws SchemaException
- Specified by:
getOrCreateExtension
in interfacePrismObject<O extends Objectable>
- Throws:
SchemaException
-
getExtensionContainerValue
public PrismContainerValue<?> getExtensionContainerValue()
- Specified by:
getExtensionContainerValue
in interfacePrismObject<O extends Objectable>
-
findExtensionItem
public <I extends Item> I findExtensionItem(String elementLocalName)
- Specified by:
findExtensionItem
in interfacePrismObject<O extends Objectable>
-
findExtensionItem
public <I extends Item> I findExtensionItem(@NotNull @NotNull QName elementName)
- Specified by:
findExtensionItem
in interfacePrismObject<O extends Objectable>
-
addExtensionItem
public <I extends Item> void addExtensionItem(I item) throws SchemaException
- Specified by:
addExtensionItem
in interfacePrismObject<O extends Objectable>
- Throws:
SchemaException
-
createExtension
public PrismContainer<?> createExtension() throws SchemaException
- Specified by:
createExtension
in interfacePrismObject<O extends Objectable>
- Throws:
SchemaException
-
applyDefinition
public void applyDefinition(PrismContainerDefinition<O> definition) throws SchemaException
- 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,I extends Item<IV,ID>> void removeItem(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
public void addReplaceExisting(Item<?,?> item) throws SchemaException
- Specified by:
addReplaceExisting
in interfacePrismObject<O extends Objectable>
- Throws:
SchemaException
-
clone
public PrismObject<O> 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
public PrismObject<O> 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
public PrismObjectImpl<O> cloneComplex(CloneStrategy strategy)
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:
CloneStrategy
-
copyValues
protected void copyValues(CloneStrategy strategy, PrismObjectImpl<O> clone)
-
deepCloneDefinition
public PrismObjectDefinition<O> deepCloneDefinition(boolean ultraDeep, Consumer<ItemDefinition> postCloneAction)
- Specified by:
deepCloneDefinition
in interfacePrismContainer<O extends Objectable>
- Specified by:
deepCloneDefinition
in interfacePrismObject<O extends Objectable>
- Overrides:
deepCloneDefinition
in classPrismContainerImpl<O extends Objectable>
-
diff
@NotNull public @NotNull ObjectDelta<O> diff(PrismObject<O> other)
- 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
public ObjectDelta<O> createDelta(ChangeType changeType)
- Specified by:
createDelta
in interfacePrismObject<O extends Objectable>
-
createAddDelta
public ObjectDelta<O> createAddDelta()
- Specified by:
createAddDelta
in interfacePrismObject<O extends Objectable>
-
createModifyDelta
public ObjectDelta<O> createModifyDelta()
- Specified by:
createModifyDelta
in interfacePrismObject<O extends Objectable>
-
createDeleteDelta
public ObjectDelta<O> createDeleteDelta()
- Specified by:
createDeleteDelta
in interfacePrismObject<O extends Objectable>
-
setParent
public void setParent(PrismContainerValue<?> parentValue)
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
public PrismContainerValue<?> 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
@NotNull public @NotNull ItemPath 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
protected Object getPathComponent()
- Overrides:
getPathComponent
in classItemImpl<PrismContainerValue<O extends Objectable>,PrismContainerDefinition<O extends Objectable>>
-
toString
public String toString()
- Overrides:
toString
in classPrismContainerImpl<O extends Objectable>
-
toDebugName
public String 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
public String 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
protected String getDebugDumpClassName()
Return a human readable name of this class suitable for logs.- Overrides:
getDebugDumpClassName
in classPrismContainerImpl<O extends Objectable>
-
appendDebugDumpSuffix
protected void appendDebugDumpSuffix(StringBuilder sb)
- Overrides:
appendDebugDumpSuffix
in classItemImpl<PrismContainerValue<O extends Objectable>,PrismContainerDefinition<O extends Objectable>>
-
getBusinessDisplayName
public String 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
public PrismObject<O> 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)
-
-