BPMN-Activiti信号中间件实例

BPM流程图如下:


        ExecutionService executionService=bpmProcessService.bpmRestServices(userId).getExecutionService();
        String parentId="";
        //
        HistoricProcessInstancesQueryParam historicProcessInstancesQueryParam = new HistoricProcessInstancesQueryParam();
        historicProcessInstancesQueryParam.setBusinessKey(bussinessKey);
        try {
            JsonNode jsonNode = (JsonNode) bpmProcessService.bpmRestServices(userId).getHistoryService().getHistoricProcessInstances(historicProcessInstancesQueryParam);
            logger.debug(jsonNode.toString());
            ArrayNode node = BaseUtils.getData(jsonNode);
            List<HistoricProcessInstanceResponse> list = new ArrayList<HistoricProcessInstanceResponse>();

            for (int i = 0; node != null && i < node.size(); i++) {
                JsonNode jn = node.get(i);
                HistoricProcessInstanceResponse resp = jsonResultService.toObject(jn.toString(), HistoricProcessInstanceResponse.class);
                list.add(resp);
                parentId=resp.getId();
                logger.debug("parentId:"+parentId);
            }

        } catch (RestException e) {
            logger.error(e.getMessage(),e);
        }

//        ProcessInstanceParam processInstanceParam = new ProcessInstanceParam();
//        processInstanceParam.setBusinessKey(bussinessKey);
//        try {
//            Object obj = bpmProcessService.bpmRestServices(userId).getRuntimeService().getProcessInstances(processInstanceParam);
//            logger.debug(obj.toString());
//        } catch (RestException e) {
//            e.printStackTrace();
//        }
        //---

        String executionId="";
        try {
            ExecutionQueryParam executionQueryParam=new ExecutionQueryParam();
//            executionQueryParam.setActivityId("CatchSignalEvent1");
            executionQueryParam.setParentId(parentId);//"a0f4ec59-62bf-11e6-9214-b8aeed2e916b"
            JsonNode executionsJsonNode = (JsonNode)executionService.getExecutions(executionQueryParam);
            logger.debug(executionsJsonNode.toString());
            ArrayNode node = BaseUtils.getData(executionsJsonNode);
            List<ExecutionResponse> list = new ArrayList<ExecutionResponse>();
            for (int i = 0; node != null && i < node.size(); i++) {
                JsonNode jn = node.get(i);
                ExecutionResponse resp = jsonResultService.toObject(jn.toString(), ExecutionResponse.class);
                list.add(resp);
                executionId=resp.getId();
                logger.debug("parentId:"+parentId);
            }
        } catch (RestException e) {
            e.printStackTrace();
        }
        //---

        ExecutionParam executionParam = new ExecutionParam();
        executionParam.setAction(ExecutionParam.SIGNAL_ACTION);
        executionParam.setSignalName(signal);
        try {
            executionService.actionExecutions(executionId,executionParam);//"743233f1-62ad-11e6-9214-b8aeed2e916b"
        } catch (RestException e) {
            e.printStackTrace();
        }
    }

转载于:https://www.cnblogs.com/gson/p/6171920.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值