示例#1
0
 public long getEntryCount() {
   long count = 0;
   try {
     Weblogger roller = WebloggerFactory.getWeblogger();
     WeblogEntryManager mgr = roller.getWeblogEntryManager();
     count = mgr.getEntryCount();
   } catch (WebloggerException e) {
     log.error("Error getting entry count for site", e);
   }
   return count;
 }
示例#2
0
 /**
  * Get pinned entries.
  *
  * @param sinceDays Only consider weblogs updated in the last sinceDays
  * @param length Max number of results to return
  */
 public List getPinnedWeblogEntries(int length) {
   List results = new ArrayList();
   try {
     Weblogger roller = WebloggerFactory.getWeblogger();
     WeblogEntryManager wmgr = roller.getWeblogEntryManager();
     List weblogs = wmgr.getWeblogEntriesPinnedToMain(new Integer(length));
     for (Iterator it = weblogs.iterator(); it.hasNext(); ) {
       WeblogEntry entry = (WeblogEntry) it.next();
       results.add(WeblogEntryWrapper.wrap(entry, urlStrategy));
     }
   } catch (Exception e) {
     log.error("ERROR: fetching pinned weblog entries", e);
   }
   return results;
 }
示例#3
0
 /**
  * Get most commented weblog entries across all weblogs, as StatCount objects, in descending order
  * by number of comments.
  *
  * @param sinceDays Only consider weblogs updated in the last sinceDays
  * @param cats To limit results to list of category names
  * @param len Max number of results to return
  */
 public List getMostCommentedWeblogEntries(List cats, int sinceDays, int length) {
   List results = new ArrayList();
   Calendar cal = Calendar.getInstance();
   cal.setTime(new Date());
   cal.add(Calendar.DATE, -1 * sinceDays);
   Date startDate = cal.getTime();
   try {
     Weblogger roller = WebloggerFactory.getWeblogger();
     WeblogEntryManager wmgr = roller.getWeblogEntryManager();
     results = wmgr.getMostCommentedWeblogEntries(null, startDate, new Date(), 0, length);
   } catch (Exception e) {
     log.error("ERROR: fetching commented weblog entries list", e);
   }
   return results;
 }
示例#4
0
  /**
   * @param sinceDays
   * @param length
   * @return
   */
  public List getPopularTags(int sinceDays, int length) {
    List results = new ArrayList();
    Date startDate = null;
    if (sinceDays > 0) {
      Calendar cal = Calendar.getInstance();
      cal.setTime(new Date());
      cal.add(Calendar.DATE, -1 * sinceDays);
      startDate = cal.getTime();
    }

    try {
      Weblogger roller = WebloggerFactory.getWeblogger();
      WeblogEntryManager wmgr = roller.getWeblogEntryManager();
      results = wmgr.getPopularTags(null, startDate, 0, length);
    } catch (Exception e) {
      log.error("ERROR: fetching site tags list", e);
    }
    return results;
  }