@SuppressWarnings("unchecked")
 @Override
 public String inportFlowbase(String flowBaseXml) {
   ByteArrayInputStream bais;
   try {
     bais = new ByteArrayInputStream(flowBaseXml.getBytes("UTF-8"));
     SAXBuilder saxBuilder = new SAXBuilder();
     Document doc = saxBuilder.build(bais);
     Element root = doc.getRootElement();
     Flowbase flowbase = XmlUtil.getBeanByElement(root, Flowbase.class);
     flowbase.setFlowName(flowbase.getFlowName() + "-副本");
     this.flowbaseDao.save(flowbase);
     List<Element> nodeList = root.getChildren("flownode");
     this.flownodeService.importFlowNode(flowbase.getId(), nodeList);
     // TODO 未完成
     return flowbase.getId();
   } catch (UnsupportedEncodingException e) {
     log.error(
         this.getClass().getSimpleName() + " e==> inportFlowbase,UnsupportedEncodingException", e);
     throw new BpmException("bpm003", "导入流程失败");
   } catch (JDOMException e) {
     log.error(this.getClass().getSimpleName() + " e==> inportFlowbase,JDOMException", e);
     throw new BpmException("bpm003", "导入流程失败");
   } catch (IOException e) {
     log.error(this.getClass().getSimpleName() + " e==> inportFlowbase,IOException", e);
     throw new BpmException("bpm003", "导入流程失败");
   }
 }
 @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");
     }
   }
 }