Search in sources :

Example 1 with VariableTransition

use of org.camunda.bpm.model.cmmn.VariableTransition in project camunda-bpm-platform by camunda.

the class SentryHandler method initializeVariableOnPart.

protected void initializeVariableOnPart(CamundaVariableOnPart variableOnPart, CmmnSentryDeclaration sentryDeclaration, CmmnHandlerContext context) {
    VariableTransition variableTransition;
    try {
        variableTransition = variableOnPart.getVariableEvent();
    } catch (IllegalArgumentException illegalArgumentexception) {
        throw LOG.nonMatchingVariableEvents(sentryDeclaration.getId());
    } catch (NullPointerException nullPointerException) {
        throw LOG.nonMatchingVariableEvents(sentryDeclaration.getId());
    }
    String variableName = variableOnPart.getVariableName();
    String variableEventName = variableTransition.name();
    if (variableName != null) {
        if (!sentryDeclaration.hasVariableOnPart(variableEventName, variableName)) {
            CmmnVariableOnPartDeclaration variableOnPartDeclaration = new CmmnVariableOnPartDeclaration();
            variableOnPartDeclaration.setVariableEvent(variableEventName);
            variableOnPartDeclaration.setVariableName(variableName);
            sentryDeclaration.addVariableOnParts(variableOnPartDeclaration);
        }
    } else {
        throw LOG.emptyVariableName(sentryDeclaration.getId());
    }
}
Also used : CmmnVariableOnPartDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnVariableOnPartDeclaration) VariableTransition(org.camunda.bpm.model.cmmn.VariableTransition)

Aggregations

CmmnVariableOnPartDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnVariableOnPartDeclaration)1 VariableTransition (org.camunda.bpm.model.cmmn.VariableTransition)1