Package com.evolveum.midpoint.prism.impl
Class PrismPropertyImpl<T>
- java.lang.Object
-
- com.evolveum.midpoint.prism.impl.ItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
- com.evolveum.midpoint.prism.impl.PrismPropertyImpl<T>
-
- All Implemented Interfaces:
Item<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
,Itemable
,ParentVisitable
,PathVisitable
,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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.evolveum.midpoint.prism.impl.ItemImpl
defaultEquivalenceStrategy, definition, elementName, immutable, incomplete, parent, prismContext, values
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Modifier Constructor Description PrismPropertyImpl(QName name)
PrismPropertyImpl(QName name, PrismContext prismContext)
protected
PrismPropertyImpl(QName name, PrismPropertyDefinition<T> definition, PrismContext prismContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRealValue(T valueToAdd)
void
addRealValues(T... valuesToAdd)
void
addRealValueSkipUniquenessCheck(T valueToAdd)
void
addValue(PrismPropertyValue<T> pValueToAdd)
void
addValue(PrismPropertyValue<T> pValueToAdd, boolean checkUniqueness)
void
addValues(Collection<PrismPropertyValue<T>> pValuesToAdd)
protected void
checkDefinition(PrismPropertyDefinition<T> def)
PrismProperty<T>
clone()
Literal clone.PrismProperty<T>
cloneComplex(CloneStrategy strategy)
Complex clone with different cloning strategies.protected void
copyValues(CloneStrategy strategy, PrismPropertyImpl<T> clone)
PropertyDelta<T>
createDelta()
Creates specific subclass of ItemDelta appropriate for type of item that this definition represents (e.g.PropertyDelta<T>
createDelta(ItemPath path)
String
debugDump(int indent)
boolean
deleteValue(PrismPropertyValue<T> pValueToDelete)
boolean
deleteValues(Collection<PrismPropertyValue<T>> pValuesToDelete)
PropertyDelta<T>
diff(PrismProperty<T> other)
PropertyDelta<T>
diff(PrismProperty<T> other, ParameterizedEquivalenceStrategy strategy)
Object
find(ItemPath path)
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
fixupDelta(ItemDelta delta, Item otherItem)
T
getAnyRealValue()
protected String
getDebugDumpClassName()
Return a human readable name of this class suitable for logs.PrismPropertyDefinition<T>
getDefinition()
Returns applicable property definition.T
getRealValue()
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.<X> X
getRealValue(Class<X> type)
Type override, also for compatibility.Collection<T>
getRealValues()
Returns (potentially empty) collection of "real values".<X> Collection<X>
getRealValues(Class<X> type)
Type override, also for compatibility.<X> X[]
getRealValuesArray(Class<X> type)
Type override, also for compatibility.<X> PrismPropertyValue<X>
getValue(Class<X> type)
Type override, also for compatibility.Class<T>
getValueClass()
<X> List<PrismPropertyValue<X>>
getValues(Class<X> type)
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.String
toHumanReadableString()
String
toString()
-
Methods inherited from class com.evolveum.midpoint.prism.impl.ItemImpl
accept, accept, acceptParentVisitor, add, add, add, add, addAll, addAll, appendDebugDumpSuffix, applyDefinition, applyDefinition, assertDefinitions, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistenceInternal, checkImmutability, checkMutability, clear, contains, contains, contains, containsEquivalentValue, containsEquivalentValue, copyValues, diff, diff, equals, equals, equals, filterValues, findValue, getAllValues, getAnyValue, getClonedValues, getDisplayName, getElementName, getEqualsHashCodeStrategy, getHelp, getHighestId, getParent, getPath, getPathComponent, getPrismContext, getPrismContextLocal, getUserData, getUserData, getValue, getValues, hasCompleteDefinition, hashCode, hashCode, hashCode, hasNoValues, hasRaw, isEmpty, isImmutable, isIncomplete, isOperational, isRaw, isSingleValue, merge, modifyUnfrozen, modifyUnfrozen, normalize, propagateDeepCloneDefinition, recomputeAllValues, remove, remove, remove, removeAll, replace, replaceAll, revive, setElementName, setImmutable, setIncomplete, setParent, setPrismContext, setUserData, size, valuesEqual
-
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.Item
acceptParentVisitor, add, add, add, addAll, addAll, applyDefinition, applyDefinition, assertDefinitions, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistenceInternal, checkImmutability, clear, contains, contains, contains, containsEquivalentValue, containsEquivalentValue, diff, diff, equals, equals, equals, filterValues, findValue, getAllValues, getAnyValue, getClonedValues, getDisplayName, getElementName, getHelp, getHighestId, getParent, getPath, getPrismContext, getPrismContextLocal, getUserData, getUserData, getValues, hasCompleteDefinition, hashCode, hashCode, hashCode, hasNoValues, hasRaw, isEmpty, isImmutable, isIncomplete, isOperational, isRaw, isSingleValue, merge, modifyUnfrozen, modifyUnfrozen, normalize, recomputeAllValues, remove, remove, removeAll, replace, replaceAll, revive, setElementName, setImmutable, setIncomplete, setParent, setPrismContext, setUserData, size, valuesEqual
-
Methods inherited from interface com.evolveum.midpoint.prism.PathVisitable
accept
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismProperty
getValue
-
-
-
-
Constructor Detail
-
PrismPropertyImpl
public PrismPropertyImpl(QName name)
-
PrismPropertyImpl
public PrismPropertyImpl(QName name, PrismContext prismContext)
-
PrismPropertyImpl
protected PrismPropertyImpl(QName name, PrismPropertyDefinition<T> definition, PrismContext prismContext)
-
-
Method Detail
-
getDefinition
public PrismPropertyDefinition<T> 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
- Specified by:
getDefinition
in interfacePrismProperty<T>
- Overrides:
getDefinition
in classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Returns:
- applicable property definition
-
setDefinition
public void setDefinition(PrismPropertyDefinition<T> definition)
Sets applicable property definition. TODO remove (method in Item is sufficient)- Specified by:
setDefinition
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
setDefinition
in interfacePrismProperty<T>
- Overrides:
setDefinition
in classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Parameters:
definition
- the definition to set
-
getValues
public <X> List<PrismPropertyValue<X>> getValues(Class<X> type)
Type override, also for compatibility.- Specified by:
getValues
in interfacePrismProperty<T>
-
getRealValues
@NotNull public Collection<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
public <X> Collection<X> getRealValues(Class<X> type)
Type override, also for compatibility.- Specified by:
getRealValues
in interfacePrismProperty<T>
-
getAnyRealValue
public T getAnyRealValue()
- Specified by:
getAnyRealValue
in interfacePrismProperty<T>
-
getRealValue
public 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>>
-
getRealValue
public <X> X getRealValue(Class<X> type)
Type override, also for compatibility.- Specified by:
getRealValue
in interfacePrismProperty<T>
-
getRealValuesArray
public <X> X[] getRealValuesArray(Class<X> type)
Type override, also for compatibility.- Specified by:
getRealValuesArray
in interfacePrismProperty<T>
-
getValue
public <X> PrismPropertyValue<X> getValue(Class<X> type)
Type override, also for compatibility.- Specified by:
getValue
in interfacePrismProperty<T>
-
setValue
public void setValue(PrismPropertyValue<T> value)
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
public void setRealValue(T realValue)
- Specified by:
setRealValue
in interfacePrismProperty<T>
-
setRealValues
public void setRealValues(T... realValues)
- Specified by:
setRealValues
in interfacePrismProperty<T>
-
addValues
public void addValues(Collection<PrismPropertyValue<T>> pValuesToAdd)
- Specified by:
addValues
in interfacePrismProperty<T>
-
addValue
public void addValue(PrismPropertyValue<T> pValueToAdd)
- Specified by:
addValue
in interfacePrismProperty<T>
-
addValue
public void addValue(PrismPropertyValue<T> pValueToAdd, boolean checkUniqueness)
-
addRealValue
public void addRealValue(T valueToAdd)
- Specified by:
addRealValue
in interfacePrismProperty<T>
-
addRealValueSkipUniquenessCheck
public void addRealValueSkipUniquenessCheck(T valueToAdd)
- Specified by:
addRealValueSkipUniquenessCheck
in interfacePrismProperty<T>
-
addRealValues
public void addRealValues(T... valuesToAdd)
- Specified by:
addRealValues
in interfacePrismProperty<T>
-
deleteValues
public boolean deleteValues(Collection<PrismPropertyValue<T>> pValuesToDelete)
- Specified by:
deleteValues
in interfacePrismProperty<T>
-
deleteValue
public boolean deleteValue(PrismPropertyValue<T> pValueToDelete)
- Specified by:
deleteValue
in interfacePrismProperty<T>
-
replaceValues
public void replaceValues(Collection<PrismPropertyValue<T>> valuesToReplace)
- Specified by:
replaceValues
in interfacePrismProperty<T>
-
hasRealValue
public boolean hasRealValue(PrismPropertyValue<T> value)
- Specified by:
hasRealValue
in interfacePrismProperty<T>
-
getValueClass
public Class<T> getValueClass()
- Specified by:
getValueClass
in interfacePrismProperty<T>
-
createDelta
public PropertyDelta<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
public PropertyDelta<T> createDelta(ItemPath path)
- Specified by:
createDelta
in interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
- Specified by:
createDelta
in interfacePrismProperty<T>
-
find
public Object find(ItemPath path)
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>>
- Specified by:
find
in interfacePrismProperty<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
public PropertyDelta<T> diff(PrismProperty<T> other)
- Specified by:
diff
in interfacePrismProperty<T>
-
diff
public PropertyDelta<T> diff(PrismProperty<T> other, ParameterizedEquivalenceStrategy strategy)
- Specified by:
diff
in interfacePrismProperty<T>
-
checkDefinition
protected void checkDefinition(PrismPropertyDefinition<T> def)
- Specified by:
checkDefinition
in classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
clone
public PrismProperty<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>>
-
cloneComplex
public PrismProperty<T> cloneComplex(CloneStrategy strategy)
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:
CloneStrategy
-
copyValues
protected void copyValues(CloneStrategy strategy, PrismPropertyImpl<T> clone)
-
fixupDelta
protected ItemDelta fixupDelta(ItemDelta delta, Item otherItem)
- Overrides:
fixupDelta
in classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
toString
public String toString()
- Specified by:
toString
in interfacePrismProperty<T>
- Overrides:
toString
in classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
- Specified by:
debugDump
in interfacePrismProperty<T>
- Overrides:
debugDump
in classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
toHumanReadableString
public String toHumanReadableString()
- Specified by:
toHumanReadableString
in interfacePrismProperty<T>
-
getDebugDumpClassName
protected String getDebugDumpClassName()
Return a human readable name of this class suitable for logs.- Overrides:
getDebugDumpClassName
in classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
-