コード例 #1
0
  /** CAUTION: Decompiled by hand. */
  protected boolean update() {
    try {
      String s = "SELECT * FROM Exchange_Mailbox";
      Vector vector = executeQuery(s);
      if (vector == null) {
        return false;
      }
      for (int i = 0; i < vector.size(); i++) {
        Map map = (Map) vector.elementAt(i);
        Date date = WMIUtils.makeJavaDateFromWMIDate((String) map.get("LastLogonTime"));
        if (date != null) {
          map.put("JavaLastLogonTime", date);
        }
        date = WMIUtils.makeJavaDateFromWMIDate((String) map.get("LastLogoffTime"));
        if (date != null) {
          map.put("JavaLastLogoffTime", date);
        }
      }

      Document document = createNewDocument("Exchange Mailbox Statistics");
      showNotAccessedInNDays(vector, document);
      showOverLimitMailboxes(vector, document);
      showTopNMailboxesInSize(vector, document);
      saveDocument(document);
      setProperty(pStateString, "OK");
      setProperty(pStatus, "OK");
      return true;
    } catch (Exception e) {
      setProperty(pNoData, "n/a");
      setProperty(pStatus, "error");
      setProperty(pStateString, e.getMessage());
      return false;
    }
  }
コード例 #2
0
  private void showNotAccessedInNDays(Vector vector, Document document) {
    int i = getPropertyAsInteger(pNotAccessedN);
    if (i > 0) {
      Vector vector1 = new Vector();
      GregorianCalendar gregoriancalendar = new GregorianCalendar();
      gregoriancalendar.setTime(new Date());
      gregoriancalendar.add(6, -i);
      Date date = gregoriancalendar.getTime();
      for (int j = 0; j < vector.size(); j++) {
        Map map = (Map) vector.elementAt(j);
        Date date1 = (Date) map.get("JavaLastLogoffTime");
        if (date1 == null || date1.getTime() >= date.getTime()) {
          continue;
        }
        Vector vector2 = new Vector();
        vector1.addElement(vector2);
        vector2.addElement(new Pair("Mailbox", map.get("MailboxDisplayName")));
        synchronized (mDisplayDateFormat) {
          vector2.addElement(new Pair("Last Logoff Time", mDisplayDateFormat.format(date1)));
        }
      }

      addListContent(vector1, "Mailboxes Not Accessed in " + i + " Days", document);
    }
  }
コード例 #3
0
  private void showOverLimitMailboxes(Vector vector, Document document) {
    Vector vector1 = new Vector();
    for (int i = 0; i < vector.size(); i++) {
      Map map = (Map) vector.elementAt(i);
      String s = (String) map.get("StorageLimitInfo");
      if (s.equals(EXCH_ISSUE_WARNING) || s.equals(EXCH_PROHIBIT_SEND)) {
        Vector vector2 = new Vector();
        vector1.addElement(vector2);
        vector2.addElement(new Pair("Mailbox", map.get("MailboxDisplayName")));
      }
    }

    addListContent(vector1, "Over Limit Mailboxes", document);
  }
コード例 #4
0
  private void showTopNMailboxesInSize(Vector vector, Document document) {
    int i = getPropertyAsInteger(pTopSizeN);
    if (i > 0) {
      Object aobj[] = vector.toArray();
      Arrays.sort(aobj, new MBSizeCompare());
      Vector vector1 = new Vector();
      for (int j = 0; j < i && j < aobj.length; j++) {
        Vector vector2 = new Vector();
        vector1.addElement(vector2);
        Map map = (Map) aobj[j];
        vector2.addElement(new Pair("Mailbox", map.get("MailboxDisplayName")));
        vector2.addElement(new Pair("Size", map.get("Size")));
      }

      addListContent(vector1, "Top " + i + " Mailboxes in Size", document);
    }
  }
コード例 #5
0
 public int compare(Object obj, Object obj1) {
   Map map = (Map) obj;
   Map map1 = (Map) obj1;
   String s = (String) map.get("Size");
   String s1 = (String) map1.get("Size");
   int i = 0;
   int j = 0;
   try {
     i = Integer.parseInt(s);
   } catch (Exception exception) {
   }
   try {
     j = Integer.parseInt(s1);
   } catch (Exception exception1) {
   }
   if (i < j) {
     return 1;
   }
   return i <= j ? 0 : -1;
 }