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:
  • Constructor Details

  • Method Details

    • getConstraintKind

      @NotNull public @NotNull PolicyConstraintKindType getConstraintKind()
      The kind of constraint that caused the trigger. For backwards compatibility, we return the "serializable version" (i.e. PolicyConstraintKindType).
    • getConstraint

      @NotNull public CT getConstraint()
    • getMessage

      public LocalizableMessage 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

      public LocalizableMessage getShortMessage()
      Short form of getMessage().
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • debugDump

      public String debugDump(int indent)
      Specified by:
      debugDump in interface DebugDumpable
    • isHidden

      public boolean isHidden()
      If returns true, this trigger will not be presented. Useful for hiding constraints that are too technical to be shown to a user.
      See Also:
    • isFinal

      public boolean isFinal()
      If returns true, 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

      protected void debugDumpSpecific(StringBuilder sb, int indent)
    • toDiagShortcut

      public String toDiagShortcut()
    • getInnerTriggers

      public Collection<EvaluatedPolicyRuleTrigger<?>> getInnerTriggers()
    • toEvaluatedPolicyRuleTriggerBean

      public EvaluatedPolicyRuleTriggerType 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., EvaluatedPolicyRuleTriggerType or its subtype.
    • toEvaluatedPolicyRuleTriggerBean

      protected <T extends EvaluatedPolicyRuleTriggerType> T toEvaluatedPolicyRuleTriggerBean(@NotNull @NotNull PolicyRuleExternalizationOptions options, @NotNull @NotNull Supplier<T> beanConstructor)
    • getTargetObjects

      public Collection<? extends PrismObject<?>> 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, see LinkTargetObjectSelectorType.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 as PolicyViolationException regardless 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