Package com.evolveum.midpoint.prism.impl
Class PrismReferenceValueImpl
- java.lang.Object
-
- com.evolveum.midpoint.prism.AbstractFreezable
-
- com.evolveum.midpoint.prism.impl.PrismValueImpl
-
- com.evolveum.midpoint.prism.impl.PrismReferenceValueImpl
-
- All Implemented Interfaces:
Freezable
,ItemDefinitionTransformer.TransformableValue
,MidpointOriginMetadata
,PathVisitable
,PrismContextSensitive
,PrismReferenceValue
,PrismValue
,Revivable
,Visitable
,DebugDumpable
,ShortDumpable
,Serializable
public class PrismReferenceValueImpl extends PrismValueImpl implements PrismReferenceValue
- Author:
- Radovan Semancik
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.evolveum.midpoint.prism.impl.PrismValueImpl
defaultEquivalenceStrategy
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description PrismReferenceValueImpl()
PrismReferenceValueImpl(String oid)
PrismReferenceValueImpl(String oid, OriginType type, Objectable source)
PrismReferenceValueImpl(String oid, QName targetType)
-
Method Summary
-
Methods inherited from class com.evolveum.midpoint.prism.impl.PrismValueImpl
accept, appendOriginDump, applyDefinition, clearParent, copyValues, diff, diffMatchingRepresentation, diffMatchingRepresentation, equals, equals, getAllValues, getOriginObject, getOriginType, getParent, getParentContainerValue, getPath, getPathComponent, getPrismContext, getRootValue, getTypeName, getUserData, getUserData, getValueMetadata, hashCode, hashCode, hasValueMetadata, isTransient, normalize, performFreeze, recompute, representsSameValue, setOriginObject, setOriginType, setParent, setPrismContext, setTransient, setUserData, setValueMetadata, setValueMetadata, setValueMetadata
-
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
debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.prism.Freezable
checkImmutable, checkMutable, freeze, isImmutable
-
Methods inherited from interface com.evolveum.midpoint.prism.metadata.MidpointOriginMetadata
getOriginObject, getOriginType, setOriginObject, setOriginType
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismContextSensitive
getPrismContext
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismValue
accept, applyDefinition, clearParent, diff, equals, getAllValues, getParent, getParentContainerValue, getPath, getRealValueOrRawType, getRootValue, getTypeName, getUserData, getUserData, getValueMetadata, getValueMetadataAsContainer, hashCode, hasRealClass, hasValueMetadata, isTransient, normalize, recompute, representsSameValue, setParent, setPrismContext, setTransient, setUserData, setValueMetadata, setValueMetadata, setValueMetadata, valueMetadata
-
Methods inherited from interface com.evolveum.midpoint.util.ShortDumpable
shortDump, shortDumpLazily
-
-
-
-
Constructor Detail
-
PrismReferenceValueImpl
public PrismReferenceValueImpl()
-
PrismReferenceValueImpl
public PrismReferenceValueImpl(String oid)
-
PrismReferenceValueImpl
public PrismReferenceValueImpl(String oid, OriginType type, Objectable source)
-
-
Method Detail
-
getOid
public String getOid()
OID of the object that this reference refers to (reference target). May return null, but the reference is in that case incomplete and unusable.- Specified by:
getOid
in interfacePrismReferenceValue
- Returns:
- the target oid
-
setOid
public void setOid(String oid)
- Specified by:
setOid
in interfacePrismReferenceValue
-
getObject
public PrismObject getObject()
Returns object that this reference points to. The object is supposed to be used for caching and optimizations. Only oid and type of the object really matters for the reference. The object is transient. It will NOT be serialized. Therefore the client must expect that the object can disappear when serialization boundary is crossed. The client must expect that the object is null.- Specified by:
getObject
in interfacePrismReferenceValue
-
setObject
public void setObject(PrismObject object)
- Specified by:
setObject
in interfacePrismReferenceValue
-
getTargetType
public QName getTargetType()
Returns XSD type of the object that this reference refers to. It may be used in XPath expressions and similar filters. May return null if the type name is not set.- Specified by:
getTargetType
in interfacePrismReferenceValue
- Returns:
- the target type name
-
setTargetType
public void setTargetType(QName targetType)
- Specified by:
setTargetType
in interfacePrismReferenceValue
-
setTargetType
public void setTargetType(QName targetType, boolean allowEmptyNamespace)
- Specified by:
setTargetType
in interfacePrismReferenceValue
- Parameters:
allowEmptyNamespace
- This is an ugly hack. See comment in DOMUtil.validateNonEmptyQName.
-
getTargetName
public PolyString getTargetName()
Returns cached name of the target object. This is a ephemeral value. It is usually not stored. It may be computed at object retrieval time or it may not be present at all. This is NOT an authoritative information. Setting it or changing it will not influence the reference meaning. OID is the only authoritative linking mechanism.- Specified by:
getTargetName
in interfacePrismReferenceValue
- Returns:
- cached name of the target object.
-
setTargetName
public void setTargetName(PolyString name)
- Specified by:
setTargetName
in interfacePrismReferenceValue
-
setTargetName
public void setTargetName(PolyStringType name)
- Specified by:
setTargetName
in interfacePrismReferenceValue
-
getTargetTypeCompileTimeClass
public Class<Objectable> getTargetTypeCompileTimeClass()
- Specified by:
getTargetTypeCompileTimeClass
in interfacePrismReferenceValue
-
getTargetTypeCompileTimeClass
public Class<Objectable> getTargetTypeCompileTimeClass(PrismContext prismContext)
- Specified by:
getTargetTypeCompileTimeClass
in interfacePrismReferenceValue
-
getRelation
public QName getRelation()
- Specified by:
getRelation
in interfacePrismReferenceValue
-
setRelation
public void setRelation(QName relation)
- Specified by:
setRelation
in interfacePrismReferenceValue
-
relation
public PrismReferenceValueImpl relation(QName relation)
- Specified by:
relation
in interfacePrismReferenceValue
-
getDescription
public String getDescription()
- Specified by:
getDescription
in interfacePrismReferenceValue
-
setDescription
public void setDescription(String description)
- Specified by:
setDescription
in interfacePrismReferenceValue
-
getFilter
public SearchFilterType getFilter()
- Specified by:
getFilter
in interfacePrismReferenceValue
-
setFilter
public void setFilter(SearchFilterType filter)
- Specified by:
setFilter
in interfacePrismReferenceValue
-
getResolutionTime
public EvaluationTimeType getResolutionTime()
- Specified by:
getResolutionTime
in interfacePrismReferenceValue
-
setResolutionTime
public void setResolutionTime(EvaluationTimeType resolutionTime)
- Specified by:
setResolutionTime
in interfacePrismReferenceValue
-
getReferentialIntegrity
public ReferentialIntegrityType getReferentialIntegrity()
- Specified by:
getReferentialIntegrity
in interfacePrismReferenceValue
-
setReferentialIntegrity
public void setReferentialIntegrity(ReferentialIntegrityType referentialIntegrity)
- Specified by:
setReferentialIntegrity
in interfacePrismReferenceValue
-
getDefinition
public PrismReferenceDefinition getDefinition()
- Specified by:
getDefinition
in interfacePrismReferenceValue
- Overrides:
getDefinition
in classPrismValueImpl
-
isRaw
public boolean isRaw()
- Specified by:
isRaw
in interfacePrismValue
-
find
public Object find(ItemPath path)
- Specified by:
find
in interfacePrismValue
-
findPartial
public <IV extends PrismValue,ID extends ItemDefinition> PartiallyResolvedItem<IV,ID> findPartial(ItemPath path)
- Specified by:
findPartial
in interfacePrismReferenceValue
-
applyDefinition
public void applyDefinition(ItemDefinition definition, boolean force) throws SchemaException
- Specified by:
applyDefinition
in interfacePrismReferenceValue
- Specified by:
applyDefinition
in interfacePrismValue
- Overrides:
applyDefinition
in classPrismValueImpl
- Throws:
SchemaException
-
applyDefinition
public void applyDefinition(PrismReferenceDefinition definition, boolean force) throws SchemaException
- Specified by:
applyDefinition
in interfacePrismReferenceValue
- Throws:
SchemaException
-
recompute
public void recompute(PrismContext prismContext)
- Specified by:
recompute
in interfacePrismValue
- Specified by:
recompute
in classPrismValueImpl
-
checkConsistenceInternal
public void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
- Specified by:
checkConsistenceInternal
in interfacePrismValue
- Specified by:
checkConsistenceInternal
in classPrismValueImpl
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacePrismValue
-
toCanonical
public PrismReferenceValueImpl toCanonical()
Returns a version of this value that is canonical, that means it has the minimal form. E.g. it will have only OID and no object.- Specified by:
toCanonical
in interfacePrismReferenceValue
-
equals
public boolean equals(PrismValue other, @NotNull @NotNull ParameterizedEquivalenceStrategy strategy)
- Specified by:
equals
in interfacePrismValue
- Overrides:
equals
in classPrismValueImpl
-
equals
public boolean equals(PrismReferenceValue other, @NotNull @NotNull ParameterizedEquivalenceStrategy strategy)
-
hashCode
public int hashCode(@NotNull @NotNull ParameterizedEquivalenceStrategy strategy)
- Specified by:
hashCode
in interfacePrismValue
- Overrides:
hashCode
in classPrismValueImpl
-
asReferencable
public Referencable asReferencable()
- Specified by:
asReferencable
in interfacePrismReferenceValue
-
asReferencables
@NotNull public static @NotNull List<Referencable> asReferencables(@NotNull @NotNull Collection<PrismReferenceValue> values)
-
asReferenceValues
@NotNull public static @NotNull List<PrismReferenceValue> asReferenceValues(@NotNull @NotNull Collection<? extends Referencable> referencables)
-
debugDump
public String debugDump()
Description copied from interface:DebugDumpable
Show the content of the object intended for diagnostics by system administrator. The out put should be suitable to use in system logs at "debug" level. It may be multi-line, but in that case it should be well indented and quite terse. As it is intended to be used by system administrator, it should not use any developer terms such as class names, exceptions or stack traces.- Specified by:
debugDump
in interfaceDebugDumpable
- Returns:
- content of the object intended for diagnostics by system administrator.
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
debugDump
public String debugDump(int indent, boolean expandObject)
- Specified by:
debugDump
in interfacePrismReferenceValue
-
clone
public PrismReferenceValueImpl clone()
Description copied from class:PrismValueImpl
Literal clone.- Specified by:
clone
in interfacePrismReferenceValue
- Specified by:
clone
in interfacePrismValue
- Specified by:
clone
in classPrismValueImpl
-
createImmutableClone
public PrismReferenceValue createImmutableClone()
- Specified by:
createImmutableClone
in interfacePrismReferenceValue
- Specified by:
createImmutableClone
in interfacePrismValue
- Overrides:
createImmutableClone
in classPrismValueImpl
-
cloneComplex
public PrismReferenceValueImpl cloneComplex(CloneStrategy strategy)
Description copied from class:PrismValueImpl
Complex clone with different cloning strategies.- Specified by:
cloneComplex
in interfacePrismReferenceValue
- Specified by:
cloneComplex
in interfacePrismValue
- Specified by:
cloneComplex
in classPrismValueImpl
- See Also:
CloneStrategy
-
copyValues
protected void copyValues(CloneStrategy strategy, PrismReferenceValueImpl clone)
-
toHumanReadableString
public String toHumanReadableString()
- Specified by:
toHumanReadableString
in interfacePrismValue
- Specified by:
toHumanReadableString
in classPrismValueImpl
-
getRealClass
public Class<?> getRealClass()
- Specified by:
getRealClass
in interfacePrismReferenceValue
- Specified by:
getRealClass
in interfacePrismValue
- Specified by:
getRealClass
in classPrismValueImpl
-
getRealValue
@Nullable public @Nullable Referencable getRealValue()
- Specified by:
getRealValue
in interfacePrismReferenceValue
- Specified by:
getRealValue
in interfacePrismValue
- Specified by:
getRealValue
in classPrismValueImpl
-
containsOid
public static boolean containsOid(Collection<PrismReferenceValue> values, @NotNull @NotNull String oid)
-
revive
public void revive(PrismContext prismContext) throws SchemaException
- Specified by:
revive
in interfaceRevivable
- Overrides:
revive
in classPrismValueImpl
- Throws:
SchemaException
-
shortDump
public void shortDump(StringBuilder sb)
Description copied from interface:ShortDumpable
Show the content of the object intended for diagnostics. This method is supposed to append a compact, human-readable output in a single line. Unlike toString() method, there is no requirement to identify the actual class or type of the object. It is assumed that the class/type will be obvious from the context in which the output is used.- Specified by:
shortDump
in interfaceShortDumpable
- Parameters:
sb
- StringBuilder to which to a compact one-line content of the object intended for diagnostics by system administrator should be appended.
-
accept
public void accept(Visitor visitor)
- Specified by:
accept
in interfacePrismValue
- Specified by:
accept
in interfaceVisitable
- Overrides:
accept
in classPrismValueImpl
-
transformDefinition
public void transformDefinition(ComplexTypeDefinition parentDef, ItemDefinition<?> itemDef, ItemDefinitionTransformer transformation)
- Specified by:
transformDefinition
in interfaceItemDefinitionTransformer.TransformableValue
-
findReferencedItem
public <I extends Item<?,?>> I findReferencedItem(ItemPath path, Class<I> type)
- Specified by:
findReferencedItem
in interfacePrismReferenceValue
-
-