本文整理匯總了Java中org.activiti.bpmn.model.Process.setId方法的典型用法代碼示例。如果您正苦於以下問題:Java Process.setId方法的具體用法?Java Process.setId怎麽用?Java Process.setId使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.activiti.bpmn.model.Process的用法示例。
在下文中一共展示了Process.setId方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: toBpmnModel
點讚 2
import org.activiti.bpmn.model.Process; //導入方法依賴的package包/類
public BpmnModel toBpmnModel(FlowDefinition definition) {
Process process = new Process();
process.setId(definition.getId().toString());
process.setName(definition.getName());
BpmnModel model = new BpmnModel();
model.addNamespace("brainslug", BrainslugBpmn.BRAINSLUG_BPMN_NS);
model.addProcess(process);
addNodes(process, definition);
addFlows(process);
return model;
}
開發者ID:adrobisch,項目名稱:brainslug,代碼行數:15,
示例2: testStartEventWithExecutionListener
點讚 2
import org.activiti.bpmn.model.Process; //導入方法依賴的package包/類
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());
}
開發者ID:springvelocity,項目名稱:xbpm5,代碼行數:38,
示例3: buildModel
點讚 2
import org.activiti.bpmn.model.Process; //導入方法依賴的package包/類
private BpmnModel buildModel() {
BpmnModel bpmnModel = new BpmnModel();
// Process
Process process = new Process();
process.setId("testModel");
ExtensionAttribute initDate = new ExtensionAttribute("initDate");
initDate.setNamespace("http://activiti.org/bpmn");
initDate.setValue("${initDate}");
process.addAttribute(initDate);
bpmnModel.addProcess(process);
// StartEvent
StartEvent startEvent = new StartEvent();
startEvent.setId("startEvent");
FormProperty startDate = new FormProperty();
startDate.setId("startDate");
startDate.setType("date");
startEvent.getFormProperties().add(startDate);
ExtensionElement extElement = new ExtensionElement();
extElement.setName("extentProperty");
extElement.setNamespace("http://activiti.org/bpmn");
ExtensionAttribute nameAttr = new ExtensionAttribute("id");
nameAttr.setValue("status");
ExtensionAttribute valueAttr = new ExtensionAttribute("value");
valueAttr.setValue("0");
extElement.addAttribute(nameAttr);
extElement.addAttribute(valueAttr);
startEvent.addExtensionElement(extElement);
process.addFlowElement(startEvent);
// UserTask
UserTask userTask = new UserTask();
userTask.setId("userTask");
process.addFlowElement(userTask);
// EndEvent
EndEvent endEvent = new EndEvent();
endEvent.setId("endEvent");
process.addFlowElement(endEvent);
GraphicInfo giStartEvent = new GraphicInfo();
giStartEvent.setElement(startEvent);
bpmnModel.addGraphicInfo(startEvent.getId(), giStartEvent);
GraphicInfo giUserTask = new GraphicInfo();
giUserTask.setElement(userTask);
bpmnModel.addGraphicInfo(userTask.getId(), giUserTask);
GraphicInfo giEndEvent = new GraphicInfo();
giEndEvent.setElement(endEvent);
bpmnModel.addGraphicInfo(endEvent.getId(), giEndEvent);
return bpmnModel;
}
開發者ID:KayuraTeam,項目名稱:kayura-activiti,代碼行數:61,
示例4: testDynamicDeploy
點讚 2
import org.activiti.bpmn.model.Process; //導入方法依賴的package包/類
@Test
public void testDynamicDeploy() throws Exception {
// 1. 創建一個空的BpmnModel和Process對象
BpmnModel model = new BpmnModel();
Process process = new Process();
model.addProcess(process);
process.setId("my-process");
// 創建Flow元素(所有的事件、任務都被認為是Flow)
process.addFlowElement(createStartEvent());
process.addFlowElement(createUserTask("task1", "First task", "fred"));
process.addFlowElement(createUserTask("task2", "Second task", "john"));
process.addFlowElement(createEndEvent());
process.addFlowElement(createSequenceFlow("start", "task1"));
process.addFlowElement(createSequenceFlow("task1", "task2"));
process.addFlowElement(createSequenceFlow("task2", "end"));
// 2. 流程圖自動布局(位於activiti-bpmn-layout模塊)
new BpmnAutoLayout(model).execute();
// 3. 把BpmnModel對象部署到引擎
Deployment deployment = activitiRule.getRepositoryService().createDeployment()
.addBpmnModel("dynamic-model.bpmn", model).name("Dynamic process deployment")
.deploy();
// 4. 啟動流程
ProcessInstance processInstance = activitiRule.getRuntimeService()
.startProcessInstanceByKey("my-process");
// 5. 檢查流程是否正常啟動
List tasks = activitiRule.getTaskService().createTaskQuery()
.processInstanceId(processInstance.getId()).list();
Assert.assertEquals(1, tasks.size());
Assert.assertEquals("First task", tasks.get(0).getName());
Assert.assertEquals("fred", tasks.get(0).getAssignee());
// 6. 導出流程圖
InputStream processDiagram = activitiRule.getRepositoryService()
.getProcessDiagram(processInstance.getProcessDefinitionId());
// 把文件生成在本章項目的test-classes目錄中
String userHomeDir = getClass().getResource("/").getFile();
System.out.println(userHomeDir);
FileUtils.copyInputStreamToFile(processDiagram, new File(userHomeDir + "/diagram.png"));
// 7. 導出Bpmn文件到本地文件係統
InputStream processBpmn = activitiRule.getRepositoryService()
.getResourceAsStream(deployment.getId(), "dynamic-model.bpmn");
FileUtils.copyInputStreamToFile(processBpmn,
new File(userHomeDir + "/process.bpmn20.xml"));
}
開發者ID:shawn-gogh,項目名稱:myjavacode,代碼行數:53,
示例5: createActivateProcess
點讚 2
import org.activiti.bpmn.model.Process; //導入方法依賴的package包/類
protected Process createActivateProcess(final TechnicalDeploymentInstance tdi) throws JAXBException {
// Creates the root element
Process process = new Process();
process.setId("TDI-" + tdi.getId() + "-" + System.currentTimeMillis());
process.setName("Activate virtual applicance " + tdi.getTechnicalDeployment().getName());
process.setExecutable(Boolean.TRUE);
// Start node
StartEvent start = new StartEvent();
start.setId("start");
process.addFlowElement(start);
// End node
EndEvent end = new EndEvent();
end.setId("end");
process.addFlowElement(end);
ParallelGateway afterStartGw = new ParallelGateway();
afterStartGw.setId("afterStartGw");
afterStartGw.getIncomingFlows().add(new SequenceFlow(start.getId(), afterStartGw.getId()));
ParallelGateway middleGw = new ParallelGateway();
middleGw.setId("middleGw");
ParallelGateway middleBisGw = new ParallelGateway();
middleBisGw.setId("middleBisGw");
ParallelGateway beforeEndGw = new ParallelGateway();
beforeEndGw.setId("beforeEndGw");
beforeEndGw.getOutgoingFlows().add(new SequenceFlow(beforeEndGw.getId(), end.getId()));
int taskCount = generateProcessServerService(tdi, ActivationStepEnum.INIT.getName(), process, afterStartGw, middleGw, ActivationStepEnum.INIT, 1);
taskCount += generateProcessServerService(tdi, ActivationStepEnum.ACTIVATE.getName(), process, middleGw, middleBisGw, ActivationStepEnum.ACTIVATE, taskCount + 1);
taskCount += generateProcessServerService(tdi, ActivationStepEnum.FIRSTSTART.getName(), process, middleBisGw, beforeEndGw, ActivationStepEnum.FIRSTSTART, taskCount + 1);
process.addFlowElement(afterStartGw);
process.addFlowElement(beforeEndGw);
process.addFlowElement(middleGw);
process.addFlowElement(middleBisGw);
ActivitiProcessUtils.simplifyProcess(process, taskCount);
return process;
}
開發者ID:orange-cloudfoundry,項目名稱:elpaaso-core,代碼行數:47,
示例6: createVappProcess
點讚 2
import org.activiti.bpmn.model.Process; //導入方法依賴的package包/類
private Process createVappProcess(final TechnicalDeploymentInstance tdi, ActivationStepEnum processType) throws JAXBException {
// Creates the root element
//ProcessDefinition definitions = new ProcessDefinitionEntity();
//definitions.setTargetNamespace("Activation");
Process process = new Process();
process.setId("TDI-" + tdi.getId() + "-" + System.currentTimeMillis());
process.setName("Start virtual applicance " + tdi.getName());
//definitions.getRootElement().add(factory.createProcess(process));
// Start node
StartEvent start = new StartEvent();
start.setId("start");
process.addFlowElement(start);
// End node
EndEvent end = new EndEvent();
end.setId("end");
process.addFlowElement(end);
ParallelGateway afterStartGw = new ParallelGateway();
afterStartGw.setId("afterStartGw");
afterStartGw.getIncomingFlows().add(new SequenceFlow(start.getId(), afterStartGw.getId()));
ParallelGateway beforeEndGw = new ParallelGateway();
beforeEndGw.setId("beforeEndGw");
beforeEndGw.getOutgoingFlows().add(new SequenceFlow(beforeEndGw.getId(), end.getId()));
int taskCount;
if (processType == ActivationStepEnum.ACTIVATE || processType == ActivationStepEnum.START) {
taskCount = generateProcessServerService(tdi, processType.getName(), process, afterStartGw, beforeEndGw, processType, 1);
} else {
taskCount = generateProcessServerServiceReverse(tdi, processType.getName(), process, afterStartGw, beforeEndGw, processType, 1);
}
process.addFlowElement(afterStartGw);
process.addFlowElement(beforeEndGw);
ActivitiProcessUtils.simplifyProcess(process, taskCount);
return process;
}
開發者ID:orange-cloudfoundry,項目名稱:elpaaso-core,代碼行數:42,
示例7: testDynamicDeploy
點讚 2
import org.activiti.bpmn.model.Process; //導入方法依賴的package包/類
@Test
public void testDynamicDeploy() throws Exception {
// 1. Build up the model from scratch
BpmnModel model = new BpmnModel();
Process process = new Process();
model.addProcess(process);
process.setId("my-process");
process.addFlowElement(createStartEvent());
process.addFlowElement(createUserTask("task1", "First task", "fred"));
process.addFlowElement(createUserTask("task2", "Second task", "john"));
process.addFlowElement(createEndEvent());
process.addFlowElement(createSequenceFlow("start", "task1"));
process.addFlowElement(createSequenceFlow("task1", "task2"));
process.addFlowElement(createSequenceFlow("task2", "end"));
// 2. Generate graphical information
new BpmnAutoLayout(model).execute();
// 3. Deploy the process to the engine
Deployment deployment = repositoryService.createDeployment().addBpmnModel("dynamic-model.bpmn", model).name("Dynamic process deployment").deploy();
// 4. Start a process instance
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("my-process");
// 5. Check if task is available
List tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
Assert.assertEquals(1, tasks.size());
Assert.assertEquals("First task", tasks.get(0).getName());
Assert.assertEquals("fred", tasks.get(0).getAssignee());
// 6. Save process diagram to a file
InputStream processDiagram = repositoryService.getProcessDiagram(processInstance.getProcessDefinitionId());
FileUtils.copyInputStreamToFile(processDiagram, new File("target/diagram.png"));
// 7. Save resulting BPMN xml to a file
InputStream processBpmn = repositoryService.getResourceAsStream(deployment.getId(), "dynamic-model.bpmn");
FileUtils.copyInputStreamToFile(processBpmn, new File("target/process.bpmn20.xml"));
}
開發者ID:orange-cloudfoundry,項目名稱:elpaaso-core,代碼行數:42,
示例8: testDynamicDeploy
點讚 2
import org.activiti.bpmn.model.Process; //導入方法依賴的package包/類
@Test
public void testDynamicDeploy() throws Exception {
// 1. Build up the model from scratch
BpmnModel model = new BpmnModel();
Process process = new Process();
model.addProcess(process);
process.setId("my-process");
process.addFlowElement(createStartEvent());
process.addFlowElement(createUserTask("task1", "First task", "fred"));
process.addFlowElement(createUserTask("task2", "Second task", "john"));
process.addFlowElement(createEndEvent());
process.addFlowElement(createSequenceFlow("start", "task1"));
process.addFlowElement(createSequenceFlow("task1", "task2"));
process.addFlowElement(createSequenceFlow("task2", "end"));
// 2. Generate graphical information
new BpmnAutoLayout(model).execute();
// 3. Deploy the process to the engine
Deployment deployment = this.repositoryService.createDeployment()
.addBpmnModel("dynamic-model.bpmn", model).name("Dynamic process deployment")
.deploy();
// 3. Deploy the process to the engine
deployment = this.repositoryService.createDeployment()
.addBpmnModel("dynamic-model.bpmn", model).name("Dynamic process deployment")
.deploy();
// 4. Start a process instance
ProcessInstance processInstance = runtimeService
.startProcessInstanceByKey("my-process");
// 5. Check if task is available
List tasks = taskService.createTaskQuery()
.processInstanceId(processInstance.getId()).list();
assertEquals(1, tasks.size());
assertEquals("First task", tasks.get(0).getName());
assertEquals("fred", tasks.get(0).getAssignee());
// 6. Save process diagram to a file
InputStream processDiagram = repositoryService
.getProcessDiagram(processInstance.getProcessDefinitionId());
FileUtils.copyInputStreamToFile(processDiagram, new File("target/diagram.png"));
// 7. Save resulting BPMN xml to a file
InputStream processBpmn = repositoryService
.getResourceAsStream(deployment.getId(), "dynamic-model.bpmn");
FileUtils.copyInputStreamToFile(processBpmn,
new File("target/process.bpmn20.xml"));
}
開發者ID:v5developer,項目名稱:maven-framework-project,代碼行數:53,
示例9: testDynamicDeploy
點讚 2
import org.activiti.bpmn.model.Process; //導入方法依賴的package包/類
@Test
public void testDynamicDeploy() throws Exception {
String fakeGroup = "fakeGroup";
String procId = Workflow.PROCESS_ID_DOC_APPROVAL + "-" + fakeGroup;
// 1. Build up the model from scratch
BpmnModel model = new BpmnModel();
Process process = new Process();
model.addProcess(process);
process.setId(procId);
process.addFlowElement(createStartEvent());
//pub.addAttribute(createExpression("documentWorkflow.publish(execution)"));
//pub.setImplementation("${documentWorkflow.publish(execution)}");
// pub.setExtensionId(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE,
// BpmnXMLConstants.ATTRIBUTE_TASK_SERVICE_EXTENSIONID);
UserTask submitTask = new UserTask();
submitTask.setId("submitDocUserTask");
submitTask.setName("Submit Document for Approval");
process.addFlowElement(submitTask);
process.addFlowElement(createSequenceFlow("start", submitTask.getId()));
SubProcess sub = createSubProcess();
process.addFlowElement(sub);
process.addFlowElement(createSequenceFlow(submitTask.getId(), sub.getId()));
BoundaryEvent boundaryEvent = new BoundaryEvent();
boundaryEvent.setId("rejectedErrorBoundaryEvent");
boundaryEvent.setName("Rejected Error Event");
boundaryEvent.setAttachedToRef(sub);
ErrorEventDefinition errorDef = new ErrorEventDefinition();
errorDef.setErrorCode("errorDocRejected");
boundaryEvent.addEventDefinition(errorDef);
process.addFlowElement(boundaryEvent);
process.addFlowElement(createSequenceFlow(boundaryEvent.getId(), submitTask.getId(), "Rejected"));
ServiceTask pub = new ServiceTask();
pub.setId("publishDocServiceTask");
pub.setName("Publish Approved Document");
pub.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
pub.setImplementation("${documentWorkflow.publish(execution)}");
process.addFlowElement(pub);
process.addFlowElement(createSequenceFlow(sub.getId(), pub.getId()));
process.addFlowElement(createEndEvent());
process.addFlowElement(createSequenceFlow(pub.getId(), "end"));
// 2. Generate graphical information
new BpmnAutoLayout(model).execute();
// 3. Deploy the process to the engine
Deployment deployment = this.repositoryService.createDeployment()
.addBpmnModel("dynamic-model.bpmn", model).name("Dynamic process deployment")
.deploy();
// 4. Start a process instance
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(procId);
// 6. Save process diagram to a file
InputStream processDiagram = repositoryService.getProcessDiagram(processInstance.getProcessDefinitionId());
FileUtils.copyInputStreamToFile(processDiagram, new File("target/diagram.png"));
// 7. Save resulting BPMN xml to a file
InputStream processBpmn = repositoryService.getResourceAsStream(deployment.getId(), "dynamic-model.bpmn");
FileUtils.copyInputStreamToFile(processBpmn, new File("target/process.bpmn20.xml"));
}
開發者ID:v5developer,項目名稱:maven-framework-project,代碼行數:70,
注:本文中的org.activiti.bpmn.model.Process.setId方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。