private int getNumber( NameStep step ) { int num = 0; if ( !step.getPredicates().isEmpty() ) { List<?> predicates = step.getPredicates(); if ( predicates.size() == 1 ) { Expr predicate = ( (Predicate) predicates.get( 0 ) ).getExpr(); if ( predicate instanceof NumberExpr ) { num = ( (NumberExpr) predicate ).getNumber().intValue(); } } } return num; }
private boolean isChildElementStepWithoutPredicateOrWithNumberPredicate( NameStep step ) { if ( step.getAxis() == CHILD && !step.getLocalName().equals( "*" ) ) { if ( step.getPredicates().isEmpty() ) { return true; } else if ( step.getPredicates().size() == 1 ) { Predicate predicate = (Predicate) step.getPredicates().get( 0 ); Expr expr = predicate.getExpr(); if ( expr instanceof NumberExpr ) { return true; } } } return false; } }
if ( lpath.getSteps().get( 0 ) instanceof NameStep ) { NameStep step = (NameStep) lpath.getSteps().get( 0 ); if ( step.getAxis() == Axis.CHILD && step.getPredicates().isEmpty() && !step.getLocalName().equals( "*" ) ) { String prefix = step.getPrefix();
if ( namestep.getPredicates() != null && !namestep.getPredicates().isEmpty() ) { String msg = "Unable to map PropertyName '" + propName.getAsText() + "': contains an attribute NameStep with a predicate."; if ( namestep.getPredicates() != null && !namestep.getPredicates().isEmpty() ) { String msg = "Unable to map PropertyName '" + propName.getAsText() + "': contains an element NameStep with a predicate (needs implementation).";
private Pair<QName, Integer> trySimpleMultiProp( ValueReference valueReference, FeatureType ft ) throws OWSException { Expr expr = valueReference.getAsXPath(); if ( !( expr instanceof LocationPath ) ) { throw new OWSException( "Cannot update property on feature type '" + ft.getName() + "'. Complex property paths are not supported.", OPERATION_NOT_SUPPORTED ); } Object obj = ( (LocationPath) expr ).getSteps().get( 0 ); if ( !( obj instanceof NameStep ) ) { throw new OWSException( "Cannot update property on feature type '" + ft.getName() + "'. Complex property paths are not supported.", OPERATION_NOT_SUPPORTED ); } NameStep namestep = (NameStep) obj; obj = namestep.getPredicates().get( 0 ); if ( !( obj instanceof Predicate ) ) { throw new OWSException( "Cannot update property on feature type '" + ft.getName() + "'. Complex property paths are not supported.", OPERATION_NOT_SUPPORTED ); } Predicate pred = (Predicate) obj; expr = pred.getExpr(); if ( !( expr instanceof NumberExpr ) ) { throw new OWSException( "Cannot update property on feature type '" + ft.getName() + "'. Complex property paths are not supported.", OPERATION_NOT_SUPPORTED ); } NumberExpr ne = (NumberExpr) expr; int index = Math.round( Float.parseFloat( ne.getText() ) ); String namespaceUri = determineNamespaceUri( valueReference, ft, namestep ); return new Pair<QName, Integer>( new QName( namespaceUri, namestep.getLocalName() ), index - 1 ); }
private SlotMapping getSlot( ValueReference propName, NameStep slotStep ) throws UnmappableException { List<?> predicates = slotStep.getPredicates(); if ( predicates == null || predicates.isEmpty() ) { String msg = "Unable to map PropertyName '" + propName.getAsText()
throw new UnmappableException( msg ); if ( !firstStep.getPredicates().isEmpty() ) { String msg = "Unable to map PropertyName '" + propName.getAsText() + "'. Predicates are not allowed for first step (" + firstStep + ").";