Examples of WeblogCategory


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

        try {
            Hashtable result = new Hashtable();
            WeblogManager weblogMgr = roller.getWeblogManager();
            List cats = weblogMgr.getWeblogCategories(website, false);
            for (Iterator wbcItr = cats.iterator(); wbcItr.hasNext();) {
                WeblogCategory category = (WeblogCategory) wbcItr.next();
                result.put(category.getPath(),
                        createCategoryStruct(category, userid));
            }
            return result;
        } catch (Exception e) {
            String msg = "ERROR in MetaWeblogAPIHandler.getCategories";
View Full Code Here

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

        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

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

        doc.add(Field.UnStored(FieldConstants.C_NAME, commentName));

        doc.add(Field.UnStored(FieldConstants.CONSTANT, FieldConstants.CONSTANT_V));

        // index Category
        WeblogCategory categorydata = data.getCategory();
        Field category = (categorydata == null)
           ? Field.UnStored(FieldConstants.CATEGORY, "")
           : Field.Text(FieldConstants.CATEGORY, categorydata.getName());
        doc.add(category);

        return doc;
    }
View Full Code Here

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

        log.info("BEGIN");
       
        WeblogManager mgr = WebloggerFactory.getWeblogger().getWeblogManager();
       
        // 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);
       
        // now delete the weblog owning these categories
View Full Code Here

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

        log.info("BEGIN");
       
        WeblogManager mgr = WebloggerFactory.getWeblogger().getWeblogManager();
       
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        WeblogCategory root = mgr.getRootWeblogCategory(testWeblog);
       
        WeblogCategory testCat = new WeblogCategory(testWeblog, null, "root", "root", null);
        assertTrue(root.equals(testCat));
       
        testCat = new WeblogCategory(testWeblog, root, "root", "root", null);
        assertFalse(root.equals(testCat));
       
        log.info("END");
    }
View Full Code Here

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

    public void testBasicCRUD() throws Exception {
       
        log.info("BEGIN");
       
        WeblogManager mgr = WebloggerFactory.getWeblogger().getWeblogManager();
        WeblogCategory cat = null;
        List cats = null;
       
        // root category is always available
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        WeblogCategory root = mgr.getRootWeblogCategory(testWeblog);
       
        // make sure we are starting with 0 categories (beneath root)
        assertEquals(0, root.getWeblogCategories().size());
       
        // add a new category
        WeblogCategory newCat = new WeblogCategory(testWeblog, root, "catTestCategory", null, null);
        mgr.saveWeblogCategory(newCat);
        TestUtils.endSession(true);
       
        // make sure category was added
        cat = null;
        cat = mgr.getWeblogCategory(newCat.getId());
        assertNotNull(cat);
        assertEquals(newCat, cat);
       
        // make sure category count increased
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        root = mgr.getRootWeblogCategory(testWeblog);
        assertEquals(1, root.getWeblogCategories().size());
       
        // update category
        cat.setName("testtest");
        mgr.saveWeblogCategory(cat);
        TestUtils.endSession(true);
       
        // verify category was updated
        cat = null;
        cat = mgr.getWeblogCategory(newCat.getId());
        assertNotNull(cat);
        assertEquals("testtest", cat.getName());
       
        // remove category
        mgr.removeWeblogCategory(cat);
        TestUtils.endSession(true);
       
        // make sure cat was removed
        cat = null;
        cat = mgr.getWeblogCategory(newCat.getId());
        assertNull(cat);
       
        // make sure category count decreased
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        root = mgr.getRootWeblogCategory(testWeblog);
View Full Code Here

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

       
        WeblogManager mgr = WebloggerFactory.getWeblogger().getWeblogManager();
       
        // root category is always available
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        WeblogCategory root = mgr.getRootWeblogCategory(testWeblog);
       
        // add a small category tree /subcat/subcat2
        WeblogCategory subcat = new WeblogCategory(testWeblog, root, "subcatTest1", null, null);
        root.addCategory(subcat);
        mgr.saveWeblogCategory(subcat);
        WeblogCategory subcat2 = new WeblogCategory(testWeblog, subcat, "subcatTest2", null, null);
        subcat.addCategory(subcat2);
        mgr.saveWeblogCategory(subcat2);
        TestUtils.endSession(true);
       
        // check that subcat tree can be navigated
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        root = mgr.getRootWeblogCategory(testWeblog);
        assertEquals(1, root.getWeblogCategories().size());
        subcat = (WeblogCategory) root.getWeblogCategories().iterator().next();
        assertEquals("subcatTest1", subcat.getName());
        assertEquals(1, subcat.getWeblogCategories().size());
        subcat2 = (WeblogCategory) subcat.getWeblogCategories().iterator().next();
        assertEquals("subcatTest2", subcat2.getName());
       
        // now delete category and subcats should be deleted by cascade
        mgr.removeWeblogCategory(subcat);
        TestUtils.endSession(true);
       
View Full Code Here

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

            if (isDuplicateWeblogCategoryName(cat)) {
                throw new WebloggerException("Duplicate category name, cannot save category");
            }
            // Newly added object. If it has a parent,
            // maintain relationship from both sides
            WeblogCategory parent = cat.getParent();
            if(parent != null) {
                parent.getWeblogCategories().add(cat);
            }
        }
       
        // update weblog last modified date.  date updated by saveWebsite()
        roller.getWeblogManager().saveWeblog(cat.getWebsite());       
View Full Code Here

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

        }
       
        // remove cat
        this.strategy.remove(cat);
        //relationship management for the other side
        WeblogCategory parent = cat.getParent();
        if(parent != null) {
            parent.getWeblogCategories().remove(cat);
        }
       
        // update website default cats if needed
        if(cat.getWebsite().getBloggerCategory().equals(cat)) {
            WeblogCategory rootCat = this.getRootWeblogCategory(cat.getWebsite());
            cat.getWebsite().setBloggerCategory(rootCat);
            this.strategy.store(cat.getWebsite());
        }
       
        if(cat.getWebsite().getDefaultCategory().equals(cat)) {
            WeblogCategory rootCat = this.getRootWeblogCategory(cat.getWebsite());
            cat.getWebsite().setDefaultCategory(rootCat);
            this.strategy.store(cat.getWebsite());
        }
       
        // update weblog last modified date.  date updated by saveWebsite()
View Full Code Here

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

       
        log.debug("Moving category "+srcCat.getPath() +
                " under "+destCat.getPath());
       
       
        WeblogCategory oldParent = srcCat.getParent();
        if(oldParent != null) {
            oldParent.getWeblogCategories().remove(srcCat);
        }
        srcCat.setParent(destCat);
        destCat.getWeblogCategories().add(srcCat);
       
        if("/".equals(destCat.getPath())) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.