03-24-2016 01:39 AM
BpmnModel model = new BpmnModel();
Process process = new Process();
model.addProcess(process);
process.setId("my-process");
process.addFlowElement(createStartEvent());
process.addFlowElement(createServiceTask("ServiceTask"));
process.addFlowElement(createEndEvent());
process.addFlowElement(createSequenceFlow("start", "ServiceTask"));
process.addFlowElement(createSequenceFlow("ServiceTask", "end"));
new BpmnAutoLayout(model).execute();
Deployment deployment = activitiRule.getRepositoryService().createDeployment()
.addBpmnModel("dynamic-model.bpmn", model).name("Dynamic process deployment").deploy();
ProcessInstance processInstance = activitiRule.getRuntimeService()
.startProcessInstanceByKey("my-process");
protected ServiceTask createServiceTask(String id){
ServiceTask serviceTask = new ServiceTask();
/*where to set the implementation class ? */
serviceTask.setImplementation("be.stacktrace.activiti.dynamicprocess.DynamicActivitiProcessTest.ServiceTaskSample");
serviceTask.setType("be.stacktrace.activiti.dynamicprocess.DynamicActivitiProcessTest.ServiceTaskSample");
serviceTask.setId(id);
return serviceTask;
}
public static class ServiceTaskSample implements JavaDelegate {
public void execute(DelegateExecution delegateExecution) throws Exception {
System.out.println("Executed process with key "+
delegateExecution.getProcessBusinessKey()+
" with process definition Id "+
delegateExecution.getProcessDefinitionId()+
" with process instance Id "+delegateExecution.getProcessInstanceId()+
" and current task name is "+
delegateExecution.getCurrentActivityName());
}
}
03-24-2016 04:03 AM
03-24-2016 05:08 AM
03-24-2016 05:20 AM
03-24-2016 05:42 AM
03-25-2016 11:11 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.