Search in sources :

Example 11 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.

the class PlanItemDefinitionActivityBehavior method repeat.

// repetition ///////////////////////////////////////////////////////////////
public void repeat(CmmnActivityExecution execution, String standardEvent) {
    CmmnActivity activity = execution.getActivity();
    boolean repeat = false;
    if (activity.getEntryCriteria().isEmpty()) {
        List<String> events = activity.getProperties().get(CmmnProperties.REPEAT_ON_STANDARD_EVENTS);
        if (events != null && events.contains(standardEvent)) {
            repeat = evaluateRepetitionRule(execution);
        }
    } else {
        if (ENABLE.equals(standardEvent) || START.equals(standardEvent) || OCCUR.equals(standardEvent)) {
            repeat = evaluateRepetitionRule(execution);
        }
    }
    if (repeat) {
        CmmnActivityExecution parent = execution.getParent();
        // instantiate a new instance of given activity
        List<CmmnExecution> children = parent.createChildExecutions(Arrays.asList(activity));
        // start the lifecycle of the new instance
        parent.triggerChildExecutionsLifecycle(children);
    }
}
Also used : CmmnActivityExecution(org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution) CmmnExecution(org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)

Example 12 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.

the class PlanItemDefinitionActivityBehavior method evaluateRequiredRule.

// rules (required and repetition rule) /////////////////////////////////////////
protected void evaluateRequiredRule(CmmnActivityExecution execution) {
    CmmnActivity activity = execution.getActivity();
    Object requiredRule = activity.getProperty(PROPERTY_REQUIRED_RULE);
    if (requiredRule != null) {
        CaseControlRule rule = (CaseControlRule) requiredRule;
        boolean required = rule.evaluate(execution);
        execution.setRequired(required);
    }
}
Also used : CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) CaseControlRule(org.camunda.bpm.engine.impl.cmmn.CaseControlRule)

Example 13 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.

the class StageOrTaskActivityBehavior method evaluateManualActivationRule.

// manual activation rule //////////////////////////////////////////////
protected boolean evaluateManualActivationRule(CmmnActivityExecution execution) {
    boolean manualActivation = false;
    CmmnActivity activity = execution.getActivity();
    Object manualActivationRule = activity.getProperty(PROPERTY_MANUAL_ACTIVATION_RULE);
    if (manualActivationRule != null) {
        CaseControlRule rule = (CaseControlRule) manualActivationRule;
        manualActivation = rule.evaluate(execution);
    }
    return manualActivation;
}
Also used : CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) CaseControlRule(org.camunda.bpm.engine.impl.cmmn.CaseControlRule)

Example 14 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.

the class StageActivityBehavior method evaluateAutoComplete.

protected boolean evaluateAutoComplete(CmmnActivityExecution execution) {
    CmmnActivity activity = getActivity(execution);
    Object autoCompleteProperty = activity.getProperty(PROPERTY_AUTO_COMPLETE);
    if (autoCompleteProperty != null) {
        String message = "Property autoComplete expression returns non-Boolean: " + autoCompleteProperty + " (" + autoCompleteProperty.getClass().getName() + ")";
        ensureInstanceOf(message, "autoComplete", autoCompleteProperty, Boolean.class);
        return (Boolean) autoCompleteProperty;
    }
    return false;
}
Also used : CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)

Example 15 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.

the class StageActivityBehavior method performStart.

// start /////////////////////////////////////////////////////////////////////
protected void performStart(CmmnActivityExecution execution) {
    CmmnActivity activity = execution.getActivity();
    List<CmmnActivity> childActivities = activity.getActivities();
    if (childActivities != null && !childActivities.isEmpty()) {
        List<CmmnExecution> children = execution.createChildExecutions(childActivities);
        execution.createSentryParts();
        execution.triggerChildExecutionsLifecycle(children);
        if (execution.isActive()) {
            execution.fireIfOnlySentryParts();
            // then the stage will be completed.
            if (execution.isActive()) {
                checkAndCompleteCaseExecution(execution);
            }
        }
    } else {
        execution.complete();
    }
}
Also used : CmmnExecution(org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)

Aggregations

CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)325 Test (org.junit.Test)298 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)112 PlanItemControl (org.camunda.bpm.model.cmmn.instance.PlanItemControl)64 CaseControlRule (org.camunda.bpm.engine.impl.cmmn.CaseControlRule)47 CmmnSentryDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration)47 ExtensionElements (org.camunda.bpm.model.cmmn.instance.ExtensionElements)39 Sentry (org.camunda.bpm.model.cmmn.instance.Sentry)39 IfPart (org.camunda.bpm.model.cmmn.instance.IfPart)37 CasePlanModelHandler (org.camunda.bpm.engine.impl.cmmn.handler.CasePlanModelHandler)36 SentryHandler (org.camunda.bpm.engine.impl.cmmn.handler.SentryHandler)35 CallableElement (org.camunda.bpm.engine.impl.core.model.CallableElement)34 ItemControl (org.camunda.bpm.model.cmmn.instance.ItemControl)32 HumanTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior)29 RepetitionRule (org.camunda.bpm.model.cmmn.instance.RepetitionRule)28 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)26 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)23 Body (org.camunda.bpm.model.cmmn.instance.Body)23 EntryCriterion (org.camunda.bpm.model.cmmn.instance.EntryCriterion)21 ExitCriterion (org.camunda.bpm.model.cmmn.instance.ExitCriterion)21