Search in sources :

Example 1 with CaseRole

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

the class Cmmn10Test method shouldGetCaseRoles.

@Test
public void shouldGetCaseRoles() {
    CmmnModelInstance modelInstance = getCmmnModelInstance();
    Case _case = modelInstance.getModelElementsByType(Case.class).iterator().next();
    Collection<CaseRole> roles = _case.getCaseRoles();
    assertThat(roles).hasSize(2);
    CaseRoles caseRole = _case.getRoles();
    assertThat(caseRole).isNull();
}
Also used : CaseRoles(org.camunda.bpm.model.cmmn.instance.CaseRoles) CaseRole(org.camunda.bpm.model.cmmn.instance.CaseRole) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) Case(org.camunda.bpm.model.cmmn.instance.Case) Test(org.junit.Test)

Example 2 with CaseRole

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

the class HumanTaskPlanItemHandlerTest method testTaskDefinitionPeformerExpression.

@Test
public void testTaskDefinitionPeformerExpression() {
    // given
    CaseRole role = createElement(caseDefinition, "aRole", CaseRole.class);
    role.setName("aPerformerRole");
    humanTask.setPerformer(role);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
    TaskDefinition taskDefinition = behavior.getTaskDefinition();
    Expression assigneeExpression = taskDefinition.getAssigneeExpression();
    assertNotNull(assigneeExpression);
    assertEquals("aPerformerRole", assigneeExpression.getExpressionText());
}
Also used : TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) Expression(org.camunda.bpm.engine.delegate.Expression) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) CaseRole(org.camunda.bpm.model.cmmn.instance.CaseRole) HumanTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 3 with CaseRole

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

the class CaseRoleImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CaseRole.class, CMMN_ELEMENT_CASE_ROLES).namespaceUri(CMMN10_NS).extendsType(Role.class).instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider<CaseRole>() {

        public CaseRole newInstance(ModelTypeInstanceContext instanceContext) {
            return new CaseRoleImpl(instanceContext);
        }
    });
    typeBuilder.build();
}
Also used : CaseRole(org.camunda.bpm.model.cmmn.instance.CaseRole) Role(org.camunda.bpm.model.cmmn.instance.Role) CaseRole(org.camunda.bpm.model.cmmn.instance.CaseRole) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Aggregations

CaseRole (org.camunda.bpm.model.cmmn.instance.CaseRole)3 Test (org.junit.Test)2 Expression (org.camunda.bpm.engine.delegate.Expression)1 HumanTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior)1 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)1 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)1 CmmnModelInstance (org.camunda.bpm.model.cmmn.CmmnModelInstance)1 Case (org.camunda.bpm.model.cmmn.instance.Case)1 CaseRoles (org.camunda.bpm.model.cmmn.instance.CaseRoles)1 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)1 Role (org.camunda.bpm.model.cmmn.instance.Role)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1