use of com.orientechnologies.orient.core.sql.functions.OSQLFunction in project orientdb by orientechnologies.
the class OFunctionCall method execute.
private Object execute(Object targetObjects, OCommandContext ctx, String name) {
List<Object> paramValues = new ArrayList<Object>();
OIdentifiable record = ctx == null ? null : (OIdentifiable) ctx.getVariable("$current");
if (record == null && targetObjects instanceof OIdentifiable) {
record = (OIdentifiable) targetObjects;
}
for (OExpression expr : this.params) {
paramValues.add(expr.execute(record, ctx));
}
OSQLFunction function = OSQLEngine.getInstance().getFunction(name);
if (function != null) {
return function.execute(targetObjects, record, null, paramValues.toArray(), ctx);
}
throw new UnsupportedOperationException("This expression is not currently supported: " + toString());
}
use of com.orientechnologies.orient.core.sql.functions.OSQLFunction 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...?");
}
Aggregations