/**
   * 增加树节点
   *
   * @see
   *     com.yunat.workflow.development.service.DevelopmentService#addZtreeNode(com.yunat.workflow.development.domain.Ztree)
   * @author: 邱路平 - [email protected]
   * @date: Created on Jun 28, 2013 3:33:41 PM
   */
  @Transactional
  public Ztree addZtreeNode(Ztree ztree) {
    ZtreeNode zn = new ZtreeNode();
    zn.setPid(ztree.getpId());
    if (ztree.getIsParent().equals("true")) {
      zn.setType("folder");
    } else {
      zn.setType(ztree.getName().substring(ztree.getName().lastIndexOf(".") + 1));
    }
    zn.setName(ztree.getName());
    zn.setId(UUID.randomUUID().toString().replace("-", ""));
    if (StringUtils.isEmpty(ztree.getTaskId())) {
      zn.setTask_id(zn.getId());
    } else {
      zn.setTask_id(ztree.getTaskId());
    }
    zn = ztreeNodeDAO.addZtreeNode(zn);

    Ztree zt = new Ztree();
    zt.setId(zn.getId());
    zt.setpId(zn.getPid());
    zt.setName(zn.getName());
    if (zn.getType().equals("folder")) {
      zt.setIsParent("true");
    } else {
      zt.setIsParent("false");
    }
    zt.setTaskId(zn.getTask_id());

    return zt;
  }
 /**
  * 查询树接口实现
  *
  * @see com.yunat.workflow.development.service.DevelopmentService#queryZtreeNodeList()
  * @author: 邱路平 - [email protected]
  * @date: Created on Jun 26, 2013 6:44:44 PM
  */
 @Transactional
 public List<Ztree> queryZtreeNode() {
   List<ZtreeNode> ztreeNodeList = ztreeNodeDAO.queryZtreeNodeList();
   List<Ztree> ztreeList = new ArrayList<Ztree>();
   for (ZtreeNode zn : ztreeNodeList) {
     Ztree zt = new Ztree();
     zt.setId(zn.getId());
     zt.setpId(zn.getPid());
     zt.setName(zn.getName());
     if (zn.getType().equals("folder")) {
       zt.setIsParent("true");
     } else {
       zt.setIsParent("false");
     }
     zt.setTaskId(zn.getTask_id());
     ztreeList.add(zt);
   }
   return ztreeList;
 }