use of org.camunda.bpm.model.cmmn.instance.Case in project camunda-bpm-platform by camunda.
the class DeployCmd method retrieveProcessKeysFromResources.
protected Set<String> retrieveProcessKeysFromResources(Map<String, ResourceEntity> resources) {
Set<String> keys = new HashSet<String>();
for (ResourceEntity resource : resources.values()) {
if (isBpmnResource(resource)) {
ByteArrayInputStream byteStream = new ByteArrayInputStream(resource.getBytes());
BpmnModelInstance model = Bpmn.readModelFromStream(byteStream);
for (Process process : model.getDefinitions().getChildElementsByType(Process.class)) {
keys.add(process.getId());
}
} else if (isCmmnResource(resource)) {
ByteArrayInputStream byteStream = new ByteArrayInputStream(resource.getBytes());
CmmnModelInstance model = Cmmn.readModelFromStream(byteStream);
for (Case cmmnCase : model.getDefinitions().getCases()) {
keys.add(cmmnCase.getId());
}
}
}
return keys;
}
use of org.camunda.bpm.model.cmmn.instance.Case in project camunda-bpm-platform by camunda.
the class CmmnDeployerTest method createCmmnModelInstance.
protected static CmmnModelInstance createCmmnModelInstance() {
final CmmnModelInstance modelInstance = Cmmn.createEmptyModel();
org.camunda.bpm.model.cmmn.instance.Definitions definitions = modelInstance.newInstance(org.camunda.bpm.model.cmmn.instance.Definitions.class);
definitions.setTargetNamespace("http://camunda.org/examples");
modelInstance.setDefinitions(definitions);
Case caseElement = modelInstance.newInstance(Case.class);
caseElement.setId("a-case");
definitions.addChildElement(caseElement);
CasePlanModel casePlanModel = modelInstance.newInstance(CasePlanModel.class);
caseElement.setCasePlanModel(casePlanModel);
Cmmn.writeModelToStream(System.out, modelInstance);
return modelInstance;
}
use of org.camunda.bpm.model.cmmn.instance.Case in project camunda-bpm-platform by camunda.
the class CmmnTransform method transformCase.
protected CaseDefinitionEntity transformCase(Case element) {
// get CaseTransformer
CmmnElementHandler<Case, CmmnActivity> caseTransformer = getDefinitionHandler(Case.class);
CmmnActivity definition = caseTransformer.handleElement(element, context);
context.setCaseDefinition((CmmnCaseDefinition) definition);
context.setParent(definition);
CasePlanModel casePlanModel = element.getCasePlanModel();
transformCasePlanModel(casePlanModel);
for (CmmnTransformListener transformListener : transformListeners) {
transformListener.transformCase(element, (CmmnCaseDefinition) definition);
}
return (CaseDefinitionEntity) definition;
}
use of org.camunda.bpm.model.cmmn.instance.Case in project camunda-cmmn-model by camunda.
the class CreateModelTest method createCaseWithOneStageAndNestedHumanTask.
@Test
public void createCaseWithOneStageAndNestedHumanTask() {
// create process
Case caseInstance = createElement(definitions, "case-with-one-human-task", Case.class);
// create case plan model
CasePlanModel casePlanModel = createElement(caseInstance, "casePlanModel_1", CasePlanModel.class);
// create a stage
Stage stage = createElement(casePlanModel, "Stage_1", Stage.class);
// create elements
HumanTask humanTask = createElement(stage, "HumanTask_1", HumanTask.class);
// create a plan item
PlanItem planItem = createElement(stage, "PlanItem_1", PlanItem.class);
// set definition to human task
planItem.setDefinition(humanTask);
}
use of org.camunda.bpm.model.cmmn.instance.Case in project camunda-cmmn-model by camunda.
the class GenerateIdTest method shouldGenerateIdsOnCreate.
@Test
public void shouldGenerateIdsOnCreate() {
CmmnModelInstance modelInstance = Cmmn.createEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
assertThat(definitions.getId()).isNotNull();
Case caseElement = modelInstance.newInstance(Case.class);
assertThat(caseElement.getId()).isNotNull();
CasePlanModel casePlanModel = modelInstance.newInstance(CasePlanModel.class);
assertThat(casePlanModel.getId()).isNotNull();
HumanTask humanTask = modelInstance.newInstance(HumanTask.class);
assertThat(humanTask.getId()).isNotNull();
}
Aggregations