public List<AttributeTypeInfo> getAttributes() { return delegate.getAttributes(); }
if (info.getAttributes() != null && !info.getAttributes().isEmpty() && info.getAttributes().get(0).getBinding() != null) { return info.getAttributes();
if (other.getAttributes() != null) return false; } else { List<AttributeTypeInfo> otherAttributes = other.getAttributes(); if (otherAttributes == attributes) return true;
if (info.getAttributes() == null || info.getAttributes().isEmpty()) { for (AttributeTypeInfo att : info.getAttributes()) { String attName = att.getName();
@Test public void testOldJTSBindingConversion() throws Exception { Catalog catalog = new CatalogImpl(); CatalogFactory cFactory = catalog.getFactory(); WorkspaceInfo ws = cFactory.createWorkspace(); ws.setName("foo"); catalog.add(ws); NamespaceInfo ns = cFactory.createNamespace(); ns.setPrefix("acme"); ns.setURI("http://acme.org"); catalog.add(ns); DataStoreInfo ds = cFactory.createDataStore(); ds.setWorkspace(ws); ds.setName("foo"); catalog.add(ds); persister.setCatalog(catalog); FeatureTypeInfo ft = persister.load( getClass().getResourceAsStream("/org/geoserver/config/old_jts_binding.xml"), FeatureTypeInfo.class); assertNotNull(ft); assertEquals( org.locationtech.jts.geom.LineString.class, ft.getAttributes().get(0).getBinding()); }
ft.setNativeName(ft.getName()); List<AttributeTypeInfo> attributes = ft.getAttributes(); for (AttributeDescriptor ad : featureType.getAttributeDescriptors()) { AttributeTypeInfo att = factory.createAttribute();
/** * Builds a {@link SimpleFeatureType} from the attributes declared in a {@link FeatureTypeInfo} * * @param fti */ protected SimpleFeatureType buildFeatureTypeFromInfo(FeatureTypeInfo fti) { SimpleFeatureType ft; SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder(); ftb.setName(fti.getName()); List<AttributeTypeInfo> attributes = fti.getAttributes(); for (AttributeTypeInfo attr : attributes) { if (Geometry.class.isAssignableFrom(attr.getBinding())) { ftb.add(attr.getName(), attr.getBinding(), fti.getCRS()); } else { ftb.add(attr.getName(), attr.getBinding()); } } ft = ftb.buildFeatureType(); return ft; } }
@Override public void onResource( String name, ResourceInfo r, StoreInfo s, MockCatalogBuilder b) { if (name.equals("Buildings")) { FeatureTypeInfo info = (FeatureTypeInfo) r; AttributeTypeInfoImpl geom1 = new AttributeTypeInfoImpl(); geom1.setName("geom"); EasyMock.expect(info.getAttributes()) .andReturn(Arrays.asList(geom1)) .anyTimes(); AttributeTypeInfoImpl geom2 = new AttributeTypeInfoImpl(); geom2.setName("geom"); geom2.setBinding(Polygon.class); try { EasyMock.expect(info.attributes()) .andReturn(Arrays.asList(geom2)) .anyTimes(); } catch (IOException e) { // will not happen } } super.onResource(name, r, s, b); } });
@SuppressWarnings("rawtypes") @Override public FeatureReader read(ImportData data, ImportTask task) throws IOException { File file = getFileFromData(data); // we need to get the feature type, to use for the particular parse through the file // since we put it on the metadata from the list method, we first check if that's still available SimpleFeatureType ft = (SimpleFeatureType) task.getMetadata().get(FeatureType.class); if (ft == null) { // if the type is not available, we can generate one from the resource // we aren't able to ask for the feature type from the resource directly, // because we don't have a backing store FeatureTypeInfo fti = (FeatureTypeInfo) task.getLayer().getResource(); SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder(); ftb.setName(fti.getName()); List<AttributeTypeInfo> attributes = fti.getAttributes(); for (AttributeTypeInfo attr : attributes) { ftb.add(attr.getName(), attr.getBinding()); } ft = ftb.buildFeatureType(); MetadataMap metadata = fti.getMetadata(); if (metadata.containsKey("importschemanames")) { Map<Object, Object> userData = ft.getUserData(); userData.put("schemanames", metadata.get("importschemanames")); } } return read(ft, file); }
ftinfo.setTitle(name); ftinfo.setNamespace(catalog.getDefaultNamespace()); List<AttributeTypeInfo> attributes = ftinfo.getAttributes(); for (AttributeDescriptor ad : featureType.getAttributeDescriptors()) { AttributeTypeInfo att = factory.createAttribute();
ftinfo.setTitle(name); ftinfo.setNamespace(catalog.getDefaultNamespace()); List<AttributeTypeInfo> attributes = ftinfo.getAttributes(); for (AttributeDescriptor ad : featureType.getAttributeDescriptors()) { AttributeTypeInfo att = factory.createAttribute();
ftinfo.setTitle(name); ftinfo.setNamespace(catalog.getDefaultNamespace()); List<AttributeTypeInfo> attributes = ftinfo.getAttributes(); for (AttributeDescriptor ad : featureType.getAttributeDescriptors()) { AttributeTypeInfo att = factory.createAttribute();
throw new RestletException("Trying to create new feature type inside the store, " + "but no feature type name was specified", Status.CLIENT_ERROR_BAD_REQUEST); } else if(fti.getAttributes() == null || fti.getAttributes() == null) { throw new RestletException("Trying to create new feature type inside the store, " + "but no attributes were specified", Status.CLIENT_ERROR_BAD_REQUEST); builder.setSRS(fti.getSRS()); for (AttributeTypeInfo ati : fti.getAttributes()) { if(ati.getLength() != null && ati.getLength() > 0) { builder.length(ati.getLength());
+ "but no feature type name was specified", HttpStatus.BAD_REQUEST); } else if (fti.getAttributes() == null || fti.getAttributes() == null) { throw new RestException( "Trying to create new feature type inside the store, " builder.setSRS(fti.getSRS()); for (AttributeTypeInfo ati : fti.getAttributes()) { if (ati.getLength() != null && ati.getLength() > 0) { builder.length(ati.getLength());
att.setName(ad.getLocalName()); att.setBinding(ad.getType().getBinding()); featureType.getAttributes().add(att);
featureType.getAttributes().clear(); List<String> typeNames = Arrays.asList(gtds.getTypeNames());
att.setName(ad.getLocalName()); att.setBinding(ad.getType().getBinding()); featureType.getAttributes().add(att);
featureType.getAttributes().clear();
@Override public void visit(FeatureTypeInfo featureType) { FeatureTypeInfo otherFeatureType = otherCatalog.getFeatureType(featureType.getId()); if (otherFeatureType != null) { otherFeatureType.setProjectionPolicy(featureType.getProjectionPolicy()); } if (!(Objects.equals(featureType, otherFeatureType) && checkEquals(featureType.getAttributes(), otherFeatureType.getAttributes()) && checkEquals(featureType.getResponseSRS(), otherFeatureType.getResponseSRS()) && checkEquals(featureType.getAlias(), otherFeatureType.getAlias()) && checkEquals(featureType.getKeywords(), otherFeatureType.getKeywords()) && checkEquals(featureType.getDataLinks(), otherFeatureType.getDataLinks()) && checkEquals(featureType.getMetadataLinks(), otherFeatureType.getMetadataLinks()) && checkEquals(featureType.getMetadata(), otherFeatureType.getMetadata()))) { differences.add(new InfoDiff(featureType, otherFeatureType)); } }
featureType.getAttributes().clear();