Search in sources :

Example 26 with CaseDefinitionEntity

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

the class GetDeploymentCaseDefinitionCmd method execute.

public CaseDefinition execute(CommandContext commandContext) {
    ensureNotNull("caseDefinitionId", caseDefinitionId);
    CaseDefinitionEntity caseDefinition = Context.getProcessEngineConfiguration().getDeploymentCache().findDeployedCaseDefinitionById(caseDefinitionId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadCaseDefinition(caseDefinition);
    }
    return caseDefinition;
}
Also used : CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Example 27 with CaseDefinitionEntity

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

the class GetDeploymentCaseModelCmd method execute.

public InputStream execute(final CommandContext commandContext) {
    ensureNotNull("caseDefinitionId", caseDefinitionId);
    CaseDefinitionEntity caseDefinition = Context.getProcessEngineConfiguration().getDeploymentCache().findDeployedCaseDefinitionById(caseDefinitionId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadCaseDefinition(caseDefinition);
    }
    final String deploymentId = caseDefinition.getDeploymentId();
    final String resourceName = caseDefinition.getResourceName();
    InputStream inputStream = commandContext.runWithoutAuthorization(new Callable<InputStream>() {

        public InputStream call() throws Exception {
            return new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
        }
    });
    return inputStream;
}
Also used : InputStream(java.io.InputStream) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) GetDeploymentResourceCmd(org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Example 28 with CaseDefinitionEntity

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

the class CaseHandler method handleElement.

public CmmnCaseDefinition handleElement(Case element, CmmnHandlerContext context) {
    CaseDefinitionEntity definition = createActivity(element, context);
    initializeActivity(element, definition, context);
    return definition;
}
Also used : CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)

Example 29 with CaseDefinitionEntity

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

the class CmmnTransformerTest method testNestedStages.

/**
 *   +-----------------+                                                    +-----------------+
 *   | Case1            \                                                   | aCaseDefinition |
 *   +-------------------+-------------------+                              +-----------------+
 *   |                                       |                                       |
 *   |  +-------+                            |                              +-----------------+
 *   |  |  A1   |                            |              +---------------|  aCasePlanModel |---------------+
 *   |  +-------+                            |              |               +-----------------+               |
 *   |                                       |              |                        |                        |
 *   |    +------------------------+         |      +-----------------+     +-----------------+      +-----------------+
 *   |   / X1                       \        |      |       A1        |     |        X1       |      |        Y        |-----------+
 *   |  +    +-------+  +-------+    +       |      +-----------------+     +-----------------+      +-----------------+           |
 *   |  |    |  A2   |  |   B   |    |       |                                      / \                                           / \
 *   |  +    +-------+  +-------+    +       |                                     /   \                                         /   \
 *   |   \                          /        |                    +---------------+     +---------------+     +-----------------+     +-----------------+
 *   |    +------------------------+         |                    |      A2       |     |      B        |     |        C        |     |       X2        |
 *   |                                       |                    +---------------+     +---------------+     +-----------------+     +-----------------+
 *   |    +-----------------------------+    |  ==>                                                                                          / \
 *   |   / Y                             \   |                                                                              +---------------+   +---------------+
 *   |  +    +-------+                    +  |                                                                              |      A1       |   |       B       |
 *   |  |    |   C   |                    |  |                                                                              +---------------+   +---------------+
 *   |  |    +-------+                    |  |
 *   |  |                                 |  |
 *   |  |   +------------------------+    |  |
 *   |  |  / X2                       \   |  |
 *   |  | +    +-------+  +-------+    +  |  |
 *   |  | |    |  A1   |  |   B   |    |  |  |
 *   |  | +    +-------+  +-------+    +  |  |
 *   |  |  \                          /   |  |
 *   |  +   +------------------------+    +  |
 *   |   \                               /   |
 *   |    +-----------------------------+    |
 *   |                                       |
 *   +---------------------------------------+
 */
@Test
public void testNestedStages() {
    // given
    Stage stageX = createElement(casePlanModel, "X", Stage.class);
    Stage stageY = createElement(casePlanModel, "Y", Stage.class);
    HumanTask humanTaskA = createElement(casePlanModel, "A", HumanTask.class);
    HumanTask humanTaskB = createElement(casePlanModel, "B", HumanTask.class);
    HumanTask humanTaskC = createElement(casePlanModel, "C", HumanTask.class);
    PlanItem planItemA1 = createElement(casePlanModel, "PI_A1", PlanItem.class);
    planItemA1.setDefinition(humanTaskA);
    PlanItem planItemX1 = createElement(casePlanModel, "PI_X1", PlanItem.class);
    planItemX1.setDefinition(stageX);
    PlanItem planItemA2 = createElement(stageX, "PI_A2", PlanItem.class);
    planItemA2.setDefinition(humanTaskA);
    PlanItem planItemB = createElement(stageX, "PI_B", PlanItem.class);
    planItemB.setDefinition(humanTaskB);
    PlanItem planItemY = createElement(casePlanModel, "PI_Y", PlanItem.class);
    planItemY.setDefinition(stageY);
    PlanItem planItemC = createElement(stageY, "PI_C", PlanItem.class);
    planItemC.setDefinition(humanTaskC);
    PlanItem planItemX2 = createElement(stageY, "PI_X2", PlanItem.class);
    planItemX2.setDefinition(stageX);
    // 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(3, children.size());
    CmmnActivity childPlanItem = children.get(0);
    assertEquals(planItemA1.getId(), childPlanItem.getId());
    assertTrue(childPlanItem.getActivities().isEmpty());
    childPlanItem = children.get(1);
    assertEquals(planItemX1.getId(), childPlanItem.getId());
    List<CmmnActivity> childrenOfX1 = childPlanItem.getActivities();
    assertFalse(childrenOfX1.isEmpty());
    assertEquals(2, childrenOfX1.size());
    childPlanItem = childrenOfX1.get(0);
    assertEquals(planItemA2.getId(), childPlanItem.getId());
    assertTrue(childPlanItem.getActivities().isEmpty());
    childPlanItem = childrenOfX1.get(1);
    assertEquals(planItemB.getId(), childPlanItem.getId());
    assertTrue(childPlanItem.getActivities().isEmpty());
    childPlanItem = children.get(2);
    assertEquals(planItemY.getId(), childPlanItem.getId());
    List<CmmnActivity> childrenOfY = childPlanItem.getActivities();
    assertFalse(childrenOfY.isEmpty());
    assertEquals(2, childrenOfY.size());
    childPlanItem = childrenOfY.get(0);
    assertEquals(planItemC.getId(), childPlanItem.getId());
    assertTrue(childPlanItem.getActivities().isEmpty());
    childPlanItem = childrenOfY.get(1);
    assertEquals(planItemX2.getId(), childPlanItem.getId());
    List<CmmnActivity> childrenOfX2 = childPlanItem.getActivities();
    assertFalse(childrenOfX2.isEmpty());
    assertEquals(2, childrenOfX2.size());
    childPlanItem = childrenOfX2.get(0);
    assertEquals(planItemA2.getId(), childPlanItem.getId());
    assertTrue(childPlanItem.getActivities().isEmpty());
    childPlanItem = childrenOfX2.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)

Example 30 with CaseDefinitionEntity

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

the class TestCmmnTransformListener method transformRootElement.

public void transformRootElement(Definitions definitions, List<? extends CmmnCaseDefinition> caseDefinitions) {
    modelElementInstances.add(definitions);
    for (CmmnCaseDefinition caseDefinition : caseDefinitions) {
        CaseDefinitionEntity entity = (CaseDefinitionEntity) caseDefinition;
        entity.setKey(entity.getKey().concat("-modified"));
    }
}
Also used : CmmnCaseDefinition(org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)

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