Package org.apache.roller.model

Examples of org.apache.roller.model.WeblogManager


       
        // request appears to be valid, lets render
        try {
            // get update time before loading context
            // TODO: this should really be handled elsewhere
            WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
            String catname = request.getParameter(RollerRequest.WEBLOGCATEGORYNAME_KEY);
            Date updateTime = wmgr.getWeblogLastPublishTime(rreq.getWebsite(), catname);
            request.setAttribute("updateTime", updateTime);
           
            ContextLoader.setupContext(ctx, rreq, response);
           
            String useTemplate;
View Full Code Here


        {
            super("dummy",  request, response, mapping);
            this.form = form;
           
            RollerRequest rreq = RollerRequest.getRollerRequest(request);
            WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();

            allCategories = new TreeSet(new CategoryPathComparator());

            // Find catid wherever it may be
            String catId = (String)
                request.getAttribute(RollerRequest.WEBLOGCATEGORYID_KEY);
            if (null == catId)
            {
                catId = request.getParameter(RollerRequest.WEBLOGCATEGORYID_KEY);
           
            if (null == catId)
            {
                catId = form.getId();    
            }

            cat = null;
            if (null == catId || catId.equals("null"))
            {
                cat = wmgr.getRootWeblogCategory(website);
            }
            else
            {
                cat = wmgr.getWeblogCategory(catId)
                website = cat.getWebsite();
            }
            form.setId(cat.getId());

            //request.setAttribute("categories", cat.getWeblogCategories());

            if (null != cat.getParent())
            {
                catPath = new LinkedList();
                catPath.add(0, cat);
                WeblogCategoryData parent = cat.getParent();
                while (parent != null)
                {
                    catPath.add(0, parent);
                    parent = parent.getParent();  
                }
                //request.setAttribute("categoryPath", catPath);

                request.setAttribute(
                    RollerRequest.PARENTID_KEY, cat.getParent().getId());
            }

            // Build collection of all Categories, except for current one,
            // sorted by path.
            Iterator iter = wmgr.getWeblogCategories(website).iterator();
            while (iter.hasNext())
            {
                WeblogCategoryData cd = (WeblogCategoryData) iter.next();
                if (!cd.getId().equals(catId))
                {
View Full Code Here

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

        String catid = request.getParameter(RollerRequest.WEBLOGCATEGORYID_KEY);
        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)
                        && cat.retrieveWeblogEntries(true).size() < 1)
                    {
                        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(
                                RollerRequest.WEBLOGCATEGORYID_KEY, returnId);
                    }              
                }
            }
            else if (form.isDelete().booleanValue()) {
               
                // User clicked YES to delete
                // remove cat to delete
                wmgr.removeWeblogCategory(catToDelete);
                RollerFactory.getRoller().flush();
               
                // notify caches of invalidated object
                CacheManager.invalidate(catToDelete);
               
View Full Code Here

                throw new Exception("Comments not allowed on this entry");
           
            WebsiteData website = entry.getWebsite();
           
            // Construct our Comment object from the submitted data
            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
            CommentFormEx cf = new CommentFormEx();
            CommentData comment = new CommentData();
            RequestUtils.populate(cf, request);
            cf.copyTo(comment, request.getLocale());
           
            comment.setWeblogEntry(entry);
            comment.setRemoteHost(request.getRemoteHost());
            comment.setPostTime(new java.sql.Timestamp(System.currentTimeMillis()));
           
            cf.setWeblogEntry(entry);
            cf.setPostTime(new java.sql.Timestamp(System.currentTimeMillis()));
           
            request.setAttribute("commentForm", cf);
            request.setAttribute("blogEntry", entry);
           
            if (preview) {
                message = "This is a comment preview only";
               
                // If comment contains blacklisted text, warn commenter
                SpamChecker checker = new SpamChecker();
                if (checker.checkComment(comment)) {
                   error = bundle.getString("commentServlet.previewMarkedAsSpam");
                   mLogger.debug("Comment marked as spam");
                }
                request.setAttribute("previewComments", "dummy");
                mLogger.debug("Comment is a preview");
               
            } else {
                if (this.authenticator.authenticate(comment, request)) {
                    mLogger.debug("Comment passed authentication");
                   
                    // If comment contains blacklisted text, mark as spam
                    SpamChecker checker = new SpamChecker();
                    if (checker.checkComment(comment)) {
                       comment.setSpam(Boolean.TRUE);
                       error = bundle.getString("commentServlet.commentMarkedAsSpam");
                       mLogger.debug("Comment marked as spam");
                    }
                    
                    // If comment moderation is on, set comment as pending
                    if (website.getCommentModerationRequired()) {
                        comment.setPending(Boolean.TRUE);  
                        comment.setApproved(Boolean.FALSE);
                        //message = bundle.getString("commentServlet.submittedToModerator");
                    } else {
                        comment.setPending(Boolean.FALSE);  
                        comment.setApproved(Boolean.TRUE);
                    }
                   
                    mgr.saveComment(comment);
                    RollerFactory.getRoller().flush();
                    reindexEntry(entry);
                   
                    // Clear all caches associated with comment
                    CacheManager.invalidate(comment);
View Full Code Here

            //------------------------------------------
            // --- Build list of email addresses to send notification to
           
            List comments = null;
            try {
                WeblogManager wMgr = RollerFactory.getRoller().getWeblogManager();
                // get only approved, non spam comments
                comments = entry.getComments(true, true);
            } catch(RollerException re) {
                // should never happen
                comments = new ArrayList();
View Full Code Here

                catParam = mRollerReq.getWebsite().getDefaultCategory().getPath();
                if (catParam.equals("/")) {
                    catParam = null;
                }
            }
            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
           
            //ret = mgr.getRecentWeblogEntriesArray(
            //name, day, catParam, maxEntries, true );
           
            List mEntries = mgr.getWeblogEntries(
                    mRollerReq.getWebsite(),
                    null,                        // startDate
                    day,                         // endDate
                    catParam,                    // catName
                    WeblogEntryData.PUBLISHED,   // status
View Full Code Here

     * @return List of Comments.
     */
    public List getRecentComments(int maxCount) {
        List recentComments = new ArrayList();
        try {
            WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
            List recent = wmgr.getComments(
                    mWebsite,
                    null,  // weblog entry
                    null,  // search String
                    null,  // startDate
                    null,  // endDate
View Full Code Here

     */
    protected void loadWeblogEntries(Date startDate, Date endDate, String catName)
    {
        try
        {
            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
            mMonthMap = mgr.getWeblogEntryObjectMap(
                            mRollerReq.getWebsite(), // userName
                            startDate,              // startDate
                            endDate,                // endDate
                            catName,                // catName
                            WeblogEntryData.PUBLISHED, // status
View Full Code Here

                }
               
                if (startDate != null && endDate != null)
                {
                    // this work should go into a Thread!
                    WeblogManager weblogMgr =
                        RollerFactory.getRoller().getWeblogManager();
                   
                    //List entries = weblogMgr.getWeblogEntriesInDateRange(
                        //rreq.getUser().getUserName(), null, startDate, endDate, false);
                    //System.out.println("Export: got " + entries.size() + " entries.");
                   
                    List entries = weblogMgr.getWeblogEntries(
                                    rreq.getWebsite(), // userName
                                    startDate,         // startDate
                                    endDate,           // endDate
                                    null,              // catName
                                    null,              // status
View Full Code Here

            throws IOException, ServletException {
        ActionForward forward = mapping.findForward("weblogEdit.page");
        try {
            RollerRequest rreq = RollerRequest.getRollerRequest(request);
            RollerSession rses = RollerSession.getRollerSession(request);
            WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
            WeblogEntryData entry = rreq.getWeblogEntry();
            WeblogEntryFormEx form = (WeblogEntryFormEx)actionForm;
            if (entry == null && form.getId() != null) {
                entry = wmgr.getWeblogEntry(form.getId());
            }
            if (entry == null) {
                ResourceBundle resources = ResourceBundle.getBundle(
                        "ApplicationResources", request.getLocale());
                request.setAttribute("javax.servlet.error.message",
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.