Package org.apache.roller.weblogger.business

Examples of org.apache.roller.weblogger.business.WeblogEntryManager


       
        // since this operation can be run on a separate thread we must treat
        // the weblog object passed in as a detached object which is proned to
        // lazy initialization problems, so requery for the object now
        try {
            WeblogEntryManager wMgr = roller.getWeblogEntryManager();
            this.data = wMgr.getWeblogEntry(this.data.getId());
        } catch (WebloggerException ex) {
            mLogger.error("Error getting weblogentry object", ex);
            return;
        }
       
View Full Code Here


     */
    public void execute() {
       
        UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
        WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
        WeblogEntryManager emgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
       
        HitCountQueue hitCounter = HitCountQueue.getInstance();
       
        // first get the current set of hits
        List currentHits = hitCounter.getHits();
       
        // now reset the queued hits
        hitCounter.resetHits();
       
        // tally the counts, grouped by weblog handle
        Map hitsTally = new HashMap();
        String weblogHandle = null;
        for(int i=0; i < currentHits.size(); i++) {
            weblogHandle = (String) currentHits.get(i);
           
            Long count = (Long) hitsTally.get(weblogHandle);
            if(count == null) {
                count = new Long(1);
            } else {
                count = new Long(count.longValue()+1);
            }
            hitsTally.put(weblogHandle, count);
        }
       
        // iterate over the tallied hits and store them in the db
        try {
            long startTime = System.currentTimeMillis();
           
            Weblog weblog = null;
            String key = null;
            Iterator it = hitsTally.keySet().iterator();
            while(it.hasNext()) {
                key = (String) it.next();
               
                try {
                    weblog = wmgr.getWeblogByHandle(key);
                    emgr.incrementHitCount(weblog, ((Long)hitsTally.get(key)).intValue());
                } catch (WebloggerException ex) {
                    log.error(ex);
                }
            }
           
View Full Code Here

       
        // since this operation can be run on a separate thread we must treat
        // the weblog object passed in as a detached object which is proned to
        // lazy initialization problems, so requery for the object now
        try {
            WeblogEntryManager wMgr = roller.getWeblogEntryManager();
            this.data = wMgr.getWeblogEntry(this.data.getId());
        } catch (WebloggerException ex) {
            mLogger.error("Error getting weblogentry object", ex);
            return;
        }
       
View Full Code Here

            } else {
                newTags.remove(tag.getName());
            }
        }

        WeblogEntryManager weblogManager = WebloggerFactory.getWeblogger().getWeblogEntryManager();
        for (Iterator it = removeTags.iterator(); it.hasNext();) {
            weblogManager.removeWeblogEntryTag((String) it.next(), this);
        }
       
        for (Iterator it = newTags.iterator(); it.hasNext();) {
            addTag((String) it.next());
        }
View Full Code Here

     * TODO: why is this method exposed to users with ability to get spam/non-approved comments?
     */
    public List getComments(boolean ignoreSpam, boolean approvedOnly) {
        List list = new ArrayList();
        try {
            WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
            return wmgr.getComments(
                    getWebsite(),
                    this,
                    null,  // search String
                    null,  // startDate
                    null,
View Full Code Here

       
        // since this operation can be run on a separate thread we must treat
        // the weblog object passed in as a detached object which is proned to
        // lazy initialization problems, so requery for the object now
        try {
            WeblogEntryManager wMgr = roller.getWeblogEntryManager();
            this.data = wMgr.getWeblogEntry(this.data.getId());
        } catch (WebloggerException ex) {
            mLogger.error("Error getting weblogentry object", ex);
            return;
        }
       
View Full Code Here

    public void runTask() {
       
        log.debug("task started");
       
        try {
            WeblogEntryManager wMgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
            IndexManager searchMgr = WebloggerFactory.getWeblogger().getIndexManager();
           
            Date now = new Date();
           
            log.debug("looking up scheduled entries older than "+now);
           
            // get all published entries older than current time
            List scheduledEntries = wMgr.getWeblogEntries(
                   
                    null,   // website
                    null,   // user
                    null,   // startDate
                    now,    // endDate
                    null,   // catName
                    null,WeblogEntry.SCHEDULED, // status
                    null,   // text
                    null,   // sortBy
                    null,   // sortOrder
                    null,   // locale
                    0, -1); // offset, length
                   
            log.debug("promoting "+scheduledEntries.size()+" entries to PUBLISHED state");
           
            WeblogEntry entry = null;
            Iterator it = scheduledEntries.iterator();
            while(it.hasNext()) {
                entry = (WeblogEntry) it.next();
               
                // update status to PUBLISHED and save
                entry.setStatus(WeblogEntry.PUBLISHED);
                wMgr.saveWeblogEntry(entry);
            }
           
            // commit the changes
            WebloggerFactory.getWeblogger().flush();
           
View Full Code Here

    public void runTask() {
       
        try {
            log.info("task started");
           
            WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
            mgr.resetAllHitCounts();
            WebloggerFactory.getWeblogger().flush();
           
            log.info("task completed");
           
        } catch (WebloggerException e) {
View Full Code Here

     */
    public WeblogEntry getWeblogEntry(String anchor) {
        WeblogEntry entry = null;
        try {
            Weblogger roller = WebloggerFactory.getWeblogger();
            WeblogEntryManager wmgr = roller.getWeblogEntryManager();
            entry = wmgr.getWeblogEntryByAnchor(this, anchor);
        } catch (WebloggerException e) {
            this.log.error("ERROR: getting entry by anchor");
        }
        return entry;
    }
View Full Code Here

     */
    public Set getWeblogCategories(String categoryPath) {
        Set ret = new HashSet();
        try {
            Weblogger roller = WebloggerFactory.getWeblogger();
            WeblogEntryManager wmgr = roller.getWeblogEntryManager();           
            WeblogCategory category = null;
            if (categoryPath != null && !categoryPath.equals("nil")) {
                category = wmgr.getWeblogCategoryByPath(this, categoryPath);
            } else {
                category = this.getDefaultCategory();
            }
            ret = category.getWeblogCategories();
        } catch (WebloggerException e) {
View Full Code Here

TOP

Related Classes of org.apache.roller.weblogger.business.WeblogEntryManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.