Package org.geoserver.catalog

Examples of org.geoserver.catalog.LayerGroupInfo


    protected void oneTimeSetUp() throws Exception {
        super.oneTimeSetUp();
       
        CatalogFactory cf = getCatalog().getFactory();
        CatalogBuilder cb = new CatalogBuilder(getCatalog());
        LayerGroupInfo gi = cf.createLayerGroup();
        gi.setName("testGroup");
        gi.getLayers().add(getCatalog().getLayerByName(MockData.BASIC_POLYGONS.getLocalPart()));
        gi.getStyles().add(getCatalog().getStyleByName("polygon"));
        cb.calculateLayerGroupBounds(gi);
        getCatalog().add(gi);
    }
View Full Code Here


        return getAttribute( "layergroup") == null;
    }
   
    @Override
    protected String handleObjectPost(Object object) throws Exception {
        LayerGroupInfo lg = (LayerGroupInfo) object;
        LOGGER.info( "POST layer group " + lg.getName() );
       
        if ( lg.getLayers().isEmpty() ) {
            throw new RestletException( "layer group must not be empty", Status.CLIENT_ERROR_BAD_REQUEST );
        }
      
        if ( lg.getBounds() == null ) {
            LOGGER.fine( "Auto calculating layer group bounds");
            new CatalogBuilder( catalog ).calculateLayerGroupBounds(lg);
        }
       
        catalog.add( lg );
        return lg.getName();
    }
View Full Code Here

    @Override
    protected void handleObjectPut(Object object) throws Exception {
        String layergroup = getAttribute("layergroup");
        LOGGER.info( "PUT layer group " + layergroup );
       
        LayerGroupInfo lg = (LayerGroupInfo) object;
        LayerGroupInfo original = catalog.getLayerGroupByName( layergroup );
      
        //ensure not a name change
        if ( lg.getName() != null && !lg.getName().equals( original.getName() ) ) {
            throw new RestletException( "Can't change name of a layer group", Status.CLIENT_ERROR_FORBIDDEN );
        }
       
        new CatalogBuilder( catalog ).updateLayerGroup( original, lg );
        catalog.save( original );
View Full Code Here

    @Override
    protected void handleObjectDelete() throws Exception {
        String layergroup = getAttribute( "layergroup" );
        LOGGER.info( "DELETE layer group " + layergroup );
       
        LayerGroupInfo lg = catalog.getLayerGroupByName( layergroup );
        catalog.remove( lg );
    }
View Full Code Here

     * @return
     */
    protected List<LayerGroupInfo> filterGroups(Authentication user, List<LayerGroupInfo> groups) {
        List<LayerGroupInfo> result = new ArrayList<LayerGroupInfo>();
        for (LayerGroupInfo original : groups) {
            LayerGroupInfo secured = checkAccess(user, original);
            if (secured != null)
                result.add(secured);
        }
        return result;
    }
View Full Code Here

       
        File f = new File( testData.getDataDirectoryRoot(),
            "layergroups/lg.xml");
        assertTrue( f.exists() );
       
        LayerGroupInfo lg = catalog.getLayerGroupByName( "lg" );
        catalog.remove( lg );
       
        assertFalse( f.exists() );
    }
View Full Code Here

       
        setNativeBox(catalog, lakes);
        setNativeBox(catalog, forests);
        setNativeBox(catalog, bridges);
       
        LayerGroupInfo lg = catalog.getFactory().createLayerGroup();
        lg.setName("lakes");
        lg.getLayers().add(catalog.getLayerByName(lakes));
        lg.getStyles().add(catalog.getStyleByName(lakes));
        lg.getLayers().add(catalog.getLayerByName(forests));
        lg.getStyles().add(catalog.getStyleByName(forests));
        lg.getLayers().add(catalog.getLayerByName(bridges));
        lg.getStyles().add(catalog.getStyleByName(bridges));
        CatalogBuilder builder = new CatalogBuilder(catalog);
        builder.calculateLayerGroupBounds(lg);
        catalog.add(lg);
    }
View Full Code Here

        tester.assertRenderedPage(LayerGroupPage.class);
        tester.assertNoErrorMessage();
       
        DataView dv = (DataView) tester.getComponentFromLastRenderedPage("table:listContainer:items");
        assertEquals(getCatalog().getLayerGroups().size(), dv.size());
        LayerGroupInfo lg = (LayerGroupInfo) dv.getDataProvider().iterator(0, 1).next();
        assertEquals(getCatalog().getLayerGroups().get(0), lg);
    }
View Full Code Here

       
        // Now we check for layer groups that are affected
        Iterator<LayerGroupInfo> lgiter = cat.getLayerGroups().iterator();
        while(lgiter.hasNext()) {
            boolean truncate = false;
            LayerGroupInfo lgi = lgiter.next();
            //System.out.println(lgi.getName());
           
            // First we check for referenced to affected layers
            Iterator<LayerInfo> liter = lgi.getLayers().iterator();
            while(! truncate && liter.hasNext()) {
                LayerInfo li = liter.next();
                //System.out.println("   " + li.getResource().getPrefixedName());
                if(li.getResource().getPrefixedName().equals(layerName)) {
                    truncate = true;
                }
            }
           
            if(truncate) {
                cleanser.deleteLayer(lgi.getName());
            }
            // Next layer group
        }       
    }
View Full Code Here

           }
          
           // Now we check for layer groups that are affected
           Iterator<LayerGroupInfo> lgiter = cat.getLayerGroups().iterator();
           while(lgiter.hasNext()) {
               LayerGroupInfo lgi = lgiter.next();
               boolean truncate = false;
              
               // First we check for referenced to affected layers
               liter = lgi.getLayers().iterator();
               while(! truncate && liter.hasNext()) {
                   LayerInfo li = liter.next();
                   if(layerNameList.contains(li.getResource().getPrefixedName())){
                       truncate = true;
                   }
               }
              
               // Finally we need to check whether the style is used explicitly
               if(! truncate) {
                   Iterator<StyleInfo> siiter = lgi.getStyles().iterator();
                   while(! truncate && siiter.hasNext()) {
                       StyleInfo si2 = siiter.next();
                       if(si2 != null && si2.getName().equals(si.getName())) {
                           truncate = true;
                       }
                   }
               }
              
               if(truncate) {
                   cleanser.deleteLayer(lgi.getName());
               }
               // Next layer group
           }
          
        } else {

        WMSLayer wmsLayer = null; //getLayer(obj);

        if(obj instanceof LayerInfo) {
            LayerInfo li = (LayerInfo) obj;
            wmsLayer = getLayer(li);
        } else
        if(obj instanceof LayerGroupInfo) {
            LayerGroupInfo lgInfo = (LayerGroupInfo) obj;
            wmsLayer = getLayer(lgInfo);
        }
       
        if (wmsLayer != null && this.list != null) {           
            updateList(wmsLayer);
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.LayerGroupInfo

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.