@Override public List<PropertyType> getNewPropertyDecls( FeatureType ft ) { return ft.getPropertyDeclarations(); }
/** * 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; }
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() ); } }
@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() ); }
/** * @param root * @throws IOException */ private static void addNode( BufferedWriter out, FeatureType ft ) throws IOException { if ( ft != null ) { String dotName = dotName( ft ); List<String> attributes = createAttributes( ft ); List<PropertyType> pd = ft.getPropertyDeclarations(); StringBuilder sb = new StringBuilder( "tooltip=\"" ); if ( pd != null && !pd.isEmpty() ) { Iterator<PropertyType> it = pd.iterator(); while ( it.hasNext() ) { sb.append( dotName( it.next().getName() ) ); if ( it.hasNext() ) { sb.append( ",<br/>" ); } } } sb.append( "\"" ); attributes.add( sb.toString() ); GraphvizDot.writeVertex( dotName, attributes, out ); } }
@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; }
private static LinkedList<Operator> findOperators( FeatureType ft, Envelope clickBox ) { LinkedList<Operator> list = new LinkedList<Operator>(); for ( PropertyType pt : ft.getPropertyDeclarations() ) { if ( pt instanceof GeometryPropertyType && ( ( (GeometryPropertyType) pt ).getCoordinateDimension() == DIM_2 || ( (GeometryPropertyType) pt ).getCoordinateDimension() == DIM_2_OR_3 ) ) { list.add( new Intersects( new ValueReference( pt.getName() ), clickBox ) ); } } return list; }
protected boolean localReferencesPossible( QueryAnalyzer analyzer, int traverseXLinkDepth ) { if ( traverseXLinkDepth == 0 && analyzer.getQueries().size() == 1 ) { List<Query> queries = analyzer.getQueries().values().iterator().next(); if ( queries.size() == 1 ) { Query query = queries.get( 0 ); if ( query.getTypeNames().length == 1 ) { TypeName typeName = query.getTypeNames()[0]; FeatureStore fs = analyzer.getQueries().keySet().iterator().next(); FeatureType ft = fs.getSchema().getFeatureType( typeName.getFeatureTypeName() ); for ( PropertyType pt : ft.getPropertyDeclarations() ) { if ( pt instanceof FeaturePropertyType ) { FeaturePropertyType fpt = (FeaturePropertyType) pt; FeatureType targetFt = fpt.getValueFt(); if ( targetFt == null || fs.getSchema().isSubType( targetFt, ft ) ) { return true; } } } LOG.debug( "Forward references can be ruled out." ); return false; } } } return true; }
for ( PropertyType t : ft.getPropertyDeclarations() ) { if ( entry.containsKey( t ) ) { props.add( entry.get( t ) );
for ( PropertyType pt : ft.getPropertyDeclarations() ) { if ( pt instanceof FeaturePropertyType ) { QName referencedFtName = ( (FeaturePropertyType) pt ).getFTName();
PrimitiveValue val = new PrimitiveValue( new BigDecimal( 0xffff & data.getShortSample( 0, 0, 0 ) ), new PrimitiveType( BaseType.DECIMAL ) ); props.add( new GenericProperty( featureType.getPropertyDeclarations().get( 0 ), val ) ); break; PrimitiveValue val = new PrimitiveValue( new BigDecimal( 0xff & data.getByteSample( 0, 0, i ) ), new PrimitiveType( BaseType.DECIMAL ) ); props.add( new GenericProperty( featureType.getPropertyDeclarations().get( 0 ), val ) ); LOG.warn( "The raster is of type '{}', this is handled as float currently.", dataType ); case FLOAT: props.add( new GenericProperty( featureType.getPropertyDeclarations().get( 0 ), new PrimitiveValue( new BigDecimal( data.getFloatSample( 0, 0, 0 ) ), new PrimitiveType( BaseType.DECIMAL ) ) ) );
for ( PropertyType pt : ft.getPropertyDeclarations() ) { propNames.add( pt.getName() );
for ( PropertyType pt : ft.getPropertyDeclarations() ) { if ( !pt.getName().getNamespaceURI().equals( appSchema.getGMLSchema().getVersion().getNamespace() ) ) { mappings.addAll( generatePropMapping( pt, mc ) );
for ( PropertyType pt : feature.getType().getPropertyDeclarations() ) { int count = ptToCount.get( pt ) == null ? 0 : ptToCount.get( pt ); if ( count < pt.getMinOccurs() ) {