本文整理汇总了Java中org.activiti.engine.impl.RepositoryServiceImpl.getDeployedProcessDefinition方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryServiceImpl.getDeployedProcessDefinition方法的具体用法?Java RepositoryServiceImpl.getDeployedProcessDefinition怎么用?Java RepositoryServiceImpl.getDeployedProcessDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.RepositoryServiceImpl
的用法示例。
在下文中一共展示了RepositoryServiceImpl.getDeployedProcessDefinition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testParseHandler
import org.activiti.engine.impl.RepositoryServiceImpl; //导入方法依赖的package包/类
@Test
@Deployment(resources = "chapter6/dynamic-form/leave.bpmn")
public void testParseHandler() throws Exception {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
assertEquals("请假流程-动态表单-被PRE解析器修改", processDefinition.getName());
assertEquals("leave-modified-by-post-parse-handler", processDefinition.getKey());
RepositoryServiceImpl repositoryServiceImpl = (RepositoryServiceImpl) repositoryService;
ReadOnlyProcessDefinition deployedProcessDefinition = repositoryServiceImpl
.getDeployedProcessDefinition(processDefinition.getId());
ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) deployedProcessDefinition;
List<ActivityImpl> activitiList = processDefinitionEntity.getActivities();//获得当前任务的所有节点
for (ActivityImpl activity : activitiList) {
System.out.println("Activity Name: " + activity.getProperty("name") + ", async=" + activity.isAsync());
}
InputStream processBpmn = activitiRule.getRepositoryService()
.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName());
String userHomeDir = getClass().getResource("/").getFile();
FileUtils.copyInputStreamToFile(processBpmn,
new File(userHomeDir + "/leave.bpmn20.xml"));
}
示例2: getActiveDocumentDiagram
import org.activiti.engine.impl.RepositoryServiceImpl; //导入方法依赖的package包/类
byte[] getActiveDocumentDiagram(String docId) throws IOException {
log.debug("getting active diagram for doc: " + docId);
//http://forums.activiti.org/content/process-diagram-highlighting-current-process
ProcessInstance pi =
runtimeService.createProcessInstanceQuery().processInstanceBusinessKey(docId).singleResult();
RepositoryServiceImpl impl = (RepositoryServiceImpl)repoSrvc;
ProcessDefinitionEntity pde = (ProcessDefinitionEntity) impl.getDeployedProcessDefinition(pi.getProcessDefinitionId());
BpmnModel bpmnModel = repoSrvc.getBpmnModel(pde.getId());
InputStream in = ProcessDiagramGenerator.generateDiagram(bpmnModel, "png", runtimeService.getActiveActivityIds(pi.getProcessInstanceId()));
byte[] bytes = IOUtils.toByteArray(in);
IOUtils.closeQuietly(in);
log.debug("Got bytes of size: " + bytes.length);
return bytes;
}
示例3: readActivityDatas
import org.activiti.engine.impl.RepositoryServiceImpl; //导入方法依赖的package包/类
/**
* 读取跟踪数据
*
* @param executionId
* @return
* @throws Exception
*/
@RequestMapping(value = "trace/data/{executionId}")
@ResponseBody
public List<Map<String, Object>> readActivityDatas(@PathVariable("executionId") String executionId) throws Exception {
ExecutionEntity executionEntity = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(executionId).singleResult();
List<String> activeActivityIds = runtimeService.getActiveActivityIds(executionId);
RepositoryServiceImpl repositoryServiceImpl = (RepositoryServiceImpl) repositoryService;
ReadOnlyProcessDefinition deployedProcessDefinition = repositoryServiceImpl
.getDeployedProcessDefinition(executionEntity.getProcessDefinitionId());
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) deployedProcessDefinition;
List<ActivityImpl> activitiList = processDefinition.getActivities();//获得当前任务的所有节点
List<Map<String, Object>> activityInfos = new ArrayList<Map<String, Object>>();
for (ActivityImpl activity : activitiList) {
ActivityBehavior activityBehavior = activity.getActivityBehavior();
boolean currentActiviti = false;
// 当前节点
String activityId = activity.getId();
if (activeActivityIds.contains(activityId)) {
currentActiviti = true;
}
Map<String, Object> activityImageInfo = packageSingleActivitiInfo(activity, executionEntity.getId(), currentActiviti);
activityInfos.add(activityImageInfo);
// 处理子流程
if (activityBehavior instanceof SubProcessActivityBehavior) {
List<ActivityImpl> innerActivityList = activity.getActivities();
for (ActivityImpl innerActivity : innerActivityList) {
String innerActivityId = innerActivity.getId();
if (activeActivityIds.contains(innerActivityId)) {
currentActiviti = true;
} else {
currentActiviti = false;
}
activityImageInfo = packageSingleActivitiInfo(innerActivity, executionEntity.getId(), currentActiviti);
activityInfos.add(activityImageInfo);
}
}
}
return activityInfos;
}
示例4: testDocApprovalFlow
import org.activiti.engine.impl.RepositoryServiceImpl; //导入方法依赖的package包/类
@Test
public void testDocApprovalFlow() throws InterruptedException, IOException {
setSpringSecurity("kermit");
Document doc = new Document();
doc.setGroupId("engineering");
doc.setCreatedDate(new Date());
doc.setTitle("title");
doc.setSummary("Summary");
doc.setContent("content");
doc.setAuthor("kermit");
String docId;
docId = documentService.createDocument(doc);
log.debug("new doc id: " + docId);
this.documentService.submitForApproval(docId);
setSpringSecurity("fozzie");
List<TaskForm> tasks = this.localTaskService.getTasks("fozzie");
assertTrue(tasks.size() == 1);
TaskForm currentTask = tasks.get(0);
log.debug("got task: " + tasks.get(0).getName());
//http://forums.activiti.org/content/process-diagram-highlighting-current-process
RepositoryServiceImpl impl = (RepositoryServiceImpl)repoSrvc;
ProcessDefinitionEntity pde = (ProcessDefinitionEntity) impl.getDeployedProcessDefinition(currentTask.getProcessDefinitionId());
BpmnModel bpmnModel = repoSrvc.getBpmnModel(pde.getId());
InputStream in = ProcessDiagramGenerator.generateDiagram(bpmnModel, "png", runtimeService.getActiveActivityIds(currentTask.getProcessInstanceId()));
FileUtils.copyInputStreamToFile(in, new File("target/current-diagram.png"));
localTaskService.approveTask(true, "task approved blah blah blah", tasks.get(0).getId());
HistoricProcessInstance pi = historyService.createHistoricProcessInstanceQuery().
includeProcessVariables().processInstanceBusinessKey(docId).singleResult();
assertNotNull(pi);
log.debug("Duration time in millis: " + pi.getDurationInMillis());
List<HistoricTaskInstance> hTasks;
hTasks = historyService.createHistoricTaskInstanceQuery().includeTaskLocalVariables().processInstanceBusinessKey(docId).list();
assertTrue(hTasks.size() == 2);
HistoricTaskInstance approval = hTasks.get(1);
Map<String, Object> vars = approval.getTaskLocalVariables();
List<Comment> comments = taskService.getTaskComments(approval.getId());
}