Package org.apache.roller.weblogger.business

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


       
        Weblog website = validate(blogid, userid,password);
        Weblogger roller = WebloggerFactory.getWeblogger();
        try {
            Hashtable result = new Hashtable();
            WeblogEntryManager weblogMgr = roller.getWeblogEntryManager();
            List cats = weblogMgr.getWeblogCategories(website, false);
            for (Iterator wbcItr = cats.iterator(); wbcItr.hasNext();) {
                WeblogCategory category = (WeblogCategory) wbcItr.next();
                result.put(category.getPath(),
                        createCategoryStruct(category, userid));
            }
View Full Code Here


        mLogger.debug("     PostId: " + postid);
        mLogger.debug("     UserId: " + userid);
        mLogger.debug("    Publish: " + publish);
       
        Weblogger roller = WebloggerFactory.getWeblogger();
        WeblogEntryManager weblogMgr = roller.getWeblogEntryManager();
        WeblogEntry entry = weblogMgr.getWeblogEntry(postid);
       
        validate(entry.getWebsite().getHandle(), userid,password);
       
        Hashtable postcontent = struct;
        String description = (String)postcontent.get("description");
        String title = (String)postcontent.get("title");
        if (title == null) title = "";
       
        Date dateCreated = (Date)postcontent.get("dateCreated");
        if (dateCreated == null) dateCreated = (Date)postcontent.get("pubDate");
       
        String cat = null;
        if ( postcontent.get("categories") != null ) {
            Object[] cats = (Object[])postcontent.get("categories");
            if (cats.length > 0) {
              cat = (String)cats[0];
            }
        }
        mLogger.debug("      Title: " + title);
        mLogger.debug("   Category: " + cat);
       
        try {
           
            Timestamp current =
                    new Timestamp(System.currentTimeMillis());
           
            if ( !title.equals("") ) entry.setTitle(title);
            entry.setText(description);
            entry.setUpdateTime(current);
            if (Boolean.valueOf(publish).booleanValue()) {
                entry.setStatus(WeblogEntry.PUBLISHED);
            } else {
                entry.setStatus(WeblogEntry.DRAFT);
            }
            if (dateCreated != null) {
                entry.setPubTime(new Timestamp(dateCreated.getTime()));
            }
           
            if ( cat != null ) {
                // Use first category specified by request
                WeblogCategory cd =
                        weblogMgr.getWeblogCategoryByPath(entry.getWebsite(), cat);
                entry.setCategory(cd);
            }
           
            // save the entry
            weblogMgr.saveWeblogEntry(entry);
            roller.flush();
           
            // notify cache
            flushPageCache(entry.getWebsite());
           
View Full Code Here

        if (dateCreated == null) dateCreated = new Date();
        mLogger.debug("      Title: " + title);
       
        try {
            Weblogger roller = WebloggerFactory.getWeblogger();
            WeblogEntryManager weblogMgr = roller.getWeblogEntryManager();
            User user = roller.getUserManager().getUserByUserName(userid);
            Timestamp current = new Timestamp(System.currentTimeMillis());
           
            WeblogEntry entry = new WeblogEntry();
            entry.setTitle(title);
            entry.setText(description);
            entry.setLocale(website.getLocale());
            entry.setPubTime(new Timestamp(dateCreated.getTime()));
            entry.setUpdateTime(current);
            entry.setWebsite(website);
            entry.setCreatorUserName(user.getUserName());
            entry.setCommentDays(new Integer(website.getDefaultCommentDays()));
            entry.setAllowComments(website.getDefaultAllowComments());
       
            // apply weblog default plugins
            if (website.getDefaultPlugins() != null) {
                entry.setPlugins(website.getDefaultPlugins());
            }
           
            if (Boolean.valueOf(publish).booleanValue()) {
                entry.setStatus(WeblogEntry.PUBLISHED);
            } else {
                entry.setStatus(WeblogEntry.DRAFT);
            }
           
            // MetaWeblog supports multiple cats, Weblogger supports one/entry
            // so here we take accept the first category that exists
            WeblogCategory rollerCat = null;
            if ( postcontent.get("categories") != null ) {
                Object[] cats = (Object[])postcontent.get("categories");
                if (cats != null && cats.length > 0) {
                    mLogger.debug("cats type - "+cats[0].getClass().getName());
                    mLogger.debug("cat to string - "+cats[0].toString());
                    for (int i=0; i<cats.length; i++) {
                        Object cat = cats[i];
                        rollerCat = weblogMgr.getWeblogCategoryByPath(website, (String)cat);
                        if (rollerCat != null) {
                            entry.setCategory(rollerCat);
                            break;
                        }
                    }
                }
            }
            if (rollerCat == null) {
                // or we fall back to the default Blogger API category
                entry.setCategory(website.getBloggerCategory());
            }
           
            // save the entry
            weblogMgr.saveWeblogEntry(entry);
            roller.flush();
           
            // notify cache
            flushPageCache(entry.getWebsite());
           
View Full Code Here

        mLogger.debug("getPost() Called =========[ SUPPORTED ]=====");
        mLogger.debug("     PostId: " + postid);
        mLogger.debug("     UserId: " + userid);
       
        Weblogger roller = WebloggerFactory.getWeblogger();
        WeblogEntryManager weblogMgr = roller.getWeblogEntryManager();
        WeblogEntry entry = weblogMgr.getWeblogEntry(postid);
       
        if (entry == null) {
            throw new XmlRpcException(INVALID_POSTID, INVALID_POSTID_MSG);
        }
        validate(entry.getWebsite().getHandle(), userid, password);
View Full Code Here

       
        try {
            Vector results = new Vector();
           
            Weblogger roller = WebloggerFactory.getWeblogger();
            WeblogEntryManager weblogMgr = roller.getWeblogEntryManager();
            if (website != null) {
                List entries = weblogMgr.getWeblogEntries(
                        website,           // website
                        null,
                        null,              // startDate
                        null,              // endDate
                        null,              // catName
View Full Code Here

    public WeblogEntry getWeblogEntry() {
       
        if(weblogEntry == null && weblogAnchor != null) {
            try {
                WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
                weblogEntry = wmgr.getWeblogEntryByAnchor(getWeblog(), weblogAnchor);
            } catch (WebloggerException ex) {
                log.error("Error getting weblog entry "+weblogAnchor, ex);
            }
        }
       
View Full Code Here

    }
   
   
    public void myPrepare() {
        try {
            WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
            if(!StringUtils.isEmpty(getBean().getId())) {
                setCategory(wmgr.getWeblogCategory(getBean().getId()));
            }
        } catch (WebloggerException ex) {
            log.error("Error looking up category", ex);
        }
    }
View Full Code Here

           
            // copy updated attributes
            getBean().copyTo(getCategory());
           
            // save changes
            WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
            wmgr.saveWeblogCategory(getCategory());
            WebloggerFactory.getWeblogger().flush();
           
            // notify caches
            CacheManager.invalidate(getCategory());
           
View Full Code Here

   
    public WeblogEntry getWeblogEntry() {
       
        if(weblogEntry == null && weblogAnchor != null) {
            try {
                WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
                weblogEntry = wmgr.getWeblogEntryByAnchor(getWeblog(), weblogAnchor);
            } catch (WebloggerException ex) {
                log.error("Error getting weblog entry "+weblogAnchor, ex);
            }
        }
       
View Full Code Here

    public WeblogCategory getWeblogCategory() {
       
        if(weblogCategory == null && weblogCategoryName != null) {
            try {
                WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
                weblogCategory = wmgr.getWeblogCategoryByPath(getWeblog(), weblogCategoryName);
            } catch (WebloggerException ex) {
                log.error("Error getting weblog category "+weblogCategoryName, ex);
            }
        }
       
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.