Java Code Examples for org.activiti.bpmn.model.UserTask#setId()

The following examples show how to use org.activiti.bpmn.model.UserTask#setId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AddBpmnModelTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 7 votes vote down vote up
private static BpmnModel createProcessModel() {
	// 创建BPMN模型
	BpmnModel model = new BpmnModel();
	// 创建一个流程定义
	Process process = new Process();
	model.addProcess(process);
	process.setId("myProcess");
	process.setName("My Process");
	// 开始事件
	StartEvent startEvent = new StartEvent();
	startEvent.setId("startEvent");
	process.addFlowElement(startEvent);
	// 用户任务
	UserTask userTask = new UserTask();
	userTask.setName("User Task");
	userTask.setId("userTask");
	process.addFlowElement(userTask);
	// 结束事件
	EndEvent endEvent = new EndEvent();
	endEvent.setId("endEvent");
	process.addFlowElement(endEvent);		
	// 添加流程顺序
	process.addFlowElement(new SequenceFlow("startEvent", "userTask"));
	process.addFlowElement(new SequenceFlow("userTask", "endEvent"));
	return model;
}
 
Example 2
Source File: AddBpmnModelTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
private static BpmnModel createProcessModel() {
	// 创建BPMN模型
	BpmnModel model = new BpmnModel();
	// 创建一个流程定义
	Process process = new Process();
	model.addProcess(process);
	process.setId("myProcess");
	process.setName("My Process");
	// 开始事件
	StartEvent startEvent = new StartEvent();
	startEvent.setId("startEvent");
	process.addFlowElement(startEvent);
	// 用户任务
	UserTask userTask = new UserTask();
	userTask.setName("User Task");
	userTask.setId("userTask");
	process.addFlowElement(userTask);
	// 结束事件
	EndEvent endEvent = new EndEvent();
	endEvent.setId("endEvent");
	process.addFlowElement(endEvent);		
	// 添加流程顺序
	process.addFlowElement(new SequenceFlow("startEvent", "userTask"));
	process.addFlowElement(new SequenceFlow("userTask", "endEvent"));
	return model;
}
 
Example 3
Source File: TestProcessUtil.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public static org.activiti.bpmn.model.Process createOneTaskProcess() {
  org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process();

  process.setId("oneTaskProcess");
  process.setName("The one task process");

  StartEvent startEvent = new StartEvent();
  startEvent.setId("start");
  process.addFlowElement(startEvent);

  UserTask userTask = new UserTask();
  userTask.setName("The Task");
  userTask.setId("theTask");
  userTask.setAssignee("kermit");
  process.addFlowElement(userTask);

  EndEvent endEvent = new EndEvent();
  endEvent.setId("theEnd");
  process.addFlowElement(endEvent);

  process.addFlowElement(new SequenceFlow("start", "theTask"));
  process.addFlowElement(new SequenceFlow("theTask", "theEnd"));

  return process;
}
 
Example 4
Source File: TestProcessUtil.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public static org.activiti.bpmn.model.Process createOneTaskProcess() {
	org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process();

	process.setId("oneTaskProcess");
	process.setName("The one task process");

	StartEvent startEvent = new StartEvent();
	startEvent.setId("start");
	process.addFlowElement(startEvent);

	UserTask userTask = new UserTask();
	userTask.setName("The Task");
	userTask.setId("theTask");
	userTask.setAssignee("kermit");
	process.addFlowElement(userTask);

	EndEvent endEvent = new EndEvent();
	endEvent.setId("theEnd");
	process.addFlowElement(endEvent);

	process.addFlowElement(new SequenceFlow("start", "theTask"));
	process.addFlowElement(new SequenceFlow("theTask", "theEnd"));

	return process;
}
 
Example 5
Source File: AbstractActivitiTestCase.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
/**
 * Since the 'one task process' is used everywhere the actual process content doesn't matter, instead of copying around the BPMN 2.0 xml one could use this method which gives a {@link BpmnModel}
 * version of the same process back.
 */
public BpmnModel createOneTaskTestProcess() {
  BpmnModel model = new BpmnModel();
  org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process();
  model.addProcess(process);
  process.setId("oneTaskProcess");
  process.setName("The one task process");

  StartEvent startEvent = new StartEvent();
  startEvent.setId("start");
  process.addFlowElement(startEvent);

  UserTask userTask = new UserTask();
  userTask.setName("The Task");
  userTask.setId("theTask");
  userTask.setAssignee("kermit");
  process.addFlowElement(userTask);

  EndEvent endEvent = new EndEvent();
  endEvent.setId("theEnd");
  process.addFlowElement(endEvent);

  process.addFlowElement(new SequenceFlow("start", "theTask"));
  process.addFlowElement(new SequenceFlow("theTask", "theEnd"));

  return model;
}
 
