Class PrismSchemaImpl
- java.lang.Object
-
- com.evolveum.midpoint.prism.AbstractFreezable
-
- com.evolveum.midpoint.prism.impl.schema.PrismSchemaImpl
-
- All Implemented Interfaces:
Freezable
,PrismContextSensitive
,DefinitionSearchImplementation
,DefinitionsStore
,GlobalDefinitionsStore
,MutablePrismSchema
,PrismSchema
,DebugDumpable
- Direct Known Subclasses:
ConnectorSchemaImpl
,ResourceSchemaImpl
public class PrismSchemaImpl extends AbstractFreezable implements MutablePrismSchema
- Author:
- Radovan Semancik
-
-
Field Summary
Fields Modifier and Type Field Description protected @NotNull Collection<Definition>
definitions
protected @NotNull String
namespace
protected PrismContext
prismContext
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description PrismSchemaImpl(@NotNull String namespace, PrismContext prismContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(@NotNull Definition def)
void
addDelayedItemDefinition(DefinitionSupplier supplier)
void
addSubstitution(QName substitutionHead, ItemDefinition<?> definition)
ComplexTypeDefinition
createComplexTypeDefinition(QName typeName)
PrismContainerDefinitionImpl
createPropertyContainerDefinition(String localTypeName)
Creates a new property container definition and adds it to the schema.PrismContainerDefinitionImpl
createPropertyContainerDefinition(String localElementName, String localTypeName)
PrismPropertyDefinition
createPropertyDefinition(String localName, QName typeName)
Creates a top-level property definition and adds it to the schema.PrismPropertyDefinition
createPropertyDefinition(QName name, QName typeName)
Creates a top-level property definition and adds it to the schema.String
debugDump(int indent)
<C extends Containerable>
ComplexTypeDefinitionfindComplexTypeDefinitionByCompileTimeClass(@NotNull Class<C> compileTimeClass)
<ID extends ItemDefinition>
IDfindItemDefinitionByType(@NotNull QName typeName, @NotNull Class<ID> definitionClass)
Looking up item definition by type name.<ID extends ItemDefinition>
@NotNull List<ID>findItemDefinitionsByCompileTimeClass(@NotNull Class<?> compileTimeClass, @NotNull Class<ID> definitionClass)
Looking up item definitions by compile-time class.<ID extends ItemDefinition>
@NotNull List<ID>findItemDefinitionsByElementName(@NotNull QName elementName, @NotNull Class<ID> definitionClass)
Looking up item definitions by element name.<TD extends TypeDefinition>
TDfindTypeDefinitionByCompileTimeClass(@NotNull Class<?> compileTimeClass, @NotNull Class<TD> definitionClass)
<TD extends TypeDefinition>
TDfindTypeDefinitionByType(@NotNull QName typeName, @NotNull Class<TD> definitionClass)
<TD extends TypeDefinition>
@NotNull Collection<TD>findTypeDefinitionsByType(@NotNull QName typeName, @NotNull Class<TD> definitionClass)
@NotNull Collection<Definition>
getDefinitions()
Returns set of definitions.<T extends Definition>
@NotNull List<T>getDefinitions(@NotNull Class<T> type)
Returns set of definitions of a given type.@NotNull String
getNamespace()
Returns schema namespace.PrismContext
getPrismContext()
com.google.common.collect.Multimap<QName,ItemDefinition<?>>
getSubstitutions()
boolean
isEmpty()
static PrismSchema
parse(Element element, boolean isRuntime, String shortDescription, PrismContext prismContext)
static PrismSchema
parse(Element element, EntityResolver resolver, boolean isRuntime, String shortDescription, boolean allowDelayedItemDefinitions, PrismContext prismContext)
void
parseThis(Element element, boolean isRuntime, String shortDescription, PrismContext prismContext)
void
performFreeze()
@NotNull Document
serializeToXsd()
String
toString()
-
Methods inherited from class com.evolveum.midpoint.prism.AbstractFreezable
freeze, freeze, freezeAll, freezeNullableList, isImmutable, isMutable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, 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.schema.GlobalDefinitionsStore
findComplexTypeDefinitionByType, findContainerDefinitionByCompileTimeClass, findContainerDefinitionByElementName, findContainerDefinitionByType, findItemDefinitionByCompileTimeClass, findItemDefinitionByElementName, findItemDefinitionByElementName, findItemDefinitionByType, findItemDefinitionsByElementName, findObjectDefinitionByCompileTimeClass, findObjectDefinitionByElementName, findObjectDefinitionByType, findPropertyDefinitionByElementName, findReferenceDefinitionByElementName, findSimpleTypeDefinitionByType, findTypeDefinitionByType, findTypeDefinitionsByType
-
Methods inherited from interface com.evolveum.midpoint.prism.schema.PrismSchema
getComplexTypeDefinitions, getObjectDefinitions
-
-
-
-
Field Detail
-
definitions
@NotNull protected final @NotNull Collection<Definition> definitions
-
namespace
@NotNull protected final @NotNull String namespace
-
prismContext
protected PrismContext prismContext
-
-
Constructor Detail
-
PrismSchemaImpl
public PrismSchemaImpl(@NotNull @NotNull String namespace, PrismContext prismContext)
-
-
Method Detail
-
getNamespace
@NotNull public @NotNull String getNamespace()
Description copied from interface:PrismSchema
Returns schema namespace. All schema definitions are placed in the returned namespace.- Specified by:
getNamespace
in interfacePrismSchema
- Returns:
- schema namespace
-
getDefinitions
@NotNull public @NotNull Collection<Definition> getDefinitions()
Description copied from interface:PrismSchema
Returns set of definitions. The set contains all definitions of all types that were parsed. Order of definitions is insignificant.- Specified by:
getDefinitions
in interfacePrismSchema
- Returns:
- set of definitions
-
getDefinitions
@NotNull public <T extends Definition> @NotNull List<T> getDefinitions(@NotNull @NotNull Class<T> type)
Description copied from interface:PrismSchema
Returns set of definitions of a given type. The set contains all definitions of the given type that were parsed. Order of definitions is insignificant.- Specified by:
getDefinitions
in interfacePrismSchema
- Returns:
- set of definitions
-
addDelayedItemDefinition
public void addDelayedItemDefinition(DefinitionSupplier supplier)
- Specified by:
addDelayedItemDefinition
in interfaceMutablePrismSchema
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacePrismSchema
-
add
public void add(@NotNull @NotNull Definition def)
- Specified by:
add
in interfaceMutablePrismSchema
-
addSubstitution
public void addSubstitution(QName substitutionHead, ItemDefinition<?> definition)
- Specified by:
addSubstitution
in interfaceMutablePrismSchema
-
getSubstitutions
public com.google.common.collect.Multimap<QName,ItemDefinition<?>> getSubstitutions()
- Specified by:
getSubstitutions
in interfacePrismSchema
-
getPrismContext
public PrismContext getPrismContext()
- Specified by:
getPrismContext
in interfacePrismContextSensitive
-
parse
public static PrismSchema parse(Element element, boolean isRuntime, String shortDescription, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
parse
public static PrismSchema parse(Element element, EntityResolver resolver, boolean isRuntime, String shortDescription, boolean allowDelayedItemDefinitions, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
parseThis
public void parseThis(Element element, boolean isRuntime, String shortDescription, PrismContext prismContext) throws SchemaException
- Specified by:
parseThis
in interfaceMutablePrismSchema
- Throws:
SchemaException
-
serializeToXsd
@NotNull public @NotNull Document serializeToXsd() throws SchemaException
- Specified by:
serializeToXsd
in interfacePrismSchema
- Throws:
SchemaException
-
createPropertyContainerDefinition
public PrismContainerDefinitionImpl createPropertyContainerDefinition(String localTypeName)
Creates a new property container definition and adds it to the schema. This is a preferred way how to create definition in the schema.- Specified by:
createPropertyContainerDefinition
in interfaceMutablePrismSchema
- Parameters:
localTypeName
- type name "relative" to schema namespace- Returns:
- new property container definition
-
createPropertyContainerDefinition
public PrismContainerDefinitionImpl createPropertyContainerDefinition(String localElementName, String localTypeName)
- Specified by:
createPropertyContainerDefinition
in interfaceMutablePrismSchema
-
createComplexTypeDefinition
public ComplexTypeDefinition createComplexTypeDefinition(QName typeName)
- Specified by:
createComplexTypeDefinition
in interfaceMutablePrismSchema
-
createPropertyDefinition
public PrismPropertyDefinition createPropertyDefinition(String localName, QName typeName)
Creates a top-level property definition and adds it to the schema. This is a preferred way how to create definition in the schema.- Specified by:
createPropertyDefinition
in interfaceMutablePrismSchema
- Parameters:
localName
- element name "relative" to schema namespacetypeName
- XSD type name of the element- Returns:
- new property definition
-
createPropertyDefinition
public PrismPropertyDefinition createPropertyDefinition(QName name, QName typeName)
Creates a top-level property definition and adds it to the schema. This is a preferred way how to create definition in the schema.- Specified by:
createPropertyDefinition
in interfaceMutablePrismSchema
- Parameters:
name
- element nametypeName
- XSD type name of the element- Returns:
- new property definition
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
findItemDefinitionsByCompileTimeClass
@NotNull public <ID extends ItemDefinition> @NotNull List<ID> findItemDefinitionsByCompileTimeClass(@NotNull @NotNull Class<?> compileTimeClass, @NotNull @NotNull Class<ID> definitionClass)
Description copied from interface:GlobalDefinitionsStore
Looking up item definitions by compile-time class. So, for example having AssignmentType.class we try to find a definition of "assignment" item. BEWARE. This method is unsound. There might be many items of AssignmentType.class.- Specified by:
findItemDefinitionsByCompileTimeClass
in interfaceGlobalDefinitionsStore
-
findItemDefinitionByType
public <ID extends ItemDefinition> ID findItemDefinitionByType(@NotNull @NotNull QName typeName, @NotNull @NotNull Class<ID> definitionClass)
Description copied from interface:GlobalDefinitionsStore
Looking up item definition by type name. So, for example having c:AssignmentType we try to find a definition of "assignment" item. BEWARE. This method is unsound. There might be many items with c:AssignmentType type.- Specified by:
findItemDefinitionByType
in interfaceGlobalDefinitionsStore
-
findItemDefinitionsByElementName
@NotNull public <ID extends ItemDefinition> @NotNull List<ID> findItemDefinitionsByElementName(@NotNull @NotNull QName elementName, @NotNull @NotNull Class<ID> definitionClass)
Description copied from interface:GlobalDefinitionsStore
Looking up item definitions by element name. The name can be qualified or unqualified. In the latter case there can be more than one definition returned.- Specified by:
findItemDefinitionsByElementName
in interfaceGlobalDefinitionsStore
-
findComplexTypeDefinitionByCompileTimeClass
public <C extends Containerable> ComplexTypeDefinition findComplexTypeDefinitionByCompileTimeClass(@NotNull @NotNull Class<C> compileTimeClass)
- Specified by:
findComplexTypeDefinitionByCompileTimeClass
in interfaceGlobalDefinitionsStore
-
findTypeDefinitionByType
@Nullable public <TD extends TypeDefinition> TD findTypeDefinitionByType(@NotNull @NotNull QName typeName, @NotNull @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionByType
in interfaceGlobalDefinitionsStore
-
findTypeDefinitionsByType
@NotNull public <TD extends TypeDefinition> @NotNull Collection<TD> findTypeDefinitionsByType(@NotNull @NotNull QName typeName, @NotNull @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionsByType
in interfaceGlobalDefinitionsStore
-
findTypeDefinitionByCompileTimeClass
@Nullable public <TD extends TypeDefinition> TD findTypeDefinitionByCompileTimeClass(@NotNull @NotNull Class<?> compileTimeClass, @NotNull @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionByCompileTimeClass
in interfaceGlobalDefinitionsStore
-
performFreeze
public void performFreeze()
- Overrides:
performFreeze
in classAbstractFreezable
-
-