/**
   * <br>
   * Created on: 2013-11-12 下午03:53:46
   *
   * @return
   */
  public List<ViewTreeResourceRote> getAllTreeNodes() {
    String hql = "from TbResourceRote";
    List<TbResourceRote> list = resourceRoteDao.find(hql, null);
    List<ViewTreeResourceRote> vList = new ArrayList<ViewTreeResourceRote>();
    if (!DataTools.isEmpty(list))
      for (TbResourceRote t : list) {
        ViewTreeResourceRote vm = new ViewTreeResourceRote();
        BeanUtils.copyProperties(t, vm);
        vm.setId(t.getNmResourceRoteid());
        TbResourceRote st = t.getTbResourceRote();
        if (!DataTools.isEmpty(st)) vm.setIntPRRId(st.getNmResourceRoteid());

        setAttributes(t, vm);
        vList.add(vm);
      }

    return vList;
  }
  /**
   * <br>
   * Created on: 2013-11-12 下午03:39:25
   */
  private void setSpendingList() {
    String vcNote = "賬單列表";
    TbResourceRote rote = getRoteByNote(vcNote, true);

    if (DataTools.isEmpty(rote)) {
      rote = new TbResourceRote();
      rote.setVcNote(vcNote);
    }

    vcNote = DateTools.getParseDateToStr(DateTools.getCurrentDate(), DateTools.YYYY_MM);

    TbResourceRote subRote = getRoteByNote(vcNote, false);
    if (DataTools.isEmpty(subRote)) {
      subRote = new TbResourceRote();
      subRote.setVcNote(vcNote);
    }

    String vcRotePage = getVcRotePage();
    subRote.setVcNote(vcNote);
    subRote.setVcRotePage(vcRotePage);
    subRote.setTbResourceRote(rote);

    addResourceRote(subRote);
  }
  /**
   * <br>
   * Created on: 2013-11-12 下午03:39:40
   */
  private void setSpendingSystem() {
    String vcNote = "系統管理";
    TbResourceRote rote = getRoteByNote(vcNote, true);

    if (DataTools.isEmpty(rote)) {
      rote = new TbResourceRote();
      rote.setVcNote(vcNote);
    }

    vcNote = "收支項目";
    TbResourceRote subRote = getRoteByNote(vcNote, false);
    if (DataTools.isEmpty(subRote)) {
      subRote = new TbResourceRote();
      subRote.setVcNote(vcNote);
    }

    String vcRotePage = "/system/spending.jsp";
    subRote.setVcNote(vcNote);
    subRote.setVcRotePage(vcRotePage);
    subRote.setTbResourceRote(rote);

    addResourceRote(subRote);

    vcNote = "錢包管理";
    subRote = getRoteByNote(vcNote, false);
    if (DataTools.isEmpty(subRote)) {
      subRote = new TbResourceRote();
      subRote.setVcNote(vcNote);
    }

    vcRotePage = "/system/dielectric.jsp";
    subRote.setVcNote(vcNote);
    subRote.setVcRotePage(vcRotePage);
    subRote.setTbResourceRote(rote);

    addResourceRote(subRote);
  }
  /**
   * <br>
   * Created on: 2013-11-12 下午03:57:16
   *
   * @param t
   * @param vm
   */
  private void setAttributes(TbResourceRote t, ViewTreeResourceRote vm) {
    Map<String, Object> attributes = new HashMap<String, Object>();
    attributes.put("vcUrl", t.getVcRotePage());

    vm.setAttributes(attributes);
  }