Search in sources :

Example 1 with EvaluatedTransitionTrigger

use of com.evolveum.midpoint.model.api.context.EvaluatedTransitionTrigger in project midpoint by Evolveum.

the class TransitionConstraintEvaluator method evaluate.

@Override
public <AH extends AssignmentHolderType> EvaluatedPolicyRuleTrigger evaluate(@NotNull JAXBElement<TransitionPolicyConstraintType> constraintElement, @NotNull PolicyRuleEvaluationContext<AH> rctx, OperationResult parentResult) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException {
    OperationResult result = parentResult.subresult(OP_EVALUATE).setMinor().build();
    try {
        TransitionPolicyConstraintType trans = constraintElement.getValue();
        List<EvaluatedPolicyRuleTrigger<?>> triggers = new ArrayList<>();
        boolean match = evaluateState(trans, rctx, ObjectState.BEFORE, trans.isStateBefore(), triggers, result) && evaluateState(trans, rctx, ObjectState.AFTER, trans.isStateAfter(), triggers, result);
        if (match) {
            return new EvaluatedTransitionTrigger(PolicyConstraintKindType.TRANSITION, trans, createMessage(constraintElement, rctx, result), createShortMessage(constraintElement, rctx, result), triggers);
        } else {
            return null;
        }
    } catch (Throwable t) {
        result.recordFatalError(t.getMessage(), t);
        throw t;
    } finally {
        result.computeStatusIfUnknown();
    }
}
Also used : TransitionPolicyConstraintType(com.evolveum.midpoint.xml.ns._public.common.common_3.TransitionPolicyConstraintType) EvaluatedPolicyRuleTrigger(com.evolveum.midpoint.model.api.context.EvaluatedPolicyRuleTrigger) EvaluatedTransitionTrigger(com.evolveum.midpoint.model.api.context.EvaluatedTransitionTrigger) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Aggregations

EvaluatedPolicyRuleTrigger (com.evolveum.midpoint.model.api.context.EvaluatedPolicyRuleTrigger)1 EvaluatedTransitionTrigger (com.evolveum.midpoint.model.api.context.EvaluatedTransitionTrigger)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 TransitionPolicyConstraintType (com.evolveum.midpoint.xml.ns._public.common.common_3.TransitionPolicyConstraintType)1 ArrayList (java.util.ArrayList)1