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
- Author:
- Radovan Semancik
- See Also:
-
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
ConstructorDescriptionPrismReferenceValueImpl
(String oid, OriginType type, Objectable source) PrismReferenceValueImpl
(String oid, QName targetType) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
applyDefinition
(ItemDefinition definition, boolean force) void
applyDefinition
(PrismReferenceDefinition definition, boolean force) static @NotNull List<Referencable>
asReferencables
(@NotNull Collection<PrismReferenceValue> values) static @NotNull List<PrismReferenceValue>
asReferenceValues
(@NotNull Collection<? extends Referencable> referencables) void
checkConsistenceInternal
(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope) clone()
Literal clone.cloneComplex
(CloneStrategy strategy) Complex clone with different cloning strategies.static boolean
containsOid
(Collection<PrismReferenceValue> values, @NotNull String oid) protected void
copyValues
(CloneStrategy strategy, PrismReferenceValueImpl clone) Show the content of the object intended for diagnostics by system administrator.debugDump
(int indent) debugDump
(int indent, boolean expandObject) boolean
equals
(PrismReferenceValue other, @NotNull ParameterizedEquivalenceStrategy strategy) boolean
equals
(PrismValue other, @NotNull ParameterizedEquivalenceStrategy strategy) <IV extends PrismValue,
ID extends ItemDefinition<?>>
PartiallyResolvedItem<IV,ID> findPartial
(ItemPath path) <I extends Item<?,
?>>
IfindReferencedItem
(ItemPath path, Class<I> type) Returns object that this reference points to.getOid()
OID of the object that this reference refers to (reference target).Class<?>
@NotNull Referencable
Returns the statically-typed "real value".Returns cached name of the target object.Returns XSD type of the object that this reference refers to.getTargetTypeCompileTimeClass
(PrismContext prismContext) int
hashCode
(@NotNull ParameterizedEquivalenceStrategy strategy) boolean
isEmpty()
boolean
isRaw()
void
recompute
(PrismContext prismContext) void
revive
(PrismContext prismContext) TODO: Is revive necessary if prism context is static? TODO document (if it's found to be necessary)void
setDescription
(String description) void
setFilter
(SearchFilterType filter) void
setObject
(PrismObject object) void
void
setReferentialIntegrity
(ReferentialIntegrityType referentialIntegrity) void
setRelation
(QName relation) void
setResolutionTime
(EvaluationTimeType resolutionTime) void
setTargetName
(PolyString name) void
setTargetName
(PolyStringType name) void
setTargetType
(QName targetType) void
setTargetType
(QName targetType, boolean allowEmptyNamespace) void
Show the content of the object intended for diagnostics.Returns a version of this value that is canonical, that means it has the minimal form.toString()
void
transformDefinition
(ComplexTypeDefinition parentDef, ItemDefinition<?> itemDef, ItemDefinitionTransformer transformation) Methods inherited from class com.evolveum.midpoint.prism.impl.PrismValueImpl
accept, appendOriginDump, applyDefinition, clearParent, copyValues, diff, diffMatchingRepresentation, diffMatchingRepresentation, equals, equals, getAllItems, 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.PrismReferenceValue
determineTargetTypeName, getEffectiveResolutionTime
Methods inherited from interface com.evolveum.midpoint.prism.PrismValue
accept, applyDefinition, clearParent, cloneIfImmutable, diff, equals, getAllItems, getAllValues, getNearestValueOfType, getParent, getParentContainerValue, getPath, getRealValueIfExists, getRealValueOrRawType, getRootObjectable, getRootValue, getTypeName, getUserData, getUserData, getValueMetadata, getValueMetadataAsContainer, hashCode, hasRealClass, hasValueMetadata, isObjectable, isOfType, isTransient, normalize, recompute, representsSameValue, setParent, setPrismContext, setTransient, setUserData, setValueMetadata, setValueMetadata, setValueMetadata, valueMetadata
Methods inherited from interface com.evolveum.midpoint.util.ShortDumpable
shortDump, shortDumpLazily
-
Constructor Details
-
PrismReferenceValueImpl
public PrismReferenceValueImpl() -
PrismReferenceValueImpl
-
PrismReferenceValueImpl
-
PrismReferenceValueImpl
-
-
Method Details
-
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
- Specified by:
setOid
in interfacePrismReferenceValue
-
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
- Specified by:
setObject
in interfacePrismReferenceValue
-
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
- Specified by:
setTargetType
in interfacePrismReferenceValue
-
setTargetType
- Specified by:
setTargetType
in interfacePrismReferenceValue
- Parameters:
allowEmptyNamespace
- This is an ugly hack. See comment in DOMUtil.validateNonEmptyQName.
-
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
- Specified by:
setTargetName
in interfacePrismReferenceValue
-
setTargetName
- Specified by:
setTargetName
in interfacePrismReferenceValue
-
getTargetTypeCompileTimeClass
- Specified by:
getTargetTypeCompileTimeClass
in interfacePrismReferenceValue
-
getTargetTypeCompileTimeClass
- Specified by:
getTargetTypeCompileTimeClass
in interfacePrismReferenceValue
-
getRelation
- Specified by:
getRelation
in interfacePrismReferenceValue
-
setRelation
- Specified by:
setRelation
in interfacePrismReferenceValue
-
relation
- Specified by:
relation
in interfacePrismReferenceValue
-
getDescription
- Specified by:
getDescription
in interfacePrismReferenceValue
-
setDescription
- Specified by:
setDescription
in interfacePrismReferenceValue
-
getFilter
- Specified by:
getFilter
in interfacePrismReferenceValue
-
setFilter
- Specified by:
setFilter
in interfacePrismReferenceValue
-
getResolutionTime
- Specified by:
getResolutionTime
in interfacePrismReferenceValue
-
setResolutionTime
- Specified by:
setResolutionTime
in interfacePrismReferenceValue
-
getReferentialIntegrity
- Specified by:
getReferentialIntegrity
in interfacePrismReferenceValue
-
setReferentialIntegrity
- Specified by:
setReferentialIntegrity
in interfacePrismReferenceValue
-
getDefinition
- Specified by:
getDefinition
in interfacePrismReferenceValue
- Overrides:
getDefinition
in classPrismValueImpl
-
isRaw
public boolean isRaw()- Specified by:
isRaw
in interfacePrismValue
-
find
- 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
- 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
- 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
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
- Specified by:
hashCode
in interfacePrismValue
- Overrides:
hashCode
in classPrismValueImpl
-
toString
-
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
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
- Specified by:
debugDump
in interfaceDebugDumpable
-
debugDump
- Specified by:
debugDump
in interfacePrismReferenceValue
-
clone
Description copied from class:PrismValueImpl
Literal clone.- Specified by:
clone
in interfacePrismReferenceValue
- Specified by:
clone
in interfacePrismValue
- Specified by:
clone
in classPrismValueImpl
-
createImmutableClone
- Specified by:
createImmutableClone
in interfacePrismReferenceValue
- Specified by:
createImmutableClone
in interfacePrismValue
- Overrides:
createImmutableClone
in classPrismValueImpl
-
cloneComplex
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:
-
copyValues
-
toHumanReadableString
- Specified by:
toHumanReadableString
in interfacePrismValue
- Specified by:
toHumanReadableString
in classPrismValueImpl
-
getRealClass
- Specified by:
getRealClass
in interfacePrismReferenceValue
- Specified by:
getRealClass
in interfacePrismValue
- Specified by:
getRealClass
in classPrismValueImpl
-
getRealValue
Description copied from interface:PrismValue
Returns the statically-typed "real value". TODO specify when exactly the returned value can be null. TODO decide for containers: they throw an exception if the value is not statically typed.- 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
Description copied from interface:Revivable
TODO: Is revive necessary if prism context is static? TODO document (if it's found to be necessary)- Specified by:
revive
in interfaceRevivable
- Overrides:
revive
in classPrismValueImpl
-
shortDump
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
- 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
- Specified by:
findReferencedItem
in interfacePrismReferenceValue
-