Package org.apache.roller.planet.pojos

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


           
            RefreshRollerPlanetTask refreshTask = new RefreshRollerPlanetTask();
            refreshTask.run();
           
            Planet planetObject = planet.getPlanet("default");
            PlanetGroup group = planet.getGroup(planetObject, "all");
            List agg = planet.getEntries(group, 0, -1);
            assertEquals(3, agg.size());
        }
        catch (Exception e) {
            e.printStackTrace();
View Full Code Here


    public List getRankedSubscriptions(String groupHandle, int sinceDays, int length) {
        List list = new ArrayList();
        try {
            PlanetManager planetManager = PlanetFactory.getPlanet().getPlanetManager();
            Planet defaultPlanet = planetManager.getPlanet(DEFAULT_PLANET_HANDLE);
            PlanetGroup planetGroup = planetManager.getGroup(defaultPlanet, groupHandle);
            List subs = planetManager.getTopSubscriptions(planetGroup, 0, length);
            for (Iterator it = subs.iterator(); it.hasNext();) {
                Subscription sub = (Subscription) it.next();
                // TODO needs pojo wrapping from planet
                list.add(sub);
View Full Code Here

       
        // make sure we are using a persistent object
        Planet testPlanet = mgr.getPlanetById(planet.getId());
       
        // store
        PlanetGroup testGroup = new PlanetGroup(testPlanet, handle, handle, handle);
        testPlanet.getGroups().add(testGroup);
        mgr.saveGroup(testGroup);
       
        // flush
        PlanetFactory.getPlanet().flush();
       
        // query to make sure we return the persisted object
        PlanetGroup group = mgr.getGroupById(testGroup.getId());
       
        if(group == null)
            throw new PlanetException("error inserting new group");
       
        return group;
View Full Code Here

     */
    public static void teardownGroup(String id) throws Exception {
       
        // lookup
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
        PlanetGroup group = mgr.getGroupById(id);
       
        // remove
        mgr.deleteGroup(group);
        group.getPlanet().getGroups().remove(group);
       
        // flush
        PlanetFactory.getPlanet().flush();
    }
View Full Code Here

   
    public List getGroupHandles(Planet planet) throws PlanetException {
        List handles = new ArrayList();
        Iterator list = getGroups(planet).iterator();
        while (list.hasNext()) {
            PlanetGroup group = (PlanetGroup) list.next();
            handles.add(group.getHandle());
        }
        return handles;
    }
View Full Code Here

            PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
            UserManager userManager = WebloggerFactory.getWeblogger().getUserManager();
           
            // first, make sure there is an "all" pmgr group
            Planet planetObject = pmgr.getPlanetById("zzz_default_planet_zzz");
            PlanetGroup group = pmgr.getGroup(planetObject, "all");
            if(group == null) {
                group = new PlanetGroup();
                group.setPlanet(planetObject);
                group.setHandle("all");
                group.setTitle("all");
                pmgr.saveGroup(group);
            }
           
            // walk through all enable weblogs and add/update subs as needed
            List liveUserFeeds = new ArrayList();
            List<Weblog> websites = userManager.getWebsites(null, Boolean.TRUE, Boolean.TRUE, null, null, 0, -1);
            for ( Weblog weblog : websites ) {
               
                log.debug("processing weblog - "+weblog.getHandle());
                String feedUrl = "weblogger:"+weblog.getHandle();
               
                // add feed url to the "live" list
                liveUserFeeds.add(feedUrl);
               
                // if sub already exists then update it, otherwise add it
                Subscription sub = pmgr.getSubscription(feedUrl);
                if (sub == null) {
                    log.debug("ADDING feed: "+feedUrl);
                   
                    sub = new Subscription();
                    sub.setTitle(weblog.getName());
                    sub.setFeedURL(feedUrl);
                    sub.setSiteURL(WebloggerFactory.getWeblogger().getUrlStrategy().getWeblogURL(weblog, null, true));
                    sub.setAuthor(weblog.getName());
                    sub.setLastUpdated(new Date(0));
                   
                    pmgr.saveSubscription(sub);
                    group.getSubscriptions().add(sub);
                    pmgr.saveGroup(group);
                } else {
                    log.debug("UPDATING feed: "+feedUrl);
                   
                    sub.setTitle(weblog.getName());
                    sub.setAuthor(weblog.getName());
                   
                    pmgr.saveSubscription(sub);
                }
               
                // save as we go
                PlanetFactory.getPlanet().flush();
            }
           
            // new subs added, existing subs updated, now delete old subs
            Set<Subscription> deleteSubs = new HashSet();
            Set<Subscription> subs = group.getSubscriptions();
            for( Subscription sub : subs ) {
               
                // only delete subs from the group if ...
                // 1. they are local
                // 2. they are no longer listed as a weblog
                if (sub.getFeedURL().startsWith("weblogger:") &&
                        !liveUserFeeds.contains(sub.getFeedURL())) {
                    deleteSubs.add(sub);
                }
            }
           
            // now go back through deleteSubs and do actual delete
            // this is required because deleting a sub in the loop above
            // causes a ConcurrentModificationException because we can't
            // modify a collection while we iterate over it
            for( Subscription deleteSub : deleteSubs ) {
               
                log.debug("DELETING feed: "+deleteSub.getFeedURL());
                pmgr.deleteSubscription(deleteSub);
                group.getSubscriptions().remove(deleteSub);
            }
           
            // all done, lets save
            pmgr.saveGroup(group);
            PlanetFactory.getPlanet().flush();
View Full Code Here

       
        myValidate();
       
        if (!hasActionErrors()) try {
           
            PlanetGroup group = getGroup();
            if(group == null) {
                log.debug("Adding New Group");
                group = new PlanetGroup();
                group.setPlanet(getPlanet());
            } else {
                log.debug("Updating Existing Group");
            }
           
            // copy in submitted data
View Full Code Here

       
        List<PlanetGroup> displayGroups = new ArrayList();
       
        Iterator allgroups = getPlanet().getGroups().iterator();
        while (allgroups.hasNext()) {
            PlanetGroup agroup = (PlanetGroup) allgroups.next();
           
            // The "all" group is considered a special group and cannot be
            // managed independently
            if (!agroup.getHandle().equals("all")) {
                displayGroups.add(agroup);
            }
        }
       
        return displayGroups;
View Full Code Here

            throws ServletException, IOException {

        log.debug("Entering");

        Planet planet = null;
        PlanetGroup group = null;

        PlanetGroupFeedRequest feedRequest = null;
        try {
            // parse the incoming request and extract the relevant data
            feedRequest = new PlanetGroupFeedRequest(request);
View Full Code Here

            throws ServletException, IOException {

        log.debug("Entering");
       
        Planet planet = null;
        PlanetGroup group = null;

        PlanetGroupOpmlRequest opmlRequest = null;
        try {
            // parse the incoming request and extract the relevant data
            opmlRequest = new PlanetGroupOpmlRequest(request);
View Full Code Here

TOP

Related Classes of org.apache.roller.planet.pojos.PlanetGroup

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.