Ejemplo n.º 1
0
  /**
   * Get list of WebsiteDisplay objects, ordered by number of hits.
   *
   * @param sinceDays Only consider weblogs updated in the last sinceDays
   * @param len Max number of results to return
   */
  public List getHotWeblogs(int sinceDays, int length) {

    List results = new ArrayList();
    try {
      WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
      List hotBlogs = mgr.getHotWeblogs(sinceDays, 0, length);

      Iterator hitCounts = hotBlogs.iterator();
      while (hitCounts.hasNext()) {
        WeblogHitCount hitCount = (WeblogHitCount) hitCounts.next();
        StatCount statCount =
            new StatCount(
                hitCount.getWeblog().getId(),
                hitCount.getWeblog().getHandle(),
                hitCount.getWeblog().getName(),
                "statCount.weblogDayHits",
                hitCount.getDailyHits());
        statCount.setWeblogHandle(hitCount.getWeblog().getHandle());
        results.add(statCount);
      }

    } catch (Exception e) {
      log.error("ERROR: fetching hot weblog list", e);
    }

    return results;
  }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
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;
 }
Ejemplo n.º 5
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;
  }
Ejemplo n.º 6
0
 /**
  * Retrieve all weblog entries in this category and, optionally, include weblog entries all
  * sub-categories.
  *
  * @param subcats True if entries from sub-categories are to be returned.
  * @return List of WeblogEntryData objects.
  * @throws WebloggerException
  */
 public List retrieveWeblogEntries(boolean subcats) throws WebloggerException {
   WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
   return wmgr.getWeblogEntries(this, subcats);
 }