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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.evolveum.midpoint.prism.impl.ItemImpl
definition, elementName, immutable, incomplete, parent, values
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description PrismPropertyImpl(QName name)PrismPropertyImpl(QName name, PrismContext prismContext)PrismPropertyImpl(QName name, PrismPropertyDefinition<T> definition, PrismContext prismContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(@NotNull PrismPropertyValue<T> newValue)Adds a given value, overwriting existing one.voidaddForced(@NotNull PrismPropertyValue<T> newValue)Adds a given value with no checks, no definition application, and so on.protected booleanaddInternalExecution(@NotNull PrismPropertyValue<T> newValue)voidaddRealValue(T valueToAdd)voidaddRealValueSkipUniquenessCheck(T valueToAdd)voidaddValue(PrismPropertyValue<T> pValueToAdd)voidaddValue(PrismPropertyValue<T> pValueToAdd, boolean checkUniqueness)voidaddValues(Collection<PrismPropertyValue<T>> pValuesToAdd)protected voidcheckDefinition(PrismPropertyDefinition<T> def)voidclear()Removes all values from the item.PrismProperty<T>clone()Literal clone.PrismProperty<T>cloneComplex(CloneStrategy strategy)Complex clone with different cloning strategies.protected voidcopyValues(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)PrismProperty<T>createImmutableClone()StringdebugDump(int indent)booleandeleteValue(PrismPropertyValue<T> pValueToDelete)booleandeleteValues(Collection<PrismPropertyValue<T>> pValuesToDelete)PropertyDelta<T>diff(PrismProperty<T> other)PropertyDelta<T>diff(PrismProperty<T> other, ParameterizedEquivalenceStrategy strategy)Objectfind(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 ItemDeltafixupDelta(ItemDelta delta, Item otherItem)TgetAnyRealValue()protected StringgetDebugDumpClassName()Return a human readable name of this class suitable for logs.PrismPropertyDefinition<T>getDefinition()Returns applicable property definition.TgetRealValue()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>getRealValues()Returns (potentially empty) collection of "real values".<X> Collection<X>getRealValues(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.booleanhasRealValue(PrismPropertyValue<T> value)voidreplaceValues(Collection<PrismPropertyValue<T>> valuesToReplace)voidsetDefinition(PrismPropertyDefinition<T> definition)Sets applicable property definition.voidsetRealValue(T realValue)voidsetRealValues(T... realValues)voidsetValue(PrismPropertyValue<T> value)Means as a short-hand for setting just a value for single-valued attributes.StringtoHumanReadableString()StringtoString()protected voidvalueRemoved(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, 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, 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 Detail
-
PrismPropertyImpl
public PrismPropertyImpl(QName name)
-
PrismPropertyImpl
public PrismPropertyImpl(QName name, PrismContext prismContext)
-
PrismPropertyImpl
public 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:
getDefinitionin interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Specified by:
getDefinitionin interfaceItemable- Overrides:
getDefinitionin 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:
setDefinitionin interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Overrides:
setDefinitionin 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:
getValuesin interfacePrismProperty<T>
-
getRealValues
@NotNull public @NotNull Collection<T> getRealValues()
Description copied from interface:ItemReturns (potentially empty) collection of "real values".- Specified by:
getRealValuesin interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Specified by:
getRealValuesin interfacePrismProperty<T>
-
getRealValues
public <X> Collection<X> getRealValues(Class<X> type)
Type override, also for compatibility.- Specified by:
getRealValuesin interfacePrismProperty<T>
-
getAnyRealValue
public T getAnyRealValue()
- Specified by:
getAnyRealValuein interfacePrismProperty<T>
-
getRealValue
public T getRealValue()
Description copied from interface:ItemReturns 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:
getRealValuein interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Specified by:
getRealValuein interfacePrismProperty<T>- Overrides:
getRealValuein classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
getValue
public <X> PrismPropertyValue<X> getValue(Class<X> type)
Type override, also for compatibility.- Specified by:
getValuein 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:
setValuein interfacePrismProperty<T>
-
setRealValue
public void setRealValue(T realValue)
- Specified by:
setRealValuein interfacePrismProperty<T>
-
setRealValues
public void setRealValues(T... realValues)
- Specified by:
setRealValuesin interfacePrismProperty<T>
-
addValues
public void addValues(Collection<PrismPropertyValue<T>> pValuesToAdd)
- Specified by:
addValuesin interfacePrismProperty<T>
-
add
public boolean add(@NotNull @NotNull PrismPropertyValue<T> newValue) throws SchemaExceptionDescription copied from interface:ItemAdds 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:
addin interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Throws:
SchemaException
-
addValue
public void addValue(PrismPropertyValue<T> pValueToAdd)
- Specified by:
addValuein interfacePrismProperty<T>
-
addValue
public void addValue(PrismPropertyValue<T> pValueToAdd, boolean checkUniqueness)
-
addInternalExecution
protected boolean addInternalExecution(@NotNull @NotNull PrismPropertyValue<T> newValue)- Overrides:
addInternalExecutionin classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
addRealValue
public void addRealValue(T valueToAdd)
- Specified by:
addRealValuein interfacePrismProperty<T>
-
addRealValueSkipUniquenessCheck
public void addRealValueSkipUniquenessCheck(T valueToAdd)
- Specified by:
addRealValueSkipUniquenessCheckin interfacePrismProperty<T>
-
deleteValues
public boolean deleteValues(Collection<PrismPropertyValue<T>> pValuesToDelete)
- Specified by:
deleteValuesin interfacePrismProperty<T>
-
deleteValue
public boolean deleteValue(PrismPropertyValue<T> pValueToDelete)
- Specified by:
deleteValuein interfacePrismProperty<T>
-
replaceValues
public void replaceValues(Collection<PrismPropertyValue<T>> valuesToReplace)
- Specified by:
replaceValuesin interfacePrismProperty<T>
-
hasRealValue
public boolean hasRealValue(PrismPropertyValue<T> value)
- Specified by:
hasRealValuein interfacePrismProperty<T>
-
getValueClass
public Class<T> getValueClass()
- Specified by:
getValueClassin interfacePrismProperty<T>
-
createDelta
public PropertyDelta<T> createDelta()
Description copied from interface:ItemCreates specific subclass of ItemDelta appropriate for type of item that this definition represents (e.g. PropertyDelta, ContainerDelta, ...)- Specified by:
createDeltain interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Specified by:
createDeltain interfacePrismProperty<T>
-
createDelta
public PropertyDelta<T> createDelta(ItemPath path)
- Specified by:
createDeltain interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Specified by:
createDeltain interfacePrismProperty<T>
-
find
public Object find(ItemPath path)
Description copied from interface:ItemReturns object (Item or PrismValue) pointed to by the given path.- Specified by:
findin interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
findPartial
public <IV extends PrismValue,ID extends ItemDefinition> PartiallyResolvedItem<IV,ID> findPartial(ItemPath path)
- Specified by:
findPartialin interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Specified by:
findPartialin interfacePrismProperty<T>
-
diff
public PropertyDelta<T> diff(PrismProperty<T> other)
- Specified by:
diffin interfacePrismProperty<T>
-
diff
public PropertyDelta<T> diff(PrismProperty<T> other, ParameterizedEquivalenceStrategy strategy)
- Specified by:
diffin interfacePrismProperty<T>
-
checkDefinition
protected void checkDefinition(PrismPropertyDefinition<T> def)
- Specified by:
checkDefinitionin classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
clone
public PrismProperty<T> clone()
Description copied from interface:ItemLiteral clone.- Specified by:
clonein interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Specified by:
clonein interfacePrismProperty<T>- Specified by:
clonein classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
createImmutableClone
public PrismProperty<T> createImmutableClone()
- Specified by:
createImmutableClonein interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Specified by:
createImmutableClonein interfacePrismProperty<T>- Overrides:
createImmutableClonein classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
cloneComplex
public PrismProperty<T> cloneComplex(CloneStrategy strategy)
Description copied from interface:ItemComplex clone with different cloning strategies.- Specified by:
cloneComplexin interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Specified by:
cloneComplexin interfacePrismProperty<T>- See Also:
CloneStrategy
-
copyValues
protected void copyValues(CloneStrategy strategy, PrismPropertyImpl<T> clone)
-
fixupDelta
protected ItemDelta fixupDelta(ItemDelta delta, Item otherItem)
- Overrides:
fixupDeltain classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
toString
public String toString()
- Overrides:
toStringin classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDumpin interfaceDebugDumpable- Overrides:
debugDumpin classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
toHumanReadableString
public String toHumanReadableString()
- Specified by:
toHumanReadableStringin interfacePrismProperty<T>
-
getDebugDumpClassName
protected String getDebugDumpClassName()
Return a human readable name of this class suitable for logs.- Overrides:
getDebugDumpClassNamein classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
addForced
public void addForced(@NotNull @NotNull PrismPropertyValue<T> newValue)Description copied from class:ItemImplAdds a given value with no checks, no definition application, and so on. For internal use only.- Overrides:
addForcedin classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
valueRemoved
protected void valueRemoved(PrismPropertyValue<T> currentValue)
- Overrides:
valueRemovedin classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
clear
public void clear()
Description copied from interface:ItemRemoves all values from the item.- Specified by:
clearin interfaceItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>>- Overrides:
clearin classItemImpl<PrismPropertyValue<T>,PrismPropertyDefinition<T>>
-
-