当前位置: 首页>>代码示例>>Java>>正文


Java RepositoryService.getProcessDefinition方法代码示例

本文整理汇总了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());
	}
	
}
 
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:19,代码来源:TestBPMN001.java

示例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();
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:26,代码来源:ProcessDefinitionService.java

示例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();
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:25,代码来源:ProcessDefinitionService.java

示例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.");
    }
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:27,代码来源:ProcessInstanceService.java

示例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";
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:28,代码来源:ModelerController.java

示例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;
    }
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:11,代码来源:ProcessDefinitionService.java


注:本文中的org.activiti.engine.RepositoryService.getProcessDefinition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。