Exemplo n.º 1
0
  /**
   * 终端命令菜单
   *
   * @return
   */
  private String terminalCommandMenuJson() {
    JSONArray jsonArray = new JSONArray();
    for (FuncModel root : authorizedFuncs) {
      // FuncModel root = (FuncModel) iterator.next();
      if (root.getParentId() != 900700 || root.getDeleted()) continue;

      JSONObject rootJsonObject = new JSONObject();
      rootJsonObject.put("id", "" + root.getEntityId());

      rootJsonObject.put("text", root.getDescr());
      rootJsonObject.put("icon", root.getIcon());
      /**
       * if (this.selectUserFuncsMap.containsKey(root.getId())) rootJsonObject.put("checked",
       * Boolean.valueOf(true)); else { rootJsonObject.put("checked", Boolean.valueOf(false)); }
       */
      JSONObject attributes = new JSONObject();
      attributes.put("funcName", root.getFuncName());
      // attributes.put("style", root.getStyle());
      rootJsonObject.put("attributes", attributes);

      List subGroupInfos = findSubSyssFuncByParnetId(root.getEntityId());

      genSubGroupsTreeJson(rootJsonObject, subGroupInfos);
      jsonArray.add(rootJsonObject);
    }
    return jsonArray.toString();
  }
Exemplo n.º 2
0
  private void genSubGroupsTreeJson(JSONObject jsonObject, List<FuncModel> subSysFunc) {
    if (subSysFunc.size() > 0) {
      JSONArray jsonArray = new JSONArray();
      for (int i = 0; i < subSysFunc.size(); i++) {
        FuncModel v = (FuncModel) subSysFunc.get(i);
        if (v.getDeleted()) continue;

        JSONObject jsonObjectChild = new JSONObject();
        jsonObjectChild.put("id", "" + v.getEntityId());

        jsonObjectChild.put("icon", v.getIcon());

        jsonObjectChild.put("text", v.getDescr()); // getText("menu." +
        // v.getId()));
        /**
         * if ((this.selectUserFuncsMap.containsKey(v.getId())) && (v.getLevel() !=
         * SysFunc.LEVEL_GROUT)) { jsonObjectChild.put("checked", Boolean.valueOf(true)); } else
         * jsonObjectChild.put("checked", Boolean.valueOf(false));
         */
        JSONObject attributes = new JSONObject();

        attributes.put("funcName", v.getFuncName());

        jsonObjectChild.put("attributes", attributes);
        List subGroupInfosChild = findSubSyssFuncByParnetId(v.getEntityId());

        genSubGroupsTreeJson(jsonObjectChild, subGroupInfosChild);
        jsonArray.add(jsonObjectChild);
      }
      jsonObject.put("menu", jsonArray);
    }
  }
Exemplo n.º 3
0
 private boolean isAuthorized(FuncModel f) {
   for (FuncModel fn : authorizedFuncs) {
     if (f.getEntityId() == fn.getEntityId() && fn.getDeleted() == false) {
       return true;
     }
   }
   return false;
 }
Exemplo n.º 4
0
  private List<FuncModel> findChidFuncByParentId(
      Integer parentId, List<FuncModel> authorizedFuncs) {
    List subSysFuncs = new ArrayList();
    for (FuncModel sysFunc : authorizedFuncs) {
      if (sysFunc.getParentId() == parentId && sysFunc.getDeleted() == false) {
        subSysFuncs.add(sysFunc);
      }
    }

    Collections.sort(authorizedFuncs, new SysFuncComparator());
    return subSysFuncs;
  }
Exemplo n.º 5
0
  public String getMapToolMenu() {
    JSONArray jsonArray = new JSONArray();
    for (FuncModel root : authorizedFuncs) {
      // FuncModel root = (FuncModel) iterator.next();
      if (root.getParentId() != 900200 || root.getDeleted()) continue;

      JSONObject rootJsonObject = new JSONObject();
      rootJsonObject.put("id", "" + root.getEntityId());

      rootJsonObject.put("text", root.getDescr());
      rootJsonObject.put("icon", root.getIcon());
      rootJsonObject.put("code", root.getFuncName());
      /**
       * if (this.selectUserFuncsMap.containsKey(root.getId())) rootJsonObject.put("checked",
       * Boolean.valueOf(true)); else { rootJsonObject.put("checked", Boolean.valueOf(false)); }
       */
      JSONObject attributes = new JSONObject();
      attributes.put("funcName", root.getFuncName());
      // attributes.put("style", root.getStyle());
      rootJsonObject.put("attributes", attributes);
      jsonArray.add(rootJsonObject);
    }
    return jsonArray.toString();
  }