Class RefinedResourceSchemaImpl
- java.lang.Object
-
- com.evolveum.midpoint.common.refinery.RefinedResourceSchemaImpl
-
- All Implemented Interfaces:
RefinedResourceSchema
,Freezable
,PrismContextSensitive
,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.Freezable
checkImmutable, checkMutable
-
Methods inherited from interface com.evolveum.midpoint.prism.schema.GlobalDefinitionsStore
findComplexTypeDefinitionByCompileTimeClass, 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
-
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
-
getExistingRefinedSchema
public static RefinedResourceSchema getExistingRefinedSchema(PrismObject<ResourceType> resource)
-
getRefinedSchema
public static RefinedResourceSchema getRefinedSchema(PrismObject<ResourceType> resource, PrismContext prismContext) throws SchemaException
Obtains refined schema for the resource. If the resource does NOT contain the schema, it must be mutable. TODO rework this -- management of refined resource schemas will be the responsibility of ResourceManager- 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
Obtains schema for the resource. If the resource does NOT contain the schema, it must be mutable. TODO rework this -- management of resource schemas will be the responsibility of ResourceManager- Throws:
SchemaException
-
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
@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
-
getPrismContext
public PrismContext getPrismContext()
- Specified by:
getPrismContext
in interfacePrismContextSensitive
-
serializeToXsd
@NotNull public @NotNull 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> @NotNull List<ID> findItemDefinitionsByCompileTimeClass(@NotNull @NotNull Class<?> compileTimeClass, @NotNull @NotNull Class<ID> definitionClass)
- Specified by:
findItemDefinitionsByCompileTimeClass
in interfaceGlobalDefinitionsStore
-
findTypeDefinitionByCompileTimeClass
@Nullable public <TD extends TypeDefinition> TD findTypeDefinitionByCompileTimeClass(@NotNull @NotNull Class<?> compileTimeClass, @NotNull @NotNull Class<TD> definitionClass)
- Specified by:
findTypeDefinitionByCompileTimeClass
in interfaceGlobalDefinitionsStore
-
findTypeDefinitionByType
@Nullable public <TD extends TypeDefinition> TD findTypeDefinitionByType(@NotNull @NotNull QName typeName, @NotNull @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 @NotNull QName typeName, @NotNull @NotNull Class<ID> definitionType)
- Specified by:
findItemDefinitionByType
in interfaceGlobalDefinitionsStore
-
findItemDefinitionsByElementName
@NotNull public <ID extends ItemDefinition> @NotNull List<ID> findItemDefinitionsByElementName(@NotNull @NotNull QName elementName, @NotNull @NotNull Class<ID> definitionClass)
- Specified by:
findItemDefinitionsByElementName
in interfaceGlobalDefinitionsStore
-
findTypeDefinitionsByType
@NotNull public <TD extends TypeDefinition> @NotNull Collection<? extends TD> findTypeDefinitionsByType(@NotNull @NotNull QName typeName, @NotNull @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
-
isImmutable
public boolean isImmutable()
- Specified by:
isImmutable
in interfaceFreezable
-
-