@Override public TypedObjectNode[] eval( TypedObjectNode particle, ValueReference path ) throws FilterEvaluationException { if ( particle instanceof GMLObject ) { return eval( (GMLObject) particle, path ); } if ( particle instanceof ElementNode ) { return eval( (ElementNode) particle, path ); } throw new FilterEvaluationException( "Evaluation of XPath expressions on '" + particle.getClass() + "' is not supported." ); }
@SuppressWarnings({ "unchecked", "synthetic-access" }) @Override public int compare( Feature f1, Feature f2 ) { int order = 0; for ( SortProperty sortCrit : sortCrits ) { ValueReference propName = sortCrit.getSortProperty(); try { // TODO handle multi properties correctly TypedObjectNode[] values1 = evaluator.eval( f1, propName ); TypedObjectNode[] values2 = evaluator.eval( f2, propName ); for ( TypedObjectNode value1 : values1 ) { if ( value1 != null ) { for ( TypedObjectNode value2 : values2 ) { if ( value2 != null ) { Pair<Object, Object> comparablePair = getPrimitives( value1, value2 ); order = ( (Comparable<Object>) comparablePair.first ).compareTo( comparablePair.second ); if ( !sortCrit.getSortOrder() ) { order *= -1; } } } } } } catch ( Exception e ) { LOG.debug( "Cannot compare values: " + e.getMessage() ); } } return order; } } );
break; TypedObjectNode[] values = evaluator.eval( member, request.getValueReference() ); for ( TypedObjectNode value : values ) { if ( valuesSkipped < startIndex ) {
break; TypedObjectNode[] values = evaluator.eval( member, request.getValueReference() ); for ( TypedObjectNode value : values ) { if ( valuesSkipped < startIndex ) {
private List<Property> getTargetProperties( final Feature feature, final ValueReference propName ) throws FeatureStoreException { if (propName == null) { return emptyList(); } try { final TypedObjectNodeXPathEvaluator evaluator = new TypedObjectNodeXPathEvaluator(); final TypedObjectNode[] nodes = evaluator.eval( feature, propName ); final List<Property> props = new ArrayList<Property>(); if ( nodes != null ) { for ( final TypedObjectNode node : nodes ) { if ( !( node instanceof Property ) ) { final String msg = propName + " does not refer to a property."; throw new FeatureStoreException( msg ); } props.add( (Property) node ); } } return props; } catch ( FilterEvaluationException e ) { throw new FeatureStoreException( e.getMessage(), e ); } }
try { for ( Feature member : rs ) { TypedObjectNode[] values = evaluator.eval( member, request.getValueReference() ); numFeatures += values.length;
private String getExternalRef( Feature building ) { String result = null; NamespaceBindings nsContext = new NamespaceBindings(); nsContext.addNamespace( "cgml", NS ); ValueReference propName = new ValueReference( "cgml:externalReference/cgml:informationSystem/text()", nsContext ); TypedObjectNodeXPathEvaluator evaluator = new TypedObjectNodeXPathEvaluator( ); TypedObjectNode[] tons; try { tons = evaluator.eval( building, propName ); if ( tons.length > 0 ) { result = ( (PrimitiveValue) tons[0] ).getAsText().trim(); } } catch ( FilterEvaluationException e ) { LOG.error( "Retrieving of information system property failed: " + e.getMessage() ); } return result; }
TypedObjectNode[] values = evaluator.eval( particle, mapping.getPath() ); int childIdx = 1; for ( TypedObjectNode value : values ) {