Package org.apache.roller.planet.pojos

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


   
    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


            throws ServletException, IOException {

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

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

            // delete a planet group
            log.debug("Deleting Planet Group ... "+getGroupid());
           
            PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
            try {
                PlanetGroup group = pmgr.getGroupById(getGroupid());
                this.planet = group.getPlanet();
                this.planet.getGroups().remove(group);
                pmgr.savePlanet(this.planet);
                pmgr.deleteGroup(group);
                PlanetFactory.getPlanet().flush();
               
                setSuccess("PlanetForm.message.groupDeleteSucceeded", group.getHandle());
                return INPUT;
            } catch (PlanetException ex) {
                log.error("Error deleting planet group", ex);
                setError("PlanetForm.error.groupDeleteFailed", getGroupid());
                return INPUT;
View Full Code Here

       
        PlanetManager pMgr = PlanetFactory.getPlanet().getPlanetManager();
        try {
            if(this.subscription.getId() == null) {
                // adding a new sub to a group, so make sure we have a group
                PlanetGroup group = pMgr.getGroupById(getGroupid());
                if(group == null) {
                    setError("PlanetSubscriptionForm.error.groupNull");
                    return INPUT;
                }
               
                // check if this subscription already exists before adding it
                Subscription sub = pMgr.getSubscription(this.subscription.getFeedURL());
                if(sub != null) {
                    this.subscription = sub;
                } else {
                    pMgr.saveSubscription(this.subscription);
                   
                    // set subid now that we have one
                    setSubid(this.subscription.getId());
                }
               
                // add the sub to the group
                group.getSubscriptions().add(this.subscription);
                this.subscription.getGroups().add(group);
                pMgr.saveGroup(group);
               
            } else {
                // updating and existing subscription, so just save it
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

            group = pMgr.getGroupById(getGroupid());
        } else {
            // new group, must have a planet to add it to
            Planet planet = pMgr.getPlanetById(getPlanetid());
            if(planet != null) {
                group = new PlanetGroup();
                group.setPlanet(planet);
            } else {
                throw new PlanetException("could not determine planet "+getPlanetid());
            }
        }
View Full Code Here

        // add a planet subscription
        log.debug("Adding Planet Subscription ...");
       
        PlanetManager pMgr = PlanetFactory.getPlanet().getPlanetManager();
        try {
            PlanetGroup group = getGroup();
            if(group == null) {
                setError("PlanetSubscriptionForm.error.groupNull");
                return INPUT;
            }
           
            // check if this subscription already exists before adding it
            Subscription sub = pMgr.getSubscription(getAddSubUrl());
            if(sub == null) {
                // sub doesn't exist yet, so we need to fetch it
                FeedFetcher fetcher = PlanetFactory.getPlanet().getFeedFetcher();
                sub = fetcher.fetchSubscription(getAddSubUrl());
               
                // save new sub
                pMgr.saveSubscription(sub);
            }
           
            // add the sub to the group
            group.getSubscriptions().add(sub);
            sub.getGroups().add(group);
            pMgr.saveGroup(group);
           
            // flush changes
            PlanetFactory.getPlanet().flush();
View Full Code Here

                Subscription sub = pmgr.getSubscriptionById(getSubid());
                if(sub == null) {
                    setError("PlanetGroupForm.error.nullSubscription");
                    return INPUT;
                } else {
                    PlanetGroup group = getGroup();
                    group.getSubscriptions().remove(sub);
                    sub.getGroups().remove(group);
                    pmgr.saveGroup(group);
                    PlanetFactory.getPlanet().flush();
                }
               
View Full Code Here

   
    public void testGroupCRUD() throws Exception {
       
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
       
        PlanetGroup testGroup = new PlanetGroup();
        testGroup.setDescription("test_group_desc");
        testGroup.setHandle("test_handle");
        testGroup.setTitle("test_title");
        testGroup.setPlanet(testPlanet);
        PlanetGroup group = null;
       
        group = mgr.getGroup(testPlanet, "test_handle");
        assertNull(group);
       
        // add
        mgr.saveGroup(testGroup);
        TestUtils.endSession(true);
       
        // verify
        group = null;
        group = mgr.getGroupById(testGroup.getId());
        assertNotNull(group);
        assertEquals("test_handle", group.getHandle());
        assertEquals(testPlanet.getId(), group.getPlanet().getId());
       
        // modify
        group.setTitle("foo");
        mgr.saveGroup(group);
        TestUtils.endSession(true);
       
        // verify
        group = null;
        group = mgr.getGroupById(testGroup.getId());
        assertNotNull(group);
        assertEquals("foo", group.getTitle());
       
        // remove
        mgr.deleteGroup(group);
        TestUtils.endSession(true);
       
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.