Package org.opengis.filter

Examples of org.opengis.filter.FilterFactory2.like()


            String singleChar = attrs.getValue( "singleChar" );
            String escape = attrs.getValue( "escape" );
            Literal pattern = (Literal) value[1].getValue();
           
         
            return factory.like(expr, (String) pattern.getValue(), wildCard, singleChar, escape);
                        }
          catch( ClassCastException expressionRequired ){
            throw new SAXException("Illegal filter for "+element, expressionRequired );
      }
          catch (IllegalFilterException e) {
View Full Code Here


public class FESFilterTest extends FESTestSupport {

    public void testEncodePropertyIsLike() throws Exception {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
        PropertyIsLike filter = ff.like(ff.property("name"), "%test%");
        org.geotools.filter.v2_0.FESConfiguration configuration = new org.geotools.filter.v2_0.FESConfiguration();
        org.geotools.xml.Encoder encoder = new org.geotools.xml.Encoder(configuration);
        encoder.encode(filter, org.geotools.filter.v2_0.FES.Filter, os);
       
        DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
View Full Code Here

   
    public void testLikeFilter() throws IllegalFilterException, OperationNotSupportedException, IOException{
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
        Expression testAttribute = ff.property("testString");

        PropertyIsLike lf = ff.like( ff.property("testString"), "test*", "*", ".", "!");

        StringWriter output = new StringWriter();
        DocumentWriter.writeFragment(lf,
            FilterSchema.getInstance(), output, null);
       
View Full Code Here

    // In a similar fashion there is a short cut for notEqual
    filter = ff.notEqual(ff.property("type"), ff.literal("draft"));

    // pattern based "like" filter
    filter = ff.like(ff.property("code"), "2300%");
    // you can customise the wildcard characters used
    filter = ff.like(ff.property("code"), "2300?", "*", "?", "\\");
    // end ff example
}

View Full Code Here

    filter = ff.notEqual(ff.property("type"), ff.literal("draft"));

    // pattern based "like" filter
    filter = ff.like(ff.property("code"), "2300%");
    // you can customise the wildcard characters used
    filter = ff.like(ff.property("code"), "2300?", "*", "?", "\\");
    // end ff example
}

public void nilExample() {
    // start nil example
View Full Code Here

    // logical start

    // you can use *not* to invert the test; this is especially handy
    // with like filters (allowing you to select content that does not
    // match the provided pattern)
    filter = ff.not(ff.like(ff.property("code"), "230%"));

    // you can also combine filters to narrow the results returned
    filter = ff.and(ff.greater(ff.property("rainfall"), ff.literal(70)),
            ff.equal(ff.property("land_use"), ff.literal("urban"), false));

View Full Code Here

        }
    }
   
    public void testLikeFilter() throws Exception {
        FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
        PropertyIsLike caseSensitiveLike = ff.like(ff.property(aname("stringProperty")),
                "Z*", "*", "?", "\\", true);
        PropertyIsLike caseInsensitiveLike = ff.like(ff.property(aname("stringProperty")),
                "Z*", "*", "?", "\\", false);
        PropertyIsLike caseInsensitiveLike2 = ff.like(ff.property(aname("stringProperty")),
                "z*", "*", "?", "\\", false);
View Full Code Here

   
    public void testLikeFilter() throws Exception {
        FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
        PropertyIsLike caseSensitiveLike = ff.like(ff.property(aname("stringProperty")),
                "Z*", "*", "?", "\\", true);
        PropertyIsLike caseInsensitiveLike = ff.like(ff.property(aname("stringProperty")),
                "Z*", "*", "?", "\\", false);
        PropertyIsLike caseInsensitiveLike2 = ff.like(ff.property(aname("stringProperty")),
                "z*", "*", "?", "\\", false);
        assertEquals(0, featureSource.getCount(new Query(null, caseSensitiveLike)));
        assertEquals(1, featureSource.getCount(new Query(null, caseInsensitiveLike)));
View Full Code Here

        FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
        PropertyIsLike caseSensitiveLike = ff.like(ff.property(aname("stringProperty")),
                "Z*", "*", "?", "\\", true);
        PropertyIsLike caseInsensitiveLike = ff.like(ff.property(aname("stringProperty")),
                "Z*", "*", "?", "\\", false);
        PropertyIsLike caseInsensitiveLike2 = ff.like(ff.property(aname("stringProperty")),
                "z*", "*", "?", "\\", false);
        assertEquals(0, featureSource.getCount(new Query(null, caseSensitiveLike)));
        assertEquals(1, featureSource.getCount(new Query(null, caseInsensitiveLike)));
        assertEquals(1, featureSource.getCount(new Query(null, caseInsensitiveLike2)));
    }
View Full Code Here

        List<Filter> filterList = new ArrayList<Filter>();
        FilterFactory2 ff = new FilterFactoryImplNamespaceAware(
                ((MappingFeatureSource) featureSource).getMapping().getNamespaces());
        Expression property = ff
                .property("gsml:geologicHistory/gsml:GeologicEvent/gsml:eventEnvironment/gsml:CGI_TermValue/gsml:value");
        Filter filter = ff.like(property, "*mid-crustal*");

        filterList.add(filter);
        property = ff.property("gsml:purpose");
        filter = ff.like(property, "*ypical*");
        filterList.add(filter);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.