private Map getWeblogEntryMap(
      WebsiteData website,
      Date startDate,
      Date endDate,
      String catName,
      String status,
      boolean stringsOnly,
      String locale,
      int offset,
      int length)
      throws RollerException {

    TreeMap map = new TreeMap(reverseComparator);

    List entries =
        getWeblogEntries(
            website, null, startDate, endDate, catName, status, null, locale, offset, length);

    Calendar cal = Calendar.getInstance();
    if (website != null) {
      cal.setTimeZone(website.getTimeZoneInstance());
    }

    SimpleDateFormat formatter = DateUtil.get8charDateFormat();
    for (Iterator wbItr = entries.iterator(); wbItr.hasNext(); ) {
      WeblogEntryData entry = (WeblogEntryData) wbItr.next();
      Date sDate = DateUtil.getNoonOfDay(entry.getPubTime(), cal);
      if (stringsOnly) {
        if (map.get(sDate) == null) map.put(sDate, formatter.format(sDate));
      } else {
        List dayEntries = (List) map.get(sDate);
        if (dayEntries == null) {
          dayEntries = new ArrayList();
          map.put(sDate, dayEntries);
        }
        dayEntries.add(entry);
      }
    }
    return map;
  }
Ejemplo n.º 2
0
  /** @inheritDoc */
  public Map<Date, String> getWeblogEntryStringMap(WeblogEntrySearchCriteria wesc)
      throws WebloggerException {
    TreeMap<Date, String> map = new TreeMap<Date, String>(Collections.reverseOrder());

    List<WeblogEntry> entries = getWeblogEntries(wesc);

    Calendar cal = Calendar.getInstance();
    SimpleDateFormat formatter = DateUtil.get8charDateFormat();
    if (wesc.getWeblog() != null) {
      TimeZone tz = wesc.getWeblog().getTimeZoneInstance();
      cal.setTimeZone(tz);
      formatter.setTimeZone(tz);
    }

    for (WeblogEntry entry : entries) {
      Date sDate = DateUtil.getNoonOfDay(entry.getPubTime(), cal);
      if (map.get(sDate) == null) {
        map.put(sDate, formatter.format(sDate));
      }
    }
    return map;
  }