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