BeanLayer implements VectorLayer, VectorLayerAssociationSupport, VectorLayerLazyFeatureConversionSupport { public List<Attribute<?>> getAttributes(String attributeName, Filter filter) throws LayerException { log.debug("creating iterator for attribute {} and filter: {}", attributeName, filter); AbstractAttributeInfo attributeInfo = null; for (AbstractAttributeInfo info : getFeatureInfo().getAttributes()) { if (info.getName().equals(attributeName)) { attributeInfo = info; break; } } List<?> values = null; if (attributeInfo instanceof AssociationAttributeInfo) { AssociationAttributeInfo associationInfo = (AssociationAttributeInfo) attributeInfo; if (associationInfo.getType().equals(AssociationType.MANY_TO_ONE)) { values = ManyToOneAttributeBean.manyToOneValues(); } } List<Attribute<?>> attributes = new ArrayList<Attribute<?>>(); if (null != values) { for (Object object : values) { try { attributes.add(converterService.toDto(object, attributeInfo)); } catch (LayerException le) { throw le; } catch (GeomajasException e) { throw new LayerException(e, ExceptionCode.CONVERSION_PROBLEM, attributeName); } } } return attributes; }  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);  }
@Test public void testGetAttributes() throws Exception { List<Attribute<?>> attributes = ((VectorLayerAssociationSupport) layer).getAttributes("manyToOneAttr", null); Assert.assertNotNull(attributes); Assert.assertEquals(2, attributes.size()); }