@TeiidFunction(name=SourceSystemFunctions.ST_FORCE_2D, category=FunctionCategoryConstants.GEOMETRY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static GeometryType force2D(GeometryType geom) { return geom; //higher dimensions not supported }
private FunctionMethod addFunction(Method method, TeiidFunction f, String name) { FunctionMethod func = MetadataFactory.createFunctionFromMethod(name, method); func.setDescription(QueryPlugin.Util.getString(QueryPlugin.Util.getString("SystemSource." + name.toLowerCase() + "_description"))); //$NON-NLS-1$ //$NON-NLS-2$ func.setCategory(f.category()); for (int i = 0; i < func.getInputParameterCount(); i++) { func.getInputParameters().get(i).setDescription(QueryPlugin.Util.getString("SystemSource." + name.toLowerCase() + "_param" + (i+1))); //$NON-NLS-1$ //$NON-NLS-2$ } func.getOutputParameter().setDescription(QueryPlugin.Util.getString("SystemSource." + name.toLowerCase() + "_result")); //$NON-NLS-1$ //$NON-NLS-2$ if (f.nullOnNull()) { func.setNullOnNull(true); } func.setDeterminism(f.determinism()); func.setPushdown(f.pushdown()); functions.add(func); return func; }
private void addFunctions(Class<?> clazz, String prefix) { Method[] methods = clazz.getMethods(); //need a consistent order for tests Arrays.sort(methods, new Comparator<Method>() { @Override public int compare(Method arg0, Method arg1) { return arg0.toGenericString().compareTo(arg1.toGenericString()); } }); for (Method method : methods) { TeiidFunction f = method.getAnnotation(TeiidFunction.class); if (f == null) { continue; } String name = f.name(); if (name.isEmpty()) { name = method.getName(); } if (prefix != null) { name = prefix + name; } addFunction(method, f, name); if (!f.alias().isEmpty()) { addFunction(method, f, f.alias()); } } }
private FunctionMethod addFunction(Method method, TeiidFunction f, String name) { FunctionMethod func = MetadataFactory.createFunctionFromMethod(name, method); func.setDescription(QueryPlugin.Util.getString(QueryPlugin.Util.getString("SystemSource." + name.toLowerCase() + "_description"))); //$NON-NLS-1$ //$NON-NLS-2$ func.setCategory(f.category()); for (int i = 0; i < func.getInputParameterCount(); i++) { func.getInputParameters().get(i).setDescription(QueryPlugin.Util.getString("SystemSource." + name.toLowerCase() + "_param" + (i+1))); //$NON-NLS-1$ //$NON-NLS-2$ } func.getOutputParameter().setDescription(QueryPlugin.Util.getString("SystemSource." + name.toLowerCase() + "_result")); //$NON-NLS-1$ //$NON-NLS-2$ if (f.nullOnNull()) { func.setNullOnNull(true); } func.setDeterminism(f.determinism()); func.setPushdown(f.pushdown()); functions.add(func); return func; }
private void addFunctions(Class<?> clazz, String prefix) { Method[] methods = clazz.getMethods(); //need a consistent order for tests Arrays.sort(methods, new Comparator<Method>() { @Override public int compare(Method arg0, Method arg1) { return arg0.toGenericString().compareTo(arg1.toGenericString()); } }); for (Method method : methods) { TeiidFunction f = method.getAnnotation(TeiidFunction.class); if (f == null) { continue; } String name = f.name(); if (name.isEmpty()) { name = method.getName(); } if (prefix != null) { name = prefix + name; } addFunction(method, f, name); if (!f.alias().isEmpty()) { addFunction(method, f, f.alias()); } } }
@TeiidFunction(name=SourceSystemFunctions.ST_HASARC, category=FunctionCategoryConstants.GEOMETRY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static boolean hasArc(@SuppressWarnings("unused") GeometryType geom) { return false; //curved not supported }
private FunctionMethod addFunction(Method method, TeiidFunction f, String name) { FunctionMethod func = MetadataFactory.createFunctionFromMethod(name, method); func.setDescription(QueryPlugin.Util.getString(QueryPlugin.Util.getString("SystemSource." + name.toLowerCase() + "_description"))); //$NON-NLS-1$ //$NON-NLS-2$ func.setCategory(f.category()); for (int i = 0; i < func.getInputParameterCount(); i++) { func.getInputParameters().get(i).setDescription(QueryPlugin.Util.getString("SystemSource." + name.toLowerCase() + "_param" + (i+1))); //$NON-NLS-1$ //$NON-NLS-2$ } func.getOutputParameter().setDescription(QueryPlugin.Util.getString("SystemSource." + name.toLowerCase() + "_result")); //$NON-NLS-1$ //$NON-NLS-2$ if (f.nullOnNull()) { func.setNullOnNull(true); } func.setDeterminism(f.determinism()); func.setPushdown(f.pushdown()); functions.add(func); return func; }
private void addFunctions(Class<?> clazz, String prefix) { Method[] methods = clazz.getMethods(); //need a consistent order for tests Arrays.sort(methods, new Comparator<Method>() { @Override public int compare(Method arg0, Method arg1) { return arg0.toGenericString().compareTo(arg1.toGenericString()); } }); for (Method method : methods) { TeiidFunction f = method.getAnnotation(TeiidFunction.class); if (f == null) { continue; } String name = f.name(); if (name.isEmpty()) { name = method.getName(); } if (prefix != null) { name = prefix + name; } addFunction(method, f, name); if (!f.alias().isEmpty()) { addFunction(method, f, f.alias()); } } }
@TeiidFunction(name=SourceSystemFunctions.ST_DISTANCE, category=FunctionCategoryConstants.GEOGRAPHY, nullOnNull=true, pushdown=PushDown.MUST_PUSHDOWN) public static Double distance(GeographyType geog1, GeographyType geog2) throws FunctionExecutionException { throw new UnsupportedOperationException(); }
@TeiidFunction(name=SourceSystemFunctions.ST_LENGTH, category=FunctionCategoryConstants.GEOGRAPHY, nullOnNull=true, pushdown=PushDown.MUST_PUSHDOWN) public static Double length(GeographyType geog) throws FunctionExecutionException { throw new UnsupportedOperationException(); }
@TeiidFunction(name=SourceSystemFunctions.ST_INTERSECTS, category=FunctionCategoryConstants.GEOGRAPHY, nullOnNull=true, pushdown=PushDown.MUST_PUSHDOWN) public static Boolean intersects(GeographyType geog1, GeographyType geog2) throws FunctionExecutionException { throw new UnsupportedOperationException(); }
@TeiidFunction(name=SourceSystemFunctions.ST_ASEWKB, category=FunctionCategoryConstants.GEOMETRY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static BlobType asEwkb(final GeometryType geometry) { return GeometryUtils.geometryToEwkb(geometry); }
@TeiidFunction(name=SourceSystemFunctions.ST_ASGEOJSON, category=FunctionCategoryConstants.GEOMETRY, pushdown=PushDown.CAN_PUSHDOWN, nullOnNull=true) public static ClobType asGeoJson(GeometryType geometry) throws FunctionExecutionException { return GeometryUtils.geometryToGeoJson(geometry); }
@TeiidFunction(name=SourceSystemFunctions.ST_ASGML, category=FunctionCategoryConstants.GEOMETRY, pushdown=PushDown.CAN_PUSHDOWN, nullOnNull=true) public static ClobType asGml(CommandContext context, GeometryType geometry) throws FunctionExecutionException { return GeometryUtils.geometryToGml(context, geometry, true); }
@TeiidFunction(name=SourceSystemFunctions.ST_SIMPLIFY, category=FunctionCategoryConstants.GEOMETRY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static GeometryType simplify(GeometryType geom, double tolerance) throws FunctionExecutionException { return GeometryUtils.simplify(geom, tolerance); }
@TeiidFunction(name=SourceSystemFunctions.ST_BOUNDARY, category=FunctionCategoryConstants.GEOMETRY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static GeometryType boundary(GeometryType geom) throws FunctionExecutionException { return GeometryUtils.boundary(geom); }
@TeiidFunction(name=SourceSystemFunctions.ST_ENDPOINT, category=FunctionCategoryConstants.GEOMETRY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static GeometryType endPoint(GeometryType geom) throws FunctionExecutionException { return GeometryUtils.startEndPoint(geom, false); }
@TeiidFunction(name=SourceSystemFunctions.ST_LENGTH, category=FunctionCategoryConstants.GEOMETRY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static Double length(GeometryType geom) throws FunctionExecutionException { return GeometryUtils.length(geom); }
@TeiidFunction(name=SourceSystemFunctions.ST_NUMGEOMETRIES, category=FunctionCategoryConstants.GEOMETRY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static Integer numGeometries(GeometryType geom) throws FunctionExecutionException { return GeometryUtils.numGeometries(geom); }
@TeiidFunction(name=SourceSystemFunctions.ST_RELATE, category=FunctionCategoryConstants.GEOMETRY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static String relate(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException { return GeometryUtils.relate(geom1, geom2); }