Package org.geotools.filter

Examples of org.geotools.filter.CompareFilter


   //SELECT ... FROM ... WHERE
   //   (statel=state and countyl=county) OR (stater=state and countyr=county )
      FilterFactory ff = FilterFactory.createFilterFactory();

   
      CompareFilter cf1 = ff.createCompareFilter(FilterType.COMPARE_EQUALS);        
      cf1.addLeftValue( ff.createAttributeExpression( null, "statel") );
      cf1.addRightValue( ff.createLiteralExpression(state));
     
      CompareFilter cf2 = ff.createCompareFilter(FilterType.COMPARE_EQUALS);        
      cf2.addLeftValue( ff.createAttributeExpression( null, "countyl") );
      cf2.addRightValue( ff.createLiteralExpression(county));
     
      LogicFilter and1 = ff.createLogicFilter(cf1,cf2,Filter.LOGIC_AND);
     
     
      CompareFilter cf3 = ff.createCompareFilter(FilterType.COMPARE_EQUALS);        
      cf3.addLeftValue( ff.createAttributeExpression( null, "stater") );
      cf3.addRightValue( ff.createLiteralExpression(state));
     
      CompareFilter cf4 = ff.createCompareFilter(FilterType.COMPARE_EQUALS);        
      cf4.addLeftValue( ff.createAttributeExpression( null, "countyr") );
      cf4.addRightValue( ff.createLiteralExpression(county));
     
      LogicFilter and2 = ff.createLogicFilter(cf3,cf4,Filter.LOGIC_AND);
     
      LogicFilter or = ff.createLogicFilter(and1,and2,Filter.LOGIC_OR);
     
View Full Code Here


   */
  public void getCC() throws Exception
  {

      FilterFactory ff = FilterFactory.createFilterFactory();
      CompareFilter cf = ff.createCompareFilter(FilterType.COMPARE_EQUALS);
        
       
      cf.addLeftValue( ff.createAttributeExpression( null, "module") );
      cf.addRightValue( ff.createLiteralExpression(MODULE));
        
     
      String[] ps = new String []{"wkb_geometry","tlid"};
      Query q = new DefaultQuery("completechain",cf,ps);        
      
View Full Code Here

   */
  public void getPolygonLines() throws Exception
  {

      FilterFactory ff = FilterFactory.createFilterFactory();
      CompareFilter cf = ff.createCompareFilter(FilterType.COMPARE_EQUALS);
        
       
      cf.addLeftValue( ff.createAttributeExpression( null, "module") );
      cf.addRightValue( ff.createLiteralExpression(MODULE));
        
     
      String[] ps = new String []{"polyidl","polyidr","tlid"};
      Query q = new DefaultQuery("polychainlink",cf,ps);        
      
View Full Code Here

   */
  public void getPIP() throws Exception
  {

      FilterFactory ff = FilterFactory.createFilterFactory();
      CompareFilter cf = ff.createCompareFilter(FilterType.COMPARE_EQUALS);
        
       
      cf.addLeftValue( ff.createAttributeExpression( null, "module") );
      cf.addRightValue( ff.createLiteralExpression(MODULE));
        
     
      String[] ps = new String []{"wkb_geometry","polyid"};
      Query q = new DefaultQuery("pip",cf,ps);        
      
View Full Code Here

        update.addProperty("NAME", "somestring");

        UpdateRequest update2 = new UpdateRequest();
        update2.setTypeName("BUILTUPA_1M");

        CompareFilter compFilter = factory.createCompareFilter(AbstractFilter.COMPARE_GREATER_THAN);
        AttributeExpression tempLeftExp = factory.createAttributeExpression((AttributeType)null);
        tempLeftExp.setAttributePath("TILE_ID");

        LiteralExpression tempRightExp = factory.createLiteralExpression(1000);
        compFilter.addLeftValue(tempLeftExp);
        compFilter.addRightValue(tempRightExp);
        update2.setFilter(compFilter);
        update2.addProperty("FAC_ID", "100");

        TransactionRequest baseRequest = new TransactionRequest();
        baseRequest.addSubRequest(update);
View Full Code Here

        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);

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

TOP

Related Classes of org.geotools.filter.CompareFilter

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.