• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java NativeExecutionQuery类的典型用法和代码示例

java 2次浏览

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

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

示例1: createNativeExecutionQuery

点赞 2

import org.activiti.engine.runtime.NativeExecutionQuery; //导入依赖的package包/类
@Override
public NativeExecutionQuery createNativeExecutionQuery() {
    return new NativeExecutionQueryImpl(commandExecutor);
}
 

开发者ID:flowable,
项目名称:flowable-engine,
代码行数:5,
代码来源:RuntimeServiceImpl.java

示例2: list

点赞 2

import org.activiti.engine.runtime.NativeExecutionQuery; //导入依赖的package包/类
/**
 * 用户参与过的流程
 *
 * @return
 */
@RequestMapping("execution/list")
public ModelAndView list(HttpServletRequest request) {
    ModelAndView mav = new ModelAndView("chapter13/execution-list");
/* 标准查询
List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().list();
List<Execution> list = runtimeService.createExecutionQuery().list();
mav.addObject("list", list);
*/

    User user = UserUtil.getUserFromSession(request.getSession());
    Page<Execution> page = new Page<Execution>(PageUtil.PAGE_SIZE);
    int[] pageParams = PageUtil.init(page, request);
    NativeExecutionQuery nativeExecutionQuery = runtimeService.createNativeExecutionQuery();

    // native query
    String sql = "select RES.* from ACT_RU_EXECUTION RES left join ACT_HI_TASKINST ART on ART.PROC_INST_ID_ = RES.PROC_INST_ID_ "
            + " where ART.ASSIGNEE_ = #{userId} and ACT_ID_ is not null and IS_ACTIVE_ = 'TRUE' order by START_TIME_ desc";

    nativeExecutionQuery.parameter("userId", user.getId());

    List<Execution> executionList = nativeExecutionQuery.sql(sql).listPage(pageParams[0], pageParams[1]);

    // 查询流程定义对象
    Map<String, ProcessDefinition> definitionMap = new HashMap<String, ProcessDefinition>();

    // 任务的英文-中文对照
    Map<String, Task> taskMap = new HashMap<String, Task>();

    // 每个Execution的当前活动ID,可能为多个
    Map<String, List<String>> currentActivityMap = new HashMap<String, List<String>>();

    // 设置每个Execution对象的当前活动节点
    for (Execution execution : executionList) {
        ExecutionEntity executionEntity = (ExecutionEntity) execution;
        String processInstanceId = executionEntity.getProcessInstanceId();
        String processDefinitionId = executionEntity.getProcessDefinitionId();

        // 缓存ProcessDefinition对象到Map集合
        definitionCache(definitionMap, processDefinitionId);

        // 查询当前流程的所有处于活动状态的活动ID,如果并行的活动则会有多个
        List<String> activeActivityIds = runtimeService.getActiveActivityIds(execution.getId());
        currentActivityMap.put(execution.getId(), activeActivityIds);

        for (String activityId : activeActivityIds) {

            // 查询处于活动状态的任务
            Task task = taskService.createTaskQuery().taskDefinitionKey(activityId).executionId(execution.getId()).singleResult();

            // 调用活动
            if (task == null) {
                ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
                        .superProcessInstanceId(processInstanceId).singleResult();
                task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult();
                definitionCache(definitionMap, processInstance.getProcessDefinitionId());
            }
            taskMap.put(activityId, task);
        }
    }

    mav.addObject("taskMap", taskMap);
    mav.addObject("definitions", definitionMap);
    mav.addObject("currentActivityMap", currentActivityMap);

    page.setResult(executionList);
    page.setTotalCount(nativeExecutionQuery.sql("select count(*) from (" + sql + ")").count());
    mav.addObject("page", page);

    return mav;
}
 

开发者ID:shawn-gogh,
项目名称:myjavacode,
代码行数:76,
代码来源:ExecutionController.java

示例3: list

点赞 2

import org.activiti.engine.runtime.NativeExecutionQuery; //导入依赖的package包/类
/**
 * 用户参与过的流程
 *
 * @return
 */
@RequestMapping("execution/list")
public ModelAndView list(HttpServletRequest request) {
    ModelAndView mav = new ModelAndView("chapter13/execution-list");
/* 标准查询
List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().list();
List<Execution> list = runtimeService.createExecutionQuery().list();
mav.addObject("list", list);
*/

    User user = UserUtil.getUserFromSession(request.getSession());
    Page<Execution> page = new Page<Execution>(PageUtil.PAGE_SIZE);
    int[] pageParams = PageUtil.init(page, request);
    NativeExecutionQuery nativeExecutionQuery = runtimeService.createNativeExecutionQuery();

    // native query
    String sql = "select RES.* from ACT_RU_EXECUTION RES left join ACT_HI_TASKINST ART on ART.PROC_INST_ID_ = RES.PROC_INST_ID_ "
            + " where SUSPENSION_STATE_ = '1' and ART.ASSIGNEE_ = #{userId} and ACT_ID_ is not null and IS_ACTIVE_ = 'TRUE' order by START_TIME_ desc";

    nativeExecutionQuery.parameter("userId", user.getId());

    List<Execution> executionList = nativeExecutionQuery.sql(sql).listPage(pageParams[0], pageParams[1]);

    // 查询流程定义对象
    Map<String, ProcessDefinition> definitionMap = new HashMap<String, ProcessDefinition>();

    // 任务的英文-中文对照
    Map<String, Task> taskMap = new HashMap<String, Task>();

    // 每个Execution的当前活动ID,可能为多个
    Map<String, List<String>> currentActivityMap = new HashMap<String, List<String>>();

    // 设置每个Execution对象的当前活动节点
    for (Execution execution : executionList) {
        ExecutionEntity executionEntity = (ExecutionEntity) execution;
        String processInstanceId = executionEntity.getProcessInstanceId();
        String processDefinitionId = executionEntity.getProcessDefinitionId();

        // 缓存ProcessDefinition对象到Map集合
        definitionCache(definitionMap, processDefinitionId);

        // 查询当前流程的所有处于活动状态的活动ID,如果并行的活动则会有多个
        List<String> activeActivityIds = runtimeService.getActiveActivityIds(execution.getId());
        currentActivityMap.put(execution.getId(), activeActivityIds);

        for (String activityId : activeActivityIds) {

            // 查询处于活动状态的任务
            Task task = taskService.createTaskQuery().taskDefinitionKey(activityId).executionId(execution.getId()).singleResult();

            // 调用活动
            if (task == null) {
                ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
                        .superProcessInstanceId(processInstanceId).singleResult();
                if (processInstance != null) {
                    task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult();
                    definitionCache(definitionMap, processInstance.getProcessDefinitionId());
                }
            }
            taskMap.put(activityId, task);
        }
    }

    mav.addObject("taskMap", taskMap);
    mav.addObject("definitions", definitionMap);
    mav.addObject("currentActivityMap", currentActivityMap);

    page.setResult(executionList);
    page.setTotalCount(nativeExecutionQuery.sql("select count(*) from (" + sql + ")").count());
    mav.addObject("page", page);

    return mav;
}
 

开发者ID:shawn-gogh,
项目名称:myjavacode,
代码行数:78,
代码来源:ExecutionController.java

示例4: list

点赞 2

import org.activiti.engine.runtime.NativeExecutionQuery; //导入依赖的package包/类
/**
 * 用户参与过的流程
 *
 * @return
 */
@RequestMapping("execution/list")
public ModelAndView list(HttpServletRequest request) {
    ModelAndView mav = new ModelAndView("chapter13/execution-list");
/* 标准查询
List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().list();
List<Execution> list = runtimeService.createExecutionQuery().list();
mav.addObject("list", list);
*/

    User user = UserUtil.getUserFromSession(request.getSession());
    Page<Execution> page = new Page<Execution>(PageUtil.PAGE_SIZE);
    int[] pageParams = PageUtil.init(page, request);
    NativeExecutionQuery nativeExecutionQuery = runtimeService.createNativeExecutionQuery();

    // native query
    String sql = "select distinct * from (select RES.* from ACT_RU_EXECUTION RES left join ACT_HI_TASKINST ART on ART.PROC_INST_ID_ = RES.PROC_INST_ID_ "
            + " left join ACT_HI_PROCINST AHP on AHP.PROC_INST_ID_ = RES.PROC_INST_ID_ "
            + " where SUSPENSION_STATE_ = '1' and (ART.ASSIGNEE_ = #{userId} or AHP.START_USER_ID_ = #{userId}) "
            + " and ACT_ID_ is not null and IS_ACTIVE_ = 'TRUE' order by ART.START_TIME_ desc)";

    nativeExecutionQuery.parameter("userId", user.getId());

    List<Execution> executionList = nativeExecutionQuery.sql(sql).listPage(pageParams[0], pageParams[1]);

    // 查询流程定义对象
    Map<String, ProcessDefinition> definitionMap = new HashMap<String, ProcessDefinition>();

    // 任务的英文-中文对照
    Map<String, Task> taskMap = new HashMap<String, Task>();

    // 每个Execution的当前活动ID,可能为多个
    Map<String, List<String>> currentActivityMap = new HashMap<String, List<String>>();

    // 设置每个Execution对象的当前活动节点
    for (Execution execution : executionList) {
        ExecutionEntity executionEntity = (ExecutionEntity) execution;
        String processInstanceId = executionEntity.getProcessInstanceId();
        String processDefinitionId = executionEntity.getProcessDefinitionId();

        // 缓存ProcessDefinition对象到Map集合
        definitionCache(definitionMap, processDefinitionId);

        // 查询当前流程的所有处于活动状态的活动ID,如果并行的活动则会有多个
        List<String> activeActivityIds = runtimeService.getActiveActivityIds(execution.getId());
        currentActivityMap.put(execution.getId(), activeActivityIds);

        for (String activityId : activeActivityIds) {

            // 查询处于活动状态的任务
            Task task = taskService.createTaskQuery().taskDefinitionKey(activityId).executionId(execution.getId()).singleResult();

            // 调用活动
            if (task == null) {
                ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
                        .superProcessInstanceId(processInstanceId).singleResult();
                if (processInstance != null) {
                    task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult();
                    definitionCache(definitionMap, processInstance.getProcessDefinitionId());
                }
            }
            taskMap.put(activityId, task);
        }
    }

    mav.addObject("taskMap", taskMap);
    mav.addObject("definitions", definitionMap);
    mav.addObject("currentActivityMap", currentActivityMap);

    page.setResult(executionList);
    page.setTotalCount(nativeExecutionQuery.sql("select count(*) from (" + sql + ")").count());
    mav.addObject("page", page);

    return mav;
}
 

开发者ID:shawn-gogh,
项目名称:myjavacode,
代码行数:80,
代码来源:ExecutionController.java

示例5: createNativeExecutionQuery

点赞 2

import org.activiti.engine.runtime.NativeExecutionQuery; //导入依赖的package包/类
public NativeExecutionQuery createNativeExecutionQuery() {
  return new NativeExecutionQueryImpl(commandExecutor);
}
 

开发者ID:springvelocity,
项目名称:xbpm5,
代码行数:4,
代码来源:RuntimeServiceImpl.java

示例6: createNativeExecutionQuery

点赞 1

import org.activiti.engine.runtime.NativeExecutionQuery; //导入依赖的package包/类
/**
 * creates a new {@link NativeExecutionQuery} to query {@link Execution}s by SQL directly
 */
NativeExecutionQuery createNativeExecutionQuery();
 

开发者ID:flowable,
项目名称:flowable-engine,
代码行数:5,
代码来源:RuntimeService.java

示例7: createNativeExecutionQuery

点赞 1

import org.activiti.engine.runtime.NativeExecutionQuery; //导入依赖的package包/类
/**
 * creates a new {@link NativeExecutionQuery} to query {@link Execution}s
 * by SQL directly
 */
NativeExecutionQuery createNativeExecutionQuery();
 

开发者ID:springvelocity,
项目名称:xbpm5,
代码行数:6,
代码来源:RuntimeService.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)