Package com.evolveum.midpoint.prism.impl
Class PrismValueImpl
- java.lang.Object
-
- com.evolveum.midpoint.prism.AbstractFreezable
-
- com.evolveum.midpoint.prism.impl.PrismValueImpl
-
- All Implemented Interfaces:
Freezable
,ItemDefinitionTransformer.TransformableValue
,MidpointOriginMetadata
,PathVisitable
,PrismContextSensitive
,PrismValue
,Revivable
,Visitable
,DebugDumpable
,Serializable
- Direct Known Subclasses:
PrismContainerValueImpl
,PrismPropertyValueImpl
,PrismReferenceValueImpl
public abstract class PrismValueImpl extends AbstractFreezable implements PrismValue, ItemDefinitionTransformer.TransformableValue
- Author:
- semancik
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected EquivalenceStrategy
defaultEquivalenceStrategy
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
accept(Visitor visitor)
void
accept(Visitor visitor, ItemPath path, boolean recursive)
protected void
appendOriginDump(StringBuilder builder)
void
applyDefinition(ItemDefinition definition)
void
applyDefinition(ItemDefinition definition, boolean force)
abstract void
checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
void
clearParent()
Used when we are removing the value from the previous parent.abstract PrismValue
clone()
Literal clone.abstract PrismValue
cloneComplex(CloneStrategy strategy)
Complex clone with different cloning strategies.protected void
copyValues(CloneStrategy strategy, PrismValueImpl clone)
PrismValue
createImmutableClone()
Collection<? extends ItemDelta>
diff(PrismValue otherValue, ParameterizedEquivalenceStrategy strategy)
Assumes matching representations.void
diffMatchingRepresentation(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy)
boolean
diffMatchingRepresentation(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy, boolean exitOnDiff)
boolean
equals(PrismValue otherValue, @NotNull EquivalenceStrategy equivalenceStrategy)
boolean
equals(PrismValue other, @NotNull ParameterizedEquivalenceStrategy strategy)
boolean
equals(Object other)
@NotNull Collection<PrismValue>
getAllValues(ItemPath path)
protected ItemDefinition
getDefinition()
Objectable
getOriginObject()
OriginType
getOriginType()
Itemable
getParent()
PrismContainerValue<?>
getParentContainerValue()
@NotNull ItemPath
getPath()
protected Object
getPathComponent()
PrismContext
getPrismContext()
abstract @Nullable Class<?>
getRealClass()
abstract <T> T
getRealValue()
PrismValue
getRootValue()
QName
getTypeName()
Map<String,Object>
getUserData()
Object
getUserData(@NotNull String key)
@NotNull ValueMetadata
getValueMetadata()
Maybe it is better to expect empty value metadata if these are absent.int
hashCode()
int
hashCode(@NotNull EquivalenceStrategy equivalenceStrategy)
int
hashCode(@NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)
boolean
hasValueMetadata()
boolean
isTransient()
void
normalize()
Currently doing nothing.protected void
performFreeze()
void
recompute()
Recompute the value or otherwise "initialize" it before adding it to a prism tree.abstract void
recompute(PrismContext prismContext)
boolean
representsSameValue(PrismValue other, boolean lax)
Returns true if this and other value represent the same value.void
revive(PrismContext prismContext)
void
setOriginObject(Objectable source)
void
setOriginType(OriginType type)
void
setParent(Itemable parent)
void
setPrismContext(PrismContext prismContext)
void
setTransient(boolean value)
void
setUserData(@NotNull String key, Object value)
void
setValueMetadata(Containerable realValue)
Sets metadata from this value (from PCV).void
setValueMetadata(PrismContainer<?> valueMetadataContainer)
Sets metadata for this value.void
setValueMetadata(ValueMetadata valueMetadata)
Sets metadata for this value.abstract String
toHumanReadableString()
-
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, toString, 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.ItemDefinitionTransformer.TransformableValue
transformDefinition
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismValue
find, getRealValueOrRawType, getValueMetadataAsContainer, hasRealClass, isEmpty, isRaw, valueMetadata
-
-
-
-
Field Detail
-
defaultEquivalenceStrategy
protected EquivalenceStrategy defaultEquivalenceStrategy
-
-
Method Detail
-
setPrismContext
public void setPrismContext(PrismContext prismContext)
- Specified by:
setPrismContext
in interfacePrismValue
-
setOriginObject
public void setOriginObject(Objectable source)
- Specified by:
setOriginObject
in interfaceMidpointOriginMetadata
-
setOriginType
public void setOriginType(OriginType type)
- Specified by:
setOriginType
in interfaceMidpointOriginMetadata
-
getOriginType
public OriginType getOriginType()
- Specified by:
getOriginType
in interfaceMidpointOriginMetadata
-
getOriginObject
public Objectable getOriginObject()
- Specified by:
getOriginObject
in interfaceMidpointOriginMetadata
-
getUserData
public Map<String,Object> getUserData()
- Specified by:
getUserData
in interfacePrismValue
-
getUserData
public Object getUserData(@NotNull @NotNull String key)
- Specified by:
getUserData
in interfacePrismValue
-
setUserData
public void setUserData(@NotNull @NotNull String key, Object value)
- Specified by:
setUserData
in interfacePrismValue
-
getParent
public Itemable getParent()
- Specified by:
getParent
in interfacePrismValue
-
setParent
public void setParent(Itemable parent)
- Specified by:
setParent
in interfacePrismValue
-
getPath
@NotNull public @NotNull ItemPath getPath()
- Specified by:
getPath
in interfacePrismValue
-
getPathComponent
protected Object getPathComponent()
-
clearParent
public void clearParent()
Used when we are removing the value from the previous parent. Or when we know that the previous parent will be discarded and we want to avoid unnecessary cloning.- Specified by:
clearParent
in interfacePrismValue
-
getPrismContext
public PrismContext getPrismContext()
- Specified by:
getPrismContext
in interfacePrismContextSensitive
-
getDefinition
protected ItemDefinition getDefinition()
-
applyDefinition
public void applyDefinition(ItemDefinition definition) throws SchemaException
- Specified by:
applyDefinition
in interfacePrismValue
- Throws:
SchemaException
-
applyDefinition
public void applyDefinition(ItemDefinition definition, boolean force) throws SchemaException
- Specified by:
applyDefinition
in interfacePrismValue
- Throws:
SchemaException
-
revive
public void revive(PrismContext prismContext) throws SchemaException
- Specified by:
revive
in interfaceRevivable
- Throws:
SchemaException
-
recompute
public void recompute()
Recompute the value or otherwise "initialize" it before adding it to a prism tree. This may as well do nothing if no recomputing or initialization is needed.- Specified by:
recompute
in interfacePrismValue
-
recompute
public abstract void recompute(PrismContext prismContext)
- Specified by:
recompute
in interfacePrismValue
-
accept
public void accept(Visitor visitor)
- Specified by:
accept
in interfacePrismValue
- Specified by:
accept
in interfaceVisitable
-
accept
public void accept(Visitor visitor, ItemPath path, boolean recursive)
- Specified by:
accept
in interfacePathVisitable
- Specified by:
accept
in interfacePrismValue
-
checkConsistenceInternal
public abstract void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
- Specified by:
checkConsistenceInternal
in interfacePrismValue
-
representsSameValue
public boolean representsSameValue(PrismValue other, boolean lax)
Description copied from interface:PrismValue
Returns true if this and other value represent the same value. E.g. if they have the same IDs, OIDs or it is otherwise know that they "belong together" without a deep examination of the values.- Specified by:
representsSameValue
in interfacePrismValue
lax
- If we can reasonably assume that the two values belong together even if they don't have the same ID, e.g. if they both belong to single-valued parent items. This is useful e.g. when comparing multi-valued containers. But can cause problems when we want to be sure we are removing the correct value.
-
normalize
public void normalize()
Description copied from interface:PrismValue
Currently doing nothing.- Specified by:
normalize
in interfacePrismValue
-
clone
public abstract PrismValue clone()
Literal clone.- Specified by:
clone
in interfacePrismValue
- Overrides:
clone
in classObject
-
createImmutableClone
public PrismValue createImmutableClone()
- Specified by:
createImmutableClone
in interfacePrismValue
-
cloneComplex
public abstract PrismValue cloneComplex(CloneStrategy strategy)
Complex clone with different cloning strategies.- Specified by:
cloneComplex
in interfacePrismValue
- See Also:
CloneStrategy
-
copyValues
protected void copyValues(CloneStrategy strategy, PrismValueImpl clone)
-
hashCode
public int hashCode(@NotNull @NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)
- Specified by:
hashCode
in interfacePrismValue
-
hashCode
public int hashCode(@NotNull @NotNull EquivalenceStrategy equivalenceStrategy)
- Specified by:
hashCode
in interfacePrismValue
-
equals
public boolean equals(PrismValue otherValue, @NotNull @NotNull EquivalenceStrategy equivalenceStrategy)
- Specified by:
equals
in interfacePrismValue
-
equals
public boolean equals(PrismValue other, @NotNull @NotNull ParameterizedEquivalenceStrategy strategy)
- Specified by:
equals
in interfacePrismValue
-
diff
public Collection<? extends ItemDelta> diff(PrismValue otherValue, ParameterizedEquivalenceStrategy strategy)
Assumes matching representations. I.e. it assumes that both this and otherValue represent the same instance of item. E.g. the container with the same ID.- Specified by:
diff
in interfacePrismValue
-
diffMatchingRepresentation
public final void diffMatchingRepresentation(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy)
-
diffMatchingRepresentation
public boolean diffMatchingRepresentation(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy, boolean exitOnDiff)
-
appendOriginDump
protected void appendOriginDump(StringBuilder builder)
-
toHumanReadableString
public abstract String toHumanReadableString()
- Specified by:
toHumanReadableString
in interfacePrismValue
-
getRealClass
@Nullable public abstract @Nullable Class<?> getRealClass()
- Specified by:
getRealClass
in interfacePrismValue
-
getRealValue
@Nullable public abstract <T> T getRealValue()
- Specified by:
getRealValue
in interfacePrismValue
-
getRootValue
public PrismValue getRootValue()
- Specified by:
getRootValue
in interfacePrismValue
-
getParentContainerValue
public PrismContainerValue<?> getParentContainerValue()
- Specified by:
getParentContainerValue
in interfacePrismValue
-
getTypeName
public QName getTypeName()
- Specified by:
getTypeName
in interfacePrismValue
-
getAllValues
@NotNull public @NotNull Collection<PrismValue> getAllValues(ItemPath path)
- Specified by:
getAllValues
in interfacePrismValue
-
getValueMetadata
@NotNull public @NotNull ValueMetadata getValueMetadata()
Description copied from interface:PrismValue
Maybe it is better to expect empty value metadata if these are absent. Client code would be simpler. HIGHLY EXPERIMENTAL.- Specified by:
getValueMetadata
in interfacePrismValue
-
hasValueMetadata
public boolean hasValueMetadata()
- Specified by:
hasValueMetadata
in interfacePrismValue
- Returns:
- True if this value has any metadata (i.e. the metadata container has any value). TODO Or should we accept only non-empty values? Probably not.
-
setValueMetadata
public void setValueMetadata(ValueMetadata valueMetadata)
Description copied from interface:PrismValue
Sets metadata for this value.- Specified by:
setValueMetadata
in interfacePrismValue
-
setValueMetadata
public void setValueMetadata(PrismContainer<?> valueMetadataContainer)
Description copied from interface:PrismValue
Sets metadata for this value.- Specified by:
setValueMetadata
in interfacePrismValue
-
setValueMetadata
public void setValueMetadata(Containerable realValue) throws SchemaException
Description copied from interface:PrismValue
Sets metadata from this value (from PCV). To be removed (most probably).- Specified by:
setValueMetadata
in interfacePrismValue
- Throws:
SchemaException
-
performFreeze
protected void performFreeze()
- Overrides:
performFreeze
in classAbstractFreezable
-
isTransient
public boolean isTransient()
- Specified by:
isTransient
in interfacePrismValue
- Returns:
- True if the value is transient, so it won't be serialized if serialization of transient value is disabled.
-
setTransient
public void setTransient(boolean value)
- Specified by:
setTransient
in interfacePrismValue
-
-