Search in sources :

Example 1 with HumanTask

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

the class HumanTaskImpl method registerType.

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

        public HumanTask newInstance(ModelTypeInstanceContext instanceContext) {
            return new HumanTaskImpl(instanceContext);
        }
    });
    performerRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_PERFORMER_REF).idAttributeReference(Role.class).build();
    /**
     * camunda extensions
     */
    camundaAssigneeAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_ASSIGNEE).namespace(CAMUNDA_NS).build();
    camundaCandidateGroupsAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CANDIDATE_GROUPS).namespace(CAMUNDA_NS).build();
    camundaCandidateUsersAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CANDIDATE_USERS).namespace(CAMUNDA_NS).build();
    camundaDueDateAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DUE_DATE).namespace(CAMUNDA_NS).build();
    camundaFollowUpDateAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_FOLLOW_UP_DATE).namespace(CAMUNDA_NS).build();
    camundaFormKeyAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_FORM_KEY).namespace(CAMUNDA_NS).build();
    camundaPriorityAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_PRIORITY).namespace(CAMUNDA_NS).build();
    SequenceBuilder sequenceBuilder = typeBuilder.sequence();
    planningTableCollection = sequenceBuilder.elementCollection(PlanningTable.class).build();
    planningTableChild = sequenceBuilder.element(PlanningTable.class).minOccurs(0).maxOccurs(1).build();
    typeBuilder.build();
}
Also used : HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) Task(org.camunda.bpm.model.cmmn.instance.Task) SequenceBuilder(org.camunda.bpm.model.xml.type.child.SequenceBuilder) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Example 2 with HumanTask

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

the class CreateModelTest method createCaseWithOneHumanTask.

@Test
public void createCaseWithOneHumanTask() {
    // create process
    Case caseInstance = createElement(definitions, "case-with-one-human-task", Case.class);
    // create case plan model
    CasePlanModel casePlanModel = createElement(caseInstance, "casePlanModel_1", CasePlanModel.class);
    // create elements
    HumanTask humanTask = createElement(casePlanModel, "HumanTask_1", HumanTask.class);
    // create a plan item
    PlanItem planItem = createElement(casePlanModel, "PlanItem_1", PlanItem.class);
    // set definition to human task
    planItem.setDefinition(humanTask);
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) PlanItem(org.camunda.bpm.model.cmmn.instance.PlanItem) Case(org.camunda.bpm.model.cmmn.instance.Case) Test(org.junit.Test)

Example 3 with HumanTask

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

the class GenerateIdTest method shouldNotGenerateIdsOnRead.

@Test
public void shouldNotGenerateIdsOnRead() {
    CmmnModelInstance modelInstance = Cmmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.cmmn"));
    Definitions definitions = modelInstance.getDefinitions();
    assertThat(definitions.getId()).isNull();
    Case caseElement = modelInstance.getModelElementsByType(Case.class).iterator().next();
    assertThat(caseElement.getId()).isNull();
    CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
    assertThat(casePlanModel.getId()).isNull();
    HumanTask humanTask = modelInstance.getModelElementsByType(HumanTask.class).iterator().next();
    assertThat(humanTask.getId()).isNull();
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) Case(org.camunda.bpm.model.cmmn.instance.Case) Test(org.junit.Test)

Example 4 with HumanTask

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

the class Cmmn10Test method shouldGetTaskInputsOutputs.

@Test
public void shouldGetTaskInputsOutputs() {
    CmmnModelInstance modelInstance = getCmmnModelInstance();
    HumanTask humanTask = modelInstance.getModelElementsByType(HumanTask.class).iterator().next();
    Collection<InputsCaseParameter> inputs = humanTask.getInputs();
    assertThat(inputs).hasSize(1);
    Collection<InputCaseParameter> inputParameters = humanTask.getInputParameters();
    assertThat(inputParameters).isEmpty();
    Collection<OutputsCaseParameter> outputs = humanTask.getOutputs();
    assertThat(outputs).hasSize(1);
    Collection<OutputCaseParameter> outputParameters = humanTask.getOutputParameters();
    assertThat(outputParameters).isEmpty();
}
Also used : InputCaseParameter(org.camunda.bpm.model.cmmn.instance.InputCaseParameter) OutputsCaseParameter(org.camunda.bpm.model.cmmn.instance.OutputsCaseParameter) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) OutputCaseParameter(org.camunda.bpm.model.cmmn.instance.OutputCaseParameter) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) InputsCaseParameter(org.camunda.bpm.model.cmmn.instance.InputsCaseParameter) Test(org.junit.Test)

Example 5 with HumanTask

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

the class HumanTaskItemHandler method initializeTaskDefinitionName.

protected void initializeTaskDefinitionName(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) {
    String name = getName(element);
    if (name == null) {
        HumanTask definition = getDefinition(element);
        name = definition.getName();
    }
    if (name != null) {
        ExpressionManager expressionManager = context.getExpressionManager();
        Expression nameExpression = expressionManager.createExpression(name);
        taskDefinition.setNameExpression(nameExpression);
    }
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) Expression(org.camunda.bpm.engine.delegate.Expression) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask)

Aggregations

HumanTask (org.camunda.bpm.model.cmmn.instance.HumanTask)20 Test (org.junit.Test)9 Expression (org.camunda.bpm.engine.delegate.Expression)8 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)8 CasePlanModel (org.camunda.bpm.model.cmmn.instance.CasePlanModel)5 PlanItem (org.camunda.bpm.model.cmmn.instance.PlanItem)5 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)4 Case (org.camunda.bpm.model.cmmn.instance.Case)4 Stage (org.camunda.bpm.model.cmmn.instance.Stage)4 CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)3 CmmnModelInstance (org.camunda.bpm.model.cmmn.CmmnModelInstance)2 Definitions (org.camunda.bpm.model.cmmn.instance.Definitions)2 Task (org.camunda.bpm.model.cmmn.instance.Task)2 Collection (java.util.Collection)1 TaskListener (org.camunda.bpm.engine.delegate.TaskListener)1 ItemHandler (org.camunda.bpm.engine.impl.cmmn.handler.ItemHandler)1 ClassDelegateTaskListener (org.camunda.bpm.engine.impl.task.listener.ClassDelegateTaskListener)1 DelegateExpressionTaskListener (org.camunda.bpm.engine.impl.task.listener.DelegateExpressionTaskListener)1 ExpressionTaskListener (org.camunda.bpm.engine.impl.task.listener.ExpressionTaskListener)1 ScriptTaskListener (org.camunda.bpm.engine.impl.task.listener.ScriptTaskListener)1