Search in sources :

Example 11 with CaseDefinitionEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.

the class TaskEntity method getTaskDefinition.

public TaskDefinition getTaskDefinition() {
    if (taskDefinition == null && taskDefinitionKey != null) {
        Map<String, TaskDefinition> taskDefinitions = null;
        if (processDefinitionId != null) {
            ProcessDefinitionEntity processDefinition = Context.getProcessEngineConfiguration().getDeploymentCache().findDeployedProcessDefinitionById(processDefinitionId);
            taskDefinitions = processDefinition.getTaskDefinitions();
        } else {
            CaseDefinitionEntity caseDefinition = Context.getProcessEngineConfiguration().getDeploymentCache().findDeployedCaseDefinitionById(caseDefinitionId);
            taskDefinitions = caseDefinition.getTaskDefinitions();
        }
        taskDefinition = taskDefinitions.get(taskDefinitionKey);
    }
    return taskDefinition;
}
Also used : TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)

Example 12 with CaseDefinitionEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.

the class CaseHandlerTest method testHistoryTimeToLiveNull.

@Test
public void testHistoryTimeToLiveNull() {
    // given: a caseDefinition
    // when
    CaseDefinitionEntity activity = (CaseDefinitionEntity) handler.handleElement(caseDefinition, context);
    // then
    assertNull(activity.getHistoryTimeToLive());
}
Also used : CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) Test(org.junit.Test)

Example 13 with CaseDefinitionEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.

the class CaseHandlerTest method testDeploymentId.

@Test
public void testDeploymentId() {
    // given: a caseDefinition
    // when
    CaseDefinitionEntity activity = (CaseDefinitionEntity) handler.handleElement(caseDefinition, context);
    // then
    String deploymentId = context.getDeployment().getId();
    assertEquals(deploymentId, activity.getDeploymentId());
}
Also used : CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) Test(org.junit.Test)

Example 14 with CaseDefinitionEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.

the class CmmnElementHandlerTest method setup.

@Before
public void setup() {
    modelInstance = Cmmn.createEmptyModel();
    definitions = modelInstance.newInstance(Definitions.class);
    definitions.setTargetNamespace("http://camunda.org/examples");
    modelInstance.setDefinitions(definitions);
    caseDefinition = createElement(definitions, "aCaseDefinition", Case.class);
    casePlanModel = createElement(caseDefinition, "aCasePlanModel", CasePlanModel.class);
    context = new CmmnHandlerContext();
    CaseDefinitionEntity caseDefinition = new CaseDefinitionEntity();
    caseDefinition.setTaskDefinitions(new HashMap<String, TaskDefinition>());
    context.setCaseDefinition(caseDefinition);
    ExpressionManager expressionManager = new ExpressionManager();
    context.setExpressionManager(expressionManager);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) CmmnHandlerContext(org.camunda.bpm.engine.impl.cmmn.handler.CmmnHandlerContext) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) Case(org.camunda.bpm.model.cmmn.instance.Case) Before(org.junit.Before)

Example 15 with CaseDefinitionEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.

the class CmmnTransformerTest method testActivityTreeWithOneStageAndNestedHumanTasks.

/**
 *   +-----------------+                                       +-----------------+
 *   | Case1            \                                      | aCaseDefinition |
 *   +-------------------+-----------------+                   +-----------------+
 *   |                                     |                            |
 *   |     +------------------------+      |                   +-----------------+
 *   |    / X                        \     |                   |  aCasePlanModel |
 *   |   +    +-------+  +-------+    +    |                   +-----------------+
 *   |   |    |   A   |  |   B   |    |    |  ==>                       |
 *   |   +    +-------+  +-------+    +    |                   +-----------------+
 *   |    \                          /     |                   |        X        |
 *   |     +------------------------+      |                   +-----------------+
 *   |                                     |                           / \
 *   +-------------------------------------+                          /   \
 *                                                 +-----------------+     +-----------------+
 *                                                 |        A        |     |        B        |
 *                                                 +-----------------+     +-----------------+
 */
@Test
public void testActivityTreeWithOneStageAndNestedHumanTasks() {
    // given
    Stage stage = createElement(casePlanModel, "X", Stage.class);
    HumanTask humanTaskA = createElement(casePlanModel, "A", HumanTask.class);
    HumanTask humanTaskB = createElement(casePlanModel, "B", HumanTask.class);
    PlanItem planItemX = createElement(casePlanModel, "PI_X", PlanItem.class);
    PlanItem planItemA = createElement(stage, "PI_A", PlanItem.class);
    PlanItem planItemB = createElement(stage, "PI_B", PlanItem.class);
    planItemX.setDefinition(stage);
    planItemA.setDefinition(humanTaskA);
    planItemB.setDefinition(humanTaskB);
    // when
    List<CaseDefinitionEntity> caseDefinitions = transform();
    // then
    assertEquals(1, caseDefinitions.size());
    CaseDefinitionEntity caseDefinition = caseDefinitions.get(0);
    List<CmmnActivity> activities = caseDefinition.getActivities();
    CmmnActivity casePlanModelActivity = activities.get(0);
    List<CmmnActivity> children = casePlanModelActivity.getActivities();
    assertEquals(1, children.size());
    CmmnActivity planItemStage = children.get(0);
    assertEquals(planItemX.getId(), planItemStage.getId());
    children = planItemStage.getActivities();
    assertEquals(2, children.size());
    CmmnActivity childPlanItem = children.get(0);
    assertEquals(planItemA.getId(), childPlanItem.getId());
    assertTrue(childPlanItem.getActivities().isEmpty());
    childPlanItem = children.get(1);
    assertEquals(planItemB.getId(), childPlanItem.getId());
    assertTrue(childPlanItem.getActivities().isEmpty());
}
Also used : CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) Stage(org.camunda.bpm.model.cmmn.instance.Stage) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) PlanItem(org.camunda.bpm.model.cmmn.instance.PlanItem) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Aggregations

CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)31 Test (org.junit.Test)9 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)6 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)5 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)4 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)4 InputStream (java.io.InputStream)3 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)3 HumanTask (org.camunda.bpm.model.cmmn.instance.HumanTask)3 PlanItem (org.camunda.bpm.model.cmmn.instance.PlanItem)3 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)2 GetDeploymentResourceCmd (org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)2 CmmnCaseDefinition (org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition)2 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)2 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)2 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)2 CmmnModelInstance (org.camunda.bpm.model.cmmn.CmmnModelInstance)2 Case (org.camunda.bpm.model.cmmn.instance.Case)2 CasePlanModel (org.camunda.bpm.model.cmmn.instance.CasePlanModel)2 Definitions (org.camunda.bpm.model.cmmn.instance.Definitions)2