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


Java ProcessDefinitionQuery类代码示例

本文整理汇总了Java中org.activiti.engine.repository.ProcessDefinitionQuery的典型用法代码示例。如果您正苦于以下问题:Java ProcessDefinitionQuery类的具体用法?Java ProcessDefinitionQuery怎么用?Java ProcessDefinitionQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProcessDefinitionQuery类属于org.activiti.engine.repository包,在下文中一共展示了ProcessDefinitionQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllDefinitions

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public List<WorkflowDefinition> getAllDefinitions()
{
    try 
    {
        ProcessDefinitionQuery query = repoService.createProcessDefinitionQuery();
        if(activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && !TenantUtil.isCurrentDomainDefault()) 
        {
            query.processDefinitionKeyLike("@" + TenantUtil.getCurrentDomain() + "%");
        }
        return getValidWorkflowDefinitions(query.list());
    } 
    catch (ActivitiException ae)
    {
        String msg = messageService.getMessage(ERR_GET_WORKFLOW_DEF);
        if(logger.isDebugEnabled())
        {
        	logger.debug(msg, ae);
        }
        throw new WorkflowException(msg, ae);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ActivitiWorkflowEngine.java

示例2: startProcess

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
public ProcessInstance startProcess(String userId, String processDefinitionKey, Map<String, Object> variables) {
    try {
        engine.getIdentityService().setAuthenticatedUserId(userId);
        // Get the last deployed version of the process and start a process instance
        ProcessDefinitionQuery query = engine.getRepositoryService()
            .createProcessDefinitionQuery()
            .processDefinitionKey(processDefinitionKey)
            .latestVersion();
        String processDefinitionId = query.singleResult().getId();
        ProcessInstance processInstance = engine.getRuntimeService().startProcessInstanceById(processDefinitionId, variables);
        return processInstance;
    } finally {
        // After the setAuthenticatedUserId() method is invoked, all Activiti service methods
        // executed within the current thread will have access to this userId. Just before
        // leaving the method, the userId is set to null, preventing other services from using
        // it unintentionally.
        engine.getIdentityService().setAuthenticatedUserId(null);
    }
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:20,代码来源:ActivitiFacade.java

示例3: getDefinitions

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public List<WorkflowDefinition> getDefinitions()
{
    try 
    {
        ProcessDefinitionQuery query = repoService.createProcessDefinitionQuery().latestVersion();
        if(activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && !TenantUtil.isCurrentDomainDefault()) 
        {
            query.processDefinitionKeyLike("@" + TenantUtil.getCurrentDomain() + "%");
        }
        return getValidWorkflowDefinitions(query.list());
    }
    catch (ActivitiException ae)
    {
        String msg = messageService.getMessage(ERR_GET_WORKFLOW_DEF);
        if(logger.isDebugEnabled())
        {
        	logger.debug(msg, ae);
        }
        throw new WorkflowException(msg, ae);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ActivitiWorkflowEngine.java

示例4: getProcessDefinition

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Override
public ProcessDefinition getProcessDefinition(String definitionId)
{
    ProcessDefinitionQuery query = activitiProcessEngine
            .getRepositoryService()
            .createProcessDefinitionQuery()
            .processDefinitionId(definitionId);
    
    if (tenantService.isEnabled() && deployWorkflowsInTenant) 
    {
        query.processDefinitionKeyLike("@" + TenantUtil.getCurrentDomain() + "@%");
    }
    
    org.activiti.engine.repository.ProcessDefinition processDefinition = query.singleResult();
    
    if (processDefinition == null) 
    {
        throw new EntityNotFoundException(definitionId); 
    }

    ProcessDefinition deploymentRest = createProcessDefinitionRest((ProcessDefinitionEntity) processDefinition);
    return deploymentRest;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:24,代码来源:ProcessDefinitionsImpl.java

示例5: readResource

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
/**
     * 读取流程资源
     *
     * @param processDefinitionId 流程定义ID
     * @param resourceName        资源名称
     */
    @GetMapping(value = "/{processDefinitionId}/resource/{resourceName}")
    public void readResource(@PathVariable String processDefinitionId
            , @PathVariable String resourceName, HttpServletResponse response)
            throws Exception {
        ProcessDefinitionQuery pdq = repositoryService.createProcessDefinitionQuery();
        ProcessDefinition pd = pdq.processDefinitionId(processDefinitionId).singleResult();

        // 通过接口读取
        InputStream resourceAsStream = repositoryService.getResourceAsStream(pd.getDeploymentId(), resourceName);
        StreamUtils.copy(resourceAsStream, response.getOutputStream());

//        // 输出资源内容到相应对象
//        byte[] b = new byte[1024];
//        int len = -1;
//        while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
//            response.getOutputStream().write(b, 0, len);
//        }
    }
 
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:25,代码来源:FlowableDeploymentController.java

示例6: processList

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
/**
 * 流程定义列表
 */
public Page<Object[]> processList(Page<Object[]> page, String category) {

    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
    		.latestVersion().orderByProcessDefinitionKey().asc();
    
    if (StringUtils.isNotEmpty(category)){
    	processDefinitionQuery.processDefinitionCategory(category);
	}
    
    page.setCount(processDefinitionQuery.count());
    
    List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage(page.getFirstResult(), page.getMaxResults());
    for (ProcessDefinition processDefinition : processDefinitionList) {
      String deploymentId = processDefinition.getDeploymentId();
      Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
      page.getList().add(new Object[]{processDefinition, deployment});
    }

	return page;
}
 
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:24,代码来源:ActProcessService.java

示例7: processList

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
/**
 * 获取流程列表
 * @param category 流程分类
 */
public Page<Object[]> processList(Page<Object[]> page, String category) {
	/*
	 * 保存两个对象,一个是ProcessDefinition(流程定义),一个是Deployment(流程部署)
	 */
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
    		.latestVersion().active().orderByProcessDefinitionKey().asc();
    
    if (StringUtils.isNotEmpty(category)){
    	processDefinitionQuery.processDefinitionCategory(category);
	}
    
    page.setCount(processDefinitionQuery.count());
    
    List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage(page.getFirstResult(), page.getMaxResults());
    for (ProcessDefinition processDefinition : processDefinitionList) {
      String deploymentId = processDefinition.getDeploymentId();
      Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
      page.getList().add(new Object[]{processDefinition, deployment});
    }
	return page;
}
 
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:26,代码来源:ActTaskService.java

示例8: getProcessDefList

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Override
public List<ProcessDefVo> getProcessDefList(QueryCondition condition, PageInfo pageInfo) {
    String name = null;
    if (condition != null)
        name = condition.getConditionMap().get("name").toString();
    List<ProcessDefinition> processDefList;
    long count;
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
    if (!StrUtil.isEmpty(name)) {
        query = query.processDefinitionName(name);
    }
    count = query.count();
    processDefList = query.orderByProcessDefinitionId().desc()
            .listPage((pageInfo.getPageNum() - 1) * pageInfo.getPageSize(), pageInfo.getPageSize());

    pageInfo.setCount((int) count);
    List<ProcessDefVo> retList = new ArrayList<>();
    for (ProcessDefinition processDefinition : processDefList) {
        ProcessDefinitionEntity entity = (ProcessDefinitionEntity) processDefinition;
        ProcessDefVo vo = new ProcessDefVo();
        BeanUtils.copyProperties(entity, vo);
        retList.add(vo);
    }

    return retList;
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:27,代码来源:RepositoryPageServiceImpl.java

示例9: getTaskDiagramById

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
public static byte[] getTaskDiagramById(String resourceId, String taskId) throws Exception {
	SysBpmnResourceVO resouce = loadResource(resourceId);
	Task task = getTaskById(taskId);
	if (null == task) {
		return null;
	}
	ProcessDefinitionQuery pdQuery = repositoryService
			.createProcessDefinitionQuery()
			.processDefinitionKey(resourceId);
	List<ProcessDefinition> pdList = pdQuery.deploymentId( resouce.getDeploymentId() ).list();
	byte data[] = null;
	for (ProcessDefinition pd : pdList) {
		List<ProcessInstance> piList = runtimeService.createProcessInstanceQuery()
				.processDefinitionId( pd.getId() )
				.list();
		for (ProcessInstance pi : piList) {
			if (pi.getProcessInstanceId().equals(task.getProcessInstanceId())) {					
				data = getDiagramByte(pi);
			}
		}
	}
	return data;
}
 
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:24,代码来源:BusinessProcessManagementUtils.java

示例10: queryProcessDefinition

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的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

示例11: readResource

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
/**
 * 读取流程资源
 *
 * @param processDefinitionId 流程定义ID
 * @param resourceName        资源名称
 */
@RequestMapping(value = "/read-resource")
public void readResource(@RequestParam("pdid") String processDefinitionId, @RequestParam("resourceName") String resourceName, HttpServletResponse response)
        throws Exception {
    ProcessDefinitionQuery pdq = repositoryService.createProcessDefinitionQuery();
    ProcessDefinition pd = pdq.processDefinitionId(processDefinitionId).singleResult();

    // 通过接口读取
    InputStream resourceAsStream = repositoryService.getResourceAsStream(pd.getDeploymentId(), resourceName);

    // 输出资源内容到相应对象
    byte[] b = new byte[1024];
    int len = -1;
    while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
        response.getOutputStream().write(b, 0, len);
    }
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:23,代码来源:DeploymentController.java

示例12: testInputStreamFromAbsoluteFilePath

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
/**
 * 从具体的文件中读取输入流部署
 */
@Test
public void testInputStreamFromAbsoluteFilePath() throws Exception {

    // 注意:读者根据自己的实际项目路径更改后验证
    String filePath = "/Users/henryyan/work/books/activiti-in-action-codes/bpmn20-example/src/test/resources/chapter5/userAndGroupInUserTask.bpmn";

    // 读取classpath的资源为一个输入流
    FileInputStream fileInputStream = new FileInputStream(filePath);
    repositoryService.createDeployment().addInputStream("userAndGroupInUserTask.bpmn", fileInputStream).deploy();

    // 验证是否部署成功
    ProcessDefinitionQuery pdq = repositoryService.createProcessDefinitionQuery();
    long count = pdq.processDefinitionKey("userAndGroupInUserTask").count();
    assertEquals(1, count);
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:19,代码来源:InputStreamDeploymentTest.java

示例13: readResource

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
/**
 * 读取流程资源
 *
 * @param processDefinitionId 流程定义ID
 * @param resourceName        资源名称
 */
@RequestMapping(value = "/read-resource")
public void readResource(@RequestParam("pdid") String processDefinitionId,
                         @RequestParam("resourceName") String resourceName, HttpServletResponse response)
        throws Exception {
    ProcessDefinitionQuery pdq = repositoryService.createProcessDefinitionQuery();
    ProcessDefinition pd = pdq.processDefinitionId(processDefinitionId).singleResult();

    // 通过接口读取
    InputStream resourceAsStream = repositoryService.getResourceAsStream(pd.getDeploymentId(), resourceName);

    // 输出资源内容到相应对象
    byte[] b = new byte[1024];
    int len;
    while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
        response.getOutputStream().write(b, 0, len);
    }
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:24,代码来源:DeploymentController.java

示例14: readResource

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
/**
 * 读取流程资源
 *
 * @param processDefinitionId 流程定义ID
 * @param resourceName        资源名称
 */
@RequestMapping(value = "/read-resource")
public void readResource(@RequestParam("pdid") String processDefinitionId,
                         @RequestParam("resourceName") String resourceName, HttpServletResponse response)
        throws Exception {
    ProcessDefinitionQuery pdq = repositoryService.createProcessDefinitionQuery();
    ProcessDefinition pd = pdq.processDefinitionId(processDefinitionId).singleResult();

    // 通过接口读取
    InputStream resourceAsStream = repositoryService.getResourceAsStream(pd.getDeploymentId(), resourceName);

    // 输出资源内容到相应对象
    byte[] b = new byte[1024];
    int len = -1;
    while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
        response.getOutputStream().write(b, 0, len);
    }
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:24,代码来源:DeploymentController.java

示例15: testGetProcessDefinitionById

import org.activiti.engine.repository.ProcessDefinitionQuery; //导入依赖的package包/类
@Test
public void testGetProcessDefinitionById()
{
    String processDefinitionId = "processDefinitionId";
    ProcessDefinitionQuery processDefinitionQuery = mock(ProcessDefinitionQuery.class);
    when(activitiRepositoryService.createProcessDefinitionQuery()).thenReturn(processDefinitionQuery);
    when(processDefinitionQuery.processDefinitionId(processDefinitionId)).thenReturn(processDefinitionQuery);
    ProcessDefinition expectedProcessDefinition = mock(ProcessDefinition.class);
    when(processDefinitionQuery.singleResult()).thenReturn(expectedProcessDefinition);
    ProcessDefinition actualProcessDefinition = activitiService.getProcessDefinitionById(processDefinitionId);
    assertSame(expectedProcessDefinition, actualProcessDefinition);
    InOrder inOrder = inOrder(processDefinitionQuery);
    inOrder.verify(processDefinitionQuery).processDefinitionId(processDefinitionId);
    inOrder.verify(processDefinitionQuery).singleResult();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:17,代码来源:ActivitiServiceTest.java


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