Example 6
Source File: AbstractActivitiTestCase.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public BpmnModel createTwoTasksTestProcess() {
  BpmnModel model = new BpmnModel();
  org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process();
  model.addProcess(process);
  process.setId("twoTasksProcess");
  process.setName("The two tasks process");

  StartEvent startEvent = new StartEvent();
  startEvent.setId("start");
  process.addFlowElement(startEvent);

  UserTask userTask = new UserTask();
  userTask.setName("The First Task");
  userTask.setId("task1");
  userTask.setAssignee("kermit");
  process.addFlowElement(userTask);

  UserTask userTask2 = new UserTask();
  userTask2.setName("The Second Task");
  userTask2.setId("task2");
  userTask2.setAssignee("kermit");
  process.addFlowElement(userTask2);

  EndEvent endEvent = new EndEvent();
  endEvent.setId("theEnd");
  process.addFlowElement(endEvent);

  process.addFlowElement(new SequenceFlow("start", "task1"));
  process.addFlowElement(new SequenceFlow("start", "task2"));
  process.addFlowElement(new SequenceFlow("task1", "theEnd"));
  process.addFlowElement(new SequenceFlow("task2", "theEnd"));

  return model;
}
 
Example 7
Source File: TestProcessUtil.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public static BpmnModel createTwoTasksBpmnModel() {
  BpmnModel model = new BpmnModel();
  org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process();
  model.addProcess(process);
  process.setId("twoTasksProcess");
  process.setName("The two tasks process");

  StartEvent startEvent = new StartEvent();
  startEvent.setId("start");
  process.addFlowElement(startEvent);

  UserTask userTask = new UserTask();
  userTask.setName("The First Task");
  userTask.setId("task1");
  userTask.setAssignee("kermit");
  process.addFlowElement(userTask);

  UserTask userTask2 = new UserTask();
  userTask2.setName("The Second Task");
  userTask2.setId("task2");
  userTask2.setAssignee("kermit");
  process.addFlowElement(userTask2);

  EndEvent endEvent = new EndEvent();
  endEvent.setId("theEnd");
  process.addFlowElement(endEvent);

  process.addFlowElement(new SequenceFlow("start", "task1"));
  process.addFlowElement(new SequenceFlow("start", "task2"));
  process.addFlowElement(new SequenceFlow("task1", "theEnd"));
  process.addFlowElement(new SequenceFlow("task2", "theEnd"));

  return model;
}
 
Example 8
Source File: EventJavaTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testStartEventWithExecutionListener() throws Exception {
  BpmnModel bpmnModel = new BpmnModel();
  Process process = new Process();
  process.setId("simpleProcess");
  process.setName("Very simple process");
  bpmnModel.getProcesses().add(process);
  StartEvent startEvent = new StartEvent();
  startEvent.setId("startEvent1");
  TimerEventDefinition timerDef = new TimerEventDefinition();
  timerDef.setTimeDuration("PT5M");
  startEvent.getEventDefinitions().add(timerDef);
  ActivitiListener listener = new ActivitiListener();
  listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
  listener.setImplementation("${test}");
  listener.setEvent("end");
  startEvent.getExecutionListeners().add(listener);
  process.addFlowElement(startEvent);
  UserTask task = new UserTask();
  task.setId("reviewTask");
  task.setAssignee("kermit");
  process.addFlowElement(task);
  SequenceFlow flow1 = new SequenceFlow();
  flow1.setId("flow1");
  flow1.setSourceRef("startEvent1");
  flow1.setTargetRef("reviewTask");
  process.addFlowElement(flow1);
  EndEvent endEvent = new EndEvent();
  endEvent.setId("endEvent1");
  process.addFlowElement(endEvent);

  byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);

  new BpmnXMLConverter().validateModel(new InputStreamSource(new ByteArrayInputStream(xml)));

  Deployment deployment = repositoryService.createDeployment().name("test").addString("test.bpmn20.xml", new String(xml)).deploy();
  repositoryService.deleteDeployment(deployment.getId());
}
 
Example 9
Source File: AbstractActivitiTestCase.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
/**
 * Since the 'one task process' is used everywhere the actual process content
 * doesn't matter, instead of copying around the BPMN 2.0 xml one could use 
 * this method which gives a {@link BpmnModel} version of the same process back.
 */
public BpmnModel createOneTaskTestProcess() {
	BpmnModel model = new BpmnModel();
	org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process();
  model.addProcess(process);
  process.setId("oneTaskProcess");
  process.setName("The one task process");
 
  StartEvent startEvent = new StartEvent();
  startEvent.setId("start");
  process.addFlowElement(startEvent);
  
  UserTask userTask = new UserTask();
  userTask.setName("The Task");
  userTask.setId("theTask");
  userTask.setAssignee("kermit");
  process.addFlowElement(userTask);
  
  EndEvent endEvent = new EndEvent();
  endEvent.setId("theEnd");
  process.addFlowElement(endEvent);
  
  process.addFlowElement(new SequenceFlow("start", "theTask"));
  process.addFlowElement(new SequenceFlow("theTask", "theEnd"));
  
  return model;
}
 
Example 10
Source File: AbstractActivitiTestCase.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public BpmnModel createTwoTasksTestProcess() {
	BpmnModel model = new BpmnModel();
	org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process();
  model.addProcess(process);
  process.setId("twoTasksProcess");
  process.setName("The two tasks process");
 
  StartEvent startEvent = new StartEvent();
  startEvent.setId("start");
  process.addFlowElement(startEvent);
  
  UserTask userTask = new UserTask();
  userTask.setName("The First Task");
  userTask.setId("task1");
  userTask.setAssignee("kermit");
  process.addFlowElement(userTask);
  
  UserTask userTask2 = new UserTask();
  userTask2.setName("The Second Task");
  userTask2.setId("task2");
  userTask2.setAssignee("kermit");
  process.addFlowElement(userTask2);
  
  EndEvent endEvent = new EndEvent();
  endEvent.setId("theEnd");
  process.addFlowElement(endEvent);
  
  process.addFlowElement(new SequenceFlow("start", "task1"));
  process.addFlowElement(new SequenceFlow("start", "task2"));
  process.addFlowElement(new SequenceFlow("task1", "theEnd"));
  process.addFlowElement(new SequenceFlow("task2", "theEnd"));
  
  return model;
}
 
Example 11
Source File: TestProcessUtil.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public static BpmnModel createTwoTasksBpmnModel() {
	BpmnModel model = new BpmnModel();
	org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process();
	model.addProcess(process);
	process.setId("twoTasksProcess");
	process.setName("The two tasks process");

	StartEvent startEvent = new StartEvent();
	startEvent.setId("start");
	process.addFlowElement(startEvent);

	UserTask userTask = new UserTask();
	userTask.setName("The First Task");
	userTask.setId("task1");
	userTask.setAssignee("kermit");
	process.addFlowElement(userTask);

	UserTask userTask2 = new UserTask();
	userTask2.setName("The Second Task");
	userTask2.setId("task2");
	userTask2.setAssignee("kermit");
	process.addFlowElement(userTask2);

	EndEvent endEvent = new EndEvent();
	endEvent.setId("theEnd");
	process.addFlowElement(endEvent);

	process.addFlowElement(new SequenceFlow("start", "task1"));
	process.addFlowElement(new SequenceFlow("start", "task2"));
	process.addFlowElement(new SequenceFlow("task1", "theEnd"));
	process.addFlowElement(new SequenceFlow("task2", "theEnd"));

	return model;
}
 
Example 12
Source File: EventJavaTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testStartEventWithExecutionListener() throws Exception {
  BpmnModel bpmnModel = new BpmnModel();
  Process process = new Process();
  process.setId("simpleProcess");
  process.setName("Very simple process");
  bpmnModel.getProcesses().add(process);
  StartEvent startEvent = new StartEvent();
  startEvent.setId("startEvent1");
  TimerEventDefinition timerDef = new TimerEventDefinition();
  timerDef.setTimeDuration("PT5M");
  startEvent.getEventDefinitions().add(timerDef);
  ActivitiListener listener = new ActivitiListener();
  listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
  listener.setImplementation("${test}");
  listener.setEvent("end");
  startEvent.getExecutionListeners().add(listener);
  process.addFlowElement(startEvent);
  UserTask task = new UserTask();
  task.setId("reviewTask");
  task.setAssignee("kermit");
  process.addFlowElement(task);
  SequenceFlow flow1 = new SequenceFlow();
  flow1.setId("flow1");
  flow1.setSourceRef("startEvent1");
  flow1.setTargetRef("reviewTask");
  process.addFlowElement(flow1);
  EndEvent endEvent = new EndEvent();
  endEvent.setId("endEvent1");
  process.addFlowElement(endEvent);
  
  byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
  
  new BpmnXMLConverter().validateModel(new InputStreamSource(new ByteArrayInputStream(xml)));
  
  Deployment deployment = repositoryService.createDeployment().name("test").addString("test.bpmn20.xml", new String(xml))
      .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE)
      .deploy();
  repositoryService.deleteDeployment(deployment.getId());
}
 
Example 13
Source File: DynamicProcess.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
protected UserTask createUserTask(String id, String name, String assignee) {
    UserTask userTask = new UserTask();
    userTask.setName(name);
    userTask.setId(id);
    userTask.setAssignee(assignee);
    return userTask;
}