Interface EvaluatedPolicyRule

All Superinterfaces:
Cloneable, DebugDumpable, Serializable
All Known Subinterfaces:
DirectlyEvaluatedClockworkPolicyRule, EvaluatedClockworkPolicyRule, ForeignEvaluatedClockworkPolicyRule
All Known Implementing Classes:
BaseEvaluatedPolicyRuleImpl, DirectlyEvaluatedClockworkPolicyRuleImpl, EvaluatedActivityPolicyRuleImpl, ForeignEvaluatedClockworkPolicyRuleImpl

public interface EvaluatedPolicyRule extends DebugDumpable, Serializable, Cloneable
Common interface for policy rules obtained from different places and evaluated at different places. E.g. policy rules from task activities, task assignments or global rules from system configuration. TODO sort the methods in some logical order, document them, etc.
  • Method Details

    • getRuleIdentifier

      @NotNull @NotNull PolicyRuleIdentifier getRuleIdentifier()
      Automatically generated identifier that - we hope - uniquely identifies the policy rule.
    • getActivityPath

      ActivityPath getActivityPath()
    • getAllTriggers

      <T extends EvaluatedPolicyRuleTrigger<?>> Collection<T> getAllTriggers(Class<T> type)
      Returns all triggers of given type, stepping down to situation policy rules and composite triggers. An exception are composite "not" triggers: it is usually of no use to collect negated triggers.
    • getPolicyConstraints

      default PolicyConstraintsType getPolicyConstraints()
    • getPolicyThreshold

      default PolicyThresholdType getPolicyThreshold()
    • getRawActions

      default PolicyActionsType getRawActions()
    • getPolicyRuleConfigItem

      @NotNull @NotNull AbstractPolicyRuleConfigItem<?> getPolicyRuleConfigItem()
    • getAllEventMarksOids

      @NotNull default @NotNull Collection<String> getAllEventMarksOids()
    • getPolicyRuleBean

      @NotNull default @NotNull PolicyRuleType getPolicyRuleBean()
    • getRuleOrigin

      @NotNull default @NotNull ConfigurationItemOrigin getRuleOrigin()
    • getName

      default String getName()
      Name of the policy rule, as configured.
    • getOrder

      default Integer getOrder()
    • containsEnabledAction

      default boolean containsEnabledAction()
    • getEnabledActions

      Collection<? extends PolicyActionConfigItem<?>> getEnabledActions()
      Returns all enabled actions. Fails if they were not computed yet. TODO clockwork vs other policy rules
    • getEnabledAction

      @Nullable default <T extends PolicyActionType> @Nullable PolicyActionConfigItem<T> getEnabledAction(Class<T> type)
      Returns enabled action of given type, if there's any. Throws an exception if there are more of them.
    • getEnabledActions

      @NotNull default <T extends PolicyActionType> @NotNull List<? extends PolicyActionConfigItem<T>> getEnabledActions(Class<T> type)
      Returns all enabled actions of given type.
    • getActions

      @NotNull default @NotNull List<PolicyActionType> getActions()
      Returns actions (beans) defined for the policy rule - in the form of a list, not the structured PolicyActionsType.
    • containsEnabledAction

      default boolean containsEnabledAction(Class<? extends PolicyActionType> type)
      Are there any enabled actions of given type?
    • getTriggers

      @NotNull @NotNull Collection<EvaluatedPolicyRuleTrigger<?>> getTriggers()
      Returns triggers for this policy rule, except for ones triggered by related situation policy rules.
    • getAllTriggers

      @NotNull @NotNull Collection<EvaluatedPolicyRuleTrigger<?>> getAllTriggers()
      Returns all triggers, even those that were indirectly collected via situation policy rules.
    • trigger

      void trigger(Collection<EvaluatedPolicyRuleTrigger<?>> triggers)
    • trigger

      default void trigger(EvaluatedPolicyRuleTrigger<?> trigger)
    • isTriggered

      boolean isTriggered()
      Was this rule triggered, i.e. are there any triggers? Note that for activity-based rules this may include triggers that occurred in previous activity runs (and so stored in the activity state).
    • extractMessages

      List<TreeNode<LocalizableMessage>> extractMessages()
    • extractShortMessages

      List<TreeNode<LocalizableMessage>> extractShortMessages()
    • hasSituationConstraint

      default boolean hasSituationConstraint()
    • hasThreshold

      default boolean hasThreshold()
    • getCount

      Integer getCount()
    • setCount

      void setCount(Integer localValue, Integer totalValue)
    • isOverThreshold

      default boolean isOverThreshold()
      Evaluates whether the current count is over the threshold defined in the policy rule. If there is no threshold, it returns true.
    • getPolicySituation

      @Nullable @Nullable String getPolicySituation()
      Returns the policy situation connected to this rule. Will be replaced by object marks.
    • getPolicyMarkRef

      @NotNull default @NotNull List<ObjectReferenceType> getPolicyMarkRef()
    • toEvaluatedPolicyRuleBeans

      @NotNull @NotNull Collection<EvaluatedPolicyRuleType> toEvaluatedPolicyRuleBeans(@NotNull @NotNull PolicyRuleExternalizationOptions options, @Nullable @Nullable Predicate<EvaluatedPolicyRuleTrigger<?>> triggerSelector)
      Serializes the policy rule into bean form (EvaluatedPolicyRuleType). - Serializes only triggered rules. - For sitation rules with are both hidden and final, serializes the inner rules. (TODO why should that be?) TODO consider if we cannot merge trigger selector with the options
      Parameters:
      options - Options - how the serialization should take place.
      triggerSelector - Which triggers should be processed?
    • isContainedIn

      default boolean isContainedIn(Collection<? extends EvaluatedPolicyRule> rules)
      Returns true if this rule is present in the provided collection of rules. Checking by id.