@Override public String toString() { return "ft=" + ft.getName() + ",idKernels=" + idKernels; } }
/** * Collects all property names of a given feature type, or all feature types if the given name is null. * * @param schema * @param featureType * @return a set of property qnames */ public static Set<QName> collectProperyNames( AppSchema schema, QName featureType ) { HashSet<QName> set = new HashSet<QName>(); for ( FeatureType ft : schema.getFeatureTypes() ) { if ( featureType == null || featureType.equals( ft.getName() ) ) { for ( PropertyType pt : ft.getPropertyDeclarations() ) { set.add( pt.getName() ); } } } return set; }
public FeatureClass( FeatureType ft, FeatureClass parent ) { super( ft.getName(), D_PACKAGE, PACKAGE_DIR, null, false, ft.isAbstract() ); this.ft = ft; this.baseType = parent; AppSchema schema = ft.getSchema(); propertyDeclarations = schema.getNewPropertyDecls( ft ); }
@Override public List<FeatureType> getFeatureTypes( String namespace, boolean includeCollections, boolean includeAbstracts ) { List<FeatureType> fts = new ArrayList<FeatureType>( ftNameToFt.values().size() ); for ( FeatureType ft : ftNameToFt.values() ) { if ( namespace == null || namespace.equals( ft.getName().getNamespaceURI() ) ) { if ( ( includeAbstracts || !ft.isAbstract() ) && ( includeCollections || !( ft instanceof FeatureCollectionType ) ) ) { fts.add( ft ); } } } return fts; }
private static void printFt( FeatureType ft, Set<String> ftNames, Set<String> propNames ) { System.out.println( "\n - feature type '" + ft.getName() + "'" + ( ft.isAbstract() ? " (abstract)" : "" ) ); ftNames.add( ft.getName().getLocalPart() ); for ( PropertyType pt : ft.getPropertyDeclarations() ) { propNames.add( pt.getName().getLocalPart() ); String ptName = pt.getName().getNamespaceURI().equals( ft.getName().getNamespaceURI() ) ? pt.getName().getLocalPart() : pt.getName().toString(); System.out.println( " - '" + ptName + "', minOccurs=" + pt.getMinOccurs() + ", maxOccurs=" + pt.getMaxOccurs() + ", type: " + pt.getClass().getSimpleName() ); } }
private static void writeLayer( HashSet<FeatureType> visited, XMLStreamWriter out, FeatureType ft, String storeId ) throws XMLStreamException { if ( visited.contains( ft ) || ft == null ) { return; } visited.add( ft ); out.writeCharacters( "\n" ); out.writeStartElement( ns, "RequestableLayer" ); XMLAdapter.writeElement( out, ns, "Name", ft.getName().getLocalPart() ); XMLAdapter.writeElement( out, ns, "Title", ft.getName().getLocalPart() ); for ( FeatureType sub : ft.getSchema().getDirectSubtypes( ft ) ) { writeLayer( visited, out, sub, storeId ); } XMLAdapter.writeElement( out, ns, "FeatureStoreId", storeId ); out.writeEndElement(); out.writeCharacters( "\n" ); }
bindings = f.getType().getSchema().getNamespaceBindings(); types.put( ref.getId(), list ); list.add( "inversZu_dientZurDarstellungVon_" + f.getType().getName().getLocalPart() ); String id = idIter.next(); if ( typeIter.next().equals( propName.getLocalPart() ) ) { PropertyType pt = f.getType().getPropertyDeclaration( propName ); Property p = new GenericProperty( pt, new FeatureReference( ctx, "#" + id, null ) ); iter.add( p );
/** * Returns the {@link FeatureStore} instance which is responsible for the specified feature type. * * @param ftName * name of the {@link FeatureType} * @return the responsible {@link FeatureStore} or <code>null</code> if no such store exists, i.e. the specified * feature type is not served */ public FeatureStore getStore( QName ftName ) { FeatureType ft = lookupFeatureType( ftName ); if ( ft == null ) { return null; } return schemaToStore.get( ft.getSchema() ); }
private void validatePropertyName( ValueReference propName, TypeName[] typeNames ) throws OWSException { // no check possible if feature type is unknown if ( typeNames.length > 0 ) { if ( propName.getAsQName() != null ) { if ( !isPrefixedAndBound( propName ) ) { repairSimpleUnqualified( propName, typeNames[0] ); } // check that the propName is indeed valid as belonging to serviced features QName name = getPropertyNameAsQName( propName ); if ( name != null ) { if ( typeNames.length == 1 ) { FeatureType ft = service.lookupFeatureType( typeNames[0].getFeatureTypeName() ); if ( ft.getPropertyDeclaration( name ) == null ) { // gml:boundedBy currently requires special treatment if ( !name.getLocalPart().equals( "boundedBy" ) ) { String msg = "Specified PropertyName '" + propName.getAsText() + "' (='" + name + "') does not exist for feature type '" + ft.getName() + "'."; throw new OWSException( msg, INVALID_PARAMETER_VALUE, "PropertyName" ); } } } // TODO really skip this check for join queries? } } else { // TODO property name may be an XPath and use aliases... } } }
@Override public List<PropertyType> getNewPropertyDecls( FeatureType ft ) { return ft.getPropertyDeclarations(); }
FeatureType possibleFT = rootFeatureTypes[i]; if ( possibleFT != null ) { GeometryPropertyType geoPT = possibleFT.getDefaultGeometryPropertyDeclaration(); if ( geoPT != null ) { posFT = possibleFT.getName();
for ( PropertyType t : ft.getPropertyDeclarations() ) { if ( entry.containsKey( t ) ) { props.add( entry.get( t ) ); props.add( new GenericProperty( ft.getDefaultGeometryPropertyDeclaration(), g ) ); feature = ft.newFeature( fid, props, null );
PropertyType propDecl = ft.getPropertyDeclaration( propName ); if ( propDecl == null ) { property = parsePropertyDynamic( propName, xmlStream, activeCRS, ft, lastPropDecl, appSchema ); Feature feature = ft.newFeature( fid, props, null ); if ( fid != null && !"".equals( fid ) ) { if ( idContext.getObject( fid ) != null ) {
@Override public FeatureType[] getConcreteSubtypes( FeatureType ft ) { FeatureType[] directSubtypes = getDirectSubtypes( ft ); List<FeatureType> result = new ArrayList<FeatureType>( ftNameToFt.size() ); if ( directSubtypes != null && directSubtypes.length > 0 ) { for ( FeatureType son : directSubtypes ) { if ( son != null ) { if ( !son.isAbstract() ) { result.add( son ); } FeatureType[] sons = getSubtypes( son ); if ( sons != null && sons.length > 0 ) { for ( FeatureType sonSon : sons ) { if ( !sonSon.isAbstract() ) { result.add( sonSon ); } } } } } } return result.toArray( new FeatureType[result.size()] ); }
QName childEl = getChildElementStepAsQName( propName ); if ( childEl != null ) { PropertyType pt = ft.getPropertyDeclaration( childEl ); String idPrefix = gmlId + "_" + toIdPrefix( propName ); addProperties( props, pt, mapping, rs, idPrefix ); feature = ft.newFeatureInstance( gmlId, props, null ); if ( fs.getCache() != null ) { fs.getCache().add( feature );
PropertyType pt = getType().getPropertyDeclaration( propName ); if ( value == null ) {
extraProps = new ExtraProps( extraPropertyList.toArray( new Property[extraPropertyList.size()] ) ); feature = ft.newFeature( fid, propertyList, extraProps );
PropertyType pt = ft.getPropertyDeclaration( propName ); if ( pt == null ) { throw new OWSException( "Cannot update property '" + propName + "' of feature type '" + ft.getName() + "'. The feature type does not define this property.", OPERATION_NOT_SUPPORTED ); xmlStream.require( START_ELEMENT, null, "Value" ); GMLStreamReader gmlReader = createGMLStreamReader( inputFormat, xmlStream ); gmlReader.setApplicationSchema( ft.getSchema() ); GeometryFactory geomFac = new GeometryFactory(); geomFac.addInspector( new CoordinateValidityInspector() );
/** * Creates a new {@link IdAnalyzer} instance for the given {@link MappedAppSchema}. * * @param schema application schema with mapping information, must not be <code>null</code> */ public IdAnalyzer( MappedAppSchema schema ) { this.schema = schema; for ( FeatureType ft : schema.getFeatureTypes() ) { if ( !ft.isAbstract() ) { FeatureTypeMapping ftMapping = schema.getFtMapping( ft.getName() ); if ( ftMapping != null ) { FIDMapping fidMapping = ftMapping.getFidMapping(); if ( fidMapping != null ) { LOG.debug( fidMapping.getPrefix() + " -> " + ft.getName() ); prefixToFt.put( fidMapping.getPrefix(), ft ); } } } } prefixKeysSortedByLengthDesc = prefixToFt.keySet().toArray( new String[0] ); sortByLengthDescending( prefixKeysSortedByLengthDesc ); }