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>
definitions
protected String
namespace
protected PrismContext
prismContext
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PrismSchemaImpl(PrismContext prismContext)
PrismSchemaImpl(String namespace, PrismContext prismContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Definition def)
void
addDelayedItemDefinition(DefinitionSupplier supplier)
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()
Show the content of the object intended for diagnostics by system administrator.String
debugDump(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.String
getNamespace()
Returns schema namespace.PrismContext
getPrismContext()
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)
static void
parseSchemas(Element wrapperElement, XmlEntityResolver resolver, List<SchemaDescription> schemaDescriptions, boolean allowDelayedItemDefinitions, PrismContext prismContext)
void
parseThis(Element element, boolean isRuntime, String shortDescription, PrismContext prismContext)
Document
serializeToXsd()
void
setNamespace(String namespace)
String
toString()
-
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:PrismSchema
Returns schema namespace. All schema definitions are placed in the returned namespace.- Specified by:
getNamespace
in interfacePrismSchema
- Returns:
- schema namespace TODO can be null?
-
setNamespace
public void setNamespace(@NotNull String namespace)
- Specified by:
setNamespace
in interfaceMutablePrismSchema
-
getDefinitions
@NotNull public 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> List<T> getDefinitions(@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 Definition def)
- Specified by:
add
in interfaceMutablePrismSchema
-
getPrismContext
public PrismContext getPrismContext()
- Specified by:
getPrismContext
in 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:
parseThis
in interfaceMutablePrismSchema
- Throws:
SchemaException
-
serializeToXsd
@NotNull public 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()
Description copied from interface:DebugDumpable
Show 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:
debugDump
in interfaceDebugDumpable
- Returns:
- content of the object intended for diagnostics by system administrator.
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
findItemDefinitionsByCompileTimeClass
@NotNull public <ID extends ItemDefinition> List<ID> findItemDefinitionsByCompileTimeClass(@NotNull Class<?> compileTimeClass, @NotNull Class<ID> definitionClass)
- Specified by:
findItemDefinitionsByCompileTimeClass
in interfaceGlobalDefinitionsStore
-
findItemDefinitionByType
public <ID extends ItemDefinition> ID findItemDefinitionByType(@NotNull QName typeName, @NotNull Class<ID> definitionClass)
- Specified by:
findItemDefinitionByType
in interfaceGlobalDefinitionsStore
-
findItemDefinitionsByElementName
@NotNull public <ID extends ItemDefinition> List<ID> findItemDefinitionsByElementName(@NotNull QName elementName, @NotNull Class<ID> definitionClass)
- Specified by:
findItemDefinitionsByElementName
in interfaceGlobalDefinitionsStore
-
findComplexTypeDefinitionByCompileTimeClass
public <C extends Containerable> ComplexTypeDefinition findComplexTypeDefinitionByCompileTimeClass(@NotNull Class<C> compileTimeClass)
- Specified by:
findComplexTypeDefinitionByCompileTimeClass
in interfaceGlobalDefinitionsStore
-
findTypeDefinitionByType
@Nullable public <TD extends TypeDefinition> TD findTypeDefinitionByType(@NotNull QName typeName, @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionByType
in interfaceGlobalDefinitionsStore
-
findTypeDefinitionsByType
@NotNull public <TD extends TypeDefinition> Collection<TD> findTypeDefinitionsByType(@NotNull QName typeName, @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionsByType
in interfaceGlobalDefinitionsStore
-
findTypeDefinitionByCompileTimeClass
@Nullable public <TD extends TypeDefinition> TD findTypeDefinitionByCompileTimeClass(@NotNull Class<?> compileTimeClass, @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionByCompileTimeClass
in interfaceGlobalDefinitionsStore
-
-