本文整理汇总了Java中org.activiti.engine.RepositoryService.getProcessDefinition方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryService.getProcessDefinition方法的具体用法?Java RepositoryService.getProcessDefinition怎么用?Java RepositoryService.getProcessDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.RepositoryService
的用法示例。
在下文中一共展示了RepositoryService.getProcessDefinition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryProcessDefinition
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
@Test
public void queryProcessDefinition() throws Exception {
RepositoryService repositoryService = (RepositoryService) AppContext.getBean("repositoryService");
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
List<ProcessDefinition> processDefs = processDefinitionQuery
.processDefinitionKey("Employee360DegreeFeedbackProjectPublishProcess")
.orderByProcessDefinitionVersion()
.desc()
.list();
for (ProcessDefinition pd : processDefs) {
System.out.println( pd.getId() + " , " + pd.getName() + " , "
+ pd.getKey() + " , " + pd.getVersion() );
ProcessDefinitionImpl pdObj = (ProcessDefinitionImpl)repositoryService.getProcessDefinition(pd.getId());
System.out.println(pdObj.getActivities());
}
}
示例2: activateProcessDefinition
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
/**
* This method will activate the given process definition
*
* @param processDefinitionId Process definition id
* @param processDefinitionActionRequest Process definition activate request
* @return Successfully activated then HTTP Response Code 200
* If already activated then HTTP Response Code 409
* If process definition is not found then HTTP Response Code 404
*/
protected Response activateProcessDefinition(String processDefinitionId,
ProcessDefinitionActionRequest processDefinitionActionRequest) {
RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId);
if (processDefinition != null) {
if (!processDefinition.isSuspended()) {
return Response.status(HttpStatus.SC_CONFLICT).build();
}
repositoryService.activateProcessDefinitionById(processDefinition.getId(),
processDefinitionActionRequest.isIncludeProcessInstances(),
processDefinitionActionRequest.getDate());
return Response.ok().build();
}
return Response.status(HttpStatus.SC_NOT_FOUND).build();
}
示例3: suspendProcessDefinition
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
/**
* This method will suspend the given process definition
*
* @param processDefinitionId Process definition id
* @param processDefinitionActionRequest Process definition suspend request
* @return Successfully suspended then HTTP Response Code 200
* If already suspended then HTTP Response Code 409
* If process definition is not found then HTTP Response Code 404
*/
protected Response suspendProcessDefinition(String processDefinitionId,
ProcessDefinitionActionRequest processDefinitionActionRequest) {
RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId);
if (processDefinition != null) {
if (processDefinition.isSuspended()) {
return Response.status(HttpStatus.SC_CONFLICT).build();
}
repositoryService.suspendProcessDefinitionById(processDefinition.getId(),
processDefinitionActionRequest.isIncludeProcessInstances(),
processDefinitionActionRequest.getDate());
return Response.ok().build();
}
return Response.status(HttpStatus.SC_NOT_FOUND).build();
}
示例4: getProcessInstanceDiagram
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
@GET
@Path("/{processInstanceId}/diagram")
@Produces(MediaType.APPLICATION_JSON)
public Response getProcessInstanceDiagram(@PathParam("processInstanceId") String processInstanceId) {
ProcessInstance processInstance = getProcessInstanceFromRequest(processInstanceId);
RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
ProcessDefinition pde = repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());
if (pde != null && pde.hasGraphicalNotation()) {
RuntimeService runtimeService = BPMNOSGIService.getRuntimeService();
InputStream diagramStream = new DefaultProcessDiagramGenerator().generateDiagram(repositoryService
.getBpmnModel(pde.getId()), "png",
runtimeService.getActiveActivityIds(processInstanceId));
try {
return Response.ok().type("image/png").entity(IOUtils.toByteArray(diagramStream)).build();
} catch (Exception e) {
throw new ActivitiIllegalArgumentException("Error exporting diagram", e);
}
} else {
throw new ActivitiIllegalArgumentException("Process instance with id '" + processInstance.getId()
+ "' has no graphical notation defined.");
}
}
示例5: xml2json
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
@RequestMapping("xml2json")
public String xml2json(
@RequestParam("processDefinitionId") String processDefinitionId)
throws Exception {
RepositoryService repositoryService = processEngine
.getRepositoryService();
ProcessDefinition processDefinition = repositoryService
.getProcessDefinition(processDefinitionId);
Model model = repositoryService.newModel();
model.setName(processDefinition.getName());
model.setDeploymentId(processDefinition.getDeploymentId());
repositoryService.saveModel(model);
BpmnModel bpmnModel = repositoryService
.getBpmnModel(processDefinitionId);
ObjectNode objectNode = new BpmnJsonConverter()
.convertToJson(bpmnModel);
String json = objectNode.toString();
repositoryService.addModelEditorSource(model.getId(),
json.getBytes("utf-8"));
return "redirect:/modeler/modeler-list.do";
}
示例6: getProcessDefinitionFromRequest
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
private ProcessDefinition getProcessDefinitionFromRequest(String processDefinitionId) {
RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiObjectNotFoundException("Could not find a process definition with id '" + processDefinitionId + "'.", ProcessDefinition.class);
}
return processDefinition;
}