Class PrismSchemaImpl
- java.lang.Object
-
- com.evolveum.midpoint.prism.impl.schema.PrismSchemaImpl
-
- All Implemented Interfaces:
DefinitionSearchImplementation,DefinitionsStore,GlobalDefinitionsStore,MutablePrismSchema,PrismSchema,DebugDumpable
- Direct Known Subclasses:
ConnectorSchemaImpl,ResourceSchemaImpl
public class PrismSchemaImpl extends Object implements MutablePrismSchema
- Author:
- Radovan Semancik
-
-
Field Summary
Fields Modifier and Type Field Description protected Collection<Definition>definitionsprotected Stringnamespaceprotected PrismContextprismContext-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPrismSchemaImpl(PrismContext prismContext)PrismSchemaImpl(String namespace, PrismContext prismContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Definition def)voidaddDelayedItemDefinition(DefinitionSupplier supplier)ComplexTypeDefinitioncreateComplexTypeDefinition(QName typeName)PrismContainerDefinitionImplcreatePropertyContainerDefinition(String localTypeName)Creates a new property container definition and adds it to the schema.PrismContainerDefinitionImplcreatePropertyContainerDefinition(String localElementName, String localTypeName)PrismPropertyDefinitioncreatePropertyDefinition(String localName, QName typeName)Creates a top-level property definition and adds it to the schema.PrismPropertyDefinitioncreatePropertyDefinition(QName name, QName typeName)Creates a top-level property definition and adds it to the schema.StringdebugDump()Show the content of the object intended for diagnostics by system administrator.StringdebugDump(int indent)<C extends Containerable>
ComplexTypeDefinitionfindComplexTypeDefinitionByCompileTimeClass(Class<C> compileTimeClass)<ID extends ItemDefinition>
IDfindItemDefinitionByType(QName typeName, Class<ID> definitionClass)<ID extends ItemDefinition>
List<ID>findItemDefinitionsByCompileTimeClass(Class<?> compileTimeClass, Class<ID> definitionClass)<ID extends ItemDefinition>
List<ID>findItemDefinitionsByElementName(QName elementName, Class<ID> definitionClass)<TD extends TypeDefinition>
TDfindTypeDefinitionByCompileTimeClass(Class<?> compileTimeClass, Class<TD> definitionClass)<TD extends TypeDefinition>
TDfindTypeDefinitionByType(QName typeName, Class<TD> definitionClass)<TD extends TypeDefinition>
Collection<TD>findTypeDefinitionsByType(QName typeName, Class<TD> definitionClass)Collection<Definition>getDefinitions()Returns set of definitions.<T extends Definition>
List<T>getDefinitions(Class<T> type)Returns set of definitions of a given type.StringgetNamespace()Returns schema namespace.PrismContextgetPrismContext()booleanisEmpty()static PrismSchemaparse(Element element, boolean isRuntime, String shortDescription, PrismContext prismContext)static PrismSchemaparse(Element element, EntityResolver resolver, boolean isRuntime, String shortDescription, boolean allowDelayedItemDefinitions, PrismContext prismContext)static voidparseSchemas(Element wrapperElement, XmlEntityResolver resolver, List<SchemaDescription> schemaDescriptions, boolean allowDelayedItemDefinitions, PrismContext prismContext)voidparseThis(Element element, boolean isRuntime, String shortDescription, PrismContext prismContext)DocumentserializeToXsd()voidsetNamespace(String namespace)StringtoString()-
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
debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.prism.schema.GlobalDefinitionsStore
findComplexTypeDefinition, findComplexTypeDefinitionByType, findContainerDefinitionByCompileTimeClass, findContainerDefinitionByElementName, findContainerDefinitionByType, findItemDefinition, findItemDefinition, 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 Collection<Definition> definitions
-
namespace
protected String namespace
-
prismContext
protected PrismContext prismContext
-
-
Constructor Detail
-
PrismSchemaImpl
protected PrismSchemaImpl(PrismContext prismContext)
-
PrismSchemaImpl
public PrismSchemaImpl(@NotNull String namespace, PrismContext prismContext)
-
-
Method Detail
-
getNamespace
public String getNamespace()
Description copied from interface:PrismSchemaReturns schema namespace. All schema definitions are placed in the returned namespace.- Specified by:
getNamespacein interfacePrismSchema- Returns:
- schema namespace TODO can be null?
-
setNamespace
public void setNamespace(@NotNull String namespace)- Specified by:
setNamespacein interfaceMutablePrismSchema
-
getDefinitions
@NotNull public Collection<Definition> getDefinitions()
Description copied from interface:PrismSchemaReturns set of definitions. The set contains all definitions of all types that were parsed. Order of definitions is insignificant.- Specified by:
getDefinitionsin interfacePrismSchema- Returns:
- set of definitions
-
getDefinitions
@NotNull public <T extends Definition> List<T> getDefinitions(@NotNull Class<T> type)
Description copied from interface:PrismSchemaReturns 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:
getDefinitionsin interfacePrismSchema- Returns:
- set of definitions
-
addDelayedItemDefinition
public void addDelayedItemDefinition(DefinitionSupplier supplier)
- Specified by:
addDelayedItemDefinitionin interfaceMutablePrismSchema
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacePrismSchema
-
add
public void add(@NotNull Definition def)- Specified by:
addin interfaceMutablePrismSchema
-
getPrismContext
public PrismContext getPrismContext()
- Specified by:
getPrismContextin interfacePrismSchema
-
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
-
parseSchemas
public static void parseSchemas(Element wrapperElement, XmlEntityResolver resolver, List<SchemaDescription> schemaDescriptions, boolean allowDelayedItemDefinitions, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
parseThis
public void parseThis(Element element, boolean isRuntime, String shortDescription, PrismContext prismContext) throws SchemaException
- Specified by:
parseThisin interfaceMutablePrismSchema- Throws:
SchemaException
-
serializeToXsd
@NotNull public Document serializeToXsd() throws SchemaException
- Specified by:
serializeToXsdin 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:
createPropertyContainerDefinitionin interfaceMutablePrismSchema- Parameters:
localTypeName- type name "relative" to schema namespace- Returns:
- new property container definition
-
createPropertyContainerDefinition
public PrismContainerDefinitionImpl createPropertyContainerDefinition(String localElementName, String localTypeName)
- Specified by:
createPropertyContainerDefinitionin interfaceMutablePrismSchema
-
createComplexTypeDefinition
public ComplexTypeDefinition createComplexTypeDefinition(QName typeName)
- Specified by:
createComplexTypeDefinitionin 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:
createPropertyDefinitionin 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:
createPropertyDefinitionin interfaceMutablePrismSchema- Parameters:
name- element nametypeName- XSD type name of the element- Returns:
- new property definition
-
debugDump
public String debugDump()
Description copied from interface:DebugDumpableShow the content of the object intended for diagnostics by system administrator. The out put should be suitable to use in system logs at "debug" level. It may be multi-line, but in that case it should be well indented and quite terse. As it is intended to be used by system administrator, it should not use any developer terms such as class names, exceptions or stack traces.- Specified by:
debugDumpin interfaceDebugDumpable- Returns:
- content of the object intended for diagnostics by system administrator.
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDumpin interfaceDebugDumpable
-
findItemDefinitionsByCompileTimeClass
@NotNull public <ID extends ItemDefinition> List<ID> findItemDefinitionsByCompileTimeClass(@NotNull Class<?> compileTimeClass, @NotNull Class<ID> definitionClass)
- Specified by:
findItemDefinitionsByCompileTimeClassin interfaceGlobalDefinitionsStore
-
findItemDefinitionByType
public <ID extends ItemDefinition> ID findItemDefinitionByType(@NotNull QName typeName, @NotNull Class<ID> definitionClass)
- Specified by:
findItemDefinitionByTypein interfaceGlobalDefinitionsStore
-
findItemDefinitionsByElementName
@NotNull public <ID extends ItemDefinition> List<ID> findItemDefinitionsByElementName(@NotNull QName elementName, @NotNull Class<ID> definitionClass)
- Specified by:
findItemDefinitionsByElementNamein interfaceGlobalDefinitionsStore
-
findComplexTypeDefinitionByCompileTimeClass
public <C extends Containerable> ComplexTypeDefinition findComplexTypeDefinitionByCompileTimeClass(@NotNull Class<C> compileTimeClass)
- Specified by:
findComplexTypeDefinitionByCompileTimeClassin interfaceGlobalDefinitionsStore
-
findTypeDefinitionByType
@Nullable public <TD extends TypeDefinition> TD findTypeDefinitionByType(@NotNull QName typeName, @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionByTypein interfaceGlobalDefinitionsStore
-
findTypeDefinitionsByType
@NotNull public <TD extends TypeDefinition> Collection<TD> findTypeDefinitionsByType(@NotNull QName typeName, @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionsByTypein interfaceGlobalDefinitionsStore
-
findTypeDefinitionByCompileTimeClass
@Nullable public <TD extends TypeDefinition> TD findTypeDefinitionByCompileTimeClass(@NotNull Class<?> compileTimeClass, @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionByCompileTimeClassin interfaceGlobalDefinitionsStore
-
-