public static String convertToODataURIValue(Object val, String odataType) throws EdmPrimitiveTypeException { if (val == null) { return "null"; // is this correct? //$NON-NLS-1$ } if(odataType.startsWith("Edm.")) { //$NON-NLS-1$ odataType = odataType.substring(4); } if (val instanceof AbstractGeospatialType) { Geometry g; try { g = GeometryUtils.getGeometry((AbstractGeospatialType)val); } catch (FunctionExecutionException e1) { throw new EdmPrimitiveTypeException(e1.getMessage(), e1); } return geometryToODataValueString(g, val instanceof GeometryType); } EdmPrimitiveTypeKind kind = EdmPrimitiveTypeKind.valueOf(odataType); String value = EdmPrimitiveTypeFactory.getInstance(kind).valueToString( val, true, null, null, Integer.MAX_VALUE, true); if (kind == EdmPrimitiveTypeKind.String) { return EdmString.getInstance().toUriLiteral(value); } return value; }
public static String convertToODataURIValue(Object val, String odataType) throws EdmPrimitiveTypeException { if (val == null) { return "null"; // is this correct? //$NON-NLS-1$ } if(odataType.startsWith("Edm.")) { //$NON-NLS-1$ odataType = odataType.substring(4); } if (val instanceof AbstractGeospatialType) { Geometry g; try { g = GeometryUtils.getGeometry((AbstractGeospatialType)val); } catch (FunctionExecutionException e1) { throw new EdmPrimitiveTypeException(e1.getMessage(), e1); } return geometryToODataValueString(g, val instanceof GeometryType); } EdmPrimitiveTypeKind kind = EdmPrimitiveTypeKind.valueOf(odataType); String value = EdmPrimitiveTypeFactory.getInstance(kind).valueToString( val, true, null, null, Integer.MAX_VALUE, true); if (kind == EdmPrimitiveTypeKind.String) { return EdmString.getInstance().toUriLiteral(value); } return value; }
combinedConst = new Constant(result, descriptor.getReturnType()); } catch(FunctionExecutionException e) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30373, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30373, e.getMessage())); } catch (BlockedException e) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30373, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30373, e.getMessage()));
combinedConst = new Constant(result, descriptor.getReturnType()); } catch(FunctionExecutionException e) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30373, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30373, e.getMessage())); } catch (BlockedException e) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30373, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30373, e.getMessage()));
combinedConst = new Constant(result, descriptor.getReturnType()); } catch(FunctionExecutionException e) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30373, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30373, e.getMessage())); } catch (BlockedException e) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30373, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30373, e.getMessage()));