Package org.apache.roller.planet.pojos

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


            // delete a planet
            log.debug("Deleting Planet ... "+getPlanetid());
           
            try {
                PlanetManager pMgr = PlanetFactory.getPlanet().getPlanetManager();
                Planet planet = pMgr.getPlanetById(getPlanetid());
                if(planet != null) {
                    pMgr.deletePlanet(planet);
                    PlanetFactory.getPlanet().flush();
                }
               
                // delete succeeded, handle rest of request as usual
                setSuccess("PlanetsList.message.planetDeleteSucceeded", planet.getHandle());
                return execute();
            } catch(Exception e) {
                log.error("Error deleting planet", e);
                setError("PlanetsList.error.planetDeleteFailed", getPlanetid());
                return LIST;
View Full Code Here


            log.debug("Loading Planet ... "+getPlanetid());
            this.planet = pMgr.getPlanetById(getPlanetid());
        } else {
            // new planet
            log.debug("No planet specified, constructing new one");
            this.planet = new Planet();
        }
    }
View Full Code Here

    /**
     * Convenience method that creates a planet and stores it.
     */
    public static Planet setupPlanet(String handle) throws Exception {
       
        Planet testPlanet = new Planet(handle, handle, handle);
       
        // store
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
        mgr.savePlanet(testPlanet);
       
        // flush
        PlanetFactory.getPlanet().flush();
       
        // query to make sure we return the persisted object
        Planet planet = mgr.getPlanet(handle);
       
        if(planet == null)
            throw new PlanetException("error inserting new planet");
       
        return planet;
View Full Code Here

     */
    public static void teardownPlanet(String id) throws Exception {
       
        // lookup
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
        Planet planet = mgr.getPlanetById(id);
       
        // remove
        mgr.deletePlanet(planet);
       
        // flush
View Full Code Here

            throws Exception {
       
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
       
        // 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();
       
View Full Code Here

            log.debug("Loading Planet Group ...");
           
            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

     */
    public void testPlanetLookups() throws Exception {
       
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
       
        Planet planet = null;
       
        // by id
        planet = mgr.getPlanetById(testPlanet.getId());
        assertNotNull(planet);
        assertEquals("planetFuncTest", planet.getHandle());
       
        // by handle
        planet = null;
        planet = mgr.getPlanet("planetFuncTest");
        assertNotNull(planet);
        assertEquals("planetFuncTest", planet.getHandle());
       
        // all planets
        List planets = mgr.getPlanets();
        assertNotNull(planets);
        assertEquals(1, planets.size());
View Full Code Here

        group = mgr.getGroup(testPlanet, testGroup1.getHandle());
        assertNotNull(group);
        assertEquals("groupFuncTest1", group.getHandle());
       
        // lookup all groups in planet
        Planet planet = mgr.getPlanetById(testPlanet.getId());
        Set groups = planet.getGroups();
        assertNotNull(groups);
        assertEquals(2, groups.size());
    }
View Full Code Here

        // setup planet
        TestUtils.setupPlanet();

        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
       
        Planet testPlanet = new Planet("testPlanet", "testPlanet", "testPlanet");
        Planet planet = null;
       
        planet = mgr.getPlanet("testPlanet");
        assertNull(planet);
       
        // add
        mgr.savePlanet(testPlanet);
        TestUtils.endSession(true);
       
        // verify
        planet = null;
        planet = mgr.getPlanetById(testPlanet.getId());
        assertNotNull(planet);
        assertEquals("testPlanet", planet.getHandle());
       
        // modify
        planet.setTitle("foo");
        mgr.savePlanet(planet);
        TestUtils.endSession(true);
       
        // verify
        planet = null;
        planet = mgr.getPlanetById(testPlanet.getId());
        assertNotNull(planet);
        assertEquals("foo", planet.getTitle());
       
        // remove
        mgr.deletePlanet(planet);
        TestUtils.endSession(true);
       
View Full Code Here

        @SuppressWarnings("unchecked")
        HashMap<String, Object> model = new HashMap();
        try {
            // populate the rendering model
            if (request.getParameter("group") != null) {
                Planet planetObject = planet.getPlanet("default");
                model.put("group", planet.getGroup(planetObject, request.getParameter("group")));
            }
            model.put("planet", planet);
            model.put("date", new Date());
            model.put("utils", new UtilitiesModel());
View Full Code Here

TOP

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

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.