@Override public List<String> getNamespacesDependencies( String ns ) { List<String> nsDependencies = nsToDependencies.get( ns ); if ( nsDependencies == null ) { Set<String> dependencies = new HashSet<String>(); List<FeatureType> fts = getFeatureTypes( ns, true, true ); for ( FeatureType ft : fts ) { dependencies.add( ft.getName().getNamespaceURI() ); for ( PropertyType pt : ft.getPropertyDeclarations() ) { if ( pt instanceof FeaturePropertyType ) { FeaturePropertyType fpt = (FeaturePropertyType) pt; if ( fpt.getValueFt() != null ) { dependencies.add( fpt.getValueFt().getName().getNamespaceURI() ); } } } if ( getParent( ft ) != null ) { dependencies.add( getParent( ft ).getName().getNamespaceURI() ); } } if ( gmlSchema != null ) { // TODO } dependencies.remove( ns ); nsDependencies = new ArrayList<String>( dependencies ); nsToDependencies.put( ns, nsDependencies ); } return nsDependencies; }
@Override public List<PropertyType> getNewPropertyDecls( FeatureType ft ) { List<PropertyType> propDecls = ft.getPropertyDeclarations(); FeatureType parentFt = getParent( ft ); int firstNewIdx = 0; if ( parentFt != null ) { for ( PropertyType parentPropDecl : parentFt.getPropertyDeclarations() ) { if ( parentPropDecl.getName().equals( propDecls.get( firstNewIdx ).getName() ) ) { firstNewIdx++; } else { throw new RuntimeException( "Content model of feature type '" + ft.getName() + "' is not compatible with parent type '" + parentFt.getName() + "'." ); } } } // TODO integrate handling of gml:featureMember properly for ( int i = firstNewIdx; i < propDecls.size(); i++ ) { if ( "featureMember".equals( propDecls.get( firstNewIdx ).getName().getLocalPart() ) ) { firstNewIdx++; } else if ( "featureMembers".equals( propDecls.get( firstNewIdx ).getName().getLocalPart() ) ) { firstNewIdx++; } } return propDecls.subList( firstNewIdx, propDecls.size() ); }