use of org.camunda.bpm.model.cmmn.CmmnModelInstance in project camunda-bpm-platform by camunda.
the class GetDeploymentCmmnModelInstanceCmd method execute.
public CmmnModelInstance execute(CommandContext commandContext) {
ensureNotNull("caseDefinitionId", caseDefinitionId);
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
final DeploymentCache deploymentCache = configuration.getDeploymentCache();
CaseDefinitionEntity caseDefinition = deploymentCache.findDeployedCaseDefinitionById(caseDefinitionId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadCaseDefinition(caseDefinition);
}
CmmnModelInstance modelInstance = Context.getProcessEngineConfiguration().getDeploymentCache().findCmmnModelInstanceForCaseDefinition(caseDefinitionId);
ensureNotNull(CmmnModelInstanceNotFoundException.class, "No CMMN model instance found for case definition id " + caseDefinitionId, "modelInstance", modelInstance);
return modelInstance;
}
use of org.camunda.bpm.model.cmmn.CmmnModelInstance in project camunda-bpm-platform by camunda.
the class CmmnModelElementInstanceCmdTest method testRepositoryService.
@Deployment(resources = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn")
public void testRepositoryService() {
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().caseDefinitionKey(CASE_KEY).singleResult().getId();
CmmnModelInstance modelInstance = repositoryService.getCmmnModelInstance(caseDefinitionId);
assertNotNull(modelInstance);
Collection<ModelElementInstance> humanTasks = modelInstance.getModelElementsByType(modelInstance.getModel().getType(HumanTask.class));
assertEquals(1, humanTasks.size());
Collection<ModelElementInstance> planItems = modelInstance.getModelElementsByType(modelInstance.getModel().getType(PlanItem.class));
assertEquals(1, planItems.size());
Collection<ModelElementInstance> cases = modelInstance.getModelElementsByType(modelInstance.getModel().getType(Case.class));
assertEquals(1, cases.size());
}
use of org.camunda.bpm.model.cmmn.CmmnModelInstance in project camunda-cmmn-model by camunda.
the class Cmmn10Test method shouldGetDescription.
@Test
public void shouldGetDescription() {
CmmnModelInstance modelInstance = getCmmnModelInstance();
CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
String description = casePlanModel.getDescription();
assertThat(description).isEqualTo("This is a description...");
Collection<Documentation> documentations = casePlanModel.getDocumentations();
assertThat(documentations).isEmpty();
}
use of org.camunda.bpm.model.cmmn.CmmnModelInstance in project camunda-cmmn-model by camunda.
the class Cmmn10Test method shouldNotAbleToAddNewElement.
@Test
public void shouldNotAbleToAddNewElement() {
CmmnModelInstance modelInstance = getCmmnModelInstance();
CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
HumanTask humanTask = modelInstance.newInstance(HumanTask.class);
casePlanModel.getPlanItemDefinitions().add(humanTask);
try {
Cmmn.writeModelToStream(System.out, modelInstance);
fail("cannot save cmmn 1.0 model");
} catch (Exception e) {
// expected exception
}
}
use of org.camunda.bpm.model.cmmn.CmmnModelInstance in project camunda-cmmn-model by camunda.
the class Cmmn10Test method shouldGetCasePlanModelExitCriterion.
@Test
public void shouldGetCasePlanModelExitCriterion() {
CmmnModelInstance modelInstance = getCmmnModelInstance();
CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
Collection<Sentry> exitCriterias = casePlanModel.getExitCriterias();
assertThat(exitCriterias).hasSize(1);
Collection<Sentry> exitCriteria = casePlanModel.getExitCriteria();
assertThat(exitCriteria).hasSize(1);
Collection<ExitCriterion> exitCriterions = casePlanModel.getExitCriterions();
assertThat(exitCriterions).isEmpty();
}
Aggregations