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 EquivalenceStrategydefaultEquivalenceStrategy-
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 voidaccept(Visitor visitor)voidaccept(Visitor visitor, ItemPath path, boolean recursive)protected voidappendOriginDump(StringBuilder builder)voidapplyDefinition(ItemDefinition definition)voidapplyDefinition(ItemDefinition definition, boolean force)abstract voidcheckConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)voidclearParent()Used when we are removing the value from the previous parent.abstract PrismValueclone()Literal clone.abstract PrismValuecloneComplex(CloneStrategy strategy)Complex clone with different cloning strategies.protected voidcopyValues(CloneStrategy strategy, PrismValueImpl clone)PrismValuecreateImmutableClone()Collection<? extends ItemDelta>diff(PrismValue otherValue, ParameterizedEquivalenceStrategy strategy)Assumes matching representations.voiddiffMatchingRepresentation(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy)booleandiffMatchingRepresentation(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy, boolean exitOnDiff)booleanequals(PrismValue otherValue, @NotNull EquivalenceStrategy equivalenceStrategy)booleanequals(PrismValue other, @NotNull ParameterizedEquivalenceStrategy strategy)booleanequals(Object other)@NotNull Collection<PrismValue>getAllValues(ItemPath path)protected ItemDefinitiongetDefinition()ObjectablegetOriginObject()OriginTypegetOriginType()ItemablegetParent()PrismContainerValue<?>getParentContainerValue()@NotNull ItemPathgetPath()protected ObjectgetPathComponent()PrismContextgetPrismContext()abstract @Nullable Class<?>getRealClass()abstract <T> TgetRealValue()PrismValuegetRootValue()QNamegetTypeName()Map<String,Object>getUserData()ObjectgetUserData(@NotNull String key)@NotNull ValueMetadatagetValueMetadata()Maybe it is better to expect empty value metadata if these are absent.inthashCode()inthashCode(@NotNull EquivalenceStrategy equivalenceStrategy)inthashCode(@NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)booleanhasValueMetadata()booleanisTransient()voidnormalize()Currently doing nothing.protected voidperformFreeze()voidrecompute()Recompute the value or otherwise "initialize" it before adding it to a prism tree.abstract voidrecompute(PrismContext prismContext)booleanrepresentsSameValue(PrismValue other, boolean lax)Returns true if this and other value represent the same value.voidrevive(PrismContext prismContext)voidsetOriginObject(Objectable source)voidsetOriginType(OriginType type)voidsetParent(Itemable parent)voidsetPrismContext(PrismContext prismContext)voidsetTransient(boolean value)voidsetUserData(@NotNull String key, Object value)voidsetValueMetadata(Containerable realValue)Sets metadata from this value (from PCV).voidsetValueMetadata(PrismContainer<?> valueMetadataContainer)Sets metadata for this value.voidsetValueMetadata(ValueMetadata valueMetadata)Sets metadata for this value.abstract StringtoHumanReadableString()-
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:
setPrismContextin interfacePrismValue
-
setOriginObject
public void setOriginObject(Objectable source)
- Specified by:
setOriginObjectin interfaceMidpointOriginMetadata
-
setOriginType
public void setOriginType(OriginType type)
- Specified by:
setOriginTypein interfaceMidpointOriginMetadata
-
getOriginType
public OriginType getOriginType()
- Specified by:
getOriginTypein interfaceMidpointOriginMetadata
-
getOriginObject
public Objectable getOriginObject()
- Specified by:
getOriginObjectin interfaceMidpointOriginMetadata
-
getUserData
public Map<String,Object> getUserData()
- Specified by:
getUserDatain interfacePrismValue
-
getUserData
public Object getUserData(@NotNull @NotNull String key)
- Specified by:
getUserDatain interfacePrismValue
-
setUserData
public void setUserData(@NotNull @NotNull String key, Object value)- Specified by:
setUserDatain interfacePrismValue
-
getParent
public Itemable getParent()
- Specified by:
getParentin interfacePrismValue
-
setParent
public void setParent(Itemable parent)
- Specified by:
setParentin interfacePrismValue
-
getPath
@NotNull public @NotNull ItemPath getPath()
- Specified by:
getPathin 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:
clearParentin interfacePrismValue
-
getPrismContext
public PrismContext getPrismContext()
- Specified by:
getPrismContextin interfacePrismContextSensitive
-
getDefinition
protected ItemDefinition getDefinition()
-
applyDefinition
public void applyDefinition(ItemDefinition definition) throws SchemaException
- Specified by:
applyDefinitionin interfacePrismValue- Throws:
SchemaException
-
applyDefinition
public void applyDefinition(ItemDefinition definition, boolean force) throws SchemaException
- Specified by:
applyDefinitionin interfacePrismValue- Throws:
SchemaException
-
revive
public void revive(PrismContext prismContext) throws SchemaException
- Specified by:
revivein 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:
recomputein interfacePrismValue
-
recompute
public abstract void recompute(PrismContext prismContext)
- Specified by:
recomputein interfacePrismValue
-
accept
public void accept(Visitor visitor)
- Specified by:
acceptin interfacePrismValue- Specified by:
acceptin interfaceVisitable
-
accept
public void accept(Visitor visitor, ItemPath path, boolean recursive)
- Specified by:
acceptin interfacePathVisitable- Specified by:
acceptin interfacePrismValue
-
checkConsistenceInternal
public abstract void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
- Specified by:
checkConsistenceInternalin interfacePrismValue
-
representsSameValue
public boolean representsSameValue(PrismValue other, boolean lax)
Description copied from interface:PrismValueReturns 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:
representsSameValuein interfacePrismValuelax- 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:PrismValueCurrently doing nothing.- Specified by:
normalizein interfacePrismValue
-
clone
public abstract PrismValue clone()
Literal clone.- Specified by:
clonein interfacePrismValue- Overrides:
clonein classObject
-
createImmutableClone
public PrismValue createImmutableClone()
- Specified by:
createImmutableClonein interfacePrismValue
-
cloneComplex
public abstract PrismValue cloneComplex(CloneStrategy strategy)
Complex clone with different cloning strategies.- Specified by:
cloneComplexin interfacePrismValue- See Also:
CloneStrategy
-
copyValues
protected void copyValues(CloneStrategy strategy, PrismValueImpl clone)
-
hashCode
public int hashCode(@NotNull @NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)- Specified by:
hashCodein interfacePrismValue
-
hashCode
public int hashCode(@NotNull @NotNull EquivalenceStrategy equivalenceStrategy)- Specified by:
hashCodein interfacePrismValue
-
equals
public boolean equals(PrismValue otherValue, @NotNull @NotNull EquivalenceStrategy equivalenceStrategy)
- Specified by:
equalsin interfacePrismValue
-
equals
public boolean equals(PrismValue other, @NotNull @NotNull ParameterizedEquivalenceStrategy strategy)
- Specified by:
equalsin 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:
diffin 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:
toHumanReadableStringin interfacePrismValue
-
getRealClass
@Nullable public abstract @Nullable Class<?> getRealClass()
- Specified by:
getRealClassin interfacePrismValue
-
getRealValue
@Nullable public abstract <T> T getRealValue()
- Specified by:
getRealValuein interfacePrismValue
-
getRootValue
public PrismValue getRootValue()
- Specified by:
getRootValuein interfacePrismValue
-
getParentContainerValue
public PrismContainerValue<?> getParentContainerValue()
- Specified by:
getParentContainerValuein interfacePrismValue
-
getTypeName
public QName getTypeName()
- Specified by:
getTypeNamein interfacePrismValue
-
getAllValues
@NotNull public @NotNull Collection<PrismValue> getAllValues(ItemPath path)
- Specified by:
getAllValuesin interfacePrismValue
-
getValueMetadata
@NotNull public @NotNull ValueMetadata getValueMetadata()
Description copied from interface:PrismValueMaybe it is better to expect empty value metadata if these are absent. Client code would be simpler. HIGHLY EXPERIMENTAL.- Specified by:
getValueMetadatain interfacePrismValue
-
hasValueMetadata
public boolean hasValueMetadata()
- Specified by:
hasValueMetadatain 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:PrismValueSets metadata for this value.- Specified by:
setValueMetadatain interfacePrismValue
-
setValueMetadata
public void setValueMetadata(PrismContainer<?> valueMetadataContainer)
Description copied from interface:PrismValueSets metadata for this value.- Specified by:
setValueMetadatain interfacePrismValue
-
setValueMetadata
public void setValueMetadata(Containerable realValue) throws SchemaException
Description copied from interface:PrismValueSets metadata from this value (from PCV). To be removed (most probably).- Specified by:
setValueMetadatain interfacePrismValue- Throws:
SchemaException
-
performFreeze
protected void performFreeze()
- Overrides:
performFreezein classAbstractFreezable
-
isTransient
public boolean isTransient()
- Specified by:
isTransientin 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:
setTransientin interfacePrismValue
-
-