Package org.apache.roller.model

Examples of org.apache.roller.model.WeblogManager


        }
       
        try {
            RollerRequest rreq = RollerRequest.getRollerRequest();
            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());
View Full Code Here


       
        try {
            Vector results = new Vector();
           
            Roller roller = RollerFactory.getRoller();
            WeblogManager weblogMgr = roller.getWeblogManager();
            if (website != null) {
                Map entries = weblogMgr.getWeblogEntryObjectMap(
                        website,                // userName
                        null,                   // startDate
                        new Date(),             // endDate
                        null,                   // catName
                        null,      // status
View Full Code Here

        }
        if (this.getActive() == null) {
            dataHolder.setActive(Boolean.FALSE);
        }
       
        WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
       
        if (getDefaultCategoryId() != null) {
            WeblogCategoryData defaultCat =
                wmgr.getWeblogCategory(getDefaultCategoryId());
            dataHolder.setDefaultCategory(defaultCat);
        }
       
        if (getBloggerCategoryId() != null) {
            WeblogCategoryData bloggerCat =
                wmgr.getWeblogCategory(getBloggerCategoryId());
            dataHolder.setBloggerCategory(bloggerCat);
        }
    }
View Full Code Here

    /**
     * Test basic persistence operations ... Create, Update, Delete
     */
    public void testCommentCRUD() throws Exception {
       
        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
       
        CommentData comment = new CommentData();
        comment.setName("test");
        comment.setEmail("test");
        comment.setUrl("test");
        comment.setRemoteHost("foofoo");
        comment.setContent("this is a test comment");
        comment.setPostTime(new java.sql.Timestamp(new java.util.Date().getTime()));
        comment.setWeblogEntry(testEntry);
        comment.setPending(Boolean.FALSE);
        comment.setApproved(Boolean.TRUE);
       
        // create a comment
        mgr.saveComment(comment);
        String id = comment.getId();
        TestUtils.endSession(true);
       
        // make sure comment was created
        comment = null;
        comment = mgr.getComment(id);
        assertNotNull(comment);
        assertEquals("this is a test comment", comment.getContent());
       
        // update a comment
        comment.setContent("testtest");
        mgr.saveComment(comment);
        TestUtils.endSession(true);
       
        // make sure comment was updated
        comment = null;
        comment = mgr.getComment(id);
        assertNotNull(comment);
        assertEquals("testtest", comment.getContent());
       
        // delete a comment
        mgr.removeComment(comment);
        TestUtils.endSession(true);
       
        // make sure comment was deleted
        comment = null;
        comment = mgr.getComment(id);
        assertNull(comment);
    }
View Full Code Here

    /**
     * Test lookup mechanisms ...
     */
    public void testCommentLookups() throws Exception {
       
        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
        List comments = null;
       
        // we need some comments to play with
        CommentData comment1 = TestUtils.setupComment("comment1", testEntry);
        CommentData comment2 = TestUtils.setupComment("comment2", testEntry);
        CommentData comment3 = TestUtils.setupComment("comment3", testEntry);
        TestUtils.endSession(true);
       
        // get all comments
        comments = null;
        comments = mgr.getComments(null, null, null, null, null, null, null, null, false, 0, -1);
        assertNotNull(comments);
        assertEquals(3, comments.size());
       
        // get all comments for entry
        comments = null;
        comments = mgr.getComments(null, testEntry, null, null, null, null, null, null, false, 0, -1);
        assertNotNull(comments);
        assertEquals(3, comments.size());
       
        // make some changes
        comment3.setPending(Boolean.TRUE);
        comment3.setApproved(Boolean.FALSE);
        mgr.saveComment(comment3);
       
        // get pending comments
        comments = null;
        comments = mgr.getComments(null, null, null, null, null, Boolean.TRUE, null, null, false, 0, -1);
        assertNotNull(comments);
        assertEquals(1, comments.size());
       
        // get approved comments
        comments = null;
        comments = mgr.getComments(null, null, null, null, null, null, Boolean.TRUE, null, false, 0, -1);
        assertNotNull(comments);
        assertEquals(2, comments.size());
       
        // get comments with offset
        comments = null;
        comments = mgr.getComments(null, null, null, null, null, null, null, null, false, 1, -1);
        assertNotNull(comments);
        assertEquals(2, comments.size());
       
        // remove test comments
        TestUtils.teardownComment(comment1.getId());
View Full Code Here

                weblogEntry = rreq.getWeblogEntry();
            }
            else if (rreq.getWebsite() != null) {
                website = rreq.getWebsite();
            }
            WeblogManager blogmgr = roller.getWeblogManager();

            int offset = queryForm.getOffset();
            comments = blogmgr.getComments(
                website,
                weblogEntry,
                queryForm.getSearchString(),
                queryForm.getStartDate(request.getLocale()),
                queryForm.getEndDate(request.getLocale()),
View Full Code Here

        testEntry.setWebsite(weblog);
        testEntry.setCreator(user);
        testEntry.setCategory(cat);
       
        // store entry
        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
        mgr.saveWeblogEntry(testEntry);
       
        // query for object
        WeblogEntryData entry = mgr.getWeblogEntry(testEntry.getId());
       
        if(entry == null)
            throw new RollerException("error setting up weblog entry");
       
        return entry;
View Full Code Here

     * Convenience method for removing a weblog entry.
     */
    public static void teardownWeblogEntry(String id) throws Exception {
       
        // lookup the entry
        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
        WeblogEntryData entry = mgr.getWeblogEntry(id);
       
        // remove the entry
        mgr.removeWeblogEntry(entry);
    }
View Full Code Here

        testComment.setWeblogEntry(entry);
        testComment.setPending(Boolean.FALSE);
        testComment.setApproved(Boolean.TRUE);
       
        // store testComment
        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
        mgr.saveComment(testComment);
       
        // query for object
        CommentData comment = mgr.getComment(testComment.getId());
       
        if(comment == null)
            throw new RollerException("error setting up comment");
       
        return comment;
View Full Code Here

     * Convenience method for removing a comment.
     */
    public static void teardownComment(String id) throws Exception {
       
        // lookup the comment
        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
        CommentData comment = mgr.getComment(id);
       
        // remove the comment
        mgr.removeComment(comment);
    }
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.