Search in sources :

Example 1 with DecisionTask

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

the class DecisionTaskItemHandler method initializeDecisionTableResultMapper.

protected void initializeDecisionTableResultMapper(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
    DecisionTask decisionTask = getDefinition(element);
    DmnDecisionTaskActivityBehavior behavior = getActivityBehavior(activity);
    String mapper = decisionTask.getCamundaMapDecisionResult();
    DecisionResultMapper decisionResultMapper = getDecisionResultMapperForName(mapper);
    behavior.setDecisionTableResultMapper(decisionResultMapper);
}
Also used : DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) DecisionTask(org.camunda.bpm.model.cmmn.instance.DecisionTask) DecisionResultMapper(org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper)

Example 2 with DecisionTask

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

the class DecisionTaskItemHandler method getDefinitionKey.

protected String getDefinitionKey(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
    DecisionTask definition = getDefinition(element);
    String decision = definition.getDecision();
    if (decision == null) {
        DecisionRefExpression decisionExpression = definition.getDecisionExpression();
        if (decisionExpression != null) {
            decision = decisionExpression.getText();
        }
    }
    return decision;
}
Also used : DecisionTask(org.camunda.bpm.model.cmmn.instance.DecisionTask) DecisionRefExpression(org.camunda.bpm.model.cmmn.instance.DecisionRefExpression)

Example 3 with DecisionTask

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

the class DecisionTaskItemHandler method initializeResultVariable.

protected void initializeResultVariable(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
    DecisionTask decisionTask = getDefinition(element);
    DmnDecisionTaskActivityBehavior behavior = getActivityBehavior(activity);
    String resultVariable = decisionTask.getCamundaResultVariable();
    behavior.setResultVariable(resultVariable);
}
Also used : DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) DecisionTask(org.camunda.bpm.model.cmmn.instance.DecisionTask)

Example 4 with DecisionTask

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

the class CmmnTransform method transformPlanItem.

protected void transformPlanItem(PlanItem planItem, CmmnActivity parent) {
    PlanItemDefinition definition = planItem.getDefinition();
    ItemHandler planItemTransformer = null;
    if (definition instanceof HumanTask) {
        planItemTransformer = getPlanItemHandler(HumanTask.class);
    } else if (definition instanceof ProcessTask) {
        planItemTransformer = getPlanItemHandler(ProcessTask.class);
    } else if (definition instanceof CaseTask) {
        planItemTransformer = getPlanItemHandler(CaseTask.class);
    } else if (definition instanceof DecisionTask) {
        planItemTransformer = getPlanItemHandler(DecisionTask.class);
    } else if (definition instanceof Task) {
        planItemTransformer = getPlanItemHandler(Task.class);
    } else if (definition instanceof Stage) {
        planItemTransformer = getPlanItemHandler(Stage.class);
    } else if (definition instanceof Milestone) {
        planItemTransformer = getPlanItemHandler(Milestone.class);
    } else if (definition instanceof EventListener) {
        planItemTransformer = getPlanItemHandler(EventListener.class);
    }
    if (planItemTransformer != null) {
        CmmnActivity newActivity = planItemTransformer.handleElement(planItem, context);
        if (definition instanceof Stage) {
            Stage stage = (Stage) definition;
            transformStage(stage, newActivity);
            context.setParent(parent);
        } else if (definition instanceof HumanTask) {
            HumanTask humanTask = (HumanTask) definition;
            // According to the specification: A HumanTask can only contain
            // one planningTable, the XSD allows multiple planningTables!
            Collection<PlanningTable> planningTables = humanTask.getPlanningTables();
            for (PlanningTable planningTable : planningTables) {
                transformPlanningTable(planningTable, parent);
            }
        }
        for (CmmnTransformListener transformListener : transformListeners) {
            if (definition instanceof HumanTask) {
                transformListener.transformHumanTask(planItem, (HumanTask) definition, newActivity);
            } else if (definition instanceof ProcessTask) {
                transformListener.transformProcessTask(planItem, (ProcessTask) definition, newActivity);
            } else if (definition instanceof CaseTask) {
                transformListener.transformCaseTask(planItem, (CaseTask) definition, newActivity);
            } else if (definition instanceof DecisionTask) {
                transformListener.transformDecisionTask(planItem, (DecisionTask) definition, newActivity);
            } else if (definition instanceof Task) {
                transformListener.transformTask(planItem, (Task) definition, newActivity);
            } else if (definition instanceof Stage) {
                transformListener.transformStage(planItem, (Stage) definition, newActivity);
            } else if (definition instanceof Milestone) {
                transformListener.transformMilestone(planItem, (Milestone) definition, newActivity);
            } else if (definition instanceof EventListener) {
                transformListener.transformEventListener(planItem, (EventListener) definition, newActivity);
            }
        }
    }
}
Also used : HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) CaseTask(org.camunda.bpm.model.cmmn.instance.CaseTask) Task(org.camunda.bpm.model.cmmn.instance.Task) ProcessTask(org.camunda.bpm.model.cmmn.instance.ProcessTask) DecisionTask(org.camunda.bpm.model.cmmn.instance.DecisionTask) Milestone(org.camunda.bpm.model.cmmn.instance.Milestone) CaseTask(org.camunda.bpm.model.cmmn.instance.CaseTask) PlanningTable(org.camunda.bpm.model.cmmn.instance.PlanningTable) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) ProcessTask(org.camunda.bpm.model.cmmn.instance.ProcessTask) PlanItemDefinition(org.camunda.bpm.model.cmmn.instance.PlanItemDefinition) ItemHandler(org.camunda.bpm.engine.impl.cmmn.handler.ItemHandler) DecisionTask(org.camunda.bpm.model.cmmn.instance.DecisionTask) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) Stage(org.camunda.bpm.model.cmmn.instance.Stage) Collection(java.util.Collection) EventListener(org.camunda.bpm.model.cmmn.instance.EventListener)

Example 5 with DecisionTask

use of org.camunda.bpm.model.cmmn.instance.DecisionTask in project camunda-cmmn-model by camunda.

the class DecisionTaskImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionTask.class, CMMN_ELEMENT_DECISION_TASK).namespaceUri(CMMN11_NS).extendsType(Task.class).instanceProvider(new ModelTypeInstanceProvider<DecisionTask>() {

        public DecisionTask newInstance(ModelTypeInstanceContext instanceContext) {
            return new DecisionTaskImpl(instanceContext);
        }
    });
    decisionRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_DECISION_REF).build();
    /**
     * Camunda extensions
     */
    camundaResultVariableAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_RESULT_VARIABLE).namespace(CAMUNDA_NS).build();
    camundaDecisionBindingAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DECISION_BINDING).namespace(CAMUNDA_NS).build();
    camundaDecisionVersionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DECISION_VERSION).namespace(CAMUNDA_NS).build();
    camundaDecisionTenantIdAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DECISION_TENANT_ID).namespace(CAMUNDA_NS).build();
    camundaMapDecisionResultAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_MAP_DECISION_RESULT).namespace(CAMUNDA_NS).build();
    SequenceBuilder sequenceBuilder = typeBuilder.sequence();
    parameterMappingCollection = sequenceBuilder.elementCollection(ParameterMapping.class).build();
    decisionRefExpressionChild = sequenceBuilder.element(DecisionRefExpression.class).build();
    typeBuilder.build();
}
Also used : DecisionTask(org.camunda.bpm.model.cmmn.instance.DecisionTask) Task(org.camunda.bpm.model.cmmn.instance.Task) DecisionTask(org.camunda.bpm.model.cmmn.instance.DecisionTask) SequenceBuilder(org.camunda.bpm.model.xml.type.child.SequenceBuilder) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Aggregations

DecisionTask (org.camunda.bpm.model.cmmn.instance.DecisionTask)5 DmnDecisionTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior)2 Task (org.camunda.bpm.model.cmmn.instance.Task)2 Collection (java.util.Collection)1 ItemHandler (org.camunda.bpm.engine.impl.cmmn.handler.ItemHandler)1 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)1 DecisionResultMapper (org.camunda.bpm.engine.impl.dmn.result.DecisionResultMapper)1 CaseTask (org.camunda.bpm.model.cmmn.instance.CaseTask)1 DecisionRefExpression (org.camunda.bpm.model.cmmn.instance.DecisionRefExpression)1 EventListener (org.camunda.bpm.model.cmmn.instance.EventListener)1 HumanTask (org.camunda.bpm.model.cmmn.instance.HumanTask)1 Milestone (org.camunda.bpm.model.cmmn.instance.Milestone)1 PlanItemDefinition (org.camunda.bpm.model.cmmn.instance.PlanItemDefinition)1 PlanningTable (org.camunda.bpm.model.cmmn.instance.PlanningTable)1 ProcessTask (org.camunda.bpm.model.cmmn.instance.ProcessTask)1 Stage (org.camunda.bpm.model.cmmn.instance.Stage)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1 SequenceBuilder (org.camunda.bpm.model.xml.type.child.SequenceBuilder)1