Package org.opengis.filter

Examples of org.opengis.filter.Filter


    Assert.assertEquals(3, t);
  }

  @Test
  public void compareFilterOnFloat() throws Exception {
    Filter lt = filterCreator.createCompareFilter(PARAM_FLOAT_ATTR, "<", "35");
    Iterator<?> it = layer.getElements(lt, 0, 0);

    int t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a HibernateTestFeature",
          it.next() instanceof HibernateTestFeature);
      t++;
    }
    Assert.assertEquals(3, t);
    Filter ne = filterCreator.createCompareFilter(PARAM_FLOAT_ATTR, "<>", "10");
    it = layer.getElements(ne, 0, 0);

    t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a HibernateTestFeature",
View Full Code Here


    Assert.assertEquals(3, t);
  }

  @Test
  public void compareFilterOnDouble() throws Exception {
    Filter lt = filterCreator.createCompareFilter(PARAM_DOUBLE_ATTR, "<", "35");
    Iterator<?> it = layer.getElements(lt, 0, 0);

    int t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a HibernateTestFeature",
          it.next() instanceof HibernateTestFeature);
      t++;
    }
    Assert.assertEquals(3, t);
    Filter ne = filterCreator.createCompareFilter(PARAM_DOUBLE_ATTR, "<>", "10");
    it = layer.getElements(ne, 0, 0);

    t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a HibernateTestFeature",
View Full Code Here

  public void compareFilterOnDate() throws Exception {
    DateFormat format = new SimpleDateFormat("dd/mm/yyyy");
    Date d1;
    d1 = format.parse("12/12/2007");

    Filter filter = filterCreator.createCompareFilter(PARAM_DATE_ATTR, "<", d1);
    Iterator<?> it = layer.getElements(filter, 0, 0);

    int t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a HibernateTestFeature",
View Full Code Here

  @Autowired
  private FilterService filterService;

  public void execute(PipelineContext context, Object response) throws GeomajasException {
    VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
    Filter filter = context.getOptional(PipelineCode.FILTER_KEY, Filter.class);
    String layerId = layer.getId();

    // apply generic security filter
    Filter layerFeatureFilter = securityContext.getFeatureFilter(layerId);
    if (null != layerFeatureFilter) {
      filter = and(filter, layerFeatureFilter);
    }

    // apply default filter
View Full Code Here

    List<Attribute<?>> attributes = response.getAttributes();
    if (null == attributes) {
      attributes = new ArrayList<Attribute<?>>();
      response.setAttributes(attributes);
      VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
      Filter filter = context.get(PipelineCode.FILTER_KEY, Filter.class);
      String attributeName = context.get(PipelineCode.ATTRIBUTE_NAME_KEY, String.class);
      if (layer instanceof VectorLayerAssociationSupport) {
        List<Attribute<?>> list = ((VectorLayerAssociationSupport) layer).getAttributes(attributeName, filter);
        attributes.addAll(list);
      }
View Full Code Here

        String layerId = context.get(PipelineCode.LAYER_ID_KEY, String.class);
        if (securityContext.isFeatureDeleteAuthorized(layerId, oldFeature)) {
          VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
          Object featureObj = layer.read(oldFeature.getId());
          if (null != featureObj) {
            Filter securityFilter = getSecurityFilter(layer,
                securityContext.getDeleteAuthorizedArea(layerId));
            if (securityFilter.evaluate(featureObj)) {
              layer.delete(oldFeature.getId());
            } else {
              throw new GeomajasSecurityException(ExceptionCode.FEATURE_DELETE_PROHIBITED,
                  oldFeature.getId(), securityContext.getUserId());
            }
View Full Code Here

 
  @Test
  @DirtiesContext
  @SuppressWarnings("unchecked")
  public void testUpdate() throws Exception {
    Filter filter = filterService.createFidFilter(new String[]{"3"});
    CoordinateReferenceSystem crs = geoService.getCrs(beanLayer.getLayerInfo().getCrs());
    List<InternalFeature> oldFeatures = layerService.getFeatures(LAYER_ID,
        crs, filter, null, VectorLayerService.FEATURE_INCLUDE_ATTRIBUTES);
    Assert.assertEquals(1, oldFeatures.size());
    InternalFeature feature = oldFeatures.get(0);
View Full Code Here

    }
    Assert.assertEquals(4, count);
    Assert.assertEquals(15, check);

    // now delete again
    Filter filter = filterService.createFidFilter(new String[]{"4"});
    oldFeatures = layerService.getFeatures(LAYER_ID,
        crs, filter, null, VectorLayerService.FEATURE_INCLUDE_ATTRIBUTES);
    Assert.assertEquals(1, oldFeatures.size());
    newFeatures = new ArrayList<InternalFeature>();
    layerService.saveOrUpdate(LAYER_ID, crs, oldFeatures, newFeatures);
View Full Code Here

  }

  @Test
  public void testGetFeaturesAllFiltered() throws Exception {
    Filter filter = filterService.createFidFilter(new String[]{"3"});
    List<InternalFeature> features = layerService.getFeatures(LAYER_ID,
        geoService.getCrs2(beanLayer.getLayerInfo().getCrs()), filter, null,
        VectorLayerService.FEATURE_INCLUDE_ALL);
    Assert.assertEquals(1, features.size());
    InternalFeature feature = features.get(0);
View Full Code Here

    Assert.assertEquals(3, bounds.getMaxY(), ALLOWANCE);
  }

  @Test
  public void testGetBoundsFidFiltered() throws Exception {
    Filter filter = filterService.createFidFilter(new String[]{"2", "3"});
    Envelope bounds = layerService.getBounds(LAYER_ID,
        geoService.getCrs2(beanLayer.getLayerInfo().getCrs()), filter);
    Assert.assertEquals(2, bounds.getMinX(), ALLOWANCE);
    Assert.assertEquals(0, bounds.getMinY(), ALLOWANCE);
    Assert.assertEquals(7, bounds.getMaxX(), ALLOWANCE);
View Full Code Here

TOP

Related Classes of org.opengis.filter.Filter

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.