Package org.apache.roller.weblogger.pojos

Examples of org.apache.roller.weblogger.pojos.WeblogCategory


                entry.setStatus(WeblogEntry.DRAFT);
            }
           
            // MetaWeblog supports multiple cats, Weblogger supports one/entry
            // so here we take accept the first category that exists
            WeblogCategory rollerCat = null;
            if ( postcontent.get("categories") != null ) {
                Object[] cats = (Object[])postcontent.get("categories");
                if (cats != null && cats.length > 0) {
                    mLogger.debug("cats type - "+cats[0].getClass().getName());
                    mLogger.debug("cat to string - "+cats[0].toString());
View Full Code Here


       
        // name is required, has max length, no html
       
        // make sure new name is not a duplicate of an existing category
        if(!getCategory().getName().equals(getBean().getName())) {
            WeblogCategory parent = getCategory().getParent();
            if(parent != null && parent.hasCategory(getBean().getName())) {
                addError("categoryForm.error.duplicateName", getBean().getName());
            }
        }
    }
View Full Code Here

        log.info("BEGIN");
       
        WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
       
        // root category is always available
        WeblogCategory root = mgr.getRootWeblogCategory(TestUtils.getManagedWebsite(testWeblog));
       
        // add a small category tree /subcat/subcat2
        WeblogCategory subcat = new WeblogCategory(
            TestUtils.getManagedWebsite(testWeblog), root, "categoryParentDeletes1", null, null);
        root.addCategory(subcat);
        mgr.saveWeblogCategory(subcat);
       
        WeblogCategory subcat2 = new WeblogCategory(
            TestUtils.getManagedWebsite(testWeblog), subcat, "categoryParentDeletes2", null, null);
        subcat.addCategory(subcat2);
        mgr.saveWeblogCategory(subcat2);
        TestUtils.endSession(true);
       
View Full Code Here

       
        if(getCategory() != null) try {
            WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
           
            if(getTargetCategoryId() != null) {
                WeblogCategory target = wmgr.getWeblogCategory(getTargetCategoryId());
                wmgr.moveWeblogCategoryContents(getCategory(), target);
                WebloggerFactory.getWeblogger().flush();
            }
           
            // notify cache
View Full Code Here

    public List<WeblogCategory> getCategories() {
        // make list of categories with first option being being a transient
        // category just meant to represent the default option of any category
        List<WeblogCategory> cats = new ArrayList();
       
        WeblogCategory tmpCat = new WeblogCategory();
        tmpCat.setName("Any");
        tmpCat.setPath("");
        cats.add(tmpCat);
       
        List<WeblogCategory> weblogCats = Collections.EMPTY_LIST;
        try {
            WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
View Full Code Here

        doc.add(new Field(FieldConstants.CONSTANT,
                FieldConstants.CONSTANT_V,
                Field.Store.NO, Field.Index.ANALYZED));

        // index Category
        WeblogCategory categorydata = data.getCategory();
        Field category = (categorydata == null)
                // unstored
                ? new Field(FieldConstants.CATEGORY, "", Field.Store.NO, Field.Index.ANALYZED)
                // text
                : new Field(FieldConstants.CATEGORY, categorydata.getName(), Field.Store.YES, Field.Index.ANALYZED);
        doc.add(category);

        return doc;
    }
View Full Code Here

       
        WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
       
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        testUser = TestUtils.getManagedUser(testUser);
        WeblogCategory root = mgr.getRootWeblogCategory(testWeblog);
        WeblogEntry e1 = null;
        WeblogEntry e2 = null;
        WeblogEntry e3 = null;
       
        try {
            // add some categories and entries to test with
            WeblogCategory dest = new WeblogCategory(testWeblog, root, "c0", null, null);
            mgr.saveWeblogCategory(dest);

            WeblogCategory c1 = new WeblogCategory(testWeblog, root, "c1", null, null);
            mgr.saveWeblogCategory(c1);

            WeblogCategory c2 = new WeblogCategory(testWeblog, c1, "c2", null, null);
            mgr.saveWeblogCategory(c2);

            WeblogCategory c3 = new WeblogCategory(testWeblog, c2, "c3", null, null);
            mgr.saveWeblogCategory(c3);

            TestUtils.endSession(true);

            c1 = mgr.getWeblogCategory(c1.getId());
            c2 = mgr.getWeblogCategory(c2.getId());
            c3 = mgr.getWeblogCategory(c3.getId());
            dest = mgr.getWeblogCategory(dest.getId());

            e1 = TestUtils.setupWeblogEntry("e1", c1, testWeblog, testUser);
            e2 = TestUtils.setupWeblogEntry("e2", c2, testWeblog, testUser);
            e3 = TestUtils.setupWeblogEntry("e3", c3, testWeblog, testUser);

            TestUtils.endSession(true);

            // need to query for cats again because we closed the session
            c1 = mgr.getWeblogCategory(c1.getId());
            c2 = mgr.getWeblogCategory(c2.getId());
            c3 = mgr.getWeblogCategory(c3.getId());
            dest = mgr.getWeblogCategory(dest.getId());

            // verify number of entries in each category
            assertEquals(0, dest.retrieveWeblogEntries(true).size());
            assertEquals(0, dest.retrieveWeblogEntries(false).size());
            assertEquals(1, c1.retrieveWeblogEntries(false).size());
            assertEquals(3, c1.retrieveWeblogEntries(true).size());

            // move contents of source category c1 to destination catetory dest
            mgr.moveWeblogCategory(c1, dest);
            TestUtils.endSession(true);

            // after move, verify number of entries in each category
            dest = mgr.getWeblogCategory(dest.getId());
            c1 = mgr.getWeblogCategory(c1.getId());
            c2 = mgr.getWeblogCategory(c2.getId());
            c3 = mgr.getWeblogCategory(c3.getId());

            assertEquals(3, dest.retrieveWeblogEntries(true).size());
            assertEquals(0, dest.retrieveWeblogEntries(false).size());

            assertEquals(dest, c1.getParent());
            assertEquals(c1,   c2.getParent());
            assertEquals(c2,   c3.getParent());

            assertEquals(1, c1.retrieveWeblogEntries(false).size());
            assertEquals(1, c2.retrieveWeblogEntries(false).size());
            assertEquals(1, c3.retrieveWeblogEntries(false).size());

            List entries = c1.retrieveWeblogEntries(true);
            assertEquals(3, entries.size());

        } finally {
View Full Code Here

        WeblogEntry e3 = null;
        try {

            testWeblog = TestUtils.getManagedWebsite(testWeblog);
            testUser = TestUtils.getManagedUser(testUser);
            WeblogCategory root = mgr.getRootWeblogCategory(testWeblog);

            // add some categories and entries to test with
            WeblogCategory dest = new WeblogCategory(testWeblog, root, "c0", null, null);
            mgr.saveWeblogCategory(dest);

            WeblogCategory c1 = new WeblogCategory(testWeblog, root, "c1", null, null);
            mgr.saveWeblogCategory(c1);

            WeblogCategory c2 = new WeblogCategory(testWeblog, c1, "c2", null, null);
            mgr.saveWeblogCategory(c2);

            WeblogCategory c3 = new WeblogCategory(testWeblog, c2, "c3", null, null);
            mgr.saveWeblogCategory(c3);

            TestUtils.endSession(true);

            c1 = mgr.getWeblogCategory(c1.getId());
            c2 = mgr.getWeblogCategory(c2.getId());
            c3 = mgr.getWeblogCategory(c3.getId());
            dest = mgr.getWeblogCategory(dest.getId());

            testWeblog = TestUtils.getManagedWebsite(testWeblog);
            testUser = TestUtils.getManagedUser(testUser);
            e1 = TestUtils.setupWeblogEntry("e1", c1, testWeblog, testUser);
            e2 = TestUtils.setupWeblogEntry("e2", c2, testWeblog, testUser);
            e3 = TestUtils.setupWeblogEntry("e3", c3, testWeblog, testUser);

            TestUtils.endSession(true);

            // need to query for cats again since session was closed
            c1 = mgr.getWeblogCategory(c1.getId());
            c2 = mgr.getWeblogCategory(c2.getId());
            c3 = mgr.getWeblogCategory(c3.getId());
            dest = mgr.getWeblogCategory(dest.getId());

            // verify number of entries in each category
            assertEquals(0, dest.retrieveWeblogEntries(true).size());
            assertEquals(0, dest.retrieveWeblogEntries(false).size());
View Full Code Here

        testEntry.setPubTime(new java.sql.Timestamp(new java.util.Date().getTime()));
        testEntry.setUpdateTime(new java.sql.Timestamp(new java.util.Date().getTime()));
        testEntry.setWebsite(testWeblog);
        testEntry.setCreatorUserName(testUser.getUserName());
       
        WeblogCategory cat = mgr.getWeblogCategory(testWeblog.getDefaultCategory().getId());
        testEntry.setCategory(cat);
       
        // create a weblog entry
        mgr.saveWeblogEntry(testEntry);
        String id = testEntry.getId();
View Full Code Here

        testEntry.setPubTime(new java.sql.Timestamp(new java.util.Date().getTime()));
        testEntry.setUpdateTime(new java.sql.Timestamp(new java.util.Date().getTime()));
        testEntry.setWebsite(testWeblog);
        testEntry.setCreatorUserName(testUser.getUserName());

        WeblogCategory cat = emgr.getWeblogCategory(testWeblog.getDefaultCategory().getId());
        testEntry.setCategory(cat);
       
        // create a weblog entry
        emgr.saveWeblogEntry(testEntry);
        String id = testEntry.getId();
View Full Code Here

TOP

Related Classes of org.apache.roller.weblogger.pojos.WeblogCategory

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.