Package com.evolveum.midpoint.prism.impl
Class ComplexTypeDefinitionImpl
- java.lang.Object
-
- com.evolveum.midpoint.prism.AbstractFreezable
-
- com.evolveum.midpoint.prism.impl.DefinitionImpl
-
- com.evolveum.midpoint.prism.impl.TypeDefinitionImpl
-
- com.evolveum.midpoint.prism.impl.ComplexTypeDefinitionImpl
-
- All Implemented Interfaces:
ComplexTypeDefinition
,Definition
,Freezable
,LocalItemDefinitionStore
,MutableComplexTypeDefinition
,MutableDefinition
,MutableTypeDefinition
,PrismContextSensitive
,Revivable
,SmartVisitable<Definition>
,TypeDefinition
,Visitable<Definition>
,DebugDumpable
,Serializable
,Cloneable
public class ComplexTypeDefinitionImpl extends TypeDefinitionImpl implements MutableComplexTypeDefinition
Direct implementation ofComplexTypeDefinition
.- Author:
- Radovan Semancik
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.evolveum.midpoint.prism.impl.TypeDefinitionImpl
compileTimeClass, instantiationOrder, serializationProxy
-
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
-
-
Constructor Summary
Constructors Constructor Description ComplexTypeDefinitionImpl(@NotNull QName typeName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(Visitor<Definition> visitor, SmartVisitation<Definition> visitation)
void
add(ItemDefinition<?> definition)
void
addSubstitution(ItemDefinition<?> itemDef, ItemDefinition<?> maybeSubst)
@NotNull ComplexTypeDefinitionImpl
clone()
Does a shallow clone of this definition (i.e.protected void
copyDefinitionDataFrom(ComplexTypeDefinition source)
PrismPropertyDefinition<?>
createPropertyDefinition(String localName, String localTypeName)
PrismPropertyDefinitionImpl<?>
createPropertyDefinition(String localName, QName typeName)
PrismPropertyDefinition<?>
createPropertyDefinition(QName name)
PrismPropertyDefinitionImpl<?>
createPropertyDefinition(QName name, QName typeName)
String
debugDump(int indent)
String
debugDump(int indent, IdentityHashMap<Definition,Object> seen)
ComplexTypeDefinition
deepClone()
@NotNull ComplexTypeDefinition
deepClone(DeepCloneOperation operation)
Does a deep clone of this definition.void
delete(QName itemName)
boolean
equals(Object obj)
protected void
extendItemDumpDefinition(StringBuilder sb, ItemDefinition<?> def)
<ID extends ItemDefinition<?>>
IDfindItemDefinition(@NotNull ItemPath path, @NotNull Class<ID> clazz)
Returns a definition of given type corresponding to given path (rooted at this store).<ID extends ItemDefinition<?>>
IDfindLocalItemDefinition(@NotNull QName name)
Returns the localItemDefinition
corresponding to given item name (in case-sensitive manner).protected String
getDebugDumpClassName()
Return a human readable name of this class suitable for logs.String
getDefaultNamespace()
When resolving unqualified names for items contained in this CTD, what should be the default namespace to look into at first.@NotNull List<? extends ItemDefinition<?>>
getDefinitions()
Returns set of item definitions.String
getDocClassName()
Returns human-readable name of this class suitable for documentation.QName
getExtensionForType()
If not null, indicates that this type defines the structure of `extension` element of a given type.@NotNull List<String>
getIgnoredNamespaces()
When resolving unqualified names for items contained in this CTD, what namespace(s) should be ignored.protected String
getSchemaNamespace()
List<PrismPropertyDefinition<?>>
getXmlAttributeDefinitions()
int
hashCode()
boolean
hasSubstitutions()
boolean
hasSubstitutions(QName itemName)
Returns true if item has substitutions in current container definitionboolean
isContainerMarker()
Flag indicating whether this type was marked as "container" in the original schema.boolean
isEmpty()
Returns true if there are no item definitions.boolean
isListMarker()
True if the complex type definition is a type dedicated to hold so-called https://docs.evolveum.com/midpoint/devel/design/xml-json-yaml-vs-xnode-vs-internal-data/heterogeneous-lists/[heterogeneous lists].boolean
isObjectMarker()
Flag indicating whether this type was marked as "object" in the original schema.boolean
isReferenceMarker()
Flag indicating whether this type was marked as "objectReference" in the original schema.boolean
isStrictAnyMarker()
boolean
isXsdAnyMarker()
True if the complex type definition contains xsd:any (directly or indirectly).void
merge(ComplexTypeDefinition otherComplexTypeDef)
Merge provided definition into this definition.void
performFreeze()
void
replaceDefinition(@NotNull QName itemName, ItemDefinition<?> newDefinition)
Replaces a definition for an item with given name.void
revive(PrismContext prismContext)
TODO: Is revive necessary if prism context is static? TODO document (if it's found to be necessary)void
setAttributeDefinitions(List<PrismPropertyDefinition<?>> definitions)
void
setContainerMarker(boolean containerMarker)
void
setDefaultNamespace(String defaultNamespace)
void
setExtensionForType(QName extensionForType)
void
setIgnoredNamespaces(@NotNull List<String> ignoredNamespaces)
void
setListMarker(boolean listMarker)
void
setObjectMarker(boolean objectMarker)
void
setReferenceMarker(boolean referenceMarker)
void
setStrictAnyMarker(boolean marker)
void
setXsdAnyMarker(boolean xsdAnyMarker)
Optional<ItemDefinition<?>>
substitution(QName name)
MutableComplexTypeDefinition
toMutable()
Returns an interface to mutate this definition.void
trimTo(@NotNull Collection<ItemPath> paths)
Trims the definition (and any definitions it refers to) to contain only items related to given paths.-
Methods inherited from class com.evolveum.midpoint.prism.impl.TypeDefinitionImpl
addStaticSubType, canRepresent, copyDefinitionDataFrom, getCompileTimeClass, getInstantiationOrder, getStaticSubTypes, getSuperType, isAssignableFrom, setCompileTimeClass, setInstantiationOrder, setSuperType, useSerializationProxy, writeReplace
-
Methods inherited from class com.evolveum.midpoint.prism.impl.DefinitionImpl
accept, addDiagram, addSchemaMigration, checkMutableOnExposing, copyDefinitionDataFrom, extendDumpHeader, getAnnotation, getAnnotations, getDeprecatedSince, getDiagrams, getDisplayName, getDisplayOrder, 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, toString
-
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.prism.ComplexTypeDefinition
itemOrSubstitution
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.prism.Definition
getAnnotation, getAnnotations, 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.LocalItemDefinitionStore
containsItemDefinition, findContainerDefinition, findItemDefinition, findLocalItemDefinition, findPropertyDefinition, findReferenceDefinition
-
Methods inherited from interface com.evolveum.midpoint.prism.MutableComplexTypeDefinition
setAbstract, setCompileTimeClass, setSuperType
-
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.MutableTypeDefinition
setInstantiationOrder
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismContextSensitive
getPrismContext
-
Methods inherited from interface com.evolveum.midpoint.prism.TypeDefinition
canRepresent, getCompileTimeClass, getInstantiationOrder, getStaticSubTypes, getSuperType, isAssignableFrom
-
-
-
-
Constructor Detail
-
ComplexTypeDefinitionImpl
public ComplexTypeDefinitionImpl(@NotNull @NotNull QName typeName)
-
-
Method Detail
-
getSchemaNamespace
protected String getSchemaNamespace()
-
getDefinitions
@NotNull public @NotNull List<? extends ItemDefinition<?>> getDefinitions()
Returns set of item definitions. The set contains all item definitions of all types that were parsed. Order of definitions is insignificant.- Specified by:
getDefinitions
in interfaceComplexTypeDefinition
- Specified by:
getDefinitions
in interfaceLocalItemDefinitionStore
- Returns:
- set of definitions
-
add
public void add(ItemDefinition<?> definition)
- Specified by:
add
in interfaceMutableComplexTypeDefinition
-
getExtensionForType
public QName getExtensionForType()
Description copied from interface:ComplexTypeDefinition
If not null, indicates that this type defines the structure of `extension` element of a given type. E.g. `getExtensionForType()` == `c:UserType` means that this complex type defines structure of `extension` elements of `UserType` objects.- Specified by:
getExtensionForType
in interfaceComplexTypeDefinition
-
setExtensionForType
public void setExtensionForType(QName extensionForType)
- Specified by:
setExtensionForType
in interfaceMutableComplexTypeDefinition
-
isReferenceMarker
public boolean isReferenceMarker()
Description copied from interface:ComplexTypeDefinition
Flag indicating whether this type was marked as "objectReference" in the original schema.- Specified by:
isReferenceMarker
in interfaceComplexTypeDefinition
-
setReferenceMarker
public void setReferenceMarker(boolean referenceMarker)
- Specified by:
setReferenceMarker
in interfaceMutableComplexTypeDefinition
-
isContainerMarker
public boolean isContainerMarker()
Description copied from interface:ComplexTypeDefinition
Flag indicating whether this type was marked as "container" in the original schema. Does not provide any information to schema processing logic, just conveys the marker from original schema so we can serialize and deserialize the schema without loss of information.- Specified by:
isContainerMarker
in interfaceComplexTypeDefinition
-
setContainerMarker
public void setContainerMarker(boolean containerMarker)
- Specified by:
setContainerMarker
in interfaceMutableComplexTypeDefinition
-
isObjectMarker
public boolean isObjectMarker()
Description copied from interface:ComplexTypeDefinition
Flag indicating whether this type was marked as "object" in the original schema. Does not provide any information to schema processing logic, just conveys the marker from original schema so we can serialized and deserialize the schema without loss of information.- Specified by:
isObjectMarker
in interfaceComplexTypeDefinition
-
isXsdAnyMarker
public boolean isXsdAnyMarker()
Description copied from interface:ComplexTypeDefinition
True if the complex type definition contains xsd:any (directly or indirectly).- Specified by:
isXsdAnyMarker
in interfaceComplexTypeDefinition
-
setXsdAnyMarker
public void setXsdAnyMarker(boolean xsdAnyMarker)
- Specified by:
setXsdAnyMarker
in interfaceMutableComplexTypeDefinition
-
isListMarker
public boolean isListMarker()
Description copied from interface:ComplexTypeDefinition
True if the complex type definition is a type dedicated to hold so-called https://docs.evolveum.com/midpoint/devel/design/xml-json-yaml-vs-xnode-vs-internal-data/heterogeneous-lists/[heterogeneous lists]. See alsoDOMUtil.IS_LIST_ATTRIBUTE_NAME
andItemDefinition.isHeterogeneousListItem()
.- Specified by:
isListMarker
in interfaceComplexTypeDefinition
-
setListMarker
public void setListMarker(boolean listMarker)
- Specified by:
setListMarker
in interfaceMutableComplexTypeDefinition
-
getDefaultNamespace
public String getDefaultNamespace()
Description copied from interface:ComplexTypeDefinition
When resolving unqualified names for items contained in this CTD, what should be the default namespace to look into at first. Currently does NOT apply recursively (to inner CTDs). Set by parsing `defaultNamespace` XSD annotation.- Specified by:
getDefaultNamespace
in interfaceComplexTypeDefinition
-
setDefaultNamespace
public void setDefaultNamespace(String defaultNamespace)
- Specified by:
setDefaultNamespace
in interfaceMutableComplexTypeDefinition
-
getIgnoredNamespaces
@NotNull public @NotNull List<String> getIgnoredNamespaces()
Description copied from interface:ComplexTypeDefinition
When resolving unqualified names for items contained in this CTD, what namespace(s) should be ignored. Names in this list are interpreted as a namespace prefixes. Currently does NOT apply recursively (to inner CTDs). Set by parsing `ignoredNamespace` XSD annotations.- Specified by:
getIgnoredNamespaces
in interfaceComplexTypeDefinition
-
setIgnoredNamespaces
public void setIgnoredNamespaces(@NotNull @NotNull List<String> ignoredNamespaces)
- Specified by:
setIgnoredNamespaces
in interfaceMutableComplexTypeDefinition
-
setObjectMarker
public void setObjectMarker(boolean objectMarker)
- Specified by:
setObjectMarker
in interfaceMutableComplexTypeDefinition
-
createPropertyDefinition
public PrismPropertyDefinitionImpl<?> createPropertyDefinition(QName name, QName typeName)
- Specified by:
createPropertyDefinition
in interfaceMutableComplexTypeDefinition
-
createPropertyDefinition
public PrismPropertyDefinition<?> createPropertyDefinition(QName name)
-
createPropertyDefinition
public PrismPropertyDefinitionImpl<?> createPropertyDefinition(String localName, QName typeName)
- Specified by:
createPropertyDefinition
in interfaceMutableComplexTypeDefinition
-
createPropertyDefinition
public PrismPropertyDefinition<?> createPropertyDefinition(String localName, String localTypeName)
-
findLocalItemDefinition
public <ID extends ItemDefinition<?>> ID findLocalItemDefinition(@NotNull @NotNull QName name)
Description copied from interface:LocalItemDefinitionStore
Returns the localItemDefinition
corresponding to given item name (in case-sensitive manner). Does not try to resolve items globally (in the case of "any" content). Note: some implementors provide optimized implementations of this method.- Specified by:
findLocalItemDefinition
in interfaceLocalItemDefinitionStore
-
findItemDefinition
public <ID extends ItemDefinition<?>> ID findItemDefinition(@NotNull @NotNull ItemPath path, @NotNull @NotNull Class<ID> clazz)
Description copied from interface:LocalItemDefinitionStore
Returns a definition of given type corresponding to given path (rooted at this store). Tries the global resolution in the case of "any" content.- Specified by:
findItemDefinition
in interfaceLocalItemDefinitionStore
-
merge
public void merge(ComplexTypeDefinition otherComplexTypeDef)
Merge provided definition into this definition.- Specified by:
merge
in interfaceComplexTypeDefinition
-
revive
public void revive(PrismContext prismContext)
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
-
isEmpty
public boolean isEmpty()
Description copied from interface:ComplexTypeDefinition
Returns true if there are no item definitions.- Specified by:
isEmpty
in interfaceComplexTypeDefinition
-
accept
public boolean accept(Visitor<Definition> visitor, SmartVisitation<Definition> visitation)
- Specified by:
accept
in interfaceSmartVisitable<Definition>
- Overrides:
accept
in classDefinitionImpl
- Returns:
- false if we already was here
-
clone
@NotNull public @NotNull ComplexTypeDefinitionImpl clone()
Description copied from interface:ComplexTypeDefinition
Does a shallow clone of this definition (i.e. item definitions themselves are NOT cloned).- Specified by:
clone
in interfaceComplexTypeDefinition
- Specified by:
clone
in interfaceDefinition
- Specified by:
clone
in interfaceMutableComplexTypeDefinition
- Specified by:
clone
in classDefinitionImpl
-
deepClone
public ComplexTypeDefinition deepClone()
-
deepClone
@NotNull public @NotNull ComplexTypeDefinition deepClone(DeepCloneOperation operation)
Description copied from interface:ComplexTypeDefinition
Does a deep clone of this definition.- Specified by:
deepClone
in interfaceComplexTypeDefinition
-
copyDefinitionDataFrom
protected void copyDefinitionDataFrom(ComplexTypeDefinition source)
-
replaceDefinition
public void replaceDefinition(@NotNull @NotNull QName itemName, ItemDefinition<?> newDefinition)
Description copied from interface:MutableComplexTypeDefinition
Replaces a definition for an item with given name. TODO specify the behavior more precisely- Specified by:
replaceDefinition
in interfaceMutableComplexTypeDefinition
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classTypeDefinitionImpl
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classTypeDefinitionImpl
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
- Overrides:
debugDump
in classDefinitionImpl
-
debugDump
public String debugDump(int indent, IdentityHashMap<Definition,Object> seen)
- Specified by:
debugDump
in interfaceDefinition
-
extendItemDumpDefinition
protected void extendItemDumpDefinition(StringBuilder sb, ItemDefinition<?> def)
-
getDebugDumpClassName
protected String getDebugDumpClassName()
Return a human readable name of this class suitable for logs.- Specified by:
getDebugDumpClassName
in classDefinitionImpl
-
getDocClassName
public String getDocClassName()
Description copied from class:DefinitionImpl
Returns human-readable name of this class suitable for documentation. (e.g. "property")- Specified by:
getDocClassName
in classDefinitionImpl
-
trimTo
public void trimTo(@NotNull @NotNull Collection<ItemPath> paths)
Description copied from interface:ComplexTypeDefinition
Trims the definition (and any definitions it refers to) to contain only items related to given paths. USE WITH CARE. Be sure no shared definitions would be affected by this operation!- Specified by:
trimTo
in interfaceComplexTypeDefinition
-
delete
public void delete(QName itemName)
- Specified by:
delete
in interfaceMutableComplexTypeDefinition
-
toMutable
public MutableComplexTypeDefinition toMutable()
Description copied from interface:Definition
Returns an interface to mutate this definition.- Specified by:
toMutable
in interfaceComplexTypeDefinition
- Specified by:
toMutable
in interfaceDefinition
-
performFreeze
public void performFreeze()
- Overrides:
performFreeze
in classAbstractFreezable
-
addSubstitution
public void addSubstitution(ItemDefinition<?> itemDef, ItemDefinition<?> maybeSubst)
- Specified by:
addSubstitution
in interfaceMutableComplexTypeDefinition
-
substitution
public Optional<ItemDefinition<?>> substitution(QName name)
- Specified by:
substitution
in interfaceComplexTypeDefinition
-
hasSubstitutions
public boolean hasSubstitutions()
- Specified by:
hasSubstitutions
in interfaceComplexTypeDefinition
-
hasSubstitutions
public boolean hasSubstitutions(QName itemName)
Description copied from interface:ComplexTypeDefinition
Returns true if item has substitutions in current container definition- Specified by:
hasSubstitutions
in interfaceComplexTypeDefinition
-
setAttributeDefinitions
public void setAttributeDefinitions(List<PrismPropertyDefinition<?>> definitions)
- Specified by:
setAttributeDefinitions
in interfaceMutableComplexTypeDefinition
-
getXmlAttributeDefinitions
public List<PrismPropertyDefinition<?>> getXmlAttributeDefinitions()
- Specified by:
getXmlAttributeDefinitions
in interfaceComplexTypeDefinition
-
isStrictAnyMarker
public boolean isStrictAnyMarker()
- Specified by:
isStrictAnyMarker
in interfaceComplexTypeDefinition
-
setStrictAnyMarker
public void setStrictAnyMarker(boolean marker)
- Specified by:
setStrictAnyMarker
in interfaceMutableComplexTypeDefinition
-
-