public void addAlertTag(HashMap hashmap, String s, String s1) {
   hashmap.put(s, s1);
   if (!Action.isBaseEntry(s)) {
     String s2 = TextUtils.getValue(hashmap, "extraCount");
     if (s2.length() == 0) s2 = "0";
     s2 = TextUtils.increment(s2);
     hashmap.put("extra" + s2, s);
     hashmap.put("extraCount", s2);
   }
 }
Exemple #2
0
  public String update(HashMap hashmap, String s) throws SiteViewException {
    String s1 = (String) hashmap.get("_healthTemplateSet");
    String s2 = "";
    String s3 = "";
    int i = Machine.getOS("");
    String s4 = i != 1 ? "Unix" : "NT";
    if (!Platform.isStandardAccount(s)) {
      s2 =
          Platform.getRoot()
              + File.separator
              + "accounts"
              + File.separator
              + s
              + File.separator
              + "templates.health";
      if (!(new File(s2)).exists()) {
        s2 = Platform.getRoot() + File.separator + "templates.health";
      }
      s3 =
          Platform.getRoot()
              + File.separator
              + "accounts"
              + File.separator
              + s
              + File.separator
              + "groups";
      if (!(new File(s3)).exists()) {
        s3 = Platform.getRoot() + File.separator + "groups";
      }
    } else {
      s2 = Platform.getRoot() + File.separator + "templates.health";
      s3 = Platform.getRoot() + File.separator + "groups";
    }
    if (s1 != null && s1.length() > 0) {
      File file = new File(s2);
      String as[] = file.list();
      Array array = null;
      try {
        array = FrameFile.readFromFile(s3 + "/" + "__Health__.mg");
      } catch (IOException ioexception) {
      }
      if (array == null || array.size() == 0) {
        array = createHealthGroup();
        APISiteView.forceConfigurationRefresh();
      }
      Array array1 = null;
      try {
        array1 = FrameFile.readFromFile(s2 + "/" + s4 + s1);
      } catch (IOException ioexception1) {
        String as1[] = {ioexception1.getMessage()};
        throw new SiteViewParameterException(
            SiteViewErrorCodes.ERR_OP_SS_HEALTH_NO_TEMPLATE_FILE, as1);
      }
      if (array != null && array1 != null) {
        HashMap hashmap1 = (HashMap) array.at(0);
        String s5 = (String) hashmap1.get("_nextID");
        for (int j = 1; j < array1.size(); j++) {
          HashMap hashmap2 = (HashMap) array1.at(j);
          HashMap hashmap3 = new HashMap();
          hashmap3.put("_id", s5);
          String s6;
          for (Enumeration enumeration = hashmap2.keys();
              enumeration.hasMoreElements();
              hashmap3.put(s6, hashmap2.get(s6))) {
            s6 = (String) enumeration.nextElement();
          }

          array.add(hashmap3);
          s5 = TextUtils.increment(s5);
        }

        hashmap1.put("_nextID", s5);
        try {
          FrameFile.writeToFile(s3 + "/" + "__Health__.mg", array);
        } catch (IOException ioexception2) {
          String as2[] = {"__Health__.mg", ioexception2.getMessage()};
          throw new SiteViewParameterException(
              SiteViewErrorCodes.ERR_OP_SS_HEALTH_CANNOT_WRITE, as2);
        }
      }
      hashmap.remove("_healthTemplateSet");
      updateMaster(hashmap);
      APIGroup.forceConfigurationRefresh();
      return s1;
    } else {
      hashmap.remove("_healthTemplateSet");
      updateMaster(hashmap);
      APIGroup.forceConfigurationRefresh();
      return "";
    }
  }
 public void incrementProperty(String s) {
   setProperty(s, TextUtils.increment(getProperty(s)));
 }
 public void incrementProperty(StringProperty stringproperty) {
   setProperty(stringproperty, TextUtils.increment(getProperty(stringproperty)));
 }