Class EvaluatedPolicyRuleTrigger<CT extends AbstractPolicyConstraintType>
java.lang.Object
com.evolveum.midpoint.repo.common.policy.EvaluatedPolicyRuleTrigger<CT>
- All Implemented Interfaces:
DebugDumpable,Serializable
- Direct Known Subclasses:
EvaluatedAlwaysTrueTrigger,EvaluatedClockworkPolicyRuleTrigger,EvaluatedCompositeTrigger,EvaluatedDurationTrigger,EvaluatedItemProcessingResultTrigger,EvaluatedNumericTrigger,EvaluatedSituationTrigger
public abstract class EvaluatedPolicyRuleTrigger<CT extends AbstractPolicyConstraintType>
extends Object
implements DebugDumpable, Serializable
A policy rule is said to be _triggered_ if its policy constraint matches the object state, its transition, or any other
condition.
_Trigger_ is the cause of the rule being triggered. Typical examples are:
- "assignment is going to be added" (for
PolicyConstraintKind.ASSIGNMENT_MODIFICATION transitional constraint)
- "object is in illegal state" (for PolicyConstraintKind.OBJECT_STATE constraint)
- "resource object was modified" (currently represented by PolicyConstraintKind.CUSTOM constraint)
- "activity took too long to execute (for PolicyConstraintKind.EXECUTION_TIME constraint)
This class represents such a trigger.
Each its instance is connected to a specific policy constraint.
Currently, there is a rough correspondence between:
- POJO version of the trigger (base: EvaluatedPolicyRuleTrigger, specific e.g. {@link `EvaluatedStateTrigger`})
- XML/JSON/YAML (bean) version of the trigger (base: EvaluatedPolicyRuleTriggerType, specific e.g.
EvaluatedStateTriggerType)
- constraint that caused the trigger (base: AbstractPolicyConstraintType, specific e.g. StatePolicyConstraintType)
- evaluator that evaluates the constraint (multiple bases - activities, clockwork, specific e.g. `StateConstraintEvaluator`)
But the match may not be 100%. For example, many triggers (both POJO and bean versions) carry no additional information
w.r.t. the base triggers. We may remove them in the future.
---
When constraints form trees, their corresponding triggers do that as well. So, e.g. `C1 and C2` constraint will produce
a root-level `EvaluatedCompositeTrigger` with two children, one for `C1` and one for `C2`.
These triggers should be immutable, although it is not enforced (by freezing the constraint and other content) for now.
But at least all fields should be `final`.- See Also:
-
Field Summary
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING -
Constructor Summary
ConstructorsConstructorDescriptionEvaluatedPolicyRuleTrigger(@NotNull PolicyConstraintKind constraintKind, CT constraint, LocalizableMessage message, LocalizableMessage shortMessage) EvaluatedPolicyRuleTrigger(@NotNull PolicyConstraintKind constraintKind, CT constraint, LocalizableMessage message, LocalizableMessage shortMessage, boolean enforcementOverride) -
Method Summary
Modifier and TypeMethodDescriptiondebugDump(int indent) protected voiddebugDumpSpecific(StringBuilder sb, int indent) boolean@NotNull PolicyConstraintKindTypeThe kind of constraint that caused the trigger.Human-readable message associated with this trigger.Short form ofgetMessage().Collection<? extends PrismObject<?>>Returns target object(s) that were matched by constraint that produced this trigger.inthashCode()booleanIf true, this trigger is to be reported asPolicyViolationExceptionregardless of specified policy rule action.booleanisFinal()If returnstrue, no children of this trigger will be presented.booleanisHidden()If returnstrue, this trigger will not be presented.Used to create XML bean which is stored in focus, assignment, or in the activity state.toEvaluatedPolicyRuleTriggerBean(@NotNull PolicyRuleExternalizationOptions options) Converts this trigger to externalized (bean) form, i.e.,EvaluatedPolicyRuleTriggerTypeor its subtype.protected <T extends EvaluatedPolicyRuleTriggerType>
TtoEvaluatedPolicyRuleTriggerBean(@NotNull PolicyRuleExternalizationOptions options, @NotNull Supplier<T> beanConstructor) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
-
Constructor Details
-
EvaluatedPolicyRuleTrigger
public EvaluatedPolicyRuleTrigger(@NotNull @NotNull PolicyConstraintKind constraintKind, @NotNull CT constraint, LocalizableMessage message, LocalizableMessage shortMessage) -
EvaluatedPolicyRuleTrigger
public EvaluatedPolicyRuleTrigger(@NotNull @NotNull PolicyConstraintKind constraintKind, @NotNull CT constraint, LocalizableMessage message, LocalizableMessage shortMessage, boolean enforcementOverride)
-
-
Method Details
-
getConstraintKind
The kind of constraint that caused the trigger. For backwards compatibility, we return the "serializable version" (i.e.PolicyConstraintKindType). -
getConstraint
-
getMessage
Human-readable message associated with this trigger. The message explain why the rule was triggered. It can be used in the logs, as an error message, in the audit trail and so on. An example: "Assignment ... is going to be added". -
getShortMessage
Short form ofgetMessage(). -
equals
-
hashCode
public int hashCode() -
toString
-
debugDump
- Specified by:
debugDumpin interfaceDebugDumpable
-
isHidden
public boolean isHidden()If returnstrue, this trigger will not be presented. Useful for hiding constraints that are too technical to be shown to a user. -
isFinal
public boolean isFinal()If returnstrue, no children of this trigger will be presented. Useful for hiding constraints that are too technical to be shown to a user.- See Also:
-
debugDumpSpecific
-
toDiagShortcut
-
getInnerTriggers
-
toEvaluatedPolicyRuleTriggerBean
Used to create XML bean which is stored in focus, assignment, or in the activity state. -
toEvaluatedPolicyRuleTriggerBean
public EvaluatedPolicyRuleTriggerType toEvaluatedPolicyRuleTriggerBean(@NotNull @NotNull PolicyRuleExternalizationOptions options) Converts this trigger to externalized (bean) form, i.e.,EvaluatedPolicyRuleTriggerTypeor its subtype. -
toEvaluatedPolicyRuleTriggerBean
protected <T extends EvaluatedPolicyRuleTriggerType> T toEvaluatedPolicyRuleTriggerBean(@NotNull @NotNull PolicyRuleExternalizationOptions options, @NotNull @NotNull Supplier<T> beanConstructor) -
getTargetObjects
Returns target object(s) that were matched by constraint that produced this trigger. For example: target of the assignment that was added (and that matched "assignment" constraint). Used for the "linked objects" feature, seeLinkTargetObjectSelectorType.F_MATCHES_CONSTRAINT. Applicable only to a very specific triggers. TODO reconsider whether it should be here -
isEnforcementOverride
public boolean isEnforcementOverride()If true, this trigger is to be reported asPolicyViolationExceptionregardless of specified policy rule action. Used e.g. for disallowing assignment of two pruned roles (MID-4766). TODO reconsider this mechanism, as it doesn't seem fitting for the trigger as such: it is more related to the context in which the rule was triggered
-