Search in sources :

Example 6 with PlanItemDefinition

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

the class ItemHandler method initializeActivity.

protected void initializeActivity(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
    if (isDiscretionaryItem(element)) {
        activity.setProperty(PROPERTY_DISCRETIONARY, true);
    }
    String name = getName(element);
    if (name == null) {
        PlanItemDefinition definition = getDefinition(element);
        if (definition != null) {
            name = definition.getName();
        }
    }
    activity.setName(name);
    // activityType
    initializeActivityType(element, activity, context);
    // description
    initializeDescription(element, activity, context);
    // autoComplete
    initializeAutoComplete(element, activity, context);
    // requiredRule
    initializeRequiredRule(element, activity, context);
    // manualActivation
    initializeManualActivationRule(element, activity, context);
    // repetitionRule
    initializeRepetitionRule(element, activity, context);
    // case execution listeners
    initializeCaseExecutionListeners(element, activity, context);
    // variable listeners
    initializeVariableListeners(element, activity, context);
    // initialize entry criteria
    initializeEntryCriterias(element, activity, context);
    // initialize exit criteria
    initializeExitCriterias(element, activity, context);
}
Also used : PlanItemDefinition(org.camunda.bpm.model.cmmn.instance.PlanItemDefinition) CamundaString(org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)

Example 7 with PlanItemDefinition

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

the class ItemHandler method initializeActivityType.

protected void initializeActivityType(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
    PlanItemDefinition definition = getDefinition(element);
    String activityType = null;
    if (definition != null) {
        ModelElementType elementType = definition.getElementType();
        if (elementType != null) {
            activityType = elementType.getTypeName();
        }
    }
    activity.setProperty(PROPERTY_ACTIVITY_TYPE, activityType);
}
Also used : ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType) PlanItemDefinition(org.camunda.bpm.model.cmmn.instance.PlanItemDefinition) CamundaString(org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)

Example 8 with PlanItemDefinition

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

the class ItemHandler method getName.

protected String getName(CmmnElement element) {
    String name = null;
    if (isPlanItem(element)) {
        PlanItem planItem = (PlanItem) element;
        name = planItem.getName();
    }
    if (name == null || name.isEmpty()) {
        PlanItemDefinition definition = getDefinition(element);
        if (definition != null) {
            name = definition.getName();
        }
    }
    return name;
}
Also used : PlanItemDefinition(org.camunda.bpm.model.cmmn.instance.PlanItemDefinition) PlanItem(org.camunda.bpm.model.cmmn.instance.PlanItem) CamundaString(org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)

Example 9 with PlanItemDefinition

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

the class StageItemHandler method initializeAutoComplete.

protected void initializeAutoComplete(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
    PlanItemDefinition definition = getDefinition(element);
    if (definition instanceof Stage) {
        Stage stage = (Stage) definition;
        activity.setProperty(PROPERTY_AUTO_COMPLETE, stage.isAutoComplete());
    }
}
Also used : PlanItemDefinition(org.camunda.bpm.model.cmmn.instance.PlanItemDefinition) Stage(org.camunda.bpm.model.cmmn.instance.Stage)

Example 10 with PlanItemDefinition

use of org.camunda.bpm.model.cmmn.instance.PlanItemDefinition 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)

Aggregations

PlanItemDefinition (org.camunda.bpm.model.cmmn.instance.PlanItemDefinition)10 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)7 PlanItem (org.camunda.bpm.model.cmmn.instance.PlanItem)2 Stage (org.camunda.bpm.model.cmmn.instance.Stage)2 Collection (java.util.Collection)1 CaseExecutionListener (org.camunda.bpm.engine.delegate.CaseExecutionListener)1 CaseVariableListener (org.camunda.bpm.engine.delegate.CaseVariableListener)1 ItemHandler (org.camunda.bpm.engine.impl.cmmn.handler.ItemHandler)1 ClassDelegateCaseExecutionListener (org.camunda.bpm.engine.impl.cmmn.listener.ClassDelegateCaseExecutionListener)1 DelegateExpressionCaseExecutionListener (org.camunda.bpm.engine.impl.cmmn.listener.DelegateExpressionCaseExecutionListener)1 ExpressionCaseExecutionListener (org.camunda.bpm.engine.impl.cmmn.listener.ExpressionCaseExecutionListener)1 ScriptCaseExecutionListener (org.camunda.bpm.engine.impl.cmmn.listener.ScriptCaseExecutionListener)1 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)1 ClassDelegateCaseVariableListener (org.camunda.bpm.engine.impl.variable.listener.ClassDelegateCaseVariableListener)1 DelegateExpressionCaseVariableListener (org.camunda.bpm.engine.impl.variable.listener.DelegateExpressionCaseVariableListener)1 ExpressionCaseVariableListener (org.camunda.bpm.engine.impl.variable.listener.ExpressionCaseVariableListener)1 ScriptCaseVariableListener (org.camunda.bpm.engine.impl.variable.listener.ScriptCaseVariableListener)1 Case (org.camunda.bpm.model.cmmn.instance.Case)1 CasePlanModel (org.camunda.bpm.model.cmmn.instance.CasePlanModel)1 CaseTask (org.camunda.bpm.model.cmmn.instance.CaseTask)1