/
EvaluatedPolicyRule.java
100 lines (71 loc) · 3.03 KB
/
EvaluatedPolicyRule.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
* Copyright (c) 2016-2017 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.model.api.context;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.function.Predicate;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.util.DebugDumpable;
import com.evolveum.midpoint.util.LocalizableMessage;
import com.evolveum.midpoint.util.TreeNode;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author semancik
*
*/
public interface EvaluatedPolicyRule extends DebugDumpable, Serializable, Cloneable {
@NotNull
Collection<EvaluatedPolicyRuleTrigger<?>> getTriggers();
default boolean isTriggered() {
return !getTriggers().isEmpty();
}
/**
* Returns all triggers, even those that were indirectly collected via situation policy rules.
*/
@NotNull
Collection<EvaluatedPolicyRuleTrigger<?>> getAllTriggers();
/**
* 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.
*/
<T extends EvaluatedPolicyRuleTrigger<?>> Collection<T> getAllTriggers(Class<T> type);
String getName();
PolicyRuleType getPolicyRule();
PolicyConstraintsType getPolicyConstraints();
PolicyThresholdType getPolicyThreshold();
// returns statically defined actions; consider using getEnabledActions() instead
PolicyActionsType getActions();
AssignmentPath getAssignmentPath();
/**
* Object that "directly owns" the rule. TODO. [consider if really needed]
*/
@Nullable
ObjectType getDirectOwner();
// TODO consider removing
String getPolicySituation();
Collection<PolicyExceptionType> getPolicyExceptions();
void addToEvaluatedPolicyRuleTypes(Collection<EvaluatedPolicyRuleType> rules, PolicyRuleExternalizationOptions options,
Predicate<EvaluatedPolicyRuleTrigger<?>> triggerSelector, PrismContext prismContext);
boolean isGlobal();
String toShortString();
List<TreeNode<LocalizableMessage>> extractMessages();
List<TreeNode<LocalizableMessage>> extractShortMessages();
// BEWARE: enabled actions can be queried only after computeEnabledActions has been called
// todo think again about this
boolean containsEnabledAction();
boolean containsEnabledAction(Class<? extends PolicyActionType> clazz);
Collection<PolicyActionType> getEnabledActions();
<T extends PolicyActionType> List<T> getEnabledActions(Class<T> clazz);
<T extends PolicyActionType> T getEnabledAction(Class<T> clazz);
// use only if you know what you're doing
void addTrigger(@NotNull EvaluatedPolicyRuleTrigger<?> trigger);
//experimental
String getPolicyRuleIdentifier();
}