use of com.evolveum.midpoint.model.impl.lens.projector.policy.PolicyRuleEvaluationContext in project midpoint by Evolveum.
the class PolicySituationConstraintEvaluator method createMessage.
private LocalizableMessage createMessage(Collection<EvaluatedPolicyRule> sourceRules, JAXBElement<PolicySituationPolicyConstraintType> constraintElement, PolicyRuleEvaluationContext<?> ctx, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException {
// determine if there's a single message that could be retrieved
List<TreeNode<LocalizableMessage>> messageTrees = sourceRules.stream().flatMap(r -> r.extractMessages().stream()).collect(Collectors.toList());
LocalizableMessage builtInMessage;
if (messageTrees.size() == 1) {
builtInMessage = messageTrees.get(0).getUserObject();
} else {
builtInMessage = new LocalizableMessageBuilder().key(SchemaConstants.DEFAULT_POLICY_CONSTRAINT_KEY_PREFIX + CONSTRAINT_KEY).build();
}
return evaluatorHelper.createLocalizableMessage(constraintElement, ctx, builtInMessage, result);
}
use of com.evolveum.midpoint.model.impl.lens.projector.policy.PolicyRuleEvaluationContext in project midpoint by Evolveum.
the class PolicySituationConstraintEvaluator method createShortMessage.
private LocalizableMessage createShortMessage(Collection<EvaluatedPolicyRule> sourceRules, JAXBElement<PolicySituationPolicyConstraintType> constraintElement, PolicyRuleEvaluationContext<?> ctx, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException {
// determine if there's a single message that could be retrieved
List<TreeNode<LocalizableMessage>> messageTrees = sourceRules.stream().flatMap(r -> r.extractShortMessages().stream()).collect(Collectors.toList());
LocalizableMessage builtInMessage;
if (messageTrees.size() == 1) {
builtInMessage = messageTrees.get(0).getUserObject();
} else {
builtInMessage = new LocalizableMessageBuilder().key(SchemaConstants.DEFAULT_POLICY_CONSTRAINT_SHORT_MESSAGE_KEY_PREFIX + CONSTRAINT_KEY).build();
}
return evaluatorHelper.createLocalizableShortMessage(constraintElement, ctx, builtInMessage, result);
}
Aggregations