@Override protected SQLOperation toProtoSQL( SpatialOperator op ) throws UnmappableException, FilterEvaluationException { throw new UnmappableException( "Spatial operators are currently not mappable in h2." ); }
/** * Ensures that the given {@link SQLExpression} is not an {@link SQLExpression} that is multi-valued. * * @param expr * SQL expression, must not be <code>null</code> * @throws UnmappableException */ protected void assertNotMultiValued( SQLExpression expr ) throws UnmappableException { if ( expr.isMultiValued() ) { String msg = "Cannot apply filter as it refers to a column that stores multiple values in concatenated form.'"; throw new UnmappableException( msg ); } } }
private void map( FeatureMapping mapping, List<MappableStep> remaining ) throws UnmappableException { // followJoins( mapping.getJoinedTable() ); if ( remaining.size() < 2 ) { throw new UnmappableException( "Not enough steps." ); } MappableStep ftStep = remaining.get( 0 ); if ( !( ftStep instanceof ElementStep ) ) { throw new UnmappableException( "Must provide a feature type name." ); } QName ftName = ( (ElementStep) ftStep ).getNodeName(); FeatureTypeMapping ftMapping = schema.getFtMapping( ftName ); if ( ftMapping == null ) { throw new UnmappableException( "Feature type '" + ftName + " is not mapped to a table." ); } String fromTable = currentTable; String fromTableAlias = currentTableAlias; // TODO what do do with Href mappings here? Needs proper reference resolving code for mapping here... String fromColumn = mapping.getJoinedTable().get( 0 ).getFromColumns().get( 0 ).toString(); String toTable = ftMapping.getFtTable().toString(); String toTableAlias = aliasManager.generateNew(); String toColumn = ftMapping.getFidMapping().getColumn(); Join appliedJoin = new Join( fromTable, fromTableAlias, Collections.singletonList( fromColumn ), toTable, toTableAlias, Collections.singletonList( toColumn ) ); joins.add( appliedJoin ); currentTable = toTable; currentTableAlias = toTableAlias; map( ftMapping.getMappings(), remaining.subList( 1, remaining.size() ) ); }
private void map( GeometryMapping mapping, List<MappableStep> remaining ) throws UnmappableException { GeometryMapping geomMapping = mapping; MappingExpression me = geomMapping.getMapping(); if ( !( me instanceof DBField ) ) { throw new UnmappableException( "Mappings to non-DBField geometries is currently not supported." ); } ParticleConverter<?> converter = null; if ( fs != null ) { converter = fs.getConverter( geomMapping ); } propMapping = new PropertyNameMapping( converter, joins, ( (DBField) me ).getColumn(), currentTableAlias ); }
String msg = "Unable to map PropertyName '" + propName.getAsText() + "'. Slot steps must specify a single name predicate (../rim:Slot[@name=...])."; throw new UnmappableException( msg ); throw new UnmappableException( msg ); String msg = "Unable to map PropertyName '" + propName.getAsText() + "'. Slot steps must specify a single name predicate (../rim:Slot[@name=...])."; throw new UnmappableException( msg ); String msg = "Unable to map PropertyName '" + propName.getAsText() + "'. Slot steps must specify a single name predicate (../rim:Slot[@name=...])."; throw new UnmappableException( msg ); String msg = "Unable to map PropertyName '" + propName.getAsText() + "'. Slot steps must specify a single name predicate (../rim:Slot[@name=...])."; throw new UnmappableException( msg ); String msg = "Unable to map PropertyName '" + propName.getAsText() + "'. No mapping for slot name '" + slotName + "' defined."; throw new UnmappableException( msg );
String msg = "Unable to map PropertyName '" + propName.getAsText() + "': Not a valid location path expression."; throw new UnmappableException( msg ); if ( steps.isEmpty() ) { String msg = "Unable to map PropertyName '" + propName.getAsText() + "': empty location path."; throw new UnmappableException( msg ); String msg = "Unable to map PropertyName '" + propName.getAsText() + "': step " + stepNo + " (" + o + ") is not a name step."; throw new UnmappableException( msg ); String msg = "Unable to map PropertyName '" + propName.getAsText() + "': step " + stepNo + " (" + o + ") is not a step on the child or attribute axis."; throw new UnmappableException( msg ); if ( "*".equals( firstStep.getLocalName() ) ) { String msg = "Unable to map PropertyName '" + propName.getAsText() + "'. First step must not be '*'."; throw new UnmappableException( msg ); throw new UnmappableException( msg ); String msg = "Unable to map PropertyName '" + propName.getAsText() + "'. First step must refer to a query type name or alias."; throw new UnmappableException( msg ); + "'. Filter predicates on registry object type '" + type.getType().name() + "' are not supported."; throw new UnmappableException( msg );
String msg = "Handling of '" + mapping.getClass() + " not implemented yet."; LOG.warn( msg ); throw new UnmappableException( msg ); String msg = "No mapping for PropertyName '" + propName.getAsText() + "' available. Could not map step '" + mappableStep + "'."; throw new UnmappableException( msg ); throw new UnmappableException( msg );
if ( !( xpath instanceof LocationPath ) ) { String msg = "Unable to map PropertyName '" + propName.getAsText() + "': not a LocationPath."; throw new UnmappableException( msg ); String msg = "Unable to map PropertyName '" + propName.getAsText() + "': contains a step that is not a NameStep."; throw new UnmappableException( msg ); } else { NameStep namestep = (NameStep) step; String msg = "Unable to map PropertyName '" + propName.getAsText() + "': contains an attribute NameStep with a predicate."; throw new UnmappableException( msg ); String msg = "Unable to map PropertyName '" + propName.getAsText() + "': contains an element NameStep with a predicate (needs implementation)."; throw new UnmappableException( msg ); String msg = "Unable to map PropertyName '" + propName.getAsText() + "': only child and attribute steps are supported."; throw new UnmappableException( msg );
private PropertyIsLike buildIsLike( Expression propName, Expression literal, boolean matchCase ) throws UnmappableException { if ( !( propName instanceof ValueReference ) || !( literal instanceof Literal ) ) { String msg = "Can not map filter. Multi-valued columns can only be compared to literals."; throw new UnmappableException( msg ); } String wildCard = "*"; String singleChar = "?"; String escapeChar = "\\"; String s = ( (Literal<?>) literal ).getValue().toString(); s = StringUtils.replaceAll( s, escapeChar, escapeChar + escapeChar ); s = StringUtils.replaceAll( s, singleChar, escapeChar + singleChar ); s = StringUtils.replaceAll( s, wildCard, escapeChar + wildCard ); Literal<PrimitiveValue> escapedLiteral = new Literal<PrimitiveValue>( new PrimitiveValue( s ), null ); return new PropertyIsLike( (ValueReference) propName, escapedLiteral, wildCard, singleChar, escapeChar, matchCase, null ); }
+ function.getName() + "' available."; LOG.warn( msg ); throw new UnmappableException( msg );
throw new UnmappableException( "Invalid property name expression '" + propName + "'. Must not end on type name element." ); } else { String msg = "No mapping for PropertyName '" + propName.getAsText() + "' available."; throw new UnmappableException( msg ); } else { String msg = "No mapping for PropertyName '" + propName.getAsText() + "' available."; throw new UnmappableException( msg ); } else { String msg = "No mapping for PropertyName '" + propName.getAsText() + "' available."; throw new UnmappableException( msg ); String msg = "Invalid property name expression '" + propName + "'. Cannot target RegistryObjectList (but a node above or below)."; throw new UnmappableException( msg ); String msg = "Invalid property name expression '" + propName + "'. Cannot target RegistryObjectList attributes."; throw new UnmappableException( msg ); String msg = "Unable to map PropertyName '" + propName.getAsText() + "'. Filtering based on '" + childType.name() + "' children of RegistryObjectList elements is not supported."; throw new UnmappableException( msg ); } else { String msg = "No mapping for PropertyName '" + propName.getAsText() + "' available.";
/** * Translates the given {@link Literal} into an {@link SQLExpression}. * <p> * The returned literal does not have any type information. Literal types are inferred in * {@link #toProtoSQL(ComparisonOperator)}. * </p> * * @param literal * literal to be translated, must not be <code>null</code> * @return corresponding SQL expression, never <code>null</code> * @throws UnmappableException * if translation is not possible (usually due to unmappable property names) * @throws FilterEvaluationException * if the filter contains invalid {@link ValueReference}s */ protected SQLExpression toProtoSQL( Literal<?> literal ) throws UnmappableException, FilterEvaluationException { Object value = literal.getValue(); if ( value != null ) { if ( value instanceof PrimitiveValue ) { PrimitiveValue pv = (PrimitiveValue) value; return new SQLArgument( pv, null ); } else { throw new UnmappableException( "Only primitive valued literals are currently supported." ); } } PrimitiveParticleConverter converter = new DefaultPrimitiveConverter( new PrimitiveType( STRING ), null, false ); return new SQLArgument( null, converter ); }
throw new UnmappableException( "Unable to map property '" + propName + "' to database column." );
throw new UnmappableException( "Unable to map property '" + propName + "' to database column." );
} else { String msg = "Can not map filter. Multi-valued columns can only be compared to literals."; throw new UnmappableException( msg ); } else { String msg = "Can not map filter. Multi-valued columns can only be compared to literals."; throw new UnmappableException( msg ); if ( !( expr instanceof ValueReference ) ) { String msg = "Mapping of PropertyIsNil is only supported for ValueReference expressions."; throw new UnmappableException( msg );