Пример #1
0
  public static void saveMG(String groupId, Array data, String s, boolean flag, boolean flag1)
      throws Exception {

    Enumeration<?> enumeration = data.elements();
    while (enumeration.hasMoreElements()) {
      HashMap hashMap = (HashMap) enumeration.nextElement();

      // Object nextID =  hashMap.get("_nextID");
      // if (nextID == null) continue;
      saveGroup(groupId, FILENAME_EXT_MG, hashMap);
      break;
    }

    // enumeration = data.elements();
    List<String> subgroups = new ArrayList<String>();
    while (enumeration.hasMoreElements()) {
      HashMap hashMap = (HashMap) enumeration.nextElement();

      String _class = (String) hashMap.get("_class");
      if (_class == null) continue;
      if ("SubGroup".equals(_class)) {
        subgroups.add(TextUtils.getValue(hashMap, "_group"));
        continue;
      }
      Object id = getId(hashMap);
      if (id == null) continue;
      MonitorEntity.save(groupId, FILENAME_EXT_MG, (String) id, hashMap);
    }
    updateSubGroup(groupId, subgroups, FILENAME_EXT_MG);
  }
Пример #2
0
  public static void saveDYN(String groupId, Array data, String s, boolean flag, boolean flag1)
      throws Exception {
    Enumeration<?> enumeration = data.elements();

    while (enumeration.hasMoreElements()) {
      HashMap hashMap = (HashMap) enumeration.nextElement();

      String id = (String) hashMap.get("id");
      if (id == null) continue;
      if (id.equals("-1")) {
        saveGroup(groupId, FILENAME_EXT_DYN, hashMap);
      } else {
        MonitorEntity.save(groupId, FILENAME_EXT_DYN, (String) id, hashMap);
      }
    }
  }
Пример #3
0
  public static Array get(String groupId, String stype) throws Exception {
    List<GenericValue> groups = getGroupValues(groupId, stype);
    Array retlist = new Array();
    if (groups.size() <= 0) return retlist;

    HashMapOrdered hashMap = new HashMapOrdered(false);
    for (GenericValue val : groups) {
      hashMap.add(val.getString("attrName"), val.getString("attrValue"));
    }
    retlist.add(hashMap);

    List<GenericValue> monitors = MonitorEntity.getMonitorsValueByGroupId(groupId, stype);
    List<HashMapOrdered> children = travel(monitors, null);
    for (HashMapOrdered child : children) {
      if (child == null) continue;
      retlist.add(child);
    }

    List<GenericValue> childreGroups = getChild(groupId, stype);

    for (GenericValue val : childreGroups) {
      HashMapOrdered childreGroup = new HashMapOrdered(false);
      String group = val.getString("id");
      String groupName = getGroupName(group);
      String[] splits = group.split("\\.");
      String id = "0";
      if (splits.length > 1) {
        id = splits[splits.length - 1];
      }
      childreGroup.add("_class", "SubGroup");
      childreGroup.add("_id", id);
      childreGroup.add("_encoding", "GBK");
      childreGroup.add("_group", group);
      childreGroup.add("_name", groupName);
      retlist.add(childreGroup);
    }

    return retlist;
  }
Пример #4
0
 public static void delete(String groupId, String stype) throws Exception {
   if (groupId == null) return;
   MonitorEntity.deleteByGroupId(groupId, stype);
   getDelegator().removeByAnd("SvGroupValue", UtilMisc.toMap("groupId", groupId, "stype", stype));
   getDelegator().removeByAnd("SvGroup", UtilMisc.toMap("id", groupId, "stype", stype));
 }