Interface ResourceSchema
-
- All Superinterfaces:
Cloneable
,DebugDumpable
,DefinitionSearchImplementation
,DefinitionsStore
,Freezable
,GlobalDefinitionsStore
,LayeredDefinition
,PrismContextSensitive
,PrismSchema
- All Known Subinterfaces:
MutableResourceSchema
- All Known Implementing Classes:
ResourceSchemaImpl
public interface ResourceSchema extends PrismSchema, Cloneable, LayeredDefinition
A schema covering the whole resource. It contains both "raw" object class definition and "refined" object type definitions. - Raw definitions are represented byResourceObjectClassDefinition
objects and are obtained directly from the connector. - Refined definitions (represented byResourceObjectTypeDefinition
) are derived from the raw ones by merging them with information in `schemaHandling` part of the resource definition. This interface contains a lot of methods that try to find object type/class definition matching criteria. Similar methods (more comprehensive) are inResourceObjectDefinitionResolver
class. NOTE: Some of the names will probably change soon. NOTE: There can be schemas that contain no refined definitions. Either the resource definition contains no `schemaHandling`, or we work at lower layers (e.g. when fetching and parsing the schema in ConnId connector).- Author:
- semancik
-
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ResourceSchema
clone()
default @Nullable ResourceObjectTypeDefinition
findDefaultObjectTypeDefinition(@NotNull ShadowKindType kind, @Nullable QName objectClassName)
Returns the default definition for given kind.default @Nullable ResourceObjectTypeDefinition
findDefaultOrAnyObjectTypeDefinition(@NotNull ShadowKindType kind)
Returns the definition for given kind.default @Nullable ResourceObjectDefinition
findDefinitionForObjectClass(@NotNull QName name)
Returns a definition for a given object class: - if there's a "default for class" type defined, it is returned (this is a kind of pre-4.5 behavior) - otherwise, the object class definition is returned (if there's any)default @NotNull ResourceObjectDefinition
findDefinitionForObjectClassRequired(@NotNull QName name)
AsfindDefinitionForObjectClass(QName)
but throws an exception if there's no suitable definition.default @Nullable ResourceObjectClassDefinition
findObjectClassDefinition(@NotNull QName name)
Returns object class definition for a given object class name.default @NotNull ResourceObjectClassDefinition
findObjectClassDefinitionRequired(@NotNull QName name)
The same asfindObjectClassDefinition(QName)
but throws an exception if there's no such definition.default @Nullable ResourceObjectDefinition
findObjectDefinition(@NotNull ShadowKindType kind, @Nullable String intent)
LikefindObjectDefinition(ShadowKindType, String, QName)
but without object class name.default @Nullable ResourceObjectDefinition
findObjectDefinition(@NotNull ShadowKindType kind, @Nullable String intent, @Nullable QName objectClassName)
Returns object definition (type or class) matching given kind and intent, and object class.default @NotNull ResourceObjectDefinition
findObjectDefinitionRequired(@NotNull ShadowKindType kind, @Nullable String intent)
AsfindObjectDefinition(ShadowKindType, String)
but throwsNullPointerException
if a definition cannot be found (in a normal way).default ResourceObjectTypeDefinition
findObjectTypeDefinitionForAnyMatchingIntent(@NotNull ShadowKindType kind, @NotNull Collection<String> intents)
Returns object type definition matching given kind and one of the intents.default @NotNull ResourceObjectTypeDefinition
findObjectTypeDefinitionRequired(@NotNull ShadowKindType kind, @Nullable String intent)
Returns object _type_ definition for given kind and intent.ResourceSchema
forLayer(LayerType layer)
Returns a representation of the schema for given layer.default @NotNull Collection<String>
getIntentsForKind(ShadowKindType kind)
TODO descriptiondefault @NotNull String
getNamespace()
Returns schema namespace.default @NotNull Collection<ResourceObjectClassDefinition>
getObjectClassDefinitions()
Returns definitions for all the object classes.default @NotNull Collection<QName>
getObjectClassNames()
Returns names of all object classes mentioned in the "raw" resource definition.default @NotNull Collection<ResourceObjectTypeDefinition>
getObjectTypeDefinitions()
Returns definitions for all the object types.default @NotNull List<? extends ResourceObjectTypeDefinition>
getObjectTypeDefinitions(@Nullable ShadowKindType kind)
Returns definitions for all types with given kind.default boolean
isRaw()
Returns true if the schema contains no "refined" (type) definitions.MutableResourceSchema
toMutable()
Returns an interface to mutate this schema.void
validate(PrismObject<ResourceType> resource)
TODO description-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, 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
findComplexTypeDefinitionByCompileTimeClass, findComplexTypeDefinitionByType, findContainerDefinitionByCompileTimeClass, findContainerDefinitionByElementName, findContainerDefinitionByType, findItemDefinitionByCompileTimeClass, findItemDefinitionByElementName, findItemDefinitionByElementName, findItemDefinitionByType, findItemDefinitionByType, findItemDefinitionsByCompileTimeClass, findItemDefinitionsByElementName, findItemDefinitionsByElementName, findObjectDefinitionByCompileTimeClass, findObjectDefinitionByElementName, findObjectDefinitionByType, findPropertyDefinitionByElementName, findReferenceDefinitionByElementName, findSimpleTypeDefinitionByType, findTypeDefinitionByCompileTimeClass, findTypeDefinitionByType, findTypeDefinitionByType, findTypeDefinitionsByType, findTypeDefinitionsByType
-
Methods inherited from interface com.evolveum.midpoint.schema.processor.LayeredDefinition
getCurrentLayer
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismContextSensitive
getPrismContext
-
Methods inherited from interface com.evolveum.midpoint.prism.schema.PrismSchema
getComplexTypeDefinitions, getDefinitions, getDefinitions, getObjectDefinitions, getSubstitutions, isEmpty, serializeToXsd
-
-
-
-
Method Detail
-
getObjectClassDefinitions
@NotNull default @NotNull Collection<ResourceObjectClassDefinition> getObjectClassDefinitions()
Returns definitions for all the object classes.
-
getObjectTypeDefinitions
@NotNull default @NotNull Collection<ResourceObjectTypeDefinition> getObjectTypeDefinitions()
Returns definitions for all the object types.
-
getObjectTypeDefinitions
@NotNull default @NotNull List<? extends ResourceObjectTypeDefinition> getObjectTypeDefinitions(@Nullable @Nullable ShadowKindType kind)
Returns definitions for all types with given kind. (If null, returns all types.)
-
findObjectDefinition
@Nullable default @Nullable ResourceObjectDefinition findObjectDefinition(@NotNull @NotNull ShadowKindType kind, @Nullable @Nullable String intent, @Nullable @Nullable QName objectClassName)
Returns object definition (type or class) matching given kind and intent, and object class. The object class parameter is used to: 1. verify that object type that matches given kind and intent is compatible with (currently: equal to) the object class; 2. provide a complementary means to select a type when intent is not specified. There is a special treatment for: - intent being null: seefindObjectDefinitionForKind(ShadowKindType, QName)
; - (a hack) for ACCOUNT/default: seefindDefaultAccountObjectClass()
[this may be removed later] The "unknown" values for kind/intent are not supported. The client must know if these are even applicable, or (if they are) how they should be interpreted.- Throws:
IllegalStateException
- if there are more matching definitions for known kind/intent (we should have checked this when parsing)IllegalArgumentException
- if "unknown" values are present; or if only the kind is specified, and there's more than one applicable definition for the kind (TODO or should be thatConfigurationException
?)
-
findObjectDefinition
@Nullable default @Nullable ResourceObjectDefinition findObjectDefinition(@NotNull @NotNull ShadowKindType kind, @Nullable @Nullable String intent)
LikefindObjectDefinition(ShadowKindType, String, QName)
but without object class name.
-
findObjectDefinitionRequired
@NotNull default @NotNull ResourceObjectDefinition findObjectDefinitionRequired(@NotNull @NotNull ShadowKindType kind, @Nullable @Nullable String intent)
AsfindObjectDefinition(ShadowKindType, String)
but throwsNullPointerException
if a definition cannot be found (in a normal way). All other exceptions from the above method apply.
-
findObjectTypeDefinitionRequired
@NotNull default @NotNull ResourceObjectTypeDefinition findObjectTypeDefinitionRequired(@NotNull @NotNull ShadowKindType kind, @Nullable @Nullable String intent)
Returns object _type_ definition for given kind and intent. Not used in standard cases. ConsiderfindObjectDefinitionRequired(ShadowKindType, String)
instead.
-
findObjectTypeDefinitionForAnyMatchingIntent
default ResourceObjectTypeDefinition findObjectTypeDefinitionForAnyMatchingIntent(@NotNull @NotNull ShadowKindType kind, @NotNull @NotNull Collection<String> intents) throws SchemaException
Returns object type definition matching given kind and one of the intents. (Or, if no intents are provided, default type for given kind is returned. We are not very eager here - by default we mean just the flag "default" being set. This is in contrast with e.g.findObjectDefinitionForKind(ShadowKindType, QName)
. But here we won't go into such levels. This is quite a specialized method.) The matching types must be co share at least the object class name. This is checked by this method. However, in practice they must share much more, as described in the description forResourceObjectAssociationType.getIntent()
(see XSD). To be used in special circumstances.- Throws:
SchemaException
-
findDefaultObjectTypeDefinition
@Nullable default @Nullable ResourceObjectTypeDefinition findDefaultObjectTypeDefinition(@NotNull @NotNull ShadowKindType kind, @Nullable @Nullable QName objectClassName)
Returns the default definition for given kind. The `default` flag must be explicitly set. Object class must match, if it's specified.
-
findDefaultOrAnyObjectTypeDefinition
@Nullable default @Nullable ResourceObjectTypeDefinition findDefaultOrAnyObjectTypeDefinition(@NotNull @NotNull ShadowKindType kind)
Returns the definition for given kind. If default one is present, it is returned. Otherwise, any definition is returned. This is similar to pre-4.5 behavior observed when looking for "refined definitions". (Although not exactly the same: now we require type definition, whereas in 4.4 and before we could return a definition even if no schemaHandling was present.) TODO Determine if this method is really needed.
-
findDefinitionForObjectClass
@Nullable default @Nullable ResourceObjectDefinition findDefinitionForObjectClass(@NotNull @NotNull QName name)
Returns a definition for a given object class: - if there's a "default for class" type defined, it is returned (this is a kind of pre-4.5 behavior) - otherwise, the object class definition is returned (if there's any)
-
findDefinitionForObjectClassRequired
@NotNull default @NotNull ResourceObjectDefinition findDefinitionForObjectClassRequired(@NotNull @NotNull QName name)
AsfindDefinitionForObjectClass(QName)
but throws an exception if there's no suitable definition. Currently it'sNullPointerException
. TODO reconsider what kind of exception should we throw
-
findObjectClassDefinition
@Nullable default @Nullable ResourceObjectClassDefinition findObjectClassDefinition(@NotNull @NotNull QName name)
Returns object class definition for a given object class name.
-
findObjectClassDefinitionRequired
@NotNull default @NotNull ResourceObjectClassDefinition findObjectClassDefinitionRequired(@NotNull @NotNull QName name) throws SchemaException
The same asfindObjectClassDefinition(QName)
but throws an exception if there's no such definition.- Throws:
SchemaException
-
getObjectClassNames
@NotNull default @NotNull Collection<QName> getObjectClassNames()
Returns names of all object classes mentioned in the "raw" resource definition.
-
toMutable
MutableResourceSchema toMutable()
Returns an interface to mutate this schema.
-
forLayer
ResourceSchema forLayer(LayerType layer)
Returns a representation of the schema for given layer.
-
getNamespace
@NotNull default @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
-
validate
void validate(PrismObject<ResourceType> resource) throws SchemaException
TODO description- Throws:
SchemaException
-
getIntentsForKind
@NotNull default @NotNull Collection<String> getIntentsForKind(ShadowKindType kind)
TODO description
-
clone
ResourceSchema clone()
-
isRaw
default boolean isRaw()
Returns true if the schema contains no "refined" (type) definitions.
-
-