Package com.evolveum.midpoint.prism.impl
Class ItemDefinitionImpl<I extends Item>
- java.lang.Object
-
- com.evolveum.midpoint.prism.AbstractFreezable
-
- com.evolveum.midpoint.prism.impl.DefinitionImpl
-
- com.evolveum.midpoint.prism.impl.ItemDefinitionImpl<I>
-
- All Implemented Interfaces:
Definition
,Freezable
,ItemDefinition<I>
,ItemDefinitionTestAccess
,MutableDefinition
,MutableItemDefinition<I>
,PrismContextSensitive
,PrismItemAccessDefinition
,Revivable
,SmartVisitable<Definition>
,Visitable<Definition>
,DebugDumpable
,Serializable
,Cloneable
- Direct Known Subclasses:
PrismContainerDefinitionImpl
,PrismPropertyDefinitionImpl
,PrismReferenceDefinitionImpl
public abstract class ItemDefinitionImpl<I extends Item> extends DefinitionImpl implements MutableItemDefinition<I>, ItemDefinitionTestAccess
Abstract item definition in the schema. This is supposed to be a superclass for all item definitions. Items are things that can appear in property containers, which generally means only a property and property container itself. Therefore this is in fact superclass for those two definitions. The definitions represent data structures of the schema. Therefore instances of Java objects from this class represent specific definitions from the schema, not specific properties or objects. E.g the definitions does not have any value. To transform definition to a real property or object use the explicit instantiate() methods provided in the definition classes. E.g. the instantiate() method will create instance of Property using appropriate PropertyDefinition. The convenience methods in Schema are using this abstract class to find appropriate definitions easily.- Author:
- Radovan Semancik
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.PrismItemAccessDefinition
PrismItemAccessDefinition.Mutable
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
heterogeneousListItem
protected @NotNull ItemName
itemName
protected QName
substitutionHead
-
Fields inherited from class com.evolveum.midpoint.prism.impl.DefinitionImpl
deprecated, deprecatedSince, displayName, displayOrder, documentation, elaborate, emphasized, experimental, help, isAbstract, isRuntimeSchema, plannedRemoval, processing, typeName
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
adoptElementDefinitionFrom(ItemDefinition otherDef)
boolean
canAdd()
Returns true if the item can be added.boolean
canBeDefinitionOf(I item)
boolean
canModify()
Returns true if the item can be modified.boolean
canRead()
Returns true if the property can be read.abstract @NotNull ItemDefinition
clone()
protected void
copyDefinitionData(ItemDefinitionImpl<I> clone)
void
debugDumpShortToString(StringBuilder sb)
Used in debugDumping items.String
debugFlags()
String
debugMultiplicity()
ItemDefinition<I>
deepClone(boolean ultraDeep, Consumer<ItemDefinition> postCloneAction)
Make a deep clone, cloning all the sub-items and definitions.ItemDefinition<I>
deepClone(Map<QName,ComplexTypeDefinition> ctdMap, Map<QName,ComplexTypeDefinition> onThisPath, Consumer<ItemDefinition> postCloneAction)
boolean
equals(Object o)
protected void
extendToString(StringBuilder sb)
<T extends ItemDefinition>
TfindItemDefinition(@NotNull ItemPath path, @NotNull Class<T> clazz)
@NotNull ItemName
getItemName()
Returns name of the defined entity.int
getMaxOccurs()
Return the number of maximal value occurrences.int
getMinOccurs()
Return the number of minimal value occurrences.String
getNamespace()
QName
getSubstitutionHead()
Returns the name of an element this one can be substituted for (e.g.PrismReferenceValue
getValueEnumerationRef()
Reference to an object that directly or indirectly represents possible values for this item.int
hashCode()
boolean
isDynamic()
Returns true if definition was created during the runtime based on a dynamic information such as xsi:type attributes in XML.boolean
isHeterogeneousListItem()
Can be used in heterogeneous lists as a list item.boolean
isIndexOnly()
EXPERIMENTAL.boolean
isInherited()
Whether an item is inherited from a supertype.boolean
isMandatory()
Returns true if property is mandatory.boolean
isOperational()
boolean
isOptional()
Returns true if property is optional.boolean
isValidFor(@NotNull QName elementQName, @NotNull Class<? extends ItemDefinition> clazz, boolean caseInsensitive)
boolean
isValidFor(QName elementQName, Class<? extends ItemDefinition> clazz)
void
replaceName(ItemName newName)
void
revive(PrismContext prismContext)
void
setCanAdd(boolean add)
void
setCanModify(boolean modify)
void
setCanRead(boolean read)
void
setDynamic(boolean dynamic)
void
setHeterogeneousListItem(boolean heterogeneousListItem)
void
setIndexOnly(boolean indexOnly)
void
setInherited(boolean inherited)
void
setItemName(@NotNull QName name)
void
setMaxOccurs(int maxOccurs)
void
setMinOccurs(int minOccurs)
void
setOperational(boolean operational)
void
setReadOnly()
void
setSubstitutionHead(QName substitutionHead)
void
setValueEnumerationRef(PrismReferenceValue valueEnumerationRef)
String
toString()
protected static boolean
useSerializationProxy(boolean localEnabled)
protected Object
writeReplace()
-
Methods inherited from class com.evolveum.midpoint.prism.impl.DefinitionImpl
accept, accept, addDiagram, addSchemaMigration, checkMutableOnExposing, copyDefinitionData, debugDump, extendDumpHeader, getAnnotation, getDebugDumpClassName, getDeprecatedSince, getDiagrams, getDisplayName, getDisplayOrder, getDocClassName, getDocumentation, getDocumentationPreview, getHelp, getPlannedRemoval, getPrismContext, getProcessing, getSchemaMigrations, getTypeClass, getTypeClassIfKnown, getTypeName, isAbstract, isDeprecated, isElaborate, isEmphasized, isExperimental, isIgnored, isRuntimeSchema, setAbstract, setAnnotation, setDeprecated, setDeprecatedSince, setDisplayName, setDisplayOrder, setDocumentation, setElaborate, setEmphasized, setExperimental, setHelp, setPlannedRemoval, setProcessing, setRuntimeSchema, setTypeName
-
Methods inherited from class com.evolveum.midpoint.prism.AbstractFreezable
freeze, freeze, freezeAll, freezeNullableList, isImmutable, isMutable, performFreeze
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.prism.Definition
debugDump, getAnnotation, getDeprecatedSince, getDiagrams, getDisplayName, getDisplayOrder, getDocumentation, getDocumentationPreview, getHelp, getMutabilityFlag, getPlannedRemoval, getProcessing, getSchemaMigrations, getSchemaRegistry, getTypeClass, getTypeClassIfKnown, getTypeName, isAbstract, isDeprecated, isElaborate, isEmphasized, isExperimental, isIgnored, isRuntimeSchema, setAnnotation
-
Methods inherited from interface com.evolveum.midpoint.prism.Freezable
checkImmutable, checkMutable, freeze, isImmutable
-
Methods inherited from interface com.evolveum.midpoint.prism.ItemDefinition
canBeDefinitionOf, createEmptyDelta, instantiate, instantiate, isMultiValue, isSingleValue, structuredType, toMutable
-
Methods inherited from interface com.evolveum.midpoint.prism.MutableDefinition
addDiagram, addSchemaMigration, setDeprecated, setDisplayName, setDisplayOrder, setDocumentation, setEmphasized, setExperimental, setHelp, setProcessing, setRuntimeSchema, setTypeName
-
Methods inherited from interface com.evolveum.midpoint.prism.MutableItemDefinition
setDeprecatedSince, setElaborate, setPlannedRemoval
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismContextSensitive
getPrismContext
-
Methods inherited from interface com.evolveum.midpoint.prism.SmartVisitable
accept
-
-
-
-
Method Detail
-
useSerializationProxy
protected static boolean useSerializationProxy(boolean localEnabled)
-
getItemName
@NotNull public @NotNull ItemName getItemName()
Returns name of the defined entity. The name is a name of the entity instance if it is fixed by the schema. E.g. it may be a name of the property in the container that cannot be changed. The name corresponds to the XML element name in the XML representation of the schema. It does NOT correspond to a XSD type name. Name is optional. If name is not set the null value is returned. If name is not set the type is "abstract", does not correspond to the element.- Specified by:
getItemName
in interfaceItemDefinition<I extends Item>
- Returns:
- the name name of the entity or null.
-
setItemName
public void setItemName(@NotNull @NotNull QName name)
- Specified by:
setItemName
in interfaceMutableItemDefinition<I extends Item>
-
getNamespace
public String getNamespace()
- Specified by:
getNamespace
in interfaceItemDefinition<I extends Item>
-
getMinOccurs
public int getMinOccurs()
Return the number of minimal value occurrences.- Specified by:
getMinOccurs
in interfaceItemDefinition<I extends Item>
- Returns:
- the minOccurs
-
setMinOccurs
public void setMinOccurs(int minOccurs)
- Specified by:
setMinOccurs
in interfaceMutableItemDefinition<I extends Item>
-
getMaxOccurs
public int getMaxOccurs()
Return the number of maximal value occurrences.Any negative number means "unbounded".
- Specified by:
getMaxOccurs
in interfaceItemDefinition<I extends Item>
- Returns:
- the maxOccurs
-
setMaxOccurs
public void setMaxOccurs(int maxOccurs)
- Specified by:
setMaxOccurs
in interfaceMutableItemDefinition<I extends Item>
-
isMandatory
public boolean isMandatory()
Returns true if property is mandatory.- Specified by:
isMandatory
in interfaceItemDefinition<I extends Item>
- Returns:
- true if property is mandatory.
-
isOptional
public boolean isOptional()
Returns true if property is optional.- Specified by:
isOptional
in interfaceItemDefinition<I extends Item>
- Returns:
- true if property is optional.
-
isOperational
public boolean isOperational()
- Specified by:
isOperational
in interfaceItemDefinition<I extends Item>
-
setOperational
public void setOperational(boolean operational)
- Specified by:
setOperational
in interfaceMutableItemDefinition<I extends Item>
-
isDynamic
public boolean isDynamic()
Description copied from interface:ItemDefinition
Returns true if definition was created during the runtime based on a dynamic information such as xsi:type attributes in XML. This means that the definition needs to be stored alongside the data to have a successful serialization "roundtrip". The definition is not part of any schema and therefore cannot be determined. It may even be different for every instance of the associated item (element name).- Specified by:
isDynamic
in interfaceItemDefinition<I extends Item>
-
setDynamic
public void setDynamic(boolean dynamic)
- Specified by:
setDynamic
in interfaceMutableItemDefinition<I extends Item>
-
canRead
public boolean canRead()
Returns true if the property can be read. I.e. if it is returned in objects retrieved from "get", "search" and similar operations.- Specified by:
canRead
in interfacePrismItemAccessDefinition
-
canModify
public boolean canModify()
Returns true if the item can be modified. I.e. if it can be changed during a modification of existing object.- Specified by:
canModify
in interfacePrismItemAccessDefinition
-
setReadOnly
public void setReadOnly()
- Specified by:
setReadOnly
in interfaceMutableItemDefinition<I extends Item>
-
setCanRead
public void setCanRead(boolean read)
- Specified by:
setCanRead
in interfaceMutableItemDefinition<I extends Item>
-
setCanModify
public void setCanModify(boolean modify)
- Specified by:
setCanModify
in interfaceMutableItemDefinition<I extends Item>
-
setCanAdd
public void setCanAdd(boolean add)
- Specified by:
setCanAdd
in interfaceMutableItemDefinition<I extends Item>
-
canAdd
public boolean canAdd()
Returns true if the item can be added. I.e. if it can be present in the object when a new object is created.- Specified by:
canAdd
in interfacePrismItemAccessDefinition
-
getSubstitutionHead
public QName getSubstitutionHead()
Description copied from interface:ItemDefinition
Returns the name of an element this one can be substituted for (e.g. c:user -> c:object, s:pipeline -> s:expression, etc). EXPERIMENTAL- Specified by:
getSubstitutionHead
in interfaceItemDefinition<I extends Item>
-
setSubstitutionHead
public void setSubstitutionHead(QName substitutionHead)
- Specified by:
setSubstitutionHead
in interfaceMutableItemDefinition<I extends Item>
-
isHeterogeneousListItem
public boolean isHeterogeneousListItem()
Description copied from interface:ItemDefinition
Can be used in heterogeneous lists as a list item. EXPERIMENTAL.- Specified by:
isHeterogeneousListItem
in interfaceItemDefinition<I extends Item>
-
setHeterogeneousListItem
public void setHeterogeneousListItem(boolean heterogeneousListItem)
- Specified by:
setHeterogeneousListItem
in interfaceMutableItemDefinition<I extends Item>
-
getValueEnumerationRef
public PrismReferenceValue getValueEnumerationRef()
Reference to an object that directly or indirectly represents possible values for this item. We do not define here what exactly the object has to be. It can be a lookup table, script that dynamically produces the values or anything similar. The object must produce the values of the correct type for this item otherwise an error occurs.- Specified by:
getValueEnumerationRef
in interfaceItemDefinition<I extends Item>
-
setValueEnumerationRef
public void setValueEnumerationRef(PrismReferenceValue valueEnumerationRef)
- Specified by:
setValueEnumerationRef
in interfaceMutableItemDefinition<I extends Item>
-
isValidFor
public boolean isValidFor(QName elementQName, Class<? extends ItemDefinition> clazz)
- Specified by:
isValidFor
in interfaceItemDefinition<I extends Item>
-
isValidFor
public boolean isValidFor(@NotNull @NotNull QName elementQName, @NotNull @NotNull Class<? extends ItemDefinition> clazz, boolean caseInsensitive)
- Specified by:
isValidFor
in interfaceItemDefinition<I extends Item>
-
adoptElementDefinitionFrom
public void adoptElementDefinitionFrom(ItemDefinition otherDef)
- Specified by:
adoptElementDefinitionFrom
in interfaceItemDefinition<I extends Item>
-
findItemDefinition
public <T extends ItemDefinition> T findItemDefinition(@NotNull @NotNull ItemPath path, @NotNull @NotNull Class<T> clazz)
- Specified by:
findItemDefinition
in interfaceItemDefinition<I extends Item>
-
canBeDefinitionOf
public boolean canBeDefinitionOf(I item)
- Specified by:
canBeDefinitionOf
in interfaceItemDefinition<I extends Item>
-
clone
@NotNull public abstract @NotNull ItemDefinition clone()
- Specified by:
clone
in interfaceDefinition
- Specified by:
clone
in interfaceItemDefinition<I extends Item>
- Specified by:
clone
in classDefinitionImpl
-
copyDefinitionData
protected void copyDefinitionData(ItemDefinitionImpl<I> clone)
-
deepClone
public ItemDefinition<I> deepClone(boolean ultraDeep, Consumer<ItemDefinition> postCloneAction)
Make a deep clone, cloning all the sub-items and definitions.- Specified by:
deepClone
in interfaceItemDefinition<I extends Item>
- Parameters:
ultraDeep
- if set to true then even the objects that were same instance in the original will be cloned as separate instances in the clone.
-
deepClone
public ItemDefinition<I> deepClone(Map<QName,ComplexTypeDefinition> ctdMap, Map<QName,ComplexTypeDefinition> onThisPath, Consumer<ItemDefinition> postCloneAction)
- Specified by:
deepClone
in interfaceItemDefinition<I extends Item>
-
revive
public void revive(PrismContext prismContext)
- Specified by:
revive
in interfaceItemDefinition<I extends Item>
- Specified by:
revive
in interfaceRevivable
- Specified by:
revive
in classDefinitionImpl
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classDefinitionImpl
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classDefinitionImpl
-
toString
public String toString()
- Overrides:
toString
in classDefinitionImpl
-
debugDumpShortToString
public void debugDumpShortToString(StringBuilder sb)
Used in debugDumping items. Does not need to have name in it as item already has it. Does not need to have class as that is just too much info that is almost anytime pretty obvious anyway.- Specified by:
debugDumpShortToString
in interfaceItemDefinition<I extends Item>
-
debugMultiplicity
public String debugMultiplicity()
-
debugFlags
public String debugFlags()
-
extendToString
protected void extendToString(StringBuilder sb)
-
isInherited
public boolean isInherited()
Description copied from interface:ItemDefinition
Whether an item is inherited from a supertype.- Specified by:
isInherited
in interfaceItemDefinition<I extends Item>
-
setInherited
public void setInherited(boolean inherited)
- Overrides:
setInherited
in classDefinitionImpl
-
isIndexOnly
public boolean isIndexOnly()
Description copied from interface:ItemDefinition
EXPERIMENTAL. If true, this item is not stored in XML representation in repo. TODO better name- Specified by:
isIndexOnly
in interfaceItemDefinition<I extends Item>
-
setIndexOnly
public void setIndexOnly(boolean indexOnly)
- Specified by:
setIndexOnly
in interfaceMutableItemDefinition<I extends Item>
-
replaceName
public void replaceName(ItemName newName)
- Specified by:
replaceName
in interfaceItemDefinitionTestAccess
-
writeReplace
protected Object writeReplace()
-
-