Package org.geotools.filter

Examples of org.geotools.filter.LiteralExpression


        assertTrue(runXmlTest(baseRequest, "15", true));
    }

    public void test8() throws Exception {
        // make base comparison objects              
        LiteralExpression tempExp1 = factory.createLiteralExpression(DefaultExpression.LITERAL_STRING);
        tempExp1.setLiteral("Main St.");

        AttributeExpression tempExp2 = factory.createAttributeExpression((FeatureType)null,"Person/Address/StreetName");
        //tempExp2.setAttributePath("Person/Address/StreetName");

        CompareFilter tempFilter = factory.createCompareFilter(AbstractFilter.COMPARE_EQUALS);
        tempFilter.addRightValue(tempExp1);
        tempFilter.addLeftValue(tempExp2);

        Filter logicFilter = factory.createLogicFilter(tempFilter,
                AbstractFilter.LOGIC_AND);
        LOGGER.fine("filter: " + logicFilter);
        tempFilter = factory.createCompareFilter(AbstractFilter.COMPARE_EQUALS);
        tempExp1 = factory.createLiteralExpression(DefaultExpression.LITERAL_STRING);
        tempExp2 = factory.createAttributeExpression((FeatureType)null,"Person/Address/City");
        tempExp1.setLiteral("Main St.");
        tempExp1.setLiteral("SomeTown");
        //tempExp2.setAttributePath("Person/Address/City");   // done at creations time
        tempFilter.addRightValue(tempExp1);
        tempFilter.addLeftValue(tempExp2);
        logicFilter = logicFilter.and(tempFilter);
        LOGGER.fine("filter: " + logicFilter);
        tempFilter = factory.createCompareFilter(AbstractFilter.COMPARE_EQUALS);
        tempExp1 = factory.createLiteralExpression(DefaultExpression.LITERAL_STRING);
        tempExp2 = factory.createAttributeExpression((FeatureType)null,"Person/Sex");
        tempExp1.setLiteral("Female");
       // tempExp2.setAttributePath("Person/Sex");
        tempFilter.addRightValue(tempExp1);
        tempFilter.addLeftValue(tempExp2);
        logicFilter = logicFilter.and(tempFilter);
        LOGGER.fine("filter: " + logicFilter);
        tempFilter = factory.createCompareFilter(AbstractFilter.COMPARE_GREATER_THAN);
        tempExp1 = factory.createLiteralExpression(DefaultExpression.LITERAL_INTEGER);
        tempExp2 = factory.createAttributeExpression((FeatureType)null,"Person/Salary");
        tempExp1.setLiteral("35000");
       // tempExp2.setAttributePath("Person/Salary");
        tempFilter.addLeftValue(tempExp2);
        tempFilter.addRightValue(tempExp1);
        logicFilter = logicFilter.and(tempFilter);

        Filter finalFilter = factory.createLogicFilter(logicFilter,
                AbstractFilter.LOGIC_AND);
        LOGGER.fine("filter: " + finalFilter);
        tempFilter = factory.createCompareFilter(AbstractFilter.COMPARE_GREATER_THAN_EQUAL);
        tempExp1 = factory.createLiteralExpression(DefaultExpression.LITERAL_INTEGER);
        tempExp2 = factory.createAttributeExpression((FeatureType)null,"Person/Address/StreetNumber");
        tempExp1.setLiteral("10000");
        //tempExp2.setAttributePath("Person/Address/StreetNumber");
        tempFilter.addLeftValue(tempExp2);
        tempFilter.addRightValue(tempExp1);
        finalFilter = finalFilter.and(tempFilter);
        LOGGER.fine("filter: " + finalFilter);
        tempFilter = factory.createCompareFilter(AbstractFilter.COMPARE_LESS_THAN_EQUAL);
        tempExp1 = factory.createLiteralExpression(DefaultExpression.LITERAL_INTEGER);
        tempExp2 = factory.createAttributeExpression((FeatureType)null,"Person/Address/StreetNumber");
        tempExp1.setLiteral("10999");
        //tempExp2.setAttributePath("Person/Address/StreetNumber");
        tempFilter.addLeftValue(tempExp2);
        tempFilter.addRightValue(tempExp1);
        finalFilter = finalFilter.and(tempFilter);
        LOGGER.fine("filter: " + finalFilter);
View Full Code Here


        coords[3] = new Coordinate(20, 10);
        coords[4] = new Coordinate(10, 10);

        LinearRing outerShell = new LinearRing(coords, new PrecisionModel(), 0);
        Polygon polygon = new Polygon(outerShell, new PrecisionModel(), 0);
        LiteralExpression rightExpression = factory.createLiteralExpression(polygon);

        filter.addLeftGeometry(leftExpression);
        filter.addRightGeometry(rightExpression);

        Query query = new Query();
View Full Code Here

        coords[3] = new Coordinate(20, 10);
        coords[4] = new Coordinate(10, 10);

        LinearRing outerShell = new LinearRing(coords, new PrecisionModel(), 0);
        Polygon polygon = new Polygon(outerShell, new PrecisionModel(), 0);
        LiteralExpression rightExpression = factory.createLiteralExpression(polygon);
        filter.addLeftGeometry(leftExpression);
        filter.addRightGeometry(rightExpression);

        Query query = new Query();
        query.setTypeName("rail");
View Full Code Here

        coords[3] = new Coordinate(20, 10);
        coords[4] = new Coordinate(10, 10);

        LinearRing outerShell = new LinearRing(coords, new PrecisionModel(), 0);
        Polygon polygon = new Polygon(outerShell, new PrecisionModel(), 0);
        LiteralExpression rightExpression = factory.createLiteralExpression(polygon);
        filter.addLeftGeometry(leftExpression);
        filter.addRightGeometry(rightExpression);

        Query query = new Query();
        query.setTypeName("rail");
View Full Code Here

        coords[3] = new Coordinate(20, 10);
        coords[4] = new Coordinate(10, 10);

        LinearRing outerShell = new LinearRing(coords, new PrecisionModel(), 0);
        Polygon polygon = new Polygon(outerShell, new PrecisionModel(), 0);
        LiteralExpression rightExpression = factory.createLiteralExpression(polygon);

        //filter.addLeftGeometry(leftExpression);
        filter.addRightGeometry(rightExpression);

        Query query = new Query();
View Full Code Here

TOP

Related Classes of org.geotools.filter.LiteralExpression

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.