Interface AssociatedPolicyRule
- 
- All Superinterfaces:
- Cloneable,- DebugDumpable,- Serializable
 - All Known Subinterfaces:
- EvaluatedPolicyRule
 
 @Experimental public interface AssociatedPolicyRule extends DebugDumpable, Serializable, Cloneable EvaluatedPolicyRulethat is associated to givenEvaluatedAssignment, either as "own" (i.e. directly evaluated and triggered on) or as "foreign" (triggered on another assignment but connected to this one, typically because of an exclusion constraint). The purpose of this class is to provide the necessary functionality when such rules are returned byEvaluatedAssignment.getAllAssociatedPolicyRules()method. Important things to consider: . The exclusion constraints on foreign policy rules are just as they are triggered on their original assignments. It means that exclusion triggers on them point to the current assigment asEvaluatedExclusionTrigger.conflictingTarget, and to original one asEvaluatedExclusionTrigger.thisTarget. See alsoEvaluatedExclusionTrigger.getRealConflictingAssignment(EvaluatedAssignment). . Also note that not all triggers on the original policy rule are relevant to this (new) assignment. For example, if a role `coordinator` excludes all roles of type `worker`, and has appropriate policy rule on it, then when you are assigning `worker-1` and `worker-2`, both get this policy rule (with 2 triggers) as a foreign rule. However, only one trigger is relevant for each of the workers. Hence, use appropriate method to select relevant triggers, e.g.getRelevantExclusionTriggers()orEvaluatedPolicyRuleTrigger.isRelevantForNewOwner(EvaluatedAssignment).
- 
- 
Field Summary- 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpableINDENT_STRING
 
- 
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddToEvaluatedPolicyRuleBeans(@NotNull Collection<EvaluatedPolicyRuleType> ruleBeans, @NotNull PolicyRuleExternalizationOptions options, @Nullable Predicate<EvaluatedPolicyRuleTrigger<?>> triggerSelector, @Nullable EvaluatedAssignment newOwner)Serializes the policy rule into bean form (EvaluatedPolicyRuleType).voidaddTrigger(@NotNull EvaluatedPolicyRuleTrigger<?> trigger)Adds a trigger to the policy rule.static booleancontains(List<? extends AssociatedPolicyRule> rules, AssociatedPolicyRule otherRule)booleancontainsEnabledAction(Class<? extends PolicyActionType> type)Are there any enabled actions of given type?<T extends PolicyActionType>
 TgetEnabledAction(Class<T> type)Returns enabled action of given type, if there's any.<T extends PolicyActionType>
 @NotNull List<T>getEnabledActions(Class<T> type)Returns all enabled actions of given type.@NotNull EvaluatedPolicyRulegetEvaluatedPolicyRule()Returns the original policy rule.@Nullable EvaluatedAssignmentgetNewOwner()Returns new owner (for foreign rules) or `null` (for original ones).default StringgetNewOwnerShortString()@NotNull StringgetPolicyRuleIdentifier()Automatically generated identifier that - we hope - uniquely identifies the policy rule.@Nullable StringgetPolicySituation()Returns the policy situation connected to this rule.@NotNull Collection<EvaluatedExclusionTrigger>getRelevantExclusionTriggers()Returns exclusion triggers without ones that are not relevant for given "new owner" (see class javadoc).static intgetTriggeredRulesCount(Collection<? extends AssociatedPolicyRule> policyRules)booleanisTriggered()Was this rule triggered, i.e.StringtoShortString()Returns short, (more or less) user-level characterization of this object.- 
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpabledebugDump, debugDump, debugDumpLazily, debugDumpLazily
 
- 
 
- 
- 
- 
Method Detail- 
getPolicyRuleIdentifier@NotNull @NotNull String getPolicyRuleIdentifier() Automatically generated identifier that - we hope - uniquely identifies the policy rule.
 - 
isTriggeredboolean isTriggered() Was this rule triggered, i.e. are there any triggers? We do not distinguish between relevant and irrelevant triggers here, as foreign rules should have always some triggers, so this is always `true` for them.
 - 
containsEnabledActionboolean containsEnabledAction(Class<? extends PolicyActionType> type) Are there any enabled actions of given type?
 - 
getEnabledAction@Nullable <T extends PolicyActionType> 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 <T extends PolicyActionType> @NotNull List<T> getEnabledActions(Class<T> type) Returns all enabled actions of given type.
 - 
getRelevantExclusionTriggers@NotNull @NotNull Collection<EvaluatedExclusionTrigger> getRelevantExclusionTriggers() Returns exclusion triggers without ones that are not relevant for given "new owner" (see class javadoc).
 - 
toShortStringString toShortString() Returns short, (more or less) user-level characterization of this object.
 - 
getNewOwner@Nullable @Nullable EvaluatedAssignment getNewOwner() Returns new owner (for foreign rules) or `null` (for original ones).
 - 
getEvaluatedPolicyRule@NotNull @NotNull EvaluatedPolicyRule getEvaluatedPolicyRule() Returns the original policy rule.
 - 
getNewOwnerShortStringdefault String getNewOwnerShortString() 
 - 
getPolicySituation@Nullable @Nullable String getPolicySituation() Returns the policy situation connected to this rule. Will be replaced by object marks.
 - 
addToEvaluatedPolicyRuleBeansvoid addToEvaluatedPolicyRuleBeans(@NotNull @NotNull Collection<EvaluatedPolicyRuleType> ruleBeans, @NotNull @NotNull PolicyRuleExternalizationOptions options, @Nullable @Nullable Predicate<EvaluatedPolicyRuleTrigger<?>> triggerSelector, @Nullable @Nullable EvaluatedAssignment newOwner)Serializes the policy rule into bean form (EvaluatedPolicyRuleType). Currently not very nice contract, should be improved later.- Parameters:
- ruleBeans- Collection of beans into which to put the result.
- options- Options - how the serialization should take place.
- triggerSelector- Which triggers should be processed?
- newOwner- If set, we should ignore triggers not relevant for this evaluated assignment.
 
 - 
addTriggervoid addTrigger(@NotNull @NotNull EvaluatedPolicyRuleTrigger<?> trigger)Adds a trigger to the policy rule. For internal use only.
 - 
getTriggeredRulesCountstatic int getTriggeredRulesCount(Collection<? extends AssociatedPolicyRule> policyRules) 
 - 
containsstatic boolean contains(List<? extends AssociatedPolicyRule> rules, AssociatedPolicyRule otherRule) 
 
- 
 
-