use of org.camunda.bpm.model.bpmn.instance.Process in project camunda-bpmn-model by camunda.
the class ProcessBuilderTest method testProcessCamundaExtensions.
@Test
public void testProcessCamundaExtensions() {
modelInstance = Bpmn.createProcess(PROCESS_ID).camundaJobPriority("${somePriority}").camundaTaskPriority(TEST_PROCESS_TASK_PRIORITY).camundaHistoryTimeToLive(TEST_HISTORY_TIME_TO_LIVE).startEvent().endEvent().done();
Process process = modelInstance.getModelElementById(PROCESS_ID);
assertThat(process.getCamundaJobPriority()).isEqualTo("${somePriority}");
assertThat(process.getCamundaTaskPriority()).isEqualTo(TEST_PROCESS_TASK_PRIORITY);
assertThat(process.getCamundaHistoryTimeToLive()).isEqualTo(TEST_HISTORY_TIME_TO_LIVE);
}
use of org.camunda.bpm.model.bpmn.instance.Process in project camunda-bpmn-model by camunda.
the class ProcessBuilderTest method testCreateEmptyProcess.
@Test
public void testCreateEmptyProcess() {
modelInstance = Bpmn.createProcess().done();
Definitions definitions = modelInstance.getDefinitions();
assertThat(definitions).isNotNull();
assertThat(definitions.getTargetNamespace()).isEqualTo(BPMN20_NS);
Collection<ModelElementInstance> processes = modelInstance.getModelElementsByType(processType);
assertThat(processes).hasSize(1);
Process process = (Process) processes.iterator().next();
assertThat(process.getId()).isNotNull();
}
use of org.camunda.bpm.model.bpmn.instance.Process in project camunda-bpmn-model by camunda.
the class ProcessBuilderTest method testGetElement.
@Test
public void testGetElement() {
// Make sure this method is publicly available
Process process = Bpmn.createProcess().getElement();
assertThat(process).isNotNull();
}
use of org.camunda.bpm.model.bpmn.instance.Process in project camunda-bpmn-model by camunda.
the class ProcessImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Process.class, BPMN_ELEMENT_PROCESS).namespaceUri(BPMN20_NS).extendsType(CallableElement.class).instanceProvider(new ModelTypeInstanceProvider<Process>() {
public Process newInstance(ModelTypeInstanceContext instanceContext) {
return new ProcessImpl(instanceContext);
}
});
processTypeAttribute = typeBuilder.enumAttribute(BPMN_ATTRIBUTE_PROCESS_TYPE, ProcessType.class).defaultValue(ProcessType.None).build();
isClosedAttribute = typeBuilder.booleanAttribute(BPMN_ATTRIBUTE_IS_CLOSED).defaultValue(false).build();
isExecutableAttribute = typeBuilder.booleanAttribute(BPMN_ATTRIBUTE_IS_EXECUTABLE).build();
// TODO: definitionalCollaborationRef
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
auditingChild = sequenceBuilder.element(Auditing.class).build();
monitoringChild = sequenceBuilder.element(Monitoring.class).build();
propertyCollection = sequenceBuilder.elementCollection(Property.class).build();
laneSetCollection = sequenceBuilder.elementCollection(LaneSet.class).build();
flowElementCollection = sequenceBuilder.elementCollection(FlowElement.class).build();
artifactCollection = sequenceBuilder.elementCollection(Artifact.class).build();
resourceRoleCollection = sequenceBuilder.elementCollection(ResourceRole.class).build();
correlationSubscriptionCollection = sequenceBuilder.elementCollection(CorrelationSubscription.class).build();
supportsCollection = sequenceBuilder.elementCollection(Supports.class).qNameElementReferenceCollection(Process.class).build();
/**
* camunda extensions
*/
camundaCandidateStarterGroupsAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CANDIDATE_STARTER_GROUPS).namespace(CAMUNDA_NS).build();
camundaCandidateStarterUsersAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CANDIDATE_STARTER_USERS).namespace(CAMUNDA_NS).build();
camundaJobPriorityAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_JOB_PRIORITY).namespace(CAMUNDA_NS).build();
camundaTaskPriorityAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_TASK_PRIORITY).namespace(CAMUNDA_NS).build();
camundaHistoryTimeToLiveAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_HISTORY_TIME_TO_LIVE).namespace(CAMUNDA_NS).build();
typeBuilder.build();
}
use of org.camunda.bpm.model.bpmn.instance.Process 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;
}
Aggregations