Search in sources :

Example 1 with OSQLFunctionFiltered

use of com.orientechnologies.orient.core.sql.functions.OSQLFunctionFiltered in project orientdb by orientechnologies.

the class OMethodCall method execute.

private Object execute(Object targetObjects, OCommandContext ctx, String name, List<OExpression> iParams, Iterable<OIdentifiable> iPossibleResults) {
    List<Object> paramValues = new ArrayList<Object>();
    for (OExpression expr : iParams) {
        paramValues.add(expr.execute((OIdentifiable) ctx.getVariable("$current"), ctx));
    }
    if (graphMethods.contains(name)) {
        OSQLFunction function = OSQLEngine.getInstance().getFunction(name);
        if (function instanceof OSQLFunctionFiltered) {
            return ((OSQLFunctionFiltered) function).execute(targetObjects, (OIdentifiable) ctx.getVariable("$current"), null, paramValues.toArray(), iPossibleResults, ctx);
        } else {
            return function.execute(targetObjects, (OIdentifiable) ctx.getVariable("$current"), null, paramValues.toArray(), ctx);
        }
    }
    OSQLMethod method = OSQLEngine.getMethod(name);
    if (method != null) {
        return method.execute(targetObjects, (OIdentifiable) ctx.getVariable("$current"), ctx, targetObjects, paramValues.toArray());
    }
    throw new UnsupportedOperationException("OMethod call, something missing in the implementation...?");
}
Also used : OSQLFunction(com.orientechnologies.orient.core.sql.functions.OSQLFunction) OIdentifiable(com.orientechnologies.orient.core.db.record.OIdentifiable) OSQLMethod(com.orientechnologies.orient.core.sql.method.OSQLMethod) OSQLFunctionFiltered(com.orientechnologies.orient.core.sql.functions.OSQLFunctionFiltered)

Aggregations

OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)1 OSQLFunction (com.orientechnologies.orient.core.sql.functions.OSQLFunction)1 OSQLFunctionFiltered (com.orientechnologies.orient.core.sql.functions.OSQLFunctionFiltered)1 OSQLMethod (com.orientechnologies.orient.core.sql.method.OSQLMethod)1