Package com.evolveum.midpoint.prism.impl
Class ItemDefinitionImpl<I extends Item<?,?>>
java.lang.Object
com.evolveum.midpoint.prism.AbstractFreezable
com.evolveum.midpoint.prism.impl.schema.SchemaRegistryStateAware
com.evolveum.midpoint.prism.impl.DefinitionImpl
com.evolveum.midpoint.prism.impl.ItemDefinitionImpl<I>
- All Implemented Interfaces:
Definition
,Definition.DefinitionBuilder
,Definition.DefinitionMutator
,DefinitionFragmentBuilder
,Freezable
,ItemDefinition<I>
,ItemDefinition.ItemDefinitionLikeBuilder
,ItemDefinition.ItemDefinitionMutator
,LivePrismItemDefinition
,PrismItemAccessDefinition
,PrismItemAccessDefinition.Mutable
,PrismItemBasicDefinition
,PrismItemBasicDefinition.Mutable
,PrismItemStorageDefinition
,PrismItemStorageDefinition.Mutable
,PrismLifecycleDefinition
,PrismLifecycleDefinition.Mutable
,PrismPresentationDefinition
,PrismPresentationDefinition.Mutable
,Revivable
,SchemaLookup.Aware
,SerializableDefinition
,SerializableItemDefinition
,SmartVisitable<Definition>
,Visitable<Definition>
,DebugDumpable
,Serializable
,Cloneable
- Direct Known Subclasses:
PrismContainerDefinitionImpl
,PrismPropertyDefinitionImpl
,PrismReferenceDefinitionImpl
public abstract class ItemDefinitionImpl<I extends Item<?,?>>
extends DefinitionImpl
implements ItemDefinition<I>, ItemDefinition.ItemDefinitionMutator, ItemDefinition.ItemDefinitionLikeBuilder, SerializableItemDefinition
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.Definition
Definition.DefinitionBuilder, Definition.DefinitionMutator
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.ItemDefinition
ItemDefinition.ItemDefinitionLikeBuilder, ItemDefinition.ItemDefinitionMutator
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.PrismItemAccessDefinition
PrismItemAccessDefinition.Data, PrismItemAccessDefinition.Delegable, PrismItemAccessDefinition.Info, PrismItemAccessDefinition.Mutable
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.PrismItemAccessDefinition.Mutable
PrismItemAccessDefinition.Mutable.Delegable
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.PrismItemBasicDefinition
PrismItemBasicDefinition.Data, PrismItemBasicDefinition.Delegable, PrismItemBasicDefinition.Mutable
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.PrismItemBasicDefinition.Mutable
PrismItemBasicDefinition.Mutable.Delegable
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.PrismItemStorageDefinition
PrismItemStorageDefinition.Mutable
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.PrismLifecycleDefinition
PrismLifecycleDefinition.Data, PrismLifecycleDefinition.Delegable, PrismLifecycleDefinition.Mutable
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.PrismLifecycleDefinition.Mutable
PrismLifecycleDefinition.Mutable.Delegable
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.PrismPresentationDefinition
PrismPresentationDefinition.Data, PrismPresentationDefinition.Delegable, PrismPresentationDefinition.Mutable
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.PrismPresentationDefinition.Mutable
PrismPresentationDefinition.Mutable.Delegable
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected final @NotNull ItemName
Final because it's sometimes used as a key in maps; moreover, it forms an identity of the definition somehow.protected ItemProcessing
protected QName
Fields inherited from class com.evolveum.midpoint.prism.impl.DefinitionImpl
deprecated, deprecatedSince, displayHint, displayName, displayOrder, documentation, elaborate, emphasized, experimental, help, isAbstract, isRuntimeSchema, plannedRemoval, removed, removedSince, typeName
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canAdd()
Returns true if the item can be added.boolean
Returns true if the item can be modified.boolean
canRead()
Returns true if the property can be read.abstract @NotNull ItemDefinition<I>
clone()
protected void
copyDefinitionDataFrom
(ItemDefinition<I> source) void
Used in debugDumping items.deepClone
(@NotNull DeepCloneOperation operation) Make a deep clone, cloning all the sub-items and definitions.boolean
protected void
<T extends ItemDefinition<?>>
TfindItemDefinition
(@NotNull ItemPath path, @NotNull Class<T> clazz) Used to find a matching item definition _within_ this definition.@NotNull ItemName
Returns name of the defined entity.int
Returns the number of maximal value occurrences.@Nullable ItemMerger
getMergerInstance
(@NotNull MergeStrategy strategy, @Nullable OriginMarker originMarker) int
Returns the number of minimal value occurrences.Returns the name of an element this one can be substituted for (e.g. c:user -> c:object, s:pipeline -> s:expression, etc).Reference to an object that directly or indirectly represents possible values for this item.int
hashCode()
boolean
Item which should always be used for equals even if it is operational and strategy does not consider operational items.boolean
Returns true if definition was created during the runtime based on a dynamic information such as xsi:type attributes in XML.boolean
Can be used in heterogeneous lists as a list item.This is XSD annotation that specifies whether a property should be indexed in the storage.boolean
If true, this item is not stored in XML representation in repo.boolean
Whether the item is inherited from a supertype.boolean
Marks operational item.boolean
Returns true if item definition is searchable.boolean
isValidFor
(@NotNull QName elementQName, @NotNull Class<? extends ItemDefinition<?>> clazz, boolean caseInsensitive) Returns true if this definition is valid for given element name and definition class, in either case-sensitive (the default) or case-insensitive way.void
revive
(PrismContext prismContext) TODO: Is revive necessary if prism context is static?void
setAlwaysUseForEquals
(boolean alwaysUseForEquals) void
setCanAdd
(boolean add) void
setCanModify
(boolean modify) void
setCanRead
(boolean read) void
setDynamic
(boolean dynamic) void
setHeterogeneousListItem
(boolean heterogeneousListItem) void
setIndexed
(Boolean indexed) void
setIndexOnly
(boolean indexOnly) void
setInherited
(boolean inherited) void
setMaxOccurs
(int maxOccurs) void
setMinOccurs
(int minOccurs) void
setOperational
(boolean operational) void
setProcessing
(ItemProcessing itemProcessing) void
void
setSearchable
(boolean searchable) void
setSubstitutionHead
(QName substitutionHead) void
setValueEnumerationRef
(PrismReferenceValue valueEnumerationRef) toString()
protected static boolean
useSerializationProxy
(boolean localEnabled) protected Object
Methods inherited from class com.evolveum.midpoint.prism.impl.DefinitionImpl
accept, accept, addSchemaMigration, copyDefinitionDataFrom, debugDump, extendDumpHeader, getAnnotation, getAnnotation, getAnnotations, getDebugDumpClassName, getDeprecatedSince, getDiagrams, getDisplayHint, getDisplayName, getDisplayOrder, getDocClassName, getDocumentation, getDocumentationPreview, getHelp, getMergerIdentifier, getNaturalKeyConstituents, getNaturalKeyInstance, getPlannedRemoval, getRemovedSince, getSchemaContextDefinition, getSchemaMigrations, getTypeName, isAbstract, isDeprecated, isElaborate, isEmphasized, isExperimental, isOptionalCleanup, isRemoved, isRuntimeSchema, setAbstract, setAnnotation, setDeprecated, setDeprecatedSince, setDiagrams, setDisplayHint, setDisplayName, setDisplayOrder, setDocumentation, setElaborate, setEmphasized, setExperimental, setHelp, setMergerIdentifier, setNaturalKeyConstituents, setOptionalCleanup, setPlannedRemoval, setRemoved, setRemovedSince, setRuntimeSchema, setSchemaContextDefinition, setSchemaMigrations
Methods inherited from class com.evolveum.midpoint.prism.impl.schema.SchemaRegistryStateAware
performFreeze, schemaLookup, setSchemaLookup
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, debugDump, debugDumpLazily, debugDumpLazily
Methods inherited from interface com.evolveum.midpoint.prism.Definition
checkMutableOnExposing, debugDump, getAnnotation, getAnnotations, getMergerIdentifier, getMutabilityFlag, getNaturalKeyConstituents, getNaturalKeyInstance, getSchemaContextDefinition, getTypeClass, getTypeName, isAbstract, isElaborate, isOptionalCleanup, isRuntimeSchema
Methods inherited from interface com.evolveum.midpoint.prism.Definition.DefinitionMutator
setAnnotation, setMergerIdentifier, setNaturalKeyConstituents, setOptionalCleanup, setRuntimeSchema, setSchemaContextDefinition
Methods inherited from interface com.evolveum.midpoint.prism.Freezable
checkImmutable, checkMutable, freeze, isImmutable
Methods inherited from interface com.evolveum.midpoint.prism.ItemDefinition
cloneWithNewName, createEmptyDelta, instantiate, instantiate, isIgnored, mutator, structuredType
Methods inherited from interface com.evolveum.midpoint.prism.ItemDefinition.ItemDefinitionLikeBuilder
getExtraFeaturesToParse
Methods inherited from interface com.evolveum.midpoint.prism.ItemDefinition.ItemDefinitionMutator
setDeprecatedSince, setElaborate, setIgnored, setPlannedRemoval
Methods inherited from interface com.evolveum.midpoint.prism.PrismItemAccessDefinition
getInfo
Methods inherited from interface com.evolveum.midpoint.prism.PrismItemAccessDefinition.Mutable
setInfo
Methods inherited from interface com.evolveum.midpoint.prism.PrismItemBasicDefinition
getTypeName, isMandatory, isMultiValue, isOptional, isSingleValue
Methods inherited from interface com.evolveum.midpoint.prism.PrismLifecycleDefinition
getDeprecatedSince, getPlannedRemoval, getRemovedSince, getSchemaMigrations, isDeprecated, isExperimental, isRemoved
Methods inherited from interface com.evolveum.midpoint.prism.PrismLifecycleDefinition.Mutable
addSchemaMigration, setDeprecated, setExperimental, setRemoved, setRemovedSince, setSchemaMigrations
Methods inherited from interface com.evolveum.midpoint.prism.PrismPresentationDefinition
getDiagrams, getDisplayHint, getDisplayName, getDisplayOrder, getDocumentation, getDocumentationPreview, getHelp, isEmphasized
Methods inherited from interface com.evolveum.midpoint.prism.PrismPresentationDefinition.Mutable
setDiagrams, setDisplayHint, setDisplayName, setDisplayOrder, setDocumentation, setEmphasized, setHelp
Methods inherited from interface com.evolveum.midpoint.prism.schema.SchemaLookup.Aware
schemaLookup
Methods inherited from interface com.evolveum.midpoint.prism.schema.SerializableDefinition
getDisplayHint, getDisplayName, getDisplayOrder, getDocumentation, getExtraFeaturesToSerialize, getHelp, isEmphasized
Methods inherited from interface com.evolveum.midpoint.prism.schema.SerializableItemDefinition
getTypeName
Methods inherited from interface com.evolveum.midpoint.prism.SmartVisitable
accept
-
Field Details
-
itemName
Final because it's sometimes used as a key in maps; moreover, it forms an identity of the definition somehow. -
substitutionHead
-
heterogeneousListItem
protected boolean heterogeneousListItem -
processing
-
-
Method Details
-
useSerializationProxy
protected static boolean useSerializationProxy(boolean localEnabled) -
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 interfacePrismItemBasicDefinition
- Specified by:
getItemName
in interfaceSerializableItemDefinition
- Returns:
- the name name of the entity or null.
-
getMinOccurs
public int getMinOccurs()Description copied from interface:PrismItemBasicDefinition
Returns the number of minimal value occurrences.- Specified by:
getMinOccurs
in interfacePrismItemBasicDefinition
- Specified by:
getMinOccurs
in interfaceSerializableItemDefinition
-
setMinOccurs
public void setMinOccurs(int minOccurs) - Specified by:
setMinOccurs
in interfacePrismItemBasicDefinition.Mutable
-
getMaxOccurs
public int getMaxOccurs()Description copied from interface:PrismItemBasicDefinition
Returns the number of maximal value occurrences. Any negative number means "unbounded".- Specified by:
getMaxOccurs
in interfacePrismItemBasicDefinition
- Specified by:
getMaxOccurs
in interfaceSerializableItemDefinition
-
setMaxOccurs
public void setMaxOccurs(int maxOccurs) - Specified by:
setMaxOccurs
in interfacePrismItemBasicDefinition.Mutable
-
isOperational
public boolean isOperational()Description copied from interface:ItemDefinition
Marks operational item. Operational properties are auxiliary data (or meta-data) that are usually not modifiable by the end user. They are generated and maintained by the system. Operational items are also not usually displayed unless it is explicitly requested. The example of operational items are modification timestamps, create timestamps, user that made the last change, etc. They are also treated in a special way when comparing values. SeeParameterizedEquivalenceStrategy
.- Specified by:
isOperational
in interfaceItemDefinition<I extends Item<?,
?>> - Specified by:
isOperational
in interfaceSerializableItemDefinition
-
setOperational
public void setOperational(boolean operational) - Specified by:
setOperational
in interfaceItemDefinition.ItemDefinitionMutator
-
isAlwaysUseForEquals
public boolean isAlwaysUseForEquals()Description copied from interface:ItemDefinition
Item which should always be used for equals even if it is operational and strategy does not consider operational items. EXPERIMENTAL- Specified by:
isAlwaysUseForEquals
in interfaceItemDefinition<I extends Item<?,
?>>
-
setAlwaysUseForEquals
public void setAlwaysUseForEquals(boolean alwaysUseForEquals) - Specified by:
setAlwaysUseForEquals
in interfaceItemDefinition.ItemDefinitionMutator
-
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 interfaceItemDefinition.ItemDefinitionMutator
-
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 interfaceItemDefinition.ItemDefinitionMutator
-
setCanRead
public void setCanRead(boolean read) - Specified by:
setCanRead
in interfacePrismItemAccessDefinition.Mutable
-
setCanModify
public void setCanModify(boolean modify) - Specified by:
setCanModify
in interfacePrismItemAccessDefinition.Mutable
-
setCanAdd
public void setCanAdd(boolean add) - Specified by:
setCanAdd
in interfacePrismItemAccessDefinition.Mutable
-
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
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
- Specified by:
setSubstitutionHead
in interfaceItemDefinition.ItemDefinitionMutator
-
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 interfaceItemDefinition.ItemDefinitionMutator
-
getValueEnumerationRef
Description copied from interface:ItemDefinition
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
- Specified by:
setValueEnumerationRef
in interfaceItemDefinition.ItemDefinitionMutator
-
isValidFor
public boolean isValidFor(@NotNull @NotNull QName elementQName, @NotNull @NotNull Class<? extends ItemDefinition<?>> clazz, boolean caseInsensitive) Description copied from interface:LivePrismItemDefinition
Returns true if this definition is valid for given element name and definition class, in either case-sensitive (the default) or case-insensitive way. Used e.g. for "slow" path lookup where we iterate over all definitions in a complex type.- Specified by:
isValidFor
in interfaceLivePrismItemDefinition
-
findItemDefinition
public <T extends ItemDefinition<?>> T findItemDefinition(@NotNull @NotNull ItemPath path, @NotNull @NotNull Class<T> clazz) Description copied from interface:LivePrismItemDefinition
Used to find a matching item definition _within_ this definition. Treats e.g. de-referencing in prism references.- Specified by:
findItemDefinition
in interfaceLivePrismItemDefinition
-
clone
- Specified by:
clone
in interfaceDefinition
- Specified by:
clone
in interfaceItemDefinition<I extends Item<?,
?>> - Specified by:
clone
in classDefinitionImpl
-
copyDefinitionDataFrom
-
deepClone
Make a deep clone, cloning all the sub-items and definitions.- Specified by:
deepClone
in interfaceItemDefinition<I extends Item<?,
?>>
-
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
- Specified by:
revive
in classDefinitionImpl
-
equals
- Overrides:
equals
in classDefinitionImpl
-
hashCode
public int hashCode()- Overrides:
hashCode
in classDefinitionImpl
-
toString
- Overrides:
toString
in classDefinitionImpl
-
debugDumpShortToString
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
-
debugFlags
-
extendToString
-
isInherited
public boolean isInherited()Description copied from interface:ItemDefinition
Whether the item is inherited from a supertype.- Specified by:
isInherited
in interfaceItemDefinition<I extends Item<?,
?>>
-
setInherited
public void setInherited(boolean inherited) - Specified by:
setInherited
in interfaceItemDefinition.ItemDefinitionMutator
-
isIndexed
Description copied from interface:PrismItemStorageDefinition
This is XSD annotation that specifies whether a property should be indexed in the storage. It can only apply to properties. It has following meaning: true: the property must be indexed. If the storage is not able to index the value, it should indicate an error. false: the property should not be indexed. null: data store decides whether to index the property or not.- Specified by:
isIndexed
in interfacePrismItemStorageDefinition
- Specified by:
isIndexed
in interfaceSerializableItemDefinition
-
setIndexed
- Specified by:
setIndexed
in interfacePrismItemStorageDefinition.Mutable
-
isIndexOnly
public boolean isIndexOnly()Description copied from interface:PrismItemStorageDefinition
If true, this item is not stored in XML representation in repo. TODO better name- Specified by:
isIndexOnly
in interfacePrismItemStorageDefinition
-
setIndexOnly
public void setIndexOnly(boolean indexOnly) - Specified by:
setIndexOnly
in interfaceItemDefinition.ItemDefinitionMutator
- Specified by:
setIndexOnly
in interfacePrismItemStorageDefinition.Mutable
-
isSearchable
public boolean isSearchable()Description copied from interface:PrismItemStorageDefinition
Returns true if item definition is searchable.- Specified by:
isSearchable
in interfacePrismItemStorageDefinition
-
setSearchable
public void setSearchable(boolean searchable) - Specified by:
setSearchable
in interfaceItemDefinition.ItemDefinitionMutator
- Specified by:
setSearchable
in interfacePrismItemStorageDefinition.Mutable
-
writeReplace
-
getProcessing
- Specified by:
getProcessing
in interfaceItemDefinition<I extends Item<?,
?>> - Specified by:
getProcessing
in interfaceSerializableItemDefinition
-
setProcessing
- Specified by:
setProcessing
in interfaceItemDefinition.ItemDefinitionMutator
-
getObjectBuilt
- Specified by:
getObjectBuilt
in interfaceDefinitionFragmentBuilder
-
getMergerInstance
@Nullable public @Nullable ItemMerger getMergerInstance(@NotNull @NotNull MergeStrategy strategy, @Nullable @Nullable OriginMarker originMarker) - Specified by:
getMergerInstance
in interfaceDefinition
- Overrides:
getMergerInstance
in classDefinitionImpl
-