Class RefinedResourceSchemaImpl
- java.lang.Object
-
- com.evolveum.midpoint.common.refinery.RefinedResourceSchemaImpl
-
- All Implemented Interfaces:
RefinedResourceSchema
,DefinitionSearchImplementation
,DefinitionsStore
,GlobalDefinitionsStore
,PrismSchema
,ResourceSchema
,DebugDumpable
public final class RefinedResourceSchemaImpl extends Object implements RefinedResourceSchema
TODO: this whole class would benefit from more refactoring. TODO: especially the parsing part.- Author:
- semancik, mederly
-
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Method Summary
-
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, findComplexTypeDefinitionByCompileTimeClass, 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
-
Methods inherited from interface com.evolveum.midpoint.common.refinery.RefinedResourceSchema
getDefaultRefinedDefinition, getObjectDefinition, getObjectDefinition, getRefinedDefinition
-
Methods inherited from interface com.evolveum.midpoint.schema.processor.ResourceSchema
findObjectClassDefinition, findObjectClassDefinition, getObjectClassList
-
-
-
-
Method Detail
-
getObjectClassDefinitions
public Collection<ObjectClassComplexTypeDefinition> getObjectClassDefinitions()
- Specified by:
getObjectClassDefinitions
in interfaceResourceSchema
-
getRefinedDefinitions
public List<? extends RefinedObjectClassDefinition> getRefinedDefinitions()
- Specified by:
getRefinedDefinitions
in interfaceRefinedResourceSchema
-
getRefinedDefinitions
public List<? extends RefinedObjectClassDefinition> getRefinedDefinitions(ShadowKindType kind)
- Specified by:
getRefinedDefinitions
in interfaceRefinedResourceSchema
-
getOriginalResourceSchema
public ResourceSchema getOriginalResourceSchema()
- Specified by:
getOriginalResourceSchema
in interfaceRefinedResourceSchema
-
getRefinedDefinition
public RefinedObjectClassDefinition getRefinedDefinition(ShadowKindType kind, String intent)
Description copied from interface:RefinedResourceSchema
if null accountType is provided, default account definition is returned.- Specified by:
getRefinedDefinition
in interfaceRefinedResourceSchema
-
determineCompositeObjectClassDefinition
public CompositeRefinedObjectClassDefinition determineCompositeObjectClassDefinition(ResourceShadowDiscriminator discriminator)
- Specified by:
determineCompositeObjectClassDefinition
in interfaceRefinedResourceSchema
-
determineCompositeObjectClassDefinition
public CompositeRefinedObjectClassDefinition determineCompositeObjectClassDefinition(PrismObject<ShadowType> shadow) throws SchemaException
- Specified by:
determineCompositeObjectClassDefinition
in interfaceRefinedResourceSchema
- Throws:
SchemaException
-
determineCompositeObjectClassDefinition
public CompositeRefinedObjectClassDefinition determineCompositeObjectClassDefinition(PrismObject<ShadowType> shadow, Collection<QName> additionalAuxiliaryObjectClassQNames) throws SchemaException
- Specified by:
determineCompositeObjectClassDefinition
in interfaceRefinedResourceSchema
- Throws:
SchemaException
-
determineCompositeObjectClassDefinition
public CompositeRefinedObjectClassDefinition determineCompositeObjectClassDefinition(QName structuralObjectClassQName, ShadowKindType kind, String intent)
- Specified by:
determineCompositeObjectClassDefinition
in interfaceRefinedResourceSchema
-
getRefinedDefinition
public RefinedObjectClassDefinition getRefinedDefinition(ShadowKindType kind, Collection<String> intents) throws SchemaException
Description copied from interface:RefinedResourceSchema
If no intents are provided, default account definition is returned. We check whether there is only one relevant rOCD.- Specified by:
getRefinedDefinition
in interfaceRefinedResourceSchema
- Throws:
SchemaException
-
getRefinedDefinition
public RefinedObjectClassDefinition getRefinedDefinition(QName objectClassName)
- Specified by:
getRefinedDefinition
in interfaceRefinedResourceSchema
-
findRefinedDefinitionByObjectClassQName
public RefinedObjectClassDefinition findRefinedDefinitionByObjectClassQName(ShadowKindType kind, QName objectClass)
- Specified by:
findRefinedDefinitionByObjectClassQName
in interfaceRefinedResourceSchema
-
forLayer
public LayerRefinedResourceSchema forLayer(LayerType layer)
- Specified by:
forLayer
in interfaceRefinedResourceSchema
-
getRefinedSchema
public static RefinedResourceSchema getRefinedSchema(ResourceType resourceType) throws SchemaException
- Throws:
SchemaException
-
getRefinedSchema
public static LayerRefinedResourceSchema getRefinedSchema(ResourceType resourceType, LayerType layer) throws SchemaException
- Throws:
SchemaException
-
getRefinedSchema
public static RefinedResourceSchema getRefinedSchema(ResourceType resourceType, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
getRefinedSchema
public static LayerRefinedResourceSchema getRefinedSchema(ResourceType resourceType, LayerType layer, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
getRefinedSchema
public static RefinedResourceSchema getRefinedSchema(PrismObject<ResourceType> resource) throws SchemaException
- Throws:
SchemaException
-
getRefinedSchema
public static RefinedResourceSchema getRefinedSchema(PrismObject<ResourceType> resource, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
getRefinedSchema
public static LayerRefinedResourceSchema getRefinedSchema(PrismObject<ResourceType> resource, LayerType layer, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
hasRefinedSchema
public static boolean hasRefinedSchema(ResourceType resourceType)
-
getResourceSchema
public static ResourceSchema getResourceSchema(ResourceType resourceType, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
getResourceSchema
public static ResourceSchema getResourceSchema(PrismObject<ResourceType> resource, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
setParsedResourceSchemaConditional
public static void setParsedResourceSchemaConditional(ResourceType resourceType, ResourceSchema parsedSchema)
-
hasParsedSchema
public static boolean hasParsedSchema(ResourceType resourceType)
-
parse
public static RefinedResourceSchema parse(PrismObject<ResourceType> resource, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
parse
public static RefinedResourceSchema parse(ResourceType resourceType, PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
getIntentsForKind
public static List<String> getIntentsForKind(RefinedResourceSchema rSchema, ShadowKindType kind)
-
findObjectClassDefinition
public ObjectClassComplexTypeDefinition findObjectClassDefinition(QName objectClassQName)
- Specified by:
findObjectClassDefinition
in interfaceRefinedResourceSchema
- Specified by:
findObjectClassDefinition
in interfaceResourceSchema
-
findObjectClassDefinition
public ObjectClassComplexTypeDefinition findObjectClassDefinition(ShadowKindType kind, String intent)
- Specified by:
findObjectClassDefinition
in interfaceResourceSchema
-
findDefaultObjectClassDefinition
public ObjectClassComplexTypeDefinition findDefaultObjectClassDefinition(ShadowKindType kind)
- Specified by:
findDefaultObjectClassDefinition
in interfaceResourceSchema
-
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?
-
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
-
getPrismContext
public PrismContext getPrismContext()
- Specified by:
getPrismContext
in interfacePrismSchema
-
serializeToXsd
@NotNull public Document serializeToXsd() throws SchemaException
- Specified by:
serializeToXsd
in interfacePrismSchema
- Throws:
SchemaException
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacePrismSchema
-
findItemDefinitionsByCompileTimeClass
@NotNull public <ID extends ItemDefinition> List<ID> findItemDefinitionsByCompileTimeClass(@NotNull Class<?> compileTimeClass, @NotNull Class<ID> definitionClass)
- Specified by:
findItemDefinitionsByCompileTimeClass
in interfaceGlobalDefinitionsStore
-
findTypeDefinitionByCompileTimeClass
@Nullable public <TD extends TypeDefinition> TD findTypeDefinitionByCompileTimeClass(@NotNull Class<?> compileTimeClass, @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionByCompileTimeClass
in interfaceGlobalDefinitionsStore
-
findTypeDefinitionByType
@Nullable public <TD extends TypeDefinition> TD findTypeDefinitionByType(@NotNull QName typeName, @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionByType
in interfaceGlobalDefinitionsStore
-
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
-
findItemDefinitionByType
@Nullable public <ID extends ItemDefinition> ID findItemDefinitionByType(@NotNull QName typeName, @NotNull Class<ID> definitionType)
- 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
-
findTypeDefinitionsByType
@NotNull public <TD extends TypeDefinition> Collection<? extends TD> findTypeDefinitionsByType(@NotNull QName typeName, @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionsByType
in interfaceGlobalDefinitionsStore
-
validateRefinedSchema
public static void validateRefinedSchema(RefinedResourceSchema refinedSchema, PrismObject<ResourceType> resource) throws SchemaException
- Throws:
SchemaException
-
toMutable
public MutableResourceSchema toMutable()
- Specified by:
toMutable
in interfaceResourceSchema
-
-