activiti model部署流程问题

初识activiti,整合了网页设计器,如图:
图片说明
在某个用户任务上配置了监听:图片说明
保存文件后,model数据中是有taskListeners节点的:图片说明
然后使用model部署流程,代码如下

 @Override
    @Transactional
    /*
     * 根据模型部署流程
     * */
    public Boolean deployProcessByModel(String modelId, String deptWithProcessKeyId, LoginInfo loginInfo) {

        RepositoryService repositoryService = processEngineUtile.getProcessEngine().getRepositoryService();
//      DeploymentBuilder deployment = repositoryService.createDeployment();
//      BpmnModel bpmnModel = getBpmnModel();
//      deployment.addBpmnModel("test", bpmnModel).deploy();

        // 部署流程
        DepartmentWithProcessEntity entity=departmentWithProcessRepository
                .get(DepartmentWithProcessEntity.class, deptWithProcessKeyId);
        String title=departmentWithProcessRepository.getProcessDeplyTitle(deptWithProcessKeyId);
        String deploymentid="";
        try {
            Model modelData=repositoryService.getModel(modelId);
//          ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
            byte[] bpmnBytes = null;
            JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelId));
            BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
            BpmnModel model = jsonConverter.convertToBpmnModel(editorNode);
//          filename = model.getMainProcess().getId() + ".bpmn20.xml";
//            BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
            bpmnBytes = new BpmnXMLConverter().convertToXML(model);
            String encoded = Base64.getEncoder().encodeToString(bpmnBytes);
            byte[] decoded = Base64.getDecoder().decode(encoded);
            String xml=new String(decoded);
            String processName = modelData.getName() + ".bpmn20.xml";
            ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
            Deployment deployment = repositoryService.createDeployment().name(title)
                    .addInputStream(processName, in).deploy();
            deploymentid = deployment.getId();
        } catch (Exception e) {
            System.out.println(e);
        }
        Assert.isTrue(!StringUtils.isEmpty(deploymentid), "流程部署出错");
        ProcessDefinition processDefinition=  repositoryService
        .createProcessDefinitionQuery()
        .deploymentId(deploymentid)
        .singleResult();
        //更新部门流程关系表
        entity.setProcessDefinitionId(deploymentid);
        departmentWithProcessRepository.update(entity);
        //部署历史表
        List<DeployHistoryEntity> deployHistoryEntities = deployHistoryRepository.getDeployHistoryByDeptWithProcessKeyId(deptWithProcessKeyId);
        for (DeployHistoryEntity deployHistoryEntity : deployHistoryEntities) {
            if (deployHistoryEntity.getModelKeyid().equals(modelId)) {
                deployHistoryEntity.setDeploy(true);
            }else {
                deployHistoryEntity.setDeploy(false);
            }
            deployHistoryRepository.update(deployHistoryEntity);
        }
        return true;
    }

editorNode变量值拷贝出来,还是可以看到taskListeners,转成bpmn后,复制出来监听部分的节点就没有了。图片说明,很迷惘,activiti版本号5.22。整合过这个设计器的没有看到谁有这个问题,但是又不知道自己错在哪里,目前只能定位到model转bpmn的时候监听丢失了。希望知道的哥哥姐姐解答一下疑惑,或远程帮助一下,不胜感激!!!

u013811335
宽广 回复兽兽尊上: 解决了,重写一部分源码,https://www.cnblogs.com/rolayblog/p/10444866.html是我园子写的博客,可以参考
大约一年之前 回复
qq_30579779
兽兽尊上 请问大神解决了吗
大约一年之前 回复

1个回答

自己通过查看修改源码已经处理

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