use of org.camunda.bpm.model.bpmn.instance.Process in project camunda-bpm-platform by camunda.
the class ModifiableBpmnModelInstance method addDocumentation.
public ModifiableBpmnModelInstance addDocumentation(String content) {
Collection<Process> processes = modelInstance.getModelElementsByType(Process.class);
Documentation documentation = modelInstance.newInstance(Documentation.class);
documentation.setTextContent(content);
for (Process process : processes) {
process.addChildElement(documentation);
}
return this;
}
use of org.camunda.bpm.model.bpmn.instance.Process in project camunda-bpm-platform by camunda.
the class UserTaskBpmnModelExecutionContextTest method assertModelInstance.
private void assertModelInstance() {
BpmnModelInstance modelInstance = ModelExecutionContextTaskListener.modelInstance;
assertNotNull(modelInstance);
Collection<ModelElementInstance> events = modelInstance.getModelElementsByType(modelInstance.getModel().getType(Event.class));
assertEquals(2, events.size());
Collection<ModelElementInstance> tasks = modelInstance.getModelElementsByType(modelInstance.getModel().getType(Task.class));
assertEquals(1, tasks.size());
Process process = (Process) modelInstance.getDefinitions().getRootElements().iterator().next();
assertEquals(PROCESS_ID, process.getId());
assertTrue(process.isExecutable());
}
use of org.camunda.bpm.model.bpmn.instance.Process in project camunda-bpm-platform by camunda.
the class StartProcessInstancesInDirectory method extractProcessDefinitionKeys.
private static List<String> extractProcessDefinitionKeys(List<String> deployableFileNames) {
ArrayList<String> keys = new ArrayList<String>();
for (String file : deployableFileNames) {
if (file.endsWith(".bpmn") || file.endsWith(".bpmn20.xml")) {
BpmnModelInstance modelInstance = Bpmn.readModelFromFile(new File(file));
Collection<Process> processes = modelInstance.getModelElementsByType(Process.class);
for (Process process : processes) {
if (process.isExecutable()) {
keys.add(process.getId());
}
}
}
}
return keys;
}
use of org.camunda.bpm.model.bpmn.instance.Process in project camunda-bpmn-model by camunda.
the class ProcessTest method shouldImportProcess.
@Test
@BpmnModelResource
public void shouldImportProcess() {
ModelElementInstance modelElementById = bpmnModelInstance.getModelElementById("exampleProcessId");
assertThat(modelElementById).isNotNull();
Collection<RootElement> rootElements = bpmnModelInstance.getDefinitions().getRootElements();
assertThat(rootElements).hasSize(1);
org.camunda.bpm.model.bpmn.instance.Process process = (Process) rootElements.iterator().next();
assertThat(process.getId()).isEqualTo("exampleProcessId");
assertThat(process.getName()).isNull();
assertThat(process.getProcessType()).isEqualTo(ProcessType.None);
assertThat(process.isExecutable()).isFalse();
assertThat(process.isClosed()).isFalse();
}
use of org.camunda.bpm.model.bpmn.instance.Process in project camunda-bpmn-model by camunda.
the class Bpmn method createProcess.
public static ProcessBuilder createProcess() {
BpmnModelInstance modelInstance = INSTANCE.doCreateEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
definitions.setTargetNamespace(BPMN20_NS);
definitions.getDomElement().registerNamespace("camunda", CAMUNDA_NS);
modelInstance.setDefinitions(definitions);
Process process = modelInstance.newInstance(Process.class);
definitions.addChildElement(process);
BpmnDiagram bpmnDiagram = modelInstance.newInstance(BpmnDiagram.class);
BpmnPlane bpmnPlane = modelInstance.newInstance(BpmnPlane.class);
bpmnPlane.setBpmnElement(process);
bpmnDiagram.addChildElement(bpmnPlane);
definitions.addChildElement(bpmnDiagram);
return process.builder();
}
Aggregations