Package org.geomajas.layer.feature

Examples of org.geomajas.layer.feature.SearchCriterion


    // prepare command
    SearchFeatureRequest request = new SearchFeatureRequest();
    request.setLayerId(LAYER_ID);
    request.setCrs("EPSG:4326");
    request.setMax(SearchFeatureRequest.MAX_UNLIMITED);
    SearchCriterion searchCriterion = new SearchCriterion();
    searchCriterion.setAttributeName(REGION_ATTRIBUTE);
    searchCriterion.setOperator("like");
    searchCriterion.setValue("'%1'");
    request.setCriteria(new SearchCriterion[] {searchCriterion});

    // execute
    SearchFeatureResponse response = (SearchFeatureResponse) dispatcher.execute(
        SearchFeatureRequest.COMMAND, request, null, "en");
View Full Code Here


    SearchFeatureRequest request = new SearchFeatureRequest();
    request.setLayerId(LAYER_ID);
    request.setCrs("EPSG:4326");
    request.setMax(SearchFeatureRequest.MAX_UNLIMITED);
    request.setOffSet(2);
    SearchCriterion searchCriterion = new SearchCriterion();
    searchCriterion.setAttributeName(REGION_ATTRIBUTE);
    searchCriterion.setOperator("like");
    searchCriterion.setValue("'%1'");
    request.setCriteria(new SearchCriterion[] {searchCriterion});

    // execute
    SearchFeatureResponse response = (SearchFeatureResponse) dispatcher.execute(
        SearchFeatureRequest.COMMAND, request, null, "en");
View Full Code Here

    // prepare command
    SearchFeatureRequest request = new SearchFeatureRequest();
    request.setLayerId(LAYER_ID);
    request.setCrs("EPSG:4326");
    request.setMax(3);
    SearchCriterion searchCriterion = new SearchCriterion();
    searchCriterion.setAttributeName(REGION_ATTRIBUTE);
    searchCriterion.setOperator("like");
    searchCriterion.setValue("'R%'");
    request.setCriteria(new SearchCriterion[] {searchCriterion});

    // execute
    SearchFeatureResponse response = (SearchFeatureResponse) dispatcher.execute(
        SearchFeatureRequest.COMMAND, request, null, "en");
View Full Code Here

  public void testSearchMultipleCriteria() throws Exception {
    // prepare command
    SearchFeatureRequest request = new SearchFeatureRequest();
    request.setLayerId(LAYER_ID);
    request.setCrs("EPSG:4326");
    SearchCriterion searchCriterion1 = new SearchCriterion();
    searchCriterion1.setAttributeName(REGION_ATTRIBUTE);
    searchCriterion1.setOperator("like");
    searchCriterion1.setValue("'%egion 1'");
    SearchCriterion searchCriterion2 = new SearchCriterion();
    searchCriterion2.setAttributeName(REGION_ATTRIBUTE);
    searchCriterion2.setOperator("like");
    searchCriterion2.setValue("'%egion 2'");
    request.setCriteria(new SearchCriterion[] {searchCriterion1, searchCriterion2});
    request.setBooleanOperator("or");

    // execute
    SearchFeatureResponse response = (SearchFeatureResponse) dispatcher.execute(
View Full Code Here

    // prepare command, verify original coordinates first
    SearchFeatureRequest request = new SearchFeatureRequest();
    request.setLayerId(LAYER_ID);
    request.setCrs("EPSG:4326");
    request.setMax(3); // this immediately tests whether returning less than the maximum works
    SearchCriterion searchCriterion = new SearchCriterion();
    searchCriterion.setAttributeName(NAME_ATTRIBUTE);
    searchCriterion.setOperator("like");
    searchCriterion.setValue("'%3'");
    request.setCriteria(new SearchCriterion[] {searchCriterion});

    // execute
    SearchFeatureResponse response = (SearchFeatureResponse) dispatcher.execute(
        SearchFeatureRequest.COMMAND, request, null, "en");
View Full Code Here

  // probably cause by directly using the command service which has an injected security context
  public void createFilterTest() throws Exception {
    SearchFeatureRequest request = new SearchFeatureRequest();
    request.setLayerId(LAYER_ID);
    request.setCrs("EPSG:4326");
    SearchCriterion searchCriterion = new SearchCriterion();
    Filter filter;

    // needs to be FidFilter when equals test on id
    searchCriterion.setAttributeName(ID_ATTRIBUTE);
    searchCriterion.setOperator("=");
    searchCriterion.setValue("'1'");
    request.setCriteria(new SearchCriterion[] {searchCriterion});
    filter = searchFeatureCommand.createFilter(request, LAYER_ID);
    Assert.assertTrue(filter instanceof FidFilter);

    // but *not* when other test
    searchCriterion.setAttributeName(ID_ATTRIBUTE);
    searchCriterion.setOperator("like");
    searchCriterion.setValue("'%a%'");
    request.setCriteria(new SearchCriterion[] {searchCriterion});
    filter = searchFeatureCommand.createFilter(request, LAYER_ID);
    Assert.assertFalse(filter instanceof FidFilter);
  }
View Full Code Here

  private SearchCriterion[] buildCriteria() {
    List<SearchCriterion> critters = new ArrayList<SearchCriterion>();
    String idField = layer.getLayerInfo().getFeatureInfo().getIdentifier().getName();
    if (features != null) {
      for (Feature feat : features) {
        critters.add(new SearchCriterion(idField, "=", feat.getId()));
      }
    }
    return critters.toArray(new SearchCriterion[critters.size()]);
  }
View Full Code Here

    SearchFeatureRequest request = new SearchFeatureRequest();
    request.setBooleanOperator("AND");
    request.setCrs("EPSG:900913"); // Can normally be acquired from the MapModel.
    request.setLayerId("layerBeans");
    request.setMax(1);
    request.setCriteria(new SearchCriterion[] { new SearchCriterion("id", "=", "1") });
    final GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND);
    command.setCommandRequest(request);

    // Create a button that executes the search command:
    IButton editFeatureButton = new IButton(I18nProvider.getSampleMessages().attributeSecurityButtonTitle());
View Full Code Here

    final boolean incAttr = (featureIncludes & GeomajasConstant.FEATURE_INCLUDE_ATTRIBUTES) != 0;
    final boolean incGeom = (featureIncludes & GeomajasConstant.FEATURE_INCLUDE_GEOMETRY) != 0;
    if (null != features) {
      for (Feature feature : features) {
        if ((incAttr && !feature.isAttributesLoaded()) || (incGeom && !feature.isGeometryLoaded())) {
          criteria.add(new SearchCriterion(SearchFeatureRequest.ID_ATTRIBUTE, "=", feature.getId()));
        }
      }
    }
    if (criteria.size() > 0) {
      Feature first = features.get(0);
View Full Code Here

          }
        }
      }

      // Now create the criterion:
      SearchCriterion criterion = new SearchCriterion();
      criterion.setAttributeName(selectedAttribute.getName());
      criterion.setOperator(operatorString);
      criterion.setValue(valueString);
      return criterion;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.geomajas.layer.feature.SearchCriterion

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.