Package org.apache.roller.pojos

Examples of org.apache.roller.pojos.PlanetGroupData


                logger.error("ERROR: cannot sync websites with Planet Roller - "
                        +"absolute URL not specified in Roller Config");
            } else {
                PlanetManager planet = roller.getPlanetManager();
                UserManager userManager = roller.getUserManager();
                PlanetGroupData group = planet.getGroup("all");
                if (group == null) {
                    group = new PlanetGroupData();
                    group.setHandle("all");
                    group.setTitle("all");
                    planet.saveGroup(group);
                    roller.flush();
                }
                try {
                    String baseFeedURL = baseURL + "/rss/";
                    String baseSiteURL = baseURL + "/page/";
                    // get list of all enabled and active weblogs
                    Iterator websites =
                        roller.getUserManager().getWebsites(null, Boolean.TRUE, Boolean.TRUE).iterator();
                    while (websites.hasNext()) {
                        WebsiteData website = (WebsiteData)websites.next();
                       
                        StringBuffer sitesb = new StringBuffer();
                        sitesb.append(baseSiteURL);
                        sitesb.append(website.getHandle());
                        String siteUrl = sitesb.toString();
                       
                        StringBuffer feedsb = new StringBuffer();
                        feedsb.append(baseFeedURL);
                        feedsb.append(website.getHandle());
                        String feedUrl = feedsb.toString();
                       
                        liveUserFeeds.add(feedUrl);
                       
                        PlanetSubscriptionData sub =
                                planet.getSubscription(feedUrl);
                        if (sub == null) {
                            logger.info("ADDING feed: "+feedUrl);
                            sub = new PlanetSubscriptionData();
                            sub.setTitle(website.getName());
                            sub.setFeedUrl(feedUrl);
                            sub.setSiteUrl(siteUrl);
                            sub.setAuthor(website.getHandle());
                            planet.saveSubscription(sub);
                            group.addSubscription(sub);
                        } else {
                            sub.setTitle(website.getName());
                            sub.setAuthor(website.getHandle());
                            planet.saveSubscription(sub);
                        }
                    }
                    planet.saveGroup(group);
                    roller.flush();
                    roller.release();
                   
                    // TODO: new planet manager method deleteSubs(list)
                    group = group = planet.getGroup("all");
                    Iterator subs = group.getSubscriptions().iterator();
                    while (subs.hasNext()) {
                        PlanetSubscriptionData sub =
                                (PlanetSubscriptionData)subs.next();
                        if (!liveUserFeeds.contains(sub.getFeedUrl())) {
                            logger.info("DELETING feed: "+sub.getFeedUrl());
View Full Code Here


    public void testGroupStorage() throws Exception {
       
        PlanetManager planet = RollerFactory.getRoller().getPlanetManager();
       
        {   // save group
            PlanetGroupData group = new PlanetGroupData();
            group.setDescription("test_group_desc");
            group.setHandle("test_handle");
            group.setTitle("test_title");
            planet.saveGroup(group);
            TestUtils.endSession(true);
        }
        {   // retrieve group
            PlanetGroupData group = planet.getGroup("test_handle");
            assertEquals("test_group_desc",group.getDescription());
            assertEquals("test_title",group.getTitle());
            assertTrue(planet.getGroupHandles().size() > 0);
        }
        {   // remove group
            PlanetGroupData group = planet.getGroup("test_handle");
            planet.deleteGroup(group);
            TestUtils.endSession(true);
        }
        {   // verify that it is gone
            PlanetGroupData group = planet.getGroup("test_handle");
            assertNull(group);
        }
    }
View Full Code Here

            sub.setFeedURL("test_url");
            planet.saveSubscription(sub);
            TestUtils.endSession(true);
        }
        {   // retrieve subscription and add to group
            PlanetGroupData group = new PlanetGroupData();
            group.setDescription("test_group_desc");
            group.setHandle("test_handle");
            group.setTitle("test_title");
            planet.saveGroup(group);
           
            PlanetSubscriptionData sub = planet.getSubscription("test_url");
            assertNotNull(sub);
            group.addSubscription(sub);
           
            PlanetSubscriptionData sub1 = new PlanetSubscriptionData();
            sub1.setFeedURL("test_url1");
            planet.saveSubscription(sub1);
           
            List subs = new ArrayList();
            subs.add(sub1);
            group.addSubscriptions(subs);
           
            planet.saveGroup(group);
            TestUtils.endSession(true);
        }
        {   // get group and check it's subscriptions, remove it
            PlanetGroupData group = planet.getGroup("test_handle");
            Set subs = group.getSubscriptions();
            assertEquals(2, subs.size());
            planet.deleteGroup(group);
            TestUtils.endSession(true);
        }
        {   // make sure group gone, subs still there, then remove them too
            PlanetGroupData group = planet.getGroup("test_handle");
            assertNull(group);
            PlanetSubscriptionData sub = planet.getSubscription("test_url");
            assertNotNull(sub);
            PlanetSubscriptionData sub1 = planet.getSubscription("test_url1");
            assertNotNull(sub1);
View Full Code Here

        PlanetManager planet = RollerFactory.getRoller().getPlanetManager();
       
        String feed_url1 = "http://rollerweblogger.org/rss/roller";
       
        {
            PlanetGroupData group = new PlanetGroupData();
            group.setDescription("test_group_desc");
            group.setHandle("test_handle");
            group.setTitle("test_title");
            planet.saveGroup(group);
           
            PlanetSubscriptionData sub = new PlanetSubscriptionData();
            sub.setFeedURL(feed_url1);
            planet.saveSubscription(sub);
           
            group.addSubscription(sub);
            planet.saveGroup(group);
            TestUtils.endSession(true);
        }
        {
            planet.refreshEntries();
            TestUtils.endSession(true);
           
            PlanetSubscriptionData sub = planet.getSubscription(feed_url1);
            int entriesSize = sub.getEntries().size();
           
            PlanetGroupData group = planet.getGroup("test_handle");
            assertNotNull(group);
           
            planet.deleteGroup(group);
            planet.deleteSubscription(sub);
            TestUtils.endSession(true);
View Full Code Here

           
            String feed_url1 = "http://rollerweblogger.org/rss/roller";
            String feed_url2 = "http://linuxintegrators.com/acoliver/?flavor=rss2";
           
            {
                PlanetGroupData group = new PlanetGroupData();
                group.setDescription("test_group_desc");
                group.setHandle("test_handle");
                group.setTitle("test_title");
                planet.saveGroup(group);
               
                PlanetSubscriptionData sub1 = new PlanetSubscriptionData();
                sub1.setFeedURL(feed_url1);
                planet.saveSubscription(sub1);
               
                PlanetSubscriptionData sub2 = new PlanetSubscriptionData();
                sub2.setFeedURL(feed_url2);
                planet.saveSubscription(sub2);
               
                group.addSubscription(sub1);
                group.addSubscription(sub2);
                planet.saveGroup(group);
                TestUtils.endSession(true);
            }
            {
                planet.refreshEntries();
                TestUtils.endSession(true);
               
                int count = 0;
                Iterator subs = planet.getAllSubscriptions();
                while  (subs.hasNext()) {
                    PlanetSubscriptionData sub= (PlanetSubscriptionData)subs.next();
                    count += sub.getEntries().size();
                }
                PlanetSubscriptionData sub1 = planet.getSubscription(feed_url1);
                assertTrue(sub1.getEntries().size() > 0);
                PlanetSubscriptionData sub2 = planet.getSubscription(feed_url2);
                assertTrue(sub2.getEntries().size() > 0);
                assertEquals(count, sub1.getEntries().size() + sub2.getEntries().size());
               
                PlanetGroupData group = planet.getGroup("test_handle");
                assertNotNull(group);
               
                List bigag = planet.getAggregation(group, null, null, 0, 30);
                assertEquals(30, bigag.size());
               
View Full Code Here

               
                String groupHandle = request.getParameter("groupHandle");
                groupHandle = (groupHandle == null) ? form.getGroupHandle() : groupHandle;
                groupHandle = (groupHandle == null) ? "external" : groupHandle;
               
                PlanetGroupData targetGroup = planet.getGroup(groupHandle);
                form.setGroupHandle(groupHandle);
                request.setAttribute("model",
                        new SubscriptionsPageModel(
                        targetGroup, request, response, mapping, form));
            } else {
View Full Code Here

               
                String groupHandle = request.getParameter("groupHandle");
                groupHandle = (groupHandle == null) ? form.getGroupHandle() : groupHandle;
                groupHandle = (groupHandle == null) ? "external" : groupHandle;
               
                PlanetGroupData targetGroup = planet.getGroup(groupHandle);
                form.setGroupHandle(groupHandle);
                request.setAttribute("model",
                        new SubscriptionsPageModel(
                        targetGroup, request, response, mapping, form));
            } else {
View Full Code Here

                   
                    String groupHandle = request.getParameter("groupHandle");
                    groupHandle = (groupHandle == null) ? form.getGroupHandle() : groupHandle;
                    groupHandle = (groupHandle == null) ? "external" : groupHandle;
                   
                    PlanetGroupData targetGroup = planet.getGroup(groupHandle);
                   
                    targetGroup.removeSubscription(sub);
                    planet.deleteSubscription(sub);
                    roller.flush();
                    // TODO: why release here?
                    roller.release();
                   
View Full Code Here

           
            String groupHandle = request.getParameter("groupHandle");
            groupHandle = (groupHandle == null) ? form.getGroupHandle() : groupHandle;
            groupHandle = (groupHandle == null) ? "external" : groupHandle;
           
            PlanetGroupData targetGroup = planet.getGroup(groupHandle);
           
            if (RollerSession.getRollerSession(request).isGlobalAdminUser()) {
               
                ActionMessages messages = new ActionMessages();
                PlanetSubscriptionData sub = null;
                ActionErrors errors = validate(planet, form);
                if (errors.isEmpty()) {
                    if (form.getId() == null || form.getId().trim().length() == 0) {                       
                        // Adding new subscription to group                       
                        // But, does subscription to that feed already exist?
                        if (form.getFeedURL() != null) {
                            sub = planet.getSubscription(form.getFeedURL());
                        }
                        if (sub != null) {
                            // Yes, we'll use it instead
                            messages.add(null, new ActionMessage(
                                "planetSubscription.foundExisting", sub.getTitle()));
                        } else {
                            // No, add new subscription
                            sub = new PlanetSubscriptionData();
                            form.copyTo(sub, request.getLocale());
                        }                       
                        targetGroup.addSubscription(sub);
                       
                    } else {
                        // User editing an existing subscription within a group
                        sub = planet.getSubscriptionById(form.getId());
                        form.copyTo(sub, request.getLocale());                       
View Full Code Here

                PlanetManager planet = roller.getPlanetManager();
                PlanetGroupForm form = (PlanetGroupForm)actionForm;
                if (request.getParameter("groupHandle") != null)
                {
                    String feedUrl = request.getParameter("groupHandle");
                    PlanetGroupData group = planet.getGroup(feedUrl);
                    form.copyFrom(group, request.getLocale());
                }
                else
                {
                    form.doReset(mapping, request);
View Full Code Here

TOP

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

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.