@Test public void manyToOneEcqlIdFilter() throws Exception { Filter filter = filterService.parseFilter("manyToOneAttr.\"id\"=1"); Iterator<?> it = layer.getElements(filter, 0, 0); int t = 0; while (it.hasNext()) { Assert.assertTrue(it.next() instanceof FeatureBean); t++; } Assert.assertEquals(1, t); }
public Iterator<?> getElements(Filter filter, int offset, int maxResultSize) throws LayerException { if (null == filter) { filter = Filter.INCLUDE; } List<Object> filteredList = new ArrayList<Object>(); try { synchronized (featuresById) { for (Object feature : featuresById.values()) { if (filter.evaluate(feature)) { filteredList.add(feature); } } } } catch (Exception e) { throw new LayerException(e, ExceptionCode.FILTER_EVALUATION_PROBLEM, filter, getId()); } if (comparator != null) { Collections.sort(filteredList, comparator); } if (maxResultSize > 0) { int fromIndex = Math.max(0, offset); int toIndex = Math.min(offset + maxResultSize, filteredList.size()); toIndex = Math.max(fromIndex, toIndex); return filteredList.subList(fromIndex, toIndex).iterator(); } else { return filteredList.iterator(); } }
BeanLayer implements VectorLayer, VectorLayerAssociationSupport, VectorLayerLazyFeatureConversionSupport { public Iterator<?> getElements(Filter filter, int offset, int maxResultSize) throws LayerException { if (null == filter) { filter = Filter.INCLUDE; } List<Object> filteredList = new ArrayList<Object>(); try { synchronized (featuresById) { for (Object feature : featuresById.values()) { if (filter.evaluate(feature)) { filteredList.add(feature); } } } } catch (Exception e) { throw new LayerException(e, ExceptionCode.FILTER_EVALUATION_PROBLEM, filter, getId()); } if (comparator != null) { Collections.sort(filteredList, comparator); } if (maxResultSize > 0) { int fromIndex = Math.max(0, offset); int toIndex = Math.min(offset + maxResultSize, filteredList.size()); toIndex = Math.max(fromIndex, toIndex); return filteredList.subList(fromIndex, toIndex).iterator(); } else { return filteredList.iterator(); } } }
BeanLayer implements VectorLayer, VectorLayerAssociationSupport, VectorLayerLazyFeatureConversionSupport { public Iterator<?> getElements(Filter filter, int offset, int maxResultSize) throws LayerException { if (null == filter) { filter = Filter.INCLUDE; } List<Object> filteredList = new ArrayList<Object>(); try { synchronized (featuresById) { for (Object feature : featuresById.values()) { if (filter.evaluate(feature)) { filteredList.add(feature); } } } } catch (Exception e) { throw new LayerException(e, ExceptionCode.FILTER_EVALUATION_PROBLEM, filter, getId()); } if (comparator != null) { Collections.sort(filteredList, comparator); } if (maxResultSize > 0) { int fromIndex = Math.max(0, offset); int toIndex = Math.min(offset + maxResultSize, filteredList.size()); toIndex = Math.max(fromIndex, toIndex); return filteredList.subList(fromIndex, toIndex).iterator(); } else { return filteredList.iterator(); } }  }
BeanLayer implements VectorLayer, VectorLayerAssociationSupport, VectorLayerLazyFeatureConversionSupport { public Iterator<?> getElements(Filter filter, int offset, int maxResultSize) throws LayerException { if (null == filter) { filter = Filter.INCLUDE; } List<Object> filteredList = new ArrayList<Object>(); try { synchronized (featuresById) { for (Object feature : featuresById.values()) { if (filter.evaluate(feature)) { filteredList.add(feature); } } } } catch (Exception e) { throw new LayerException(e, ExceptionCode.FILTER_EVALUATION_PROBLEM, filter, getId()); } if (comparator != null) { Collections.sort(filteredList, comparator); } if (maxResultSize > 0) { int fromIndex = Math.max(0, offset); int toIndex = Math.min(offset + maxResultSize, filteredList.size()); toIndex = Math.max(fromIndex, toIndex); return filteredList.subList(fromIndex, toIndex).iterator(); } else { return filteredList.iterator(); } }  String getId(); @Api void setId(String id); CoordinateReferenceSystem getCrs(); boolean isCreateCapable(); boolean isUpdateCapable(); boolean isDeleteCapable(); boolean useLazyFeatureConversion(); @Api void setUseLazyFeatureConversion(boolean useLazyFeatureConversion); Iterator<?> getElements(Filter filter, int offset, int maxResultSize); Envelope getBounds(); Envelope getBounds(Filter queryFilter); FeatureModel getFeatureModel(); void setLayerInfo(VectorLayerInfo layerInfo); VectorLayerInfo getLayerInfo(); Object create(Object feature); Object read(String featureId); Object saveOrUpdate(Object feature); void delete(String featureId); List<Object> getFeatures(); void setFeatures(List<Object> features); List<Attribute<?>> getAttributes(String attributeName, Filter filter); }
BeanLayer implements VectorLayer, VectorLayerAssociationSupport, VectorLayerLazyFeatureConversionSupport { public Iterator<?> getElements(Filter filter, int offset, int maxResultSize) throws LayerException { if (null == filter) { filter = Filter.INCLUDE; } List<Object> filteredList = new ArrayList<Object>(); try { synchronized (featuresById) { for (Object feature : featuresById.values()) { if (filter.evaluate(feature)) { filteredList.add(feature); } } } } catch (Exception e) { throw new LayerException(e, ExceptionCode.FILTER_EVALUATION_PROBLEM, filter, getId()); } if (comparator != null) { Collections.sort(filteredList, comparator); } if (maxResultSize > 0) { int fromIndex = Math.max(0, offset); int toIndex = Math.min(offset + maxResultSize, filteredList.size()); toIndex = Math.max(fromIndex, toIndex); return filteredList.subList(fromIndex, toIndex).iterator(); } else { return filteredList.iterator(); } }  String getId(); @Api void setId(String id); CoordinateReferenceSystem getCrs(); boolean isCreateCapable(); boolean isUpdateCapable(); boolean isDeleteCapable(); boolean useLazyFeatureConversion(); @Api void setUseLazyFeatureConversion(boolean useLazyFeatureConversion); Iterator<?> getElements(Filter filter, int offset, int maxResultSize); Envelope getBounds(); Envelope getBounds(Filter queryFilter); FeatureModel getFeatureModel(); void setLayerInfo(VectorLayerInfo layerInfo); VectorLayerInfo getLayerInfo(); Object create(Object feature); Object read(String featureId); Object saveOrUpdate(Object feature); void delete(String featureId); List<Object> getFeatures(); void setFeatures(List<Object> features); List<Attribute<?>> getAttributes(String attributeName, Filter filter);  }