Package org.geoserver.catalog

Examples of org.geoserver.catalog.Keyword


            fail( "adding without id should throw exception" );
        }
        catch( Exception e ) {};
       
        ((ServiceInfoImpl)service).setId( "id" );
        service.getKeywords().add(new Keyword("keyword"));
        geoServer.add( service );

        assertEquals(service.getKeywords(), geoServer.getService("id", ServiceInfo.class).getKeywords());

        ServiceInfo s2 = geoServer.getFactory().createService();
View Full Code Here


        }
       
        List<String> keywords = (List<String>) properties.get( "keywords" );
        if ( keywords != null ) {
            for (String kw : keywords) {
                service.getKeywords().add(new Keyword(kw));
            }
        }
       
        service.setOnlineResource( (String) properties.get( "onlineResource" ) );
        service.setFees( (String) properties.get( "fees" ) );
View Full Code Here

        // insert extra metadata
        ResourceInfo forestInfo = getCatalog().getLayerByName("Forests").getResource();       
        forestInfo.getMetadata().put("date", "09/10/2012");
        forestInfo.setLatLonBoundingBox(new ReferencedEnvelope(-200, -180, -100, -90, CRS
                .decode("EPSG:4326")));
        forestInfo.getKeywords().add(new Keyword ("CustomKeyWord-1"));
        forestInfo.getKeywords().add(new Keyword ("CustomKeyWord-2"));
        forestInfo.setDescription("Land with lots of trees on.");
        forestInfo.getAlias().add("Bush");
        forestInfo.getAlias().add("Woods");
        getCatalog().save(forestInfo);
    }
View Full Code Here

            if (!m.matches()) {
                throw new IllegalArgumentException(
                    String.format("%s does not match regular expression: %s", str, RE));
            }

            KeywordInfo kw = new Keyword(m.group(1));
            if (m.group(2) != null) {
                kw.setLanguage(m.group(2));
            }
            if (m.group(3) != null) {
                kw.setVocabulary(m.group(3));
            }
            return kw;
        }
View Full Code Here

            featureType.setNativeCRS(CRS.decode("EPSG:" + srs));
        } catch (Exception e) {
            LOGGER.warning("Failed to decode EPSG:" + srs + ", setting the native SRS to null");
        }
        featureType.setNumDecimals(8);
        featureType.getKeywords().add(new Keyword(name));
        featureType.setEnabled(true);
        featureType.setProjectionPolicy(LayerProperty.PROJECTION_POLICY.get(props, ProjectionPolicy.NONE));
        featureType.setLatLonBoundingBox(LayerProperty.LATLON_ENVELOPE.get(props, DEFAULT_LATLON_ENVELOPE));
        featureType.setNativeBoundingBox(LayerProperty.ENVELOPE.get(props, null));
View Full Code Here

            fail( "adding with no store should throw exception");
        }
        catch( Exception e ) {}
       
        ft2.setStore( ds );
        ft2.getKeywords().add(new Keyword("keyword"));

        catalog.add( ft2 );
       
        FeatureTypeInfo ft3 = catalog.getFactory().createFeatureType();
        ft3.setName( "ft3Name");
View Full Code Here

    public void testModifyFeatureType() {
        addFeatureType();
       
        FeatureTypeInfo ft2 = catalog.getFeatureTypeByName(ft.getName());
        ft2.setDescription( "ft2Description" );
        ft2.getKeywords().add(new Keyword("ft2"));
       
        FeatureTypeInfo ft3 = catalog.getFeatureTypeByName(ft.getName());
        assertEquals( "ftName", ft3.getName() );
        assertEquals( "ftDescription", ft3.getDescription() );
        assertTrue( ft3.getKeywords().isEmpty() );
View Full Code Here

    public void testGet() {
        addDataStore();
        addNamespace();

        FeatureTypeInfo ft1 = newFeatureType("ft1", ds);
        ft1.getKeywords().add(new Keyword("kw1_ft1"));
        ft1.getKeywords().add(new Keyword("kw2_ft1"));
        ft1.getKeywords().add(new Keyword("repeatedKw"));

        FeatureTypeInfo ft2 = newFeatureType("ft2", ds);
        ft2.getKeywords().add(new Keyword("kw1_ft2"));
        ft2.getKeywords().add(new Keyword("kw2_ft2"));
        ft2.getKeywords().add(new Keyword("repeatedKw"));

        catalog.add(ft1);
        catalog.add(ft2);

        StyleInfo s1, s2, s3;
View Full Code Here

        catalog.add(ft2 = newFeatureType("ft2", ds));
        catalog.add(ft3 = newFeatureType("ft3", ds));
        ft1 = catalog.getFeatureType(ft1.getId());
        ft2 = catalog.getFeatureType(ft2.getId());
        ft3 = catalog.getFeatureType(ft3.getId());
        ft1.getKeywords().add(new Keyword("keyword1"));
        ft1.getKeywords().add(new Keyword("keyword2"));
        ft1.getKeywords().add(new Keyword("ft1"));
        ft1.setDescription("ft1 description");
        catalog.save(ft1);
        ft2.getKeywords().add(new Keyword("keyword1"));
        ft2.getKeywords().add(new Keyword("keyword1"));
        ft2.setDescription("ft2");
        catalog.save(ft2);
        ft3.getKeywords().add(new Keyword("ft3"));
        ft3.getKeywords().add(new Keyword("ft3"));
        ft3.setDescription("FT3");
        catalog.save(ft3);

        Filter filter = acceptAll();
        Set<? extends CatalogInfo> expected;
        Set<? extends CatalogInfo> actual;
       
        // opposite equality
        filter = factory.equal(factory.literal(ft1.getId()), factory.property("id"), true);
        expected = Sets.newHashSet(ft1);
        actual = Sets.newHashSet(catalog.list(ResourceInfo.class, filter));
        assertEquals(expected, actual);
       
        // match case
        filter = factory.equal(factory.literal("FT1"), factory.property("name"), false);
        expected = Sets.newHashSet(ft1);
        actual = Sets.newHashSet(catalog.list(ResourceInfo.class, filter));
        assertEquals(expected, actual);
       
        // equality of fields
        filter = factory.equal(factory.property("name"), factory.property("description"), true);
        expected = Sets.newHashSet(ft2);
        actual = Sets.newHashSet(catalog.list(ResourceInfo.class, filter));
        assertEquals(expected, actual);
       
        // match case
        filter = factory.equal(factory.property("name"), factory.property("description"), false);
        expected = Sets.newHashSet(ft2, ft3);
        actual = Sets.newHashSet(catalog.list(ResourceInfo.class, filter));
        assertEquals(expected, actual);
       
        //match action
        filter = factory.equal(factory.literal(new Keyword("keyword1")), factory.property("keywords"), true, MatchAction.ANY);
        expected = Sets.newHashSet(ft1, ft2);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        filter = factory.equal(factory.literal(new Keyword("keyword1")), factory.property("keywords"), true, MatchAction.ALL);
        expected = Sets.newHashSet(ft2);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        filter = factory.equal(factory.literal(new Keyword("keyword1")), factory.property("keywords"), true, MatchAction.ONE);
        expected = Sets.newHashSet(ft1);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        //match action - like
        filter = factory.like(factory.property("keywords"), "key*d1", "*","?","\\", true, MatchAction.ANY);
        expected = Sets.newHashSet(ft1, ft2);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        filter = factory.like(factory.property("keywords"), "key*d1", "*","?","\\", true, MatchAction.ALL);
        expected = Sets.newHashSet(ft2);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        filter = factory.like(factory.property("keywords"), "key*d1", "*","?","\\", true, MatchAction.ONE);
        expected = Sets.newHashSet(ft1);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        //multivalued literals
        List values = new ArrayList<String>();
        values.add("ft1");
        values.add("ft2");
        filter = factory.equal(factory.literal(values), factory.property("name"), true, MatchAction.ANY);
        expected = Sets.newHashSet(ft1, ft2);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        values = new ArrayList<String>();
        values.add("ft1");
        values.add("ft1");
        filter = factory.equal(factory.literal(values), factory.property("name"), true, MatchAction.ALL);
        expected = Sets.newHashSet(ft1);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        values = new ArrayList<String>();
        values.add("ft1");
        values.add("ft2");
        filter = factory.equal(factory.literal(values), factory.property("name"), true, MatchAction.ALL);
        expected = Sets.newHashSet();
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        values = new ArrayList<String>();
        values.add("ft1");
        values.add("ft1");
        values.add("ft2");
        filter = factory.equal(factory.literal(values), factory.property("name"), true, MatchAction.ONE);
        expected = Sets.newHashSet(ft2);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        //multivalued literals with multivalued fields
       
        values = new ArrayList<Keyword>();
        values.add(new Keyword("keyword1"));
        values.add(new Keyword("keyword2"))
        filter = factory.equal(factory.literal(values), factory.property("keywords"), true, MatchAction.ANY);
        expected = Sets.newHashSet(ft1, ft2);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        values = new ArrayList<Keyword>();
        values.add(new Keyword("keyword1"));
        values.add(new Keyword("keyword1"))
        filter = factory.equal(factory.literal(values), factory.property("keywords"), true, MatchAction.ALL);
        expected = Sets.newHashSet(ft2);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);
       
        values = new ArrayList<Keyword>();
        values.add(new Keyword("keyword1"));
        values.add(new Keyword("blah"));
        filter = factory.equal(factory.literal(values), factory.property("keywords"), true, MatchAction.ONE);
        expected = Sets.newHashSet(ft1);
        actual = Sets.newHashSet(catalog.list(FeatureTypeInfo.class, filter));
        assertEquals(expected, actual);

View Full Code Here

        FeatureTypeInfo ft1 = newFeatureType("ft1", ds);
        FeatureTypeInfo ft2 = newFeatureType("ft2", ds);
        FeatureTypeInfo ft3 = newFeatureType("ft3", ds);

        ft2.getKeywords().add(new Keyword("keyword1"));
        ft2.getKeywords().add(new Keyword("keyword2"));

        catalog.add(ft1);
        catalog.add(ft2);
        catalog.add(ft3);
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.Keyword

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.