Class ObjectOperationPolicyHelper
java.lang.Object
com.evolveum.midpoint.repo.common.ObjectOperationPolicyHelper
Deals with
effectiveOperationPolicy
in objects (currently shadows).
[NOTE]
====
*BEWARE OF THE EXECUTION MODES*
Most methods take `mode` as a parameter, as both policy statements and default policy for shadow object type can be
mode-dependent. The caller is responsible for providing the correct mode, especially regarding the existing (cached)
effective policy in the provided object.
Rule: The repository will contain mark refs computed only under the PRODUCTION mode.
I.e., the development-mode statements will not be present there.
====- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Contains effective mark refs (both production-mode and current-mode), and computed effective operation policy (for the current mode). -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomputeEffectiveMarksAndPolicies
(@NotNull ObjectType object, @NotNull ObjectMarkHelper.ObjectMarksComputer objectMarksComputer, @NotNull TaskExecutionMode mode, @NotNull OperationResult result) Computes effective marks and policies; depending on the support in repo (see below).@NotNull ObjectOperationPolicyType
computeEffectivePolicy
(@NotNull ObjectType object, @NotNull TaskExecutionMode mode, @NotNull OperationResult parentResult) Computes effective operation policy from stored mark refs and policy statements.void
destroy()
static ObjectOperationPolicyHelper
get()
@Nullable ObjectOperationPolicyType
getDefaultPolicyForResourceObjectType
(@NotNull ResourceObjectDefinition objectDefinition, @NotNull TaskExecutionMode mode, @NotNull OperationResult result) @NotNull ObjectOperationPolicyType
getEffectivePolicy
(@NotNull ObjectType object, @NotNull TaskExecutionMode mode, @NotNull OperationResult result) Returns present effective policy, or computes it (from stored mark refs and statements) if not present.void
init()
-
Constructor Details
-
ObjectOperationPolicyHelper
public ObjectOperationPolicyHelper()
-
-
Method Details
-
init
@PostConstruct public void init() -
destroy
@PreDestroy public void destroy() -
get
-
getEffectivePolicy
@NotNull public @NotNull ObjectOperationPolicyType getEffectivePolicy(@NotNull @NotNull ObjectType object, @NotNull @NotNull TaskExecutionMode mode, @NotNull @NotNull OperationResult result) throws ConfigurationException Returns present effective policy, or computes it (from stored mark refs and statements) if not present. For shadows, it assumes the shadow has the up-to-date definition present (because of the default policy). Execution mode: It influences the policy statements and the default policy. If there is a pre-computed policy in the object, the caller is responsible to provide a mode that matches the one under which the pre-computed policy was computed.- Throws:
ConfigurationException
-
computeEffectivePolicy
@NotNull public @NotNull ObjectOperationPolicyType computeEffectivePolicy(@NotNull @NotNull ObjectType object, @NotNull @NotNull TaskExecutionMode mode, @NotNull @NotNull OperationResult parentResult) throws ConfigurationException Computes effective operation policy from stored mark refs and policy statements. Uses marks from the native repository. BEWARE: If we compute policy for a shadow, it must have the correct definition present! Execution mode: It influences the policy statements and the default policy. We assume that the stored mark refs were computed under the PRODUCTION mode, i.e., that no development-mode policy statements were taken into account.- Throws:
ConfigurationException
-
computeEffectiveMarksAndPolicies
public ObjectOperationPolicyHelper.EffectiveMarksAndPolicies computeEffectiveMarksAndPolicies(@NotNull @NotNull ObjectType object, @NotNull @NotNull ObjectMarkHelper.ObjectMarksComputer objectMarksComputer, @NotNull @NotNull TaskExecutionMode mode, @NotNull @NotNull OperationResult result) throws SchemaException, ConfigurationException Computes effective marks and policies; depending on the support in repo (see below). For native repository: 1. Computes effective marks (using policy statements, the computer, and the currently effective ones) - for both production and current (client-provided) mode. 2. Computes effective policy based on current-mode marks. 3. Updates both in the shadow, plus the legacy protected object flag. For legacy repository: 1. Just computes and updates the legacy protected object flag plus corresponding operation policy. BEWARE: If we compute policy for a shadow, it must have the correct definition present! Just computes. DOES NOT UPDATE THE OBJECT. -
getDefaultPolicyForResourceObjectType
@Nullable public @Nullable ObjectOperationPolicyType getDefaultPolicyForResourceObjectType(@NotNull @NotNull ResourceObjectDefinition objectDefinition, @NotNull @NotNull TaskExecutionMode mode, @NotNull @NotNull OperationResult result) throws ConfigurationException - Throws:
ConfigurationException
-