Class ArchetypeManager
java.lang.Object
com.evolveum.midpoint.model.common.archetypes.ArchetypeManager
- All Implemented Interfaces:
Cache
,CacheInvalidationListener
Component that can efficiently determine archetypes for objects.
It is backed by caches, therefore this is supposed to be a low-overhead service that can be
used in many places.
As a secondary responsibility, this class handles the resolution of object templates.
[NOTE]
====
When resolving archetype references (i.e. obtaining archetype objects from references in object assignments and
`archetypeRef` values, as well as when resolving super-archetypes), we currently handle dangling references
(non-existing objects) by ignoring them. We just log the exception, and keep the
OperationResultStatus.FATAL_ERROR
in the result tree - where the lower-level code put it. (It may or may not be available to the ultimate caller; depending
on the overall operation result processing.)
====- Author:
- Radovan Semancik
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondetermineArchetypeOids
(@Nullable ObjectType object) Determines all archetype OIDs (structural + auxiliary) for a given (static) object.<O extends ObjectType>
@NotNull Set<String>determineArchetypeOids
(O before, O after) Determines all archetype OIDs in the "dynamic" case where the object is changed during clockwork processing.determineArchetypePolicy
(@Nullable PrismObject<? extends ObjectType> object, OperationResult result) A convenience variant ofdetermineArchetypePolicy(ObjectType, OperationResult)
.determineArchetypePolicy
(@Nullable ObjectType object, OperationResult result) Determines the archetype policy for an object.determineArchetypePolicy
(Collection<ArchetypeType> allArchetypes, ObjectType object, OperationResult result) Determines "complex" archetype policy; takes auxiliary archetypes, super archetypes, and even legacy (subtype) configuration into account.@NotNull List<ArchetypeType>
determineArchetypes
(@Nullable ObjectType object, OperationResult result) Determines all archetypes for a "static" object.static <O extends ObjectType>
LifecycleStateModelTypedetermineLifecycleModel
(PrismObject<O> object, PrismObject<SystemConfigurationType> systemConfiguration) static <O extends ObjectType>
LifecycleStateModelTypedetermineLifecycleModel
(PrismObject<O> object, SystemConfigurationType systemConfiguration) <O extends ObjectType>
ObjectPolicyConfigurationTypedetermineObjectPolicyConfiguration
(@NotNull Class<O> objectClass, OperationResult result) Determines default object policy configuration for the specified object typedetermineObjectPolicyConfiguration
(ObjectType object, OperationResult result) Determines legacy object policy configuration (from subtypes)determineStructuralArchetype
(@Nullable AssignmentHolderType assignmentHolder, OperationResult result) Determines the structural archetype for a "static" object.void
@NotNull ArchetypeType
getArchetype
(String oid, OperationResult result) Gets an archetype by OID.@NotNull ObjectTemplateType
getExpandedObjectTemplate
(@NotNull String oid, @NotNull TaskExecutionMode executionMode, @NotNull OperationResult result) Returns the "expanded" object template, i.e.@Nullable ArchetypePolicyType
getPolicyForArchetype
(@NotNull String archetypeOid, OperationResult result) A convenience variant ofgetPolicyForArchetype(ArchetypeType, OperationResult)
.getPolicyForArchetype
(ArchetypeType archetype, OperationResult result) Returns policy collected from this archetype and its super-archetypes.@NotNull Collection<SingleCacheStateInformationType>
void
invalidate
(Class<?> type, String oid, CacheInvalidationContext context) void
register()
resolveArchetypeOids
(Collection<String> oids, Object context, OperationResult result) Resolves archetype OIDs to full objects.void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.evolveum.midpoint.repo.api.Cache
getEventSpecifications, invalidate
-
Constructor Details
-
ArchetypeManager
public ArchetypeManager()
-
-
Method Details
-
register
@PostConstruct public void register() -
unregister
@PreDestroy public void unregister() -
getArchetype
@NotNull public @NotNull ArchetypeType getArchetype(String oid, OperationResult result) throws ObjectNotFoundException, SchemaException Gets an archetype by OID. Assumes that caching ofArchetypeType
objects is enabled by global repository cache. (By default, it is - see `default-caching-profile.xml` in `infra/schema` resources.) -
resolveArchetypeOids
public List<ArchetypeType> resolveArchetypeOids(Collection<String> oids, Object context, OperationResult result) throws SchemaException Resolves archetype OIDs to full objects. See the class-level note about resolving dangling references.- Throws:
SchemaException
-
determineArchetypeOids
Determines all archetype OIDs (structural + auxiliary) for a given (static) object. -
determineArchetypeOids
@NotNull public <O extends ObjectType> @NotNull Set<String> determineArchetypeOids(O before, O after) Determines all archetype OIDs in the "dynamic" case where the object is changed during clockwork processing.- See Also:
-
determineArchetypes
@NotNull public @NotNull List<ArchetypeType> determineArchetypes(@Nullable @Nullable ObjectType object, OperationResult result) throws SchemaException Determines all archetypes for a "static" object. See the class-level note about resolving dangling references.- Throws:
SchemaException
-
determineStructuralArchetype
public ArchetypeType determineStructuralArchetype(@Nullable @Nullable AssignmentHolderType assignmentHolder, OperationResult result) throws SchemaException Determines the structural archetype for a "static" object. (See the class-level note about resolving dangling references.)- Throws:
SchemaException
-
determineArchetypePolicy
public ArchetypePolicyType determineArchetypePolicy(@Nullable @Nullable ObjectType object, OperationResult result) throws SchemaException, ConfigurationException Determines the archetype policy for an object. (See the class-level note about resolving dangling archetype references.) -
determineArchetypePolicy
public ArchetypePolicyType determineArchetypePolicy(@Nullable @Nullable PrismObject<? extends ObjectType> object, OperationResult result) throws SchemaException, ConfigurationException A convenience variant ofdetermineArchetypePolicy(ObjectType, OperationResult)
. -
determineArchetypePolicy
public ArchetypePolicyType determineArchetypePolicy(Collection<ArchetypeType> allArchetypes, ObjectType object, OperationResult result) throws SchemaException, ConfigurationException Determines "complex" archetype policy; takes auxiliary archetypes, super archetypes, and even legacy (subtype) configuration into account. -
getPolicyForArchetype
@Nullable public @Nullable ArchetypePolicyType getPolicyForArchetype(@NotNull @NotNull String archetypeOid, OperationResult result) throws SchemaException, ConfigurationException, ObjectNotFoundException A convenience variant ofgetPolicyForArchetype(ArchetypeType, OperationResult)
. -
getPolicyForArchetype
public ArchetypePolicyType getPolicyForArchetype(ArchetypeType archetype, OperationResult result) throws SchemaException, ConfigurationException Returns policy collected from this archetype and its super-archetypes. Uses the policy cache. -
determineObjectPolicyConfiguration
public <O extends ObjectType> ObjectPolicyConfigurationType determineObjectPolicyConfiguration(@NotNull @NotNull Class<O> objectClass, OperationResult result) throws SchemaException, ConfigurationException Determines default object policy configuration for the specified object type -
determineObjectPolicyConfiguration
public ObjectPolicyConfigurationType determineObjectPolicyConfiguration(ObjectType object, OperationResult result) throws SchemaException, ConfigurationException Determines legacy object policy configuration (from subtypes) -
determineLifecycleModel
public static <O extends ObjectType> LifecycleStateModelType determineLifecycleModel(PrismObject<O> object, PrismObject<SystemConfigurationType> systemConfiguration) throws ConfigurationException - Throws:
ConfigurationException
-
determineLifecycleModel
public static <O extends ObjectType> LifecycleStateModelType determineLifecycleModel(PrismObject<O> object, SystemConfigurationType systemConfiguration) throws ConfigurationException - Throws:
ConfigurationException
-
invalidate
- Specified by:
invalidate
in interfaceCache
-
getStateInformation
- Specified by:
getStateInformation
in interfaceCache
-
dumpContent
public void dumpContent()- Specified by:
dumpContent
in interfaceCache
-
getExpandedObjectTemplate
@NotNull public @NotNull ObjectTemplateType getExpandedObjectTemplate(@NotNull @NotNull String oid, @NotNull @NotNull TaskExecutionMode executionMode, @NotNull @NotNull OperationResult result) throws SchemaException, ObjectNotFoundException, ConfigurationException Returns the "expanded" object template, i.e. the one with "include" instructions resolved. Note that the handling of dangling references is graceful just like in the case of archetypes, see the note in the class-level javadoc. However, if the `oid` parameter cannot be resolved, the respective exception is thrown.- Returns:
- Immutable expanded template
- Throws:
SchemaException
ObjectNotFoundException
ConfigurationException
-