Package org.apache.roller.model

Examples of org.apache.roller.model.WeblogManager


                    if ( mDate == null ) // pre-jdk1.4 --> || mDate.getYear() <= 70 )
                    {
                        // we have the /username/pagelink/anchor form of URL
                        try
                        {
                            WeblogManager weblogMgr = roller.getWeblogManager();
                            mWeblogEntry = weblogMgr.getWeblogEntryByAnchor(
                                mWebsite, pathInfo[2]);
                        }
                        catch (Exception e)
                        {
                            mLogger.debug("Can't find entry by anchor", e);
                        }
                    }
                    else
                    {
                        // we have the /username/pagelink/datestring form of URL
                        mDateString = pathInfo[2];
                        if (pathInfo[1].length() == 8) {
                            mIsDaySpecified = true;
                        } else {
                            mIsMonthSpecified = true;
                        }
                    }
                }
                else if ( pathInfo.length == 4 )
                {
                    // we have the /username/pagelink/datestring/anchor form of URL
                    mPageLink = pathInfo[1];
                    mPage = mWebsite.getPageByLink(pathInfo[1]);
                   
                    mDate = parseDate(pathInfo[2]);
                    mDateString = pathInfo[2];
                    if (pathInfo[1].length() == 8) {
                        mIsDaySpecified = true;
                    } else {
                        mIsMonthSpecified = true;
                    }

                    // we have the /username/pagelink/date/anchor form of URL
                    WeblogManager weblogMgr = RollerFactory.getRoller().getWeblogManager();
                    mWeblogEntry = weblogMgr.getWeblogEntryByAnchor(
                                    mWebsite, pathInfo[3]);
                }               
            }
            if (mDate == null && mWeblogEntry != null)
            {
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

        throws Exception
    {
        ActionForward forward = mapping.findForward("categories");
        WeblogCategoryFormEx form = (WeblogCategoryFormEx)actionForm;
        RollerRequest rreq = RollerRequest.getRollerRequest(request);
        WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();

        WeblogCategoryData cd = null;
        if (null != form.getId() && !form.getId().trim().equals(""))
        {
            cd = wmgr.getWeblogCategory(form.getId());
        }
        else
        {
            cd = new WeblogCategoryData();
            String pid = form.getParentId();
            WeblogCategoryData parentCat = wmgr.getWeblogCategory(pid);
            cd.setWebsite(parentCat.getWebsite());
            cd.setParent(parentCat);
        }

        RollerSession rses = RollerSession.getRollerSession(request);
        if (cd.getWebsite().hasUserPermissions(
            rses.getAuthenticatedUser(), PermissionsData.AUTHOR))
        {
            form.copyTo(cd, request.getLocale());
            wmgr.saveWeblogCategory(cd);
            RollerFactory.getRoller().flush();
           
            // notify caches of object invalidation
            CacheManager.invalidate(cd);
        }
View Full Code Here

     * @throws RollerException
     */
    public List retrieveWeblogEntries(boolean subcats)
        throws RollerException
    {
        WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
        return wmgr.getWeblogEntries(this, subcats);
    }
View Full Code Here

        boolean websiteSpecificSearch = checkForWebsite(rreq.getRequest());
        TreeMap searchResults = new TreeMap(new ReverseComparator());
        TreeSet categories = new TreeSet();
        Roller roller = RollerFactory.getRoller();
        UserManager userMgr = roller.getUserManager();
        WeblogManager weblogMgr =roller.getWeblogManager();
        WeblogEntryData entry;
        Document doc = null;
        String handle = null;
        for (int i = ioffset; i < ioffset+ilimit; i++) {
            entry = null; // reset for each iteration
           
            doc = hits.doc(i);
            handle = doc.getField(FieldConstants.WEBSITE_HANDLE).stringValue();
           
            if (websiteSpecificSearch && website != null) {
                // "wrong user" results have been reported
                if (handle.equals(rreq.getWebsite().getHandle())) {
                    // get real entry for display on user's site
                    entry = weblogMgr.getWeblogEntry(
                            doc.getField(FieldConstants.ID).stringValue() );
                }
            } else {
                // if user is not enabled, website will be null
                //entry = buildSearchEntry(website, doc);
                entry = weblogMgr.getWeblogEntry(
                        doc.getField(FieldConstants.ID).stringValue() );
                if (doc.getField(FieldConstants.CATEGORY) != null) {
                    categories.add(
                            doc.getField(FieldConstants.CATEGORY).stringValue());
                }
View Full Code Here

        WebsiteData website = validate(blogid, userid,password);
        RollerRequest rreq = RollerRequest.getRollerRequest();
        Roller roller = RollerFactory.getRoller();
        try {
            Hashtable result = new Hashtable();
            WeblogManager weblogMgr = roller.getWeblogManager();
            List cats = weblogMgr.getWeblogCategories(website, false);
            for (Iterator wbcItr = cats.iterator(); wbcItr.hasNext();) {
                WeblogCategoryData category = (WeblogCategoryData) 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);
       
        Roller roller = RollerFactory.getRoller();
        WeblogManager weblogMgr = roller.getWeblogManager();
        WeblogEntryData 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 ) {
            Vector cats = (Vector)postcontent.get("categories");
            cat = (String)cats.elementAt(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(WeblogEntryData.PUBLISHED);
            } else {
                entry.setStatus(WeblogEntryData.DRAFT);
            }
            if (dateCreated != null) {
                entry.setPubTime(new Timestamp(dateCreated.getTime()));
            }
           
            if ( cat != null ) {
                // Use first category specified by request
                WeblogCategoryData 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 {
            Roller roller = RollerFactory.getRoller();
            WeblogManager weblogMgr = roller.getWeblogManager();
            UserData user = roller.getUserManager().getUserByUsername(userid);
            Timestamp current =
                    new Timestamp(System.currentTimeMillis());
           
            WeblogEntryData entry = new WeblogEntryData();
            entry.setTitle(title);
            entry.setText(description);
            entry.setPubTime(new Timestamp(dateCreated.getTime()));
            entry.setUpdateTime(current);
            entry.setWebsite(website);
            entry.setCreator(user);
            if (Boolean.valueOf(publish).booleanValue()) {
                entry.setStatus(WeblogEntryData.PUBLISHED);
            } else {
                entry.setStatus(WeblogEntryData.DRAFT);
            }
                       
            // MetaWeblog supports multiple cats, Roller supports one/entry
            // so here we take accept the first category that exists
            WeblogCategoryData rollerCat = null;
            if ( postcontent.get("categories") != null ) {
                Vector cats = (Vector)postcontent.get("categories");
                if (cats != null && cats.size() > 0) {
                    for (int i=0; i<cats.size(); i++) {
                        String cat = (String)cats.get(i);
                        rollerCat = weblogMgr.getWeblogCategoryByPath(website, 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);
       
        Roller roller = RollerFactory.getRoller();
        WeblogManager weblogMgr = roller.getWeblogManager();
        WeblogEntryData entry = weblogMgr.getWeblogEntry(postid);
       
        validate(entry.getWebsite().getHandle(), userid,password);
       
        try {
            return createPostStruct(entry, userid);
View Full Code Here

       
        try {
            Vector results = new Vector();
           
            Roller roller = RollerFactory.getRoller();
            WeblogManager weblogMgr = roller.getWeblogManager();
            if (website != null) {
                List entries = weblogMgr.getWeblogEntries(
                    website,           // website
                    null,              // startDate
                    null,              // endDate
                    null,              // catName
                    null,              // status
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.