Package org.apache.roller.pojos

Examples of org.apache.roller.pojos.WeblogEntryData


            throws IOException, ServletException {
        ActionForward forward = mapping.findForward("weblogEntryRemove.page");
        try {
            Roller roller = RollerFactory.getRoller();
            WeblogEntryFormEx wf = (WeblogEntryFormEx)actionForm;
            WeblogEntryData wd =
                    roller.getWeblogManager().getWeblogEntry(wf.getId());
            RollerSession rses =
                    RollerSession.getRollerSession(request);
            if (     rses.isUserAuthorizedToAuthor(wd.getWebsite())
            || (rses.isUserAuthorized(wd.getWebsite()) && wd.isDraft()) ) {
                wf.copyFrom(wd, request.getLocale());
                if (wd == null || wd.getId() == null) {
                    ResourceBundle resources = ResourceBundle.getBundle(
                            "ApplicationResources", request.getLocale());
                    request.setAttribute("javax.servlet.error.message",
                            resources.getString("weblogEntry.notFound"));
                    forward = mapping.findForward("error");
View Full Code Here


            HttpServletRequest  request,
            HttpServletResponse response)
            throws IOException, ServletException {
        try {
            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
            WeblogEntryData wd =
                    mgr.getWeblogEntry(request.getParameter("id"));
            RollerSession rses =
                    RollerSession.getRollerSession(request);
            if (     rses.isUserAuthorizedToAuthor(wd.getWebsite())
            || (rses.isUserAuthorized(wd.getWebsite()) && wd.isDraft()) ) {
               
                // remove the index for it
                // TODO: can we do this in a better way?
                wd.setStatus(WeblogEntryData.DRAFT);
                reindexEntry(RollerFactory.getRoller(), wd);
               
                // remove entry itself
                mgr.removeWeblogEntry(wd);
                RollerFactory.getRoller().flush();
               
                // flush caches
                CacheManager.invalidate(wd);
               
                ActionMessages uiMessages = new ActionMessages();
                uiMessages.add(null,
                        new ActionMessage("weblogEdit.entryRemoved"));
                saveMessages(request, uiMessages);
               
                RollerRequest.getRollerRequest().setWebsite(wd.getWebsite());
            } else {
                return mapping.findForward("access-denied");
            }
        } catch (Exception e) {
            throw new ServletException(e);
View Full Code Here

            HttpServletRequest request,
            HttpServletResponse response) throws RollerException {
        ActionMessages resultMsg = new ActionMessages();
        ActionForward forward = mapping.findForward("weblogEdit.page");
        ActionErrors errors = new ActionErrors();
        WeblogEntryData entry = null;
        try {
            WeblogEntryFormEx form = (WeblogEntryFormEx)actionForm;
            String entryid = form.getId();
            if ( entryid == null ) {
                entryid =
                        request.getParameter(RollerRequest.WEBLOGENTRYID_KEY);
            }
            Roller roller = RollerFactory.getRoller();
            RollerContext rctx= RollerContext.getRollerContext();
            WeblogManager wmgr= roller.getWeblogManager();
            entry = wmgr.getWeblogEntry(entryid);
           
            RollerSession rses = RollerSession.getRollerSession(request);
            if (rses.isUserAuthorizedToAuthor(entry.getWebsite())) {
                // Run entry through registered PagePlugins
                PagePluginManager ppmgr = roller.getPagePluginManager();
                Map plugins = ppmgr.createAndInitPagePlugins(
                        entry.getWebsite(),
                        RollerContext.getRollerContext().getServletContext(),
                        RollerContext.getRollerContext().getAbsoluteContextUrl(request),
                        new VelocityContext());
               
                String content = "";
                if (!StringUtils.isEmpty(entry.getText())) {
                    content = entry.getText();
                } else {
                    content = entry.getSummary();
                }
                content = ppmgr.applyPagePlugins(entry, plugins, content, true);

                String title = entry.getTitle();
                String excerpt = StringUtils.left( Utilities.removeHTML(content),255 );
               
                String url = rctx.createEntryPermalink(entry, request, true);
                String blog_name = entry.getWebsite().getName();
               
                if (form.getTrackbackUrl() != null) {
                    // by default let all trackbacks to be sent
                    boolean allowTrackback = true;
                   
View Full Code Here

    /**
     * @see javax.servlet.jsp.tagext.Tag#doStartTag()
     */
    public int doStartTag() throws JspException {
        Roller roller = RollerFactory.getRoller();
        WeblogEntryData entry = (WeblogEntryData)
            RequestUtils.lookup(pageContext, name, property, scope);
        if (Utilities.isNotEmpty(entry.getSummary())) {
            String xformed = entry.getSummary();
            try {       
                if (entry.getPlugins() != null) {
                    RollerContext rctx =
                        RollerContext.getRollerContext();
                    PagePluginManager ppmgr = roller.getPagePluginManager();
                    Map plugins = ppmgr.createAndInitPagePlugins(
                        entry.getWebsite(),
                        rctx.getServletContext(),
                        rctx.getAbsoluteContextUrl((HttpServletRequest)pageContext.getRequest()),
                        new VelocityContext());
                    xformed = ppmgr.applyPagePlugins(
                        entry, plugins, entry.getSummary(), true);
                }              
                pageContext.getOut().println(xformed);
            } catch (Throwable e) {
                throw new JspException("ERROR applying plugin to entry", e);
            }
View Full Code Here

    /**
     * @see javax.servlet.jsp.tagext.Tag#doStartTag()
     */
    public int doStartTag() throws JspException {
        Roller roller = RollerFactory.getRoller();
        WeblogEntryData entry = (WeblogEntryData)
            RequestUtils.lookup(pageContext, name, property, scope);
        if (Utilities.isNotEmpty(entry.getText())) {
            String xformed = entry.getText();;       
            try {
                if (entry.getPlugins() != null) {
                    RollerContext rctx =
                        RollerContext.getRollerContext();
                    try {
                        PagePluginManager ppmgr = roller.getPagePluginManager();
                        Map plugins = ppmgr.createAndInitPagePlugins(
                            entry.getWebsite(), rctx.getServletContext(),
                            rctx.getAbsoluteContextUrl((HttpServletRequest)pageContext.getRequest()),
                            new VelocityContext());
                        xformed = ppmgr.applyPagePlugins(
                            entry, plugins, entry.getText(), singleEntry);
                    } catch (Exception e) {
                        mLogger.error(e);
                    }
                }

View Full Code Here

    /** returns a dummied-up weblog entry object */
    public WeblogEntryData getWeblogEntry() throws RollerException
    {
        if (weblogEntry == null)
        {
            weblogEntry = new WeblogEntryData();
            weblogEntry.setWebsite(getWebsite());
            form.copyTo(weblogEntry,
                    getRequest().getLocale(), getRequest().getParameterMap());
            weblogEntry.setWebsite(weblogEntry.getWebsite());
        }
View Full Code Here

  public ActionForward execute(
    ActionMapping mapping, ActionForm form,
    HttpServletRequest req, HttpServletResponse res)
    throws Exception
  {
        WeblogEntryData entry = null;
        RollerRequest rreq = RollerRequest.getRollerRequest(req);
        RollerSession rollerSession = RollerSession.getRollerSession(req);
        try
        {
            if (rreq.getWebsite() != null
View Full Code Here

        mLogger.debug("     PostId: " + postid);
        mLogger.debug("     UserId: " + userid);
       
        Roller roller = RollerFactory.getRoller();
        WeblogManager weblogMgr = roller.getWeblogManager();
        WeblogEntryData entry = weblogMgr.getWeblogEntry(postid);
       
        validate(entry.getWebsite().getHandle(), userid, password);
       
        try {
            // delete the entry
            weblogMgr.removeWeblogEntry(entry);
            roller.flush();
           
            // notify cache
            flushPageCache(entry.getWebsite());
        } catch (Exception e) {
            String msg = "ERROR in blogger.deletePost: "+e.getClass().getName();
            mLogger.error(msg,e);
            throw new XmlRpcException(UNKNOWN_EXCEPTION, msg);
        }
View Full Code Here

            try {
                Timestamp current = new Timestamp(System.currentTimeMillis());
               
                Roller roller = RollerFactory.getRoller();
                WeblogManager weblogMgr = roller.getWeblogManager();
                WeblogEntryData entry = weblogMgr.getWeblogEntry(postid);
                entry.setText(content);
                entry.setUpdateTime(current);
                if (Boolean.valueOf(publish).booleanValue()) {
                    entry.setStatus(WeblogEntryData.PUBLISHED);
                } else {
                    entry.setStatus(WeblogEntryData.DRAFT);
                }
               
                // save the entry
                weblogMgr.saveWeblogEntry(entry);
                roller.flush();
               
                // notify cache
                flushPageCache(entry.getWebsite());
               
                return true;
            } catch (Exception e) {
                String msg = "ERROR in BlooggerAPIHander.editPost";
                mLogger.error(msg,e);
View Full Code Here

            Roller roller = RollerFactory.getRoller();
            WeblogManager weblogMgr = roller.getWeblogManager();
           
            Timestamp current = new Timestamp(System.currentTimeMillis());
           
            WeblogEntryData entry = new WeblogEntryData();
            entry.setTitle(title);
            entry.setText(content);
            entry.setPubTime(current);
            entry.setUpdateTime(current);
            UserData user = roller.getUserManager().getUserByUsername(userid);
            entry.setCreator(user);
            entry.setWebsite(website);
            entry.setCategory(website.getBloggerCategory());
            if (Boolean.valueOf(publish).booleanValue()) {
                entry.setStatus(WeblogEntryData.PUBLISHED);
            } else {
                entry.setStatus(WeblogEntryData.DRAFT);
            }
           
            // save the entry
            weblogMgr.saveWeblogEntry(entry);
            roller.flush();
           
            // notify cache
            flushPageCache(entry.getWebsite());

            return entry.getId();
        } catch (Exception e) {
            String msg = "ERROR in BlooggerAPIHander.newPost";
            mLogger.error(msg,e);
            throw new XmlRpcException(UNKNOWN_EXCEPTION, msg);
        }
View Full Code Here

TOP

Related Classes of org.apache.roller.pojos.WeblogEntryData

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.