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;
}
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;
}
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;
}
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());
}
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"));
}
}
Aggregations