您的位置:首页 > 产品设计 > 产品经理

BPMN-Activiti信号中间件实例

2016-08-16 15:17 239 查看
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();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: