コード例 #1
0
 @Override
 public String exportFlowbase(String flowbaseId) {
   Flowbase flowbase = flowbaseDao.getById(flowbaseId);
   if (flowbase == null) {
     log.warn(
         this.getClass().getSimpleName()
             + " w==> exportFlowbase, can not find flowbase by Id:["
             + flowbaseId
             + "]");
     throw new BpmException("bpm004", "导出流程失败,流程不存在");
   } else {
     Document doc = new Document();
     Element element = XmlUtil.getElementByBean(flowbase);
     if (element == null) {
       log.error(
           this.getClass().getSimpleName()
               + " e==> exportFlowbase,getElementByBean return null,flowbaseId:["
               + flowbaseId
               + "]");
       throw new BpmException("bpm005", "导出流程失败,流程为空");
     }
     element.addContent(flownodeService.exportFlowNodeElement(flowbaseId));
     // TODO 添加导出出口link功能
     doc.setRootElement(element);
     StringWriter sw = new StringWriter();
     XMLOutputter outp = new XMLOutputter();
     try {
       outp.output(doc, sw);
       return sw.toString();
     } catch (IOException e) {
       log.error(
           this.getClass().getSimpleName()
               + " e==> exportFlowbase,IOException,flowbaseId:["
               + flowbaseId
               + "]",
           e);
       throw new BpmException("bpm006", "导出流程失败,IOException");
     }
   }
 }