@Override public String getId( TypedObjectNode context ) { if ( context instanceof GMLObject ) { return ( (GMLObject) context ).getId(); } // TODO implement fallback to generic gml:id attribute return null; } }
/** * Adds a new {@link GMLObject} that has been encountered during the parsing of the GML document. * * @param object * GML object, must not be <code>null</code> and must not be of type {@link GMLReference} */ public void addObject( GMLObject object ) { String id = object.getId(); if ( id != null && id.length() > 0 ) { idToObject.put( object.getId(), object ); } }
@Override public void add( GMLObject obj ) { idToObject.put( obj.getId(), new SoftReference<GMLObject>( obj ) ); }
@Override public boolean visitObject( final GMLObject o ) { checkForDuplication( o.getId() ); return true; }
private GMLObject fetchExternalGmlObject( String uri, String baseURL ) { GMLObject object = null; try { URL resolvedURL = null; if ( baseURL != null ) { resolvedURL = new URL( new URL( baseURL ), uri ); } else { resolvedURL = new URL( uri ); } GMLStreamReader gmlReader = createGMLStreamReader( version, resolvedURL ); gmlReader.setApplicationSchema( schema ); object = gmlReader.read(); gmlReader.close(); LOG.debug( "Read GML object: id='" + object.getId() + "'" ); } catch ( Throwable e ) { String msg = "Unable to resolve external object reference to '" + uri + "': " + e.getMessage(); throw new ReferenceResolvingException( msg ); } return object; }
GMLObjectNode<GMLObject, ?> gmlObjectNode = (GMLObjectNode<GMLObject, ?>) node; GMLObject object = gmlObjectNode.getValue(); if ( object.getId() != null ) { List<AttributeNode<?>> idAttrs = new ArrayList<AttributeNode<?>>( 4 ); PrimitiveValue id = new PrimitiveValue( object.getId() ); idAttrs.add( new AttributeNode<GMLObject>( gmlObjectNode, new QName( "fid" ), id ) ); idAttrs.add( new AttributeNode<GMLObject>( gmlObjectNode, new QName( "gid" ), id ) );