private Set<QName> getConcreteSubstitutions( AppSchema appSchema, QName elName ) { Set<QName> elNames = new HashSet<QName>(); GMLObjectType type = appSchema.getGeometryType( elName ); if ( type != null ) { if ( !type.isAbstract() ) { elNames.add( type.getName() ); } for ( GMLObjectType substitution : appSchema.getSubstitutions( type.getName() ) ) { if ( !substitution.isAbstract() ) { elNames.add( substitution.getName() ); } } } return elNames; }
@Override public List<GMLObjectType> getSubstitutions( QName name ) { List<GMLObjectType> directSubtypes = getDirectSubstitutions( name ); List<GMLObjectType> result = new ArrayList<GMLObjectType>( typeNameToType.size() ); if ( directSubtypes != null && !directSubtypes.isEmpty() ) { for ( GMLObjectType son : directSubtypes ) { if ( son != null ) { result.add( son ); List<GMLObjectType> sons = getSubstitutions( son.getName() ); if ( sons != null ) { result.addAll( sons ); } } } } return result; }
private static QName getName( GMLObject object ) { if ( object.getType() != null ) { return object.getType().getName(); } if ( object instanceof Feature ) { return ( (Feature) object ).getName(); } else if ( object instanceof Geometry ) { // TODO should be covered by the type return new QName( "GEOMETRY" ); } else if ( object instanceof TimeInstant ) { return new QName( GML3_2_NS, "TimeInstant" ); } else if ( object instanceof TimePeriod ) { return new QName( GML3_2_NS, "TimePeriod" ); } throw new IllegalArgumentException( "Creating GMLObjectNode from " + object.getClass() + " needs implementation." ); }
final GMLObjectType type = buildGenericObjectType( elDecl ); genericGmlObjectTypes.add( type ); typeNameToType.put( type.getName(), type ); final GMLObjectType type = buildGenericObjectType( elDecl ); genericGmlObjectTypes.add( type ); typeNameToType.put( type.getName(), type ); typeNameToType.put( type.getName(), type );
private FeatureType buildFeatureType( XSElementDeclaration elDecl ) { final GMLObjectType type = objectTypeFactory.build( elDecl ); final List<XSElementDeclaration> fcDecls = gmlSchema.getFeatureCollectionElementDeclarations( null, false ); if ( fcDecls.contains( elDecl ) ) { return new GenericFeatureCollectionType( type.getName(), type.getPropertyDeclarations(), elDecl.getAbstract() ); } return new GenericFeatureType( type.getName(), type.getPropertyDeclarations(), elDecl.getAbstract() ); }
public void export( final TimeSlice timeSlice, final GmlXlinkOptions resolveState ) throws XMLStreamException, UnknownCRSException, TransformationException { if ( timeSlice.getId() != null ) { referenceExportStrategy.addExportedId( timeSlice.getId() ); } final QName featureName = timeSlice.getType().getName(); LOG.debug( "Exporting TimeSlice {} with ID {}", featureName, timeSlice.getId() ); final String namespaceURI = featureName.getNamespaceURI(); final String localName = featureName.getLocalPart(); writeStartElementWithNS( namespaceURI, localName ); if ( timeSlice.getId() != null ) { if ( fidAttr.getNamespaceURI() == "" ) { writer.writeAttribute( fidAttr.getLocalPart(), timeSlice.getId() ); } else { writeAttributeWithNS( fidAttr.getNamespaceURI(), fidAttr.getLocalPart(), timeSlice.getId() ); } } for ( final Property prop : timeSlice.getProperties() ) { export( prop, resolveState ); } writer.writeEndElement(); }
if ( gmlObjectTypes != null ) { for ( final GMLObjectType gmlObjectType : gmlObjectTypes ) { typeNameToType.put( gmlObjectType.getName(), gmlObjectType ); if ( gmlObjectType.getCategory() == GEOMETRY ) { geometryTypes.add( gmlObjectType );
activeDecl.getMaxOccurs(), type.getName() ); throw new XMLParsingException( xmlStream, msg ); String msg = null; if ( activeDecl.getMinOccurs() == 1 ) { msg = Messages.getMessage( "ERROR_PROPERTY_MANDATORY", activeDecl.getName(), type.getName() ); } else { msg = Messages.getMessage( "ERROR_PROPERTY_TOO_FEW_OCCURENCES", activeDecl.getName(), activeDecl.getMinOccurs(), type.getName() ); String msg = Messages.getMessage( "ERROR_PROPERTY_UNEXPECTED", propName, type.getName() ); throw new XMLParsingException( xmlStream, msg );
private void startGeometry( String localName, Geometry geometry ) throws XMLStreamException, UnknownCRSException, TransformationException { GMLObjectType gmlType = geometry.getType(); if ( gmlType == null ) { writeStartElementWithNS( gmlNs, localName ); } else { QName elName = gmlType.getName(); writeStartElementWithNS( elName.getNamespaceURI(), elName.getLocalPart() ); } if ( geometry.getId() != null ) { referenceExportStrategy.addExportedId( geometry.getId() ); writeAttributeWithNS( gmlNs, "id", geometry.getId() ); } else if ( version == GML_32 && geometry.getId() == null ) { // in GML 3.2, a gml:id is required for every geometry writeAttributeWithNS( gmlNs, "id", "GEOMETRY_" + generateNewId() ); } if ( outputCRS != null ) { writer.writeAttribute( "srsName", outputCRS.getAlias() ); } else if ( geometry.getCoordinateSystem() != null ) { writer.writeAttribute( "srsName", geometry.getCoordinateSystem().getAlias() ); } exportStandardProps( geometry ); }