Java Code Examples for org.activiti.engine.impl.pvm.process.ActivityImpl#getActivities()

The following examples show how to use org.activiti.engine.impl.pvm.process.ActivityImpl#getActivities() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcessInstanceHighlightsResource.java    From hsweb-framework with Apache License 2.0 5 votes vote down vote up
/**
 * getBoundaryEventOutgoingTransitions
 *
 * @param activity
 * @return
 */
private List<PvmTransition> getBoundaryEventOutgoingTransitions(ActivityImpl activity) {
    List<PvmTransition> boundaryTrans = new ArrayList<PvmTransition>();
    for (ActivityImpl subActivity : activity.getActivities()) {
        String type = (String) subActivity.getProperty("type");
        if (type != null && type.toLowerCase().indexOf("boundary") >= 0) {
            boundaryTrans.addAll(subActivity.getOutgoingTransitions());
        }
    }
    return boundaryTrans;
}
 
Example 2
Source File: ScopeUtil.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
public static ActivityImpl findInParentScopesByBehaviorType(ActivityImpl activity, Class<? extends ActivityBehavior> behaviorType) {
    while (activity != null) {
        for (ActivityImpl childActivity : activity.getActivities()) {
            if (behaviorType.isAssignableFrom(childActivity.getActivityBehavior().getClass())) {
                return childActivity;
            }
        }
        activity = activity.getParentActivity();
    }
    return null;
}
 
Example 3
Source File: TraceProcessController.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
/**
 * 读取跟踪数据
 *
 * @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;
}
 
Example 4
Source File: TraceProcessController.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
/**
 * 读取跟踪数据
 *
 * @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;
}
 
Example 5
Source File: TraceProcessController.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
/**
 * 读取跟踪数据
 *
 * @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;
}
 
Example 6
Source File: TraceProcessController.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
/**
 * 读取跟踪数据
 *
 * @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;
}
 
Example 7
Source File: TraceProcessController.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
/**
 * 读取跟踪数据
 *
 * @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;
}