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:
-
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
ConstructorDescriptionEvaluatedPolicyRuleImpl
(@NotNull AbstractPolicyRuleConfigItem<?> policyRuleCI, @NotNull String ruleId, @Nullable AssignmentPath assignmentPath, @NotNull EvaluatedPolicyRule.TargetType targetType) EvaluatedPolicyRuleImpl
(@NotNull AbstractPolicyRuleConfigItem<?> policyRuleCI, @NotNull String ruleId, @Nullable AssignmentPath assignmentPath, @Nullable EvaluatedAssignmentImpl<?> evaluatedAssignment, @NotNull EvaluatedPolicyRule.TargetType targetType) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.clone()
void
computeEnabledActions
(@Nullable PolicyRuleEvaluationContext<?> rctx, PrismObject<?> object, Task task, OperationResult result) Call only after "triggered" status was determined.boolean
boolean
containsEnabledAction
(Class<? extends PolicyActionType> type) Are there any enabled actions of given type?debugDump
(int indent) boolean
@NotNull Collection<EvaluatedPolicyRuleTrigger<?>>
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
@NotNull AssignmentPath
int
getCount()
<T extends PolicyActionType>
PolicyActionConfigItem<T>getEnabledAction
(Class<T> type) Returns enabled action of given type, if there's any.@NotNull List<? extends PolicyActionConfigItem<?>>
Returns all enabled actions.<T extends PolicyActionType>
@NotNull List<? extends PolicyActionConfigItem<T>>getEnabledActions
(Class<T> type) Returns all enabled actions of given type.@Nullable EvaluatedAssignmentImpl<?>
Evaluated assignment that brought this policy rule to the focus or target.@NotNull EvaluatedPolicyRule
Returns the original policy rule.getName()
Name of the policy rule, as configured.@Nullable EvaluatedAssignment
Returns new owner (for foreign rules) or `null` (for original ones).@NotNull List<ObjectReferenceType>
@NotNull PolicyRuleType
@NotNull String
Automatically generated identifier that - we hope - uniquely identifies the policy rule.@Nullable String
Returns the policy situation connected to this rule.@NotNull Collection<EvaluatedExclusionTrigger>
Returns exclusion triggers without ones that are not relevant for given "new owner" (see class javadoc).@NotNull ConfigurationItemOrigin
To which object is the policy rule targeted and how.@NotNull Collection<EvaluatedPolicyRuleTrigger<?>>
int
hashCode()
boolean
boolean
TODOboolean
isGlobal()
boolean
boolean
Was this rule triggered, i.e.void
void
setCount
(int value) void
Returns short, (more or less) user-level characterization of this object.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 Details
-
EvaluatedPolicyRuleImpl
public EvaluatedPolicyRuleImpl(@NotNull @NotNull AbstractPolicyRuleConfigItem<?> policyRuleCI, @NotNull @NotNull String ruleId, @Nullable @Nullable AssignmentPath assignmentPath, @NotNull @NotNull EvaluatedPolicyRule.TargetType targetType) -
EvaluatedPolicyRuleImpl
public EvaluatedPolicyRuleImpl(@NotNull @NotNull AbstractPolicyRuleConfigItem<?> policyRuleCI, @NotNull @NotNull String ruleId, @Nullable @Nullable AssignmentPath assignmentPath, @Nullable @Nullable EvaluatedAssignmentImpl<?> evaluatedAssignment, @NotNull @NotNull EvaluatedPolicyRule.TargetType targetType)
-
-
Method Details
-
clone
-
getName
Description copied from interface:EvaluatedPolicyRule
Name of the policy rule, as configured.- Specified by:
getName
in interfaceEvaluatedPolicyRule
-
getPolicyRule
- Specified by:
getPolicyRule
in interfaceEvaluatedPolicyRule
-
getRuleOrigin
-
getAssignmentPath
- Specified by:
getAssignmentPath
in interfaceEvaluatedPolicyRule
-
getAssignmentPathRequired
-
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
- Specified by:
getPolicyConstraints
in interfaceEvaluatedPolicyRule
-
getPolicyThreshold
- Specified by:
getPolicyThreshold
in interfaceEvaluatedPolicyRule
-
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
Description copied from interface:EvaluatedPolicyRule
Returns all triggers, even those that were indirectly collected via situation policy rules.- Specified by:
getAllTriggers
in interfaceEvaluatedPolicyRule
-
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
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
-
addTrigger
Description copied from interface:AssociatedPolicyRule
Adds a trigger to the policy rule. For internal use only.- Specified by:
addTrigger
in interfaceAssociatedPolicyRule
-
getActions
- Specified by:
getActions
in interfaceEvaluatedPolicyRule
-
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
-
getPolicyMarkRef
- Specified by:
getPolicyMarkRef
in interfaceAssociatedPolicyRule
-
debugDump
- Specified by:
debugDump
in interfaceDebugDumpable
-
equals
-
hashCode
public int hashCode() -
toString
-
isGlobal
public boolean isGlobal()- Specified by:
isGlobal
in interfaceEvaluatedPolicyRule
-
toShortString
Description copied from interface:AssociatedPolicyRule
Returns short, (more or less) user-level characterization of this object.- Specified by:
toShortString
in interfaceAssociatedPolicyRule
-
extractMessages
- Specified by:
extractMessages
in interfaceEvaluatedPolicyRule
-
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
Description copied from interface:EvaluatedPolicyRule
Returns all enabled actions. Fails if they were not computed yet.- Specified by:
getEnabledActions
in interfaceEvaluatedPolicyRule
-
containsEnabledAction
public boolean containsEnabledAction()- Specified by:
containsEnabledAction
in interfaceEvaluatedPolicyRule
-
containsEnabledAction
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<? extends PolicyActionConfigItem<T>> getEnabledActions(Class<T> type) Description copied from interface:AssociatedPolicyRule
Returns all enabled actions of given type.- Specified by:
getEnabledActions
in interfaceAssociatedPolicyRule
-
getEnabledAction
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 Call only after "triggered" status was determined. -
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
- Specified by:
isOverThreshold
in interfaceEvaluatedPolicyRule
- Throws:
ConfigurationException
-
hasSituationConstraint
public boolean hasSituationConstraint()- Specified by:
hasSituationConstraint
in interfaceEvaluatedPolicyRule
-
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
Description copied from interface:AssociatedPolicyRule
Returns new owner (for foreign rules) or `null` (for original ones).- Specified by:
getNewOwner
in interfaceAssociatedPolicyRule
-
getEvaluatedPolicyRule
Description copied from interface:AssociatedPolicyRule
Returns the original policy rule.- Specified by:
getEvaluatedPolicyRule
in interfaceAssociatedPolicyRule
-
setEvaluated
public void setEvaluated() -
isEvaluated
public boolean isEvaluated()Description copied from interface:AssociatedPolicyRule
TODO- Specified by:
isEvaluated
in interfaceAssociatedPolicyRule
-