Examples of PlanetGroupData


Examples of org.apache.roller.planet.pojos.PlanetGroupData

    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

Examples of org.apache.roller.planet.pojos.PlanetGroupData

           
            PlanetSubscriptionData sub1 = new PlanetSubscriptionData();
            sub1.setFeedURL("test_url1");
            planet.saveSubscription(sub1);  
           
            PlanetGroupData group = new PlanetGroupData();
            group.setDescription("test_group_desc");
            group.setHandle("test_handle");
            group.setTitle("test_title");
            planet.saveGroup(group);
           
            TestUtils.endSession(true);
        }
        {   // retrieve subscriptions and add to group
           
            PlanetSubscriptionData sub = planet.getSubscription("test_url");
            PlanetSubscriptionData sub1 = planet.getSubscription("test_url1");
            PlanetGroupData group = planet.getGroup("test_handle");
           
            group.getSubscriptions().add(sub);
            sub.getGroups().add(group);
           
            group.getSubscriptions().add(sub1);
            sub1.getGroups().add(group);
                       
            planet.saveSubscription(sub);
            planet.saveSubscription(sub1);
            planet.saveGroup(group);
           
            TestUtils.endSession(true);
        }
        {   // get group and remove one subscription
            PlanetSubscriptionData sub = planet.getSubscription("test_url");
            PlanetGroupData group = planet.getGroup("test_handle");
            group.getSubscriptions().remove(sub);
            TestUtils.endSession(true);
        }
        {   // get group and check it's subscriptions, remove it
            PlanetGroupData group = planet.getGroup("test_handle");
            Set subs = group.getSubscriptions();
            assertEquals(1, 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

Examples of org.apache.roller.planet.pojos.PlanetGroupData

        {
            PlanetConfigData config = planet.getConfiguration();
            config.setCacheDir("." + File.separator + "planet-cache");
            planet.saveConfiguration(config);
           
            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.getSubscriptions().add(sub);
            planet.saveGroup(group);
            TestUtils.endSession(true);
        }
        {
            planet.refreshEntries("." + File.separator + "planet-cache");
            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

Examples of org.apache.roller.planet.pojos.PlanetGroupData

           
            String feed_url1 = "http://rollerweblogger.org/roller/feed/entries/rss";
            String feed_url2 = "http://blogs.sun.com/main/feed/entries/atom";
           
            {
                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.getSubscriptions().add(sub1);
                group.getSubscriptions().add(sub2);
                planet.saveGroup(group);
                TestUtils.endSession(true);
            }
            {
                planet.refreshEntries("." + File.separator + "planet-cache");
                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

Examples of org.apache.roller.planet.pojos.PlanetGroupData

               
                List rawEntries = null;
                if (feedURL != null) {
                    rawEntries = planetManager.getFeedEntries(feedURL, offset, length+1);
                } else if (groupHandle != null) {
                    PlanetGroupData group = planetManager.getGroup(groupHandle);
                    rawEntries = planetManager.getAggregation(group, startDate, null, offset, length+1);
                } else {
                    rawEntries = planetManager.getAggregation(startDate, null, offset, length+1);
                }
               
View Full Code Here

Examples of org.apache.roller.planet.pojos.PlanetGroupData

               
                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

Examples of org.apache.roller.planet.pojos.PlanetGroupData

               
                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

Examples of org.apache.roller.planet.pojos.PlanetGroupData

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

Examples of org.apache.roller.planet.pojos.PlanetGroupData

           
            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());
                            planet.saveSubscription(sub);
                        }                       
                        targetGroup.getSubscriptions().add(sub);
                       
                    } else {
                        // User editing an existing subscription within a group
                        sub = planet.getSubscriptionById(form.getId());
                        form.copyTo(sub, request.getLocale());                       
View Full Code Here

Examples of org.apache.roller.planet.pojos.PlanetGroupData

                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
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.