Class EvaluatedPolicyRuleImpl
- java.lang.Object
-
- com.evolveum.midpoint.model.impl.lens.EvaluatedPolicyRuleImpl
-
- All Implemented Interfaces:
AssociatedPolicyRule
,EvaluatedPolicyRule
,DebugDumpable
,Serializable
,Cloneable
public class EvaluatedPolicyRuleImpl extends Object implements EvaluatedPolicyRule, AssociatedPolicyRule
- Author:
- semancik
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.evolveum.midpoint.model.api.context.EvaluatedPolicyRule
EvaluatedPolicyRule.TargetType
-
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description EvaluatedPolicyRuleImpl(@NotNull PolicyRuleType policyRuleBean, @NotNull String ruleId, @Nullable AssignmentPath assignmentPath, @NotNull EvaluatedPolicyRule.TargetType targetType)
EvaluatedPolicyRuleImpl(@NotNull PolicyRuleType policyRuleBean, @NotNull String ruleId, @Nullable AssignmentPath assignmentPath, @Nullable EvaluatedAssignmentImpl<?> evaluatedAssignment, @NotNull EvaluatedPolicyRule.TargetType targetType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addToEvaluatedPolicyRuleBeans(@NotNull Collection<EvaluatedPolicyRuleType> ruleBeans, @NotNull PolicyRuleExternalizationOptions options, @Nullable Predicate<EvaluatedPolicyRuleTrigger<?>> triggerSelector, @Nullable EvaluatedAssignment newOwner)
Honors "final" but not "hidden" flag.void
addToEvaluatedPolicyRuleBeansInternal(@NotNull Collection<EvaluatedPolicyRuleType> ruleBeans, @NotNull PolicyRuleExternalizationOptions options, @Nullable Predicate<EvaluatedPolicyRuleTrigger<?>> triggerSelector, @Nullable EvaluatedAssignment newOwner)
void
addTrigger(@NotNull EvaluatedPolicyRuleTrigger<?> trigger)
Adds a trigger to the policy rule.EvaluatedPolicyRuleImpl
clone()
void
computeEnabledActions(@Nullable PolicyRuleEvaluationContext<?> rctx, PrismObject<?> object, Task task, OperationResult result)
boolean
containsEnabledAction()
boolean
containsEnabledAction(Class<? extends PolicyActionType> type)
Are there any enabled actions of given type?String
debugDump(int indent)
boolean
equals(Object o)
List<TreeNode<LocalizableMessage>>
extractMessages()
List<TreeNode<LocalizableMessage>>
extractShortMessages()
PolicyActionsType
getActions()
@NotNull Collection<EvaluatedPolicyRuleTrigger<?>>
getAllTriggers()
Returns all triggers, even those that were indirectly collected via situation policy rules.<T extends EvaluatedPolicyRuleTrigger<?>>
Collection<T>getAllTriggers(Class<T> type)
Returns all triggers of given type, stepping down to situation policy rules and composite triggers.@Nullable AssignmentPath
getAssignmentPath()
@NotNull AssignmentPath
getAssignmentPathRequired()
int
getCount()
<T extends PolicyActionType>
TgetEnabledAction(Class<T> type)
Returns enabled action of given type, if there's any.@NotNull List<PolicyActionType>
getEnabledActions()
<T extends PolicyActionType>
@NotNull List<T>getEnabledActions(Class<T> type)
Returns all enabled actions of given type.@Nullable EvaluatedAssignmentImpl<?>
getEvaluatedAssignment()
Evaluated assignment that brought this policy rule to the focus or target.@NotNull EvaluatedPolicyRule
getEvaluatedPolicyRule()
Returns the original policy rule.String
getName()
@Nullable EvaluatedAssignment
getNewOwner()
Returns new owner (for foreign rules) or `null` (for original ones).PolicyConstraintsType
getPolicyConstraints()
@NotNull PolicyRuleType
getPolicyRule()
@NotNull String
getPolicyRuleIdentifier()
Automatically generated identifier that - we hope - uniquely identifies the policy rule.@Nullable String
getPolicySituation()
Returns the policy situation connected to this rule.PolicyThresholdType
getPolicyThreshold()
@NotNull Collection<EvaluatedExclusionTrigger>
getRelevantExclusionTriggers()
Returns exclusion triggers without ones that are not relevant for given "new owner" (see class javadoc).EvaluatedPolicyRule.TargetType
getTargetType()
To which object is the policy rule targeted and how.@NotNull Collection<EvaluatedPolicyRuleTrigger<?>>
getTriggers()
int
hashCode()
boolean
hasSituationConstraint()
boolean
isGlobal()
boolean
isOverThreshold()
boolean
isTriggered()
Was this rule triggered, i.e.void
registerAsForeignRuleIfNeeded()
void
setCount(int value)
String
toShortString()
Returns short, (more or less) user-level characterization of this object.String
toString()
void
trigger(Collection<EvaluatedPolicyRuleTrigger<?>> triggers)
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.model.api.context.AssociatedPolicyRule
getNewOwnerShortString
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.model.api.context.EvaluatedPolicyRule
hasThreshold, isApplicableToAssignment, isApplicableToFocusObject, isApplicableToProjection
-
-
-
-
Constructor Detail
-
EvaluatedPolicyRuleImpl
public EvaluatedPolicyRuleImpl(@NotNull @NotNull PolicyRuleType policyRuleBean, @NotNull @NotNull String ruleId, @Nullable @Nullable AssignmentPath assignmentPath, @NotNull @NotNull EvaluatedPolicyRule.TargetType targetType)
-
EvaluatedPolicyRuleImpl
public EvaluatedPolicyRuleImpl(@NotNull @NotNull PolicyRuleType policyRuleBean, @NotNull @NotNull String ruleId, @Nullable @Nullable AssignmentPath assignmentPath, @Nullable @Nullable EvaluatedAssignmentImpl<?> evaluatedAssignment, @NotNull @NotNull EvaluatedPolicyRule.TargetType targetType)
-
-
Method Detail
-
clone
public EvaluatedPolicyRuleImpl clone()
-
getName
public String getName()
- Specified by:
getName
in interfaceEvaluatedPolicyRule
-
getPolicyRule
@NotNull public @NotNull PolicyRuleType getPolicyRule()
- Specified by:
getPolicyRule
in interfaceEvaluatedPolicyRule
-
getAssignmentPath
@Nullable public @Nullable AssignmentPath getAssignmentPath()
- Specified by:
getAssignmentPath
in interfaceEvaluatedPolicyRule
-
getAssignmentPathRequired
@NotNull public @NotNull AssignmentPath getAssignmentPathRequired()
-
getEvaluatedAssignment
@Nullable public @Nullable EvaluatedAssignmentImpl<?> getEvaluatedAssignment()
Description copied from interface:EvaluatedPolicyRule
Evaluated assignment that brought this policy rule to the focus or target. May be missing for artificially-crafted policy rules (to be reviewed!)- Specified by:
getEvaluatedAssignment
in interfaceEvaluatedPolicyRule
-
getPolicyConstraints
public PolicyConstraintsType getPolicyConstraints()
- Specified by:
getPolicyConstraints
in interfaceEvaluatedPolicyRule
-
getPolicyThreshold
public PolicyThresholdType getPolicyThreshold()
- Specified by:
getPolicyThreshold
in interfaceEvaluatedPolicyRule
-
getTriggers
@NotNull public @NotNull Collection<EvaluatedPolicyRuleTrigger<?>> getTriggers()
- Specified by:
getTriggers
in interfaceEvaluatedPolicyRule
-
isTriggered
public boolean isTriggered()
Description copied from interface:AssociatedPolicyRule
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.- Specified by:
isTriggered
in interfaceAssociatedPolicyRule
-
getAllTriggers
@NotNull public @NotNull Collection<EvaluatedPolicyRuleTrigger<?>> getAllTriggers()
Description copied from interface:EvaluatedPolicyRule
Returns all triggers, even those that were indirectly collected via situation policy rules.- Specified by:
getAllTriggers
in interfaceEvaluatedPolicyRule
-
getRelevantExclusionTriggers
@NotNull public @NotNull Collection<EvaluatedExclusionTrigger> getRelevantExclusionTriggers()
Description copied from interface:AssociatedPolicyRule
Returns exclusion triggers without ones that are not relevant for given "new owner" (see class javadoc).- Specified by:
getRelevantExclusionTriggers
in interfaceAssociatedPolicyRule
-
getAllTriggers
public <T extends EvaluatedPolicyRuleTrigger<?>> Collection<T> getAllTriggers(Class<T> type)
Description copied from interface:EvaluatedPolicyRule
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.- Specified by:
getAllTriggers
in interfaceEvaluatedPolicyRule
-
trigger
public void trigger(Collection<EvaluatedPolicyRuleTrigger<?>> triggers)
-
addTrigger
public void addTrigger(@NotNull @NotNull EvaluatedPolicyRuleTrigger<?> trigger)
Description copied from interface:AssociatedPolicyRule
Adds a trigger to the policy rule. For internal use only.- Specified by:
addTrigger
in interfaceAssociatedPolicyRule
-
getActions
public PolicyActionsType getActions()
- Specified by:
getActions
in interfaceEvaluatedPolicyRule
-
getPolicySituation
@Nullable public @Nullable String getPolicySituation()
Description copied from interface:AssociatedPolicyRule
Returns the policy situation connected to this rule. Will be replaced by object marks.- Specified by:
getPolicySituation
in interfaceAssociatedPolicyRule
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
isGlobal
public boolean isGlobal()
- Specified by:
isGlobal
in interfaceEvaluatedPolicyRule
-
toShortString
public String toShortString()
Description copied from interface:AssociatedPolicyRule
Returns short, (more or less) user-level characterization of this object.- Specified by:
toShortString
in interfaceAssociatedPolicyRule
-
extractMessages
public List<TreeNode<LocalizableMessage>> extractMessages()
- Specified by:
extractMessages
in interfaceEvaluatedPolicyRule
-
extractShortMessages
public List<TreeNode<LocalizableMessage>> extractShortMessages()
- Specified by:
extractShortMessages
in interfaceEvaluatedPolicyRule
-
addToEvaluatedPolicyRuleBeans
public void addToEvaluatedPolicyRuleBeans(@NotNull @NotNull Collection<EvaluatedPolicyRuleType> ruleBeans, @NotNull @NotNull PolicyRuleExternalizationOptions options, @Nullable @Nullable Predicate<EvaluatedPolicyRuleTrigger<?>> triggerSelector, @Nullable @Nullable EvaluatedAssignment newOwner)
Honors "final" but not "hidden" flag.- Specified by:
addToEvaluatedPolicyRuleBeans
in interfaceAssociatedPolicyRule
- 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.
-
addToEvaluatedPolicyRuleBeansInternal
public void addToEvaluatedPolicyRuleBeansInternal(@NotNull @NotNull Collection<EvaluatedPolicyRuleType> ruleBeans, @NotNull @NotNull PolicyRuleExternalizationOptions options, @Nullable @Nullable Predicate<EvaluatedPolicyRuleTrigger<?>> triggerSelector, @Nullable @Nullable EvaluatedAssignment newOwner)
-
getEnabledActions
@NotNull public @NotNull List<PolicyActionType> getEnabledActions()
- Specified by:
getEnabledActions
in interfaceEvaluatedPolicyRule
-
containsEnabledAction
public boolean containsEnabledAction()
- Specified by:
containsEnabledAction
in interfaceEvaluatedPolicyRule
-
containsEnabledAction
public boolean containsEnabledAction(Class<? extends PolicyActionType> type)
Description copied from interface:AssociatedPolicyRule
Are there any enabled actions of given type?- Specified by:
containsEnabledAction
in interfaceAssociatedPolicyRule
-
getEnabledActions
@NotNull public <T extends PolicyActionType> @NotNull List<T> getEnabledActions(Class<T> type)
Description copied from interface:AssociatedPolicyRule
Returns all enabled actions of given type.- Specified by:
getEnabledActions
in interfaceAssociatedPolicyRule
-
getEnabledAction
public <T extends PolicyActionType> T getEnabledAction(Class<T> type)
Description copied from interface:AssociatedPolicyRule
Returns enabled action of given type, if there's any. Throws an exception if there are more of them.- Specified by:
getEnabledAction
in interfaceAssociatedPolicyRule
-
computeEnabledActions
public void computeEnabledActions(@Nullable @Nullable PolicyRuleEvaluationContext<?> rctx, PrismObject<?> object, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException
-
getPolicyRuleIdentifier
@NotNull public @NotNull String getPolicyRuleIdentifier()
Description copied from interface:AssociatedPolicyRule
Automatically generated identifier that - we hope - uniquely identifies the policy rule.- Specified by:
getPolicyRuleIdentifier
in interfaceAssociatedPolicyRule
-
getCount
public int getCount()
- Specified by:
getCount
in interfaceEvaluatedPolicyRule
-
setCount
public void setCount(int value)
- Specified by:
setCount
in interfaceEvaluatedPolicyRule
-
isOverThreshold
public boolean isOverThreshold() throws ConfigurationException
- Specified by:
isOverThreshold
in interfaceEvaluatedPolicyRule
- Throws:
ConfigurationException
-
hasSituationConstraint
public boolean hasSituationConstraint()
- Specified by:
hasSituationConstraint
in interfaceEvaluatedPolicyRule
-
getTargetType
@NotNull public EvaluatedPolicyRule.TargetType getTargetType()
Description copied from interface:EvaluatedPolicyRule
To which object is the policy rule targeted and how.- Specified by:
getTargetType
in interfaceEvaluatedPolicyRule
-
registerAsForeignRuleIfNeeded
public void registerAsForeignRuleIfNeeded()
-
getNewOwner
@Nullable public @Nullable EvaluatedAssignment getNewOwner()
Description copied from interface:AssociatedPolicyRule
Returns new owner (for foreign rules) or `null` (for original ones).- Specified by:
getNewOwner
in interfaceAssociatedPolicyRule
-
getEvaluatedPolicyRule
@NotNull public @NotNull EvaluatedPolicyRule getEvaluatedPolicyRule()
Description copied from interface:AssociatedPolicyRule
Returns the original policy rule.- Specified by:
getEvaluatedPolicyRule
in interfaceAssociatedPolicyRule
-
-