Package com.evolveum.midpoint.prism.impl
Class PrismPropertyImpl<T>
java.lang.Object
com.evolveum.midpoint.prism.AbstractFreezable
com.evolveum.midpoint.prism.impl.ItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
com.evolveum.midpoint.prism.impl.PrismPropertyImpl<T>
- All Implemented Interfaces:
Freezable
,Item<PrismPropertyValue<T>,
,PrismPropertyDefinition<T>> Itemable
,ItemDefinitionTransformer.TransformableItem
,ParentVisitable
,PathVisitable
,PrismContextSensitive
,PrismProperty<T>
,Revivable
,Visitable
,DebugDumpable
,Serializable
- Direct Known Subclasses:
ResourceAttributeImpl
public class PrismPropertyImpl<T>
extends ItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
implements PrismProperty<T>
Property is a specific characteristic of an object. It may be considered
object "attribute" or "field". For example User has fullName property that
contains string value of user's full name.
Properties may be single-valued or multi-valued
Properties may contain primitive types or complex types (defined by XSD schema)
Property values are unordered, implementation may change the order of values
Duplicate values of properties should be silently removed by implementations, but clients must be able tolerate presence of duplicate values.
Operations that modify the objects work with the granularity of properties. They add/remove/replace the values of properties, but do not "see" inside the property.
Property is mutable.
- Author:
- Radovan Semancik
- See Also:
-
Field Summary
Fields inherited from class com.evolveum.midpoint.prism.impl.ItemImpl
definition, elementName, incomplete, parent, values
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
Constructor Summary
ConstructorDescriptionPrismPropertyImpl
(QName name) PrismPropertyImpl
(QName name, PrismContext prismContext) PrismPropertyImpl
(QName name, PrismPropertyDefinition<T> definition, PrismContext prismContext) -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(@NotNull PrismPropertyValue<T> newValue) Adds a given value, overwriting existing one.void
addForced
(@NotNull PrismPropertyValue<T> newValue) Adds a given value with no checks, no definition application, and so on.protected boolean
addInternalExecution
(@NotNull PrismPropertyValue<T> newValue) void
addRealValue
(T valueToAdd) void
addRealValueSkipUniquenessCheck
(T valueToAdd) void
addValue
(PrismPropertyValue<T> pValueToAdd) void
addValue
(PrismPropertyValue<T> pValueToAdd, boolean checkUniqueness) void
addValues
(Collection<PrismPropertyValue<T>> pValuesToAdd) protected void
void
clear()
Removes all values from the item.clone()
Literal clone.cloneComplex
(CloneStrategy strategy) Complex clone with different cloning strategies.protected void
copyValues
(CloneStrategy strategy, PrismPropertyImpl<T> clone) Creates specific subclass of ItemDelta appropriate for type of item that this definition represents (e.g.createDelta
(ItemPath path) debugDump
(int indent) boolean
deleteValue
(PrismPropertyValue<T> pValueToDelete) boolean
deleteValues
(Collection<PrismPropertyValue<T>> pValuesToDelete) diff
(PrismProperty<T> other) diff
(PrismProperty<T> other, ParameterizedEquivalenceStrategy strategy) Returns object (Item or PrismValue) pointed to by the given path.<IV extends PrismValue,
ID extends ItemDefinition<?>>
PartiallyResolvedItem<IV,ID> findPartial
(ItemPath path) protected ItemDelta<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> fixupDelta
(ItemDelta<PrismPropertyValue<T>, PrismPropertyDefinition<T>> delta, Item<PrismPropertyValue<T>, PrismPropertyDefinition<T>> otherItem) protected String
Return a human-readable name of this class suitable for logs.Returns applicable property definition.Returns the "real value" (content) of this item: - value contained in PrismPropertyValue - Referencable in PrismReferenceValue - Containerable in PrismContainerValue - Objectable in PrismObjectValue Note that the real value can contain operational items.@NotNull Collection<T>
Returns (potentially empty) collection of "real values".<X> Collection<X>
getRealValues
(Class<X> type) Type override, also for compatibility.<X> PrismPropertyValue<X>
Type override, also for compatibility.<X> List<PrismPropertyValue<X>>
Type override, also for compatibility.boolean
hasRealValue
(PrismPropertyValue<T> value) void
replaceValues
(Collection<PrismPropertyValue<T>> valuesToReplace) void
setDefinition
(PrismPropertyDefinition<T> definition) Sets applicable property definition.void
setRealValue
(T realValue) void
setRealValues
(T... realValues) void
setValue
(PrismPropertyValue<T> value) Means as a short-hand for setting just a value for single-valued attributes.toString()
protected void
valueRemoved
(PrismPropertyValue<T> currentValue) Methods inherited from class com.evolveum.midpoint.prism.impl.ItemImpl
accept, accept, acceptParentVisitor, add, addAll, addIgnoringEquivalents, addInternal, addRespectingMetadataAndCloning, appendDebugDumpSuffix, applyDefinition, applyDefinition, assertDefinitions, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistenceInternal, copyValues, diff, equals, equals, equals, getAllItems, getAllValues, getElementName, getHighestId, getParent, getPath, getPathComponent, getPrismContext, getPrismContextLocal, getRealValue, getRealValuesArray, getUserData, getUserData, getValue, getValues, hashCode, hashCode, hashCode, isIncomplete, merge, normalize, performFreeze, propagateDeepCloneDefinition, recomputeAllValues, remove, remove, removeAll, removeRespectingMetadata, replace, replaceAll, revive, setElementName, setIncomplete, setParent, setPrismContext, setUserData, transformDefinition
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, 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, addAll, addAll, addIgnoringEquivalents, addRespectingMetadataAndCloning, applyDefinition, applyDefinition, assertDefinitions, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistenceInternal, contains, contains, copy, diff, diff, equals, equals, equals, filterValues, filterYields, findValue, findValue, getAllItems, getAllValues, getAnyValue, getAnyValue, getClonedValues, getDisplayName, getElementName, getHelp, getHighestId, getParent, getPath, getPrismContextLocal, getRealValue, getRealValuesArray, getRealValuesOrRawTypes, getUserData, getUserData, getValue, 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, setParent, setPrismContext, setUserData, size, valuesStream
Methods inherited from interface com.evolveum.midpoint.prism.PathVisitable
accept
Methods inherited from interface com.evolveum.midpoint.prism.PrismContextSensitive
getPrismContext
Methods inherited from interface com.evolveum.midpoint.prism.PrismProperty
addRealValues
-
Constructor Details
-
PrismPropertyImpl
-
PrismPropertyImpl
-
PrismPropertyImpl
public PrismPropertyImpl(QName name, PrismPropertyDefinition<T> definition, PrismContext prismContext)
-
-
Method Details
-
getDefinition
Returns applicable property definition.May return null if no definition is applicable or the definition is not know.
- Specified by:
getDefinition
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Specified by:
getDefinition
in interfaceItemable
- Overrides:
getDefinition
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Returns:
- applicable property definition
-
setDefinition
Sets applicable property definition. TODO remove (method in Item is sufficient)- Specified by:
setDefinition
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Overrides:
setDefinition
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Parameters:
definition
- the definition to set
-
getValues
Type override, also for compatibility.- Specified by:
getValues
in interfacePrismProperty<T>
-
getRealValues
Description copied from interface:Item
Returns (potentially empty) collection of "real values".- Specified by:
getRealValues
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Specified by:
getRealValues
in interfacePrismProperty<T>
-
getRealValues
Type override, also for compatibility.- Specified by:
getRealValues
in interfacePrismProperty<T>
-
getAnyRealValue
- Specified by:
getAnyRealValue
in interfacePrismProperty<T>
-
getRealValue
Description copied from interface:Item
Returns the "real value" (content) of this item: - value contained in PrismPropertyValue - Referencable in PrismReferenceValue - Containerable in PrismContainerValue - Objectable in PrismObjectValue Note that the real value can contain operational items. It can also contain container IDs (although they are not considered to be part of the real value). It does not contain information about item element name nor other metadata like origin, definition, etc. (Although e.g. Containerable can be converted back into PrismContainerValue that can be used to retrieve this information.)- Specified by:
getRealValue
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Specified by:
getRealValue
in interfacePrismProperty<T>
- Overrides:
getRealValue
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
getValue
Type override, also for compatibility.- Specified by:
getValue
in interfacePrismProperty<T>
-
setValue
Means as a short-hand for setting just a value for single-valued attributes. Will remove all existing values.- Specified by:
setValue
in interfacePrismProperty<T>
-
setRealValue
- Specified by:
setRealValue
in interfacePrismProperty<T>
-
setRealValues
- Specified by:
setRealValues
in interfacePrismProperty<T>
-
addValues
- Specified by:
addValues
in interfacePrismProperty<T>
-
add
Description copied from interface:Item
Adds a given value, overwriting existing one. It compares values using DEFAULT_FOR_EQUALS (DATA) strategy, so it e.g. takes value metadata differences into account. It is because this method is used during parsing, internal computations (typically using generated beans), and similar situations where we expect little sophistication when it comes to value comparison. The less surprises the better.- Specified by:
add
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Throws:
SchemaException
-
addValue
- Specified by:
addValue
in interfacePrismProperty<T>
-
addValue
-
addInternalExecution
- Overrides:
addInternalExecution
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
addRealValue
- Specified by:
addRealValue
in interfacePrismProperty<T>
-
addRealValueSkipUniquenessCheck
- Specified by:
addRealValueSkipUniquenessCheck
in interfacePrismProperty<T>
-
deleteValues
- Specified by:
deleteValues
in interfacePrismProperty<T>
-
deleteValue
- Specified by:
deleteValue
in interfacePrismProperty<T>
-
replaceValues
- Specified by:
replaceValues
in interfacePrismProperty<T>
-
hasRealValue
- Specified by:
hasRealValue
in interfacePrismProperty<T>
-
getValueClass
- Specified by:
getValueClass
in interfacePrismProperty<T>
-
createDelta
Description copied from interface:Item
Creates specific subclass of ItemDelta appropriate for type of item that this definition represents (e.g. PropertyDelta, ContainerDelta, ...)- Specified by:
createDelta
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Specified by:
createDelta
in interfacePrismProperty<T>
-
createDelta
- Specified by:
createDelta
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Specified by:
createDelta
in interfacePrismProperty<T>
-
find
Description copied from interface:Item
Returns object (Item or PrismValue) pointed to by the given path.- Specified by:
find
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
findPartial
public <IV extends PrismValue,ID extends ItemDefinition<?>> PartiallyResolvedItem<IV,ID> findPartial(ItemPath path) - Specified by:
findPartial
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Specified by:
findPartial
in interfacePrismProperty<T>
-
diff
- Specified by:
diff
in interfacePrismProperty<T>
-
diff
- Specified by:
diff
in interfacePrismProperty<T>
-
checkDefinition
- Specified by:
checkDefinition
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
clone
Description copied from interface:Item
Literal clone.- Specified by:
clone
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Specified by:
clone
in interfacePrismProperty<T>
- Specified by:
clone
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
createImmutableClone
- Specified by:
createImmutableClone
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Specified by:
createImmutableClone
in interfacePrismProperty<T>
- Overrides:
createImmutableClone
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
cloneComplex
Description copied from interface:Item
Complex clone with different cloning strategies.- Specified by:
cloneComplex
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Specified by:
cloneComplex
in interfacePrismProperty<T>
- See Also:
-
copyValues
-
fixupDelta
protected ItemDelta<PrismPropertyValue<T>,PrismPropertyDefinition<T>> fixupDelta(ItemDelta<PrismPropertyValue<T>, PrismPropertyDefinition<T>> delta, Item<PrismPropertyValue<T>, PrismPropertyDefinition<T>> otherItem) - Overrides:
fixupDelta
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
toString
- Overrides:
toString
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
debugDump
- Specified by:
debugDump
in interfaceDebugDumpable
- Overrides:
debugDump
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
toHumanReadableString
- Specified by:
toHumanReadableString
in interfacePrismProperty<T>
-
getDebugDumpClassName
Return a human-readable name of this class suitable for logs.- Overrides:
getDebugDumpClassName
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
addForced
Description copied from class:ItemImpl
Adds a given value with no checks, no definition application, and so on. For internal use only.- Overrides:
addForced
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
valueRemoved
- Overrides:
valueRemoved
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-
clear
public void clear()Description copied from interface:Item
Removes all values from the item.- Specified by:
clear
in interfaceItem<PrismPropertyValue<T>,
PrismPropertyDefinition<T>> - Overrides:
clear
in classItemImpl<PrismPropertyValue<T>,
PrismPropertyDefinition<T>>
-