Package org.apache.roller.business

Examples of org.apache.roller.business.WeblogManager


           
        } else if(pageRequest.getTags() != null && pageRequest.getTags().size() > 0) {
           
            try {
                // tags specified.  make sure they exist.
                WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
                invalid = !wmgr.getTagComboExists(pageRequest.getTags(), (isSiteWide) ? null : weblog);
            } catch (RollerException ex) {
                invalid = true;
            }
        }
View Full Code Here


        HttpServletRequest  request,
        HttpServletResponse response)
        throws Exception
    {
        RollerRequest rreq = RollerRequest.getRollerRequest(request);
        WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
        WeblogCategoryFormEx form = (WeblogCategoryFormEx)actionForm;
       
        BasePageModel pageModel = null;
        WeblogCategoryData parentCat = null;
        if (null!=rreq.getWeblogCategory() && null==request.getParameter("correct"))
        {
            // If request specifies Category and we are not correcting an
            // already submitted form then load that Category into the form.
            WeblogCategoryData cd = rreq.getWeblogCategory();
            form.copyFrom(cd, request.getLocale());
            request.setAttribute("state","edit");
                            
            parentCat = cd.getParent();           
            pageModel = new BasePageModel(
                "categoryForm.edit.title", request, response, mapping);
            pageModel.setWebsite(cd.getWebsite());
        }
        else if (null != request.getParameter("correct"))
        {
            // We are correcting a previously submtted form.
            // already submitted form then load that Category into the form.
            WeblogCategoryData cd = rreq.getWeblogCategory();
            request.setAttribute("state","correcting");   
           
            parentCat = wmgr.getWeblogCategory(cd.getId());         
            pageModel = new BasePageModel(
                "categoryForm.correct.title", request, response, mapping);
            pageModel.setWebsite(cd.getWebsite());
        }
        else
        {
            // We are adding a new Category
            request.setAttribute("state","add");
           
            String pid = request.getParameter(RequestConstants.PARENT_ID);
            parentCat = wmgr.getWeblogCategory(pid);            
            form.setParentId(parentCat.getId());
           
            pageModel = new BasePageModel(
                "categoryForm.add.title", request, response, mapping);
            pageModel.setWebsite(parentCat.getWebsite());
View Full Code Here

        assertEquals(3, entries.size());
    }
   
    public void testMoveWeblogCategoryContents() throws Exception {
       
        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
       
        // add some categories and entries to test with
        WeblogCategoryData dest = new WeblogCategoryData();
        dest.setName("c0");
        dest.setParent(mgr.getRootWeblogCategory(testWeblog));
        dest.setWebsite(testWeblog);
        mgr.saveWeblogCategory(dest);
       
        WeblogCategoryData c1 = new WeblogCategoryData();
        c1.setName("c1");
        c1.setParent(mgr.getRootWeblogCategory(testWeblog));
        c1.setWebsite(testWeblog);
        mgr.saveWeblogCategory(c1);
       
        WeblogCategoryData c2 = new WeblogCategoryData();
        c2.setName("c2");
        c2.setParent(c1);
        c2.setWebsite(testWeblog);
        mgr.saveWeblogCategory(c2);
       
        WeblogCategoryData c3 = new WeblogCategoryData();
        c3.setName("c3");
        c3.setParent(c2);
        c3.setWebsite(testWeblog);
        mgr.saveWeblogCategory(c3);
       
        TestUtils.endSession(true);
       
        c1 = mgr.getWeblogCategory(c1.getId());
        c2 = mgr.getWeblogCategory(c2.getId());
        c3 = mgr.getWeblogCategory(c3.getId());
        dest = mgr.getWeblogCategory(dest.getId());
       
        WeblogEntryData e1 = TestUtils.setupWeblogEntry("e1", c1, testWeblog, testUser);
        WeblogEntryData e2 = TestUtils.setupWeblogEntry("e2", c2, testWeblog, testUser);
        WeblogEntryData e3 = TestUtils.setupWeblogEntry("e3", c3, testWeblog, testUser);
       
        TestUtils.endSession(true);
       
        // verify number of entries in each category
        assertEquals(0, dest.retrieveWeblogEntries(true).size());
        assertEquals(0, dest.retrieveWeblogEntries(false).size());
        assertEquals(1, c1.retrieveWeblogEntries(false).size());
        assertEquals(3, c1.retrieveWeblogEntries(true).size());
       
        // move contents of source category c1 to destination category dest
        mgr.moveWeblogCategoryContents(c1, dest);
        mgr.saveWeblogCategory(c1);
        TestUtils.endSession(true);
       
        // after move, verify number of entries in each category
        dest = mgr.getWeblogCategory(dest.getId());
        c1 = mgr.getWeblogCategory(c1.getId());
       
        // Hierarchy is flattened under dest     
        assertEquals(3, dest.retrieveWeblogEntries(true).size());
        assertEquals(3, dest.retrieveWeblogEntries(false).size());
       
View Full Code Here

     */
    public List getWeblogCategories(String categoryPath) {
        List ret = new ArrayList();
        try {
            Roller roller = RollerFactory.getRoller();
            WeblogManager wmgr = roller.getWeblogManager();           
            WeblogCategoryData category = null;
            if (categoryPath != null && !categoryPath.equals("nil")) {
                category = wmgr.getWeblogCategoryByPath(this, null, categoryPath);
            } else {
                category = this.getDefaultCategory();
            }
            ret = category.getWeblogCategories();
        } catch (RollerException e) {
View Full Code Here

     */
    public WeblogCategoryData getWeblogCategory(String categoryPath) {
        WeblogCategoryData category = null;
        try {
            Roller roller = RollerFactory.getRoller();
            WeblogManager wmgr = roller.getWeblogManager();
            if (categoryPath != null && !categoryPath.equals("nil")) {
                category = wmgr.getWeblogCategoryByPath(this, null, categoryPath);
            } else {
                category = this.getDefaultCategory();
            }
        } catch (RollerException e) {
            log.error("ERROR: fetching category at path: " + categoryPath, e);
View Full Code Here

        if (cat != null && "nil".equals(cat)) cat = null;
        if (length > 100) length = 100;
        List recentEntries = new ArrayList();
        if (length < 1) return recentEntries;
        try {
            WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
            recentEntries = wmgr.getWeblogEntries(
                    this,
                    null,       // user
                    null,       // startDate
                    new Date(), // endDate
                    cat,        // cat or null
View Full Code Here

    public List getRecentComments(int length) {  
        if (length > 100) length = 100;
        List recentComments = new ArrayList();
        if (length < 1) return recentComments;
        try {
            WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
            recentComments = wmgr.getComments(
                    this,
                    null,          // weblog entry
                    null,          // search String
                    null,          // startDate
                    null,          // endDate
View Full Code Here

                WebsiteData website = usermgr.getWebsiteByHandle(sub.getAuthor());
                if (website == null)
                    return newEntries;
               
                // figure website last update time
                WeblogManager blogmgr = RollerFactory.getRoller().getWeblogManager();
               
                Date siteUpdated = website.getLastModified();
                if (siteUpdated == null) { // Site never updated, skip it
                    log.warn("Last-publish time null, skipping local feed ["
                            + website.getHandle() + "]");
                    return newEntries;
                }
               
                // if website last update time > subsciption last update time
                List entries = new ArrayList();
                if (sub.getLastUpdated()==null || siteUpdated.after(sub.getLastUpdated())) {
                    int entryCount = RollerRuntimeConfig.getIntProperty(
                            "site.newsfeeds.defaultEntries");
                    entries = blogmgr.getWeblogEntries(
                            website,
                            null,
                            null,                        // startDate
                            new Date(),                  // endDate
                            null,                        // catName
View Full Code Here

     * @roller.wrapPojoMethod type="simple"
     */
    public int getTodaysHits() {
        try {
            Roller roller = RollerFactory.getRoller();
            WeblogManager mgr = roller.getWeblogManager();
            HitCountData hitCount = mgr.getHitCountByWeblog(this);
           
            return (hitCount != null) ? hitCount.getDailyHits() : 0;
           
        } catch (RollerException e) {
            log.error("PageModel getTotalHits()", e);
View Full Code Here

            cal.add(Calendar.DATE, -1 * sinceDays);       
            startDate = cal.getTime();    
        }       
        try {           
            Roller roller = RollerFactory.getRoller();
            WeblogManager wmgr = roller.getWeblogManager();
            results = wmgr.getPopularTags(this, startDate, length);
        } catch (Exception e) {
            log.error("ERROR: fetching weblog tags list", e);
        }
        return results;
    }     
View Full Code Here

TOP

Related Classes of org.apache.roller.business.WeblogManager

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.