Search in sources :

Example 1 with AlwaysTruePolicyConstraintType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AlwaysTruePolicyConstraintType in project midpoint by Evolveum.

the class AlwaysTrueConstraintEvaluator method createBuiltInMessage.

@NotNull
private <AH extends AssignmentHolderType> LocalizableMessage createBuiltInMessage(String keyPrefix, JAXBElement<AlwaysTruePolicyConstraintType> constraintElement, PolicyRuleEvaluationContext<AH> ctx, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException {
    AlwaysTruePolicyConstraintType constraint = constraintElement.getValue();
    List<Object> args = new ArrayList<>();
    args.add(evaluatorHelper.createBeforeAfterMessage(ctx));
    String keySuffix;
    if (constraint.getName() != null) {
        args.add(constraint.getName());
        keySuffix = KEY_NAMED;
    } else {
        keySuffix = KEY_UNNAMED;
    }
    LocalizableMessage builtInMessage = new LocalizableMessageBuilder().key(keyPrefix + keySuffix).args(args).build();
    return evaluatorHelper.createLocalizableMessage(constraintElement, ctx, builtInMessage, result);
}
Also used : ArrayList(java.util.ArrayList) AlwaysTruePolicyConstraintType(com.evolveum.midpoint.xml.ns._public.common.common_3.AlwaysTruePolicyConstraintType) LocalizableMessage(com.evolveum.midpoint.util.LocalizableMessage) LocalizableMessageBuilder(com.evolveum.midpoint.util.LocalizableMessageBuilder) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

LocalizableMessage (com.evolveum.midpoint.util.LocalizableMessage)1 LocalizableMessageBuilder (com.evolveum.midpoint.util.LocalizableMessageBuilder)1 AlwaysTruePolicyConstraintType (com.evolveum.midpoint.xml.ns._public.common.common_3.AlwaysTruePolicyConstraintType)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1