Package org.apache.roller.model

Examples of org.apache.roller.model.WeblogManager


        HttpServletResponse response)
        throws Exception
    {
        ActionForward forward = mapping.findForward("categories");
        CategoryDeleteForm form = (CategoryDeleteForm)actionForm;
        WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();

        String catid = request.getParameter(RequestConstants.WEBLOGCATEGORY_ID);
        WeblogCategoryData catToDelete =
                wmgr.getWeblogCategory(catid);
        RollerSession rses = RollerSession.getRollerSession(request);
        if (rses.isUserAuthorizedToAuthor(catToDelete.getWebsite()))
        {
            String returnId = null;
            if (catToDelete.getParent() != null)
            {
                returnId = catToDelete.getParent().getId();
            }
            if (form.isDelete() == null)
            {
                // Present CategoryDeleteOK? page to user
                RollerRequest rreq = RollerRequest.getRollerRequest(request);
                WeblogCategoryData theCat = wmgr.getWeblogCategory(catid);
                Iterator allCats =
                    wmgr.getWeblogCategories(theCat.getWebsite()).iterator();
                List destCats = new LinkedList();
                while (allCats.hasNext())
                {
                    WeblogCategoryData cat = (WeblogCategoryData)allCats.next();
                    // Allow entries to be moved to any other category except
                    // root and the sub-cats of the category being deleted.
                    if (!cat.getId().equals(catid)
                        && cat.getParent()!=null
                        && !cat.descendentOf(catToDelete))
                    {
                        destCats.add(cat);
                    }                   
                }
                if (destCats.size() > 0)
                {
                    form.setName(theCat.getName());
                    form.setCategoryId(catid);
                    form.setCats(destCats);
                    form.setInUse(Boolean.valueOf(catToDelete.isInUse()));
                    forward = mapping.findForward("CategoryDeleteOK");
                }
                else
                {
                    // Can't delete last category, send 'em back!
                    if (null != returnId)
                    {
                        request.setAttribute(
                                RequestConstants.WEBLOGCATEGORY_ID, returnId);
                    }              
                }
            }
            else if (form.isDelete().booleanValue()) {
               
                // User clicked YES to delete
                // remove cat to delete
                if (form.getMoveToWeblogCategoryId() != null)
                {
                    WeblogCategoryData destCat =
                        wmgr.getWeblogCategory(form.getMoveToWeblogCategoryId());
                    if (rses.isUserAuthorizedToAuthor(destCat.getWebsite()))
                    {
                        wmgr.moveWeblogCategoryContents(catToDelete, destCat);               
                        RollerFactory.getRoller().flush();
                    }
                    else
                    {
                        return mapping.findForward("access-denied");
                    }
                }
                               
                catToDelete = wmgr.getWeblogCategory(catToDelete.getId());
                wmgr.removeWeblogCategory(catToDelete);
                RollerFactory.getRoller().flush();

                // notify caches of invalidated object
                CacheManager.invalidate(catToDelete);
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

            }
            try
            {
                if ( entryid != null )
                {
                    WeblogManager weblogMgr = RollerFactory.getRoller().getWeblogManager();
                    mWeblogEntry = weblogMgr.getWeblogEntry(entryid);               
               
                    // We can use entry to find the website, if we don't have one
                    if ( mWeblogEntry != null && mWebsite == null )
                    {
                        mWebsite = mWeblogEntry.getWebsite();
                    }
                }
                else if ( mWebsite != null && anchor != null )
                {
                    WeblogManager weblogMgr =
                        RollerFactory.getRoller().getWeblogManager();
                    mWeblogEntry = weblogMgr.getWeblogEntryByAnchor(
                        mWebsite,anchor);
                }                            
            }
            catch (RollerException e)
            {
View Full Code Here

        IndexWriter writer = beginWriting();
       
        Roller roller = RollerFactory.getRoller();
        try {
            if (writer != null) {
                WeblogManager weblogManager = roller.getWeblogManager();
               
                List entries = weblogManager .getWeblogEntries(
                        website,                   // website           
                        null,
                        null,                      // startDate
                        new Date(),                // endDate (don't index 'future' entries)
                        null,                      // catName
View Full Code Here

        loadWeblogEntries(startDate, endDate, cat);
    }
   
    protected void loadWeblogEntries(Date startDate, Date endDate, String catName) {
        try {
            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
            monthMap = mgr.getWeblogEntryStringMap(
                    weblog,                  // website
                    startDate,                 // startDate
                    endDate,                   // endDate
                    catName,                   // cat
                    WeblogEntryData.PUBLISHED, // status
View Full Code Here

    }
   
   
    protected void loadWeblogEntries(Date startDate, Date endDate, String catName) {
        try {
            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
            monthMap = mgr.getWeblogEntryObjectMap(
                    weblog,                  // website
                    startDate,                 // startDate
                    endDate,                   // endDate
                    catName,                   // cat
                    WeblogEntryData.PUBLISHED, // status
View Full Code Here

        HttpServletResponse response)
        throws IOException, ServletException, RollerException
    {
        WeblogEntryManagementForm form = (WeblogEntryManagementForm)actionForm;
        RollerRequest   rreq = RollerRequest.getRollerRequest(request);
        WeblogManager   wmgr = RollerFactory.getRoller().getWeblogManager();          
        RollerSession   rses = RollerSession.getRollerSession(request);
       
        // ensure that weblog is specfied and user has permission to work there
        if (rreq.getWebsite() != null && rses.isUserAuthorized(rreq.getWebsite())) {
            String status= form.getStatus().equals("ALL") ? null : form.getStatus();       
View Full Code Here

TOP

Related Classes of org.apache.roller.model.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.