Examples of OSQLFunctionRuntime


Examples of com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime

  public static final String  NAME = "function";
  private OSQLFunctionRuntime func;

  public OSQLMethodFunctionDelegate(final OSQLFunction f) {
    super(NAME);
    func = new OSQLFunctionRuntime(f);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime

    if (beginParenthesis > -1 && (separator == -1 || separator > beginParenthesis)) {
      final int endParenthesis = iWord.indexOf(OStringSerializerHelper.EMBEDDED_END, beginParenthesis);

      if (endParenthesis > -1 && Character.isLetter(iWord.charAt(0)))
        // FUNCTION: CREATE A RUN-TIME CONTAINER FOR IT TO SAVE THE PARAMETERS
        return new OSQLFunctionRuntime(iCommand, iWord);
    }

    return null;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime

                 // MERGE AGGREGATED FIELDS
                 for (Map.Entry<String, Object> p : proj.entrySet()) {
                   if (p.getValue() instanceof OSQLFunctionRuntime) {
                     // MERGE RESULTS
                     final OSQLFunctionRuntime f = (OSQLFunctionRuntime) p.getValue();

                     toMerge.clear();
                     for (Map.Entry<String, Object> entry : ((Map<String, Object>) result).entrySet()) {
                       final List<Object> resultSet = (List<Object>) entry.getValue();

                       for (Object r : resultSet) {
                         if (r instanceof ODocument) {
                           final ODocument d = (ODocument) r;
                           toMerge.add(d.rawField(p.getKey()));
                         }
                       }

                     }

                     // WRITE THE FINAL MERGED RESULT
                     doc.field(p.getKey(), f.getFunction().mergeDistributedResult(toMerge));
                   }
                 }

                 result = list;
               } else {
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime

      // NESTED CONDITION: EVALUATE IT RECURSIVELY
      return ((OSQLFilterCondition) iValue).evaluate(iCurrentRecord, iCurrentResult, iContext);

    if (iValue instanceof OSQLFunctionRuntime) {
      // STATELESS FUNCTION: EXECUTE IT
      final OSQLFunctionRuntime f = (OSQLFunctionRuntime) iValue;
      return f.execute(iCurrentRecord, iCurrentRecord, iCurrentResult, iContext);
    }

    final Iterable<?> multiValue = OMultiValue.getMultiValueIterable(iValue);

    if (multiValue != null) {
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime

          // RETURN A VARIABLE FROM THE CONTEXT
          projectionValue = ((OSQLFilterItemVariable) v).getValue(inputDocument, iValue, iContext);
        } else if (v instanceof OSQLFilterItemField)
          projectionValue = ((OSQLFilterItemField) v).getValue(inputDocument, iValue, iContext);
        else if (v instanceof OSQLFunctionRuntime) {
          final OSQLFunctionRuntime f = (OSQLFunctionRuntime) v;
          projectionValue = f.execute(inputDocument, inputDocument, iValue, iContext);
        } else
          projectionValue = v;

        if (projectionValue != null)
          if (projectionValue instanceof ORidBag)
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime

      for (Entry<String, Object> projection : iProjections.entrySet()) {
        if (!iValue.containsField(projection.getKey())) {
          // ONLY IF NOT ALREADY CONTAINS A VALUE, OTHERWISE HAS BEEN SET MANUALLY (INDEX?)
          final Object v = projection.getValue();
          if (v instanceof OSQLFunctionRuntime) {
            final OSQLFunctionRuntime f = (OSQLFunctionRuntime) v;
            canExcludeResult = f.filterResult();

            Object fieldValue = f.getResult();

            if (fieldValue != null)
              iValue.field(projection.getKey(), fieldValue);
          }
        }
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime

          subQuery.resetPagination();
          subQuery.getContext().setParent(context);
          subQuery.getContext().setVariable("current", iRecord);
          varValue = ODatabaseRecordThreadLocal.INSTANCE.get().query(subQuery);
        } else if (letValue instanceof OSQLFunctionRuntime) {
          final OSQLFunctionRuntime f = (OSQLFunctionRuntime) letValue;
          if (f.getFunction().aggregateResults()) {
            f.execute(iRecord, iRecord, null, context);
            varValue = f.getFunction().getResult();
          } else
            varValue = f.execute(iRecord, iRecord, null, context);
        } else if (letValue instanceof String)
          varValue = ODocumentHelper.getFieldValue(iRecord, ((String) letValue).trim(), context);
        else
          varValue = letValue;
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime

      try {

        final Map.Entry<String, Object> entry = projections.entrySet().iterator().next();

        if (entry.getValue() instanceof OSQLFunctionRuntime) {
          final OSQLFunctionRuntime rf = (OSQLFunctionRuntime) entry.getValue();
          if (rf.function instanceof OSQLFunctionCount && rf.configuredParameters.length == 1
              && "*".equals(rf.configuredParameters[0])) {
            long count = 0;

            if (parsedTarget.getTargetClasses() != null) {
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime

    final Object projection = projections.values().iterator().next();
    if (!(projection instanceof OSQLFunctionRuntime))
      return false;

    final OSQLFunctionRuntime f = (OSQLFunctionRuntime) projection;
    return f.getRoot().equals(OSQLFunctionCount.NAME)
        && ((f.configuredParameters == null || f.configuredParameters.length == 0) || (f.configuredParameters.length == 1 && f.configuredParameters[0]
            .equals("*")));
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime

    final Object projection = projections.values().iterator().next();
    if (!(projection instanceof OSQLFunctionRuntime))
      return false;

    final OSQLFunctionRuntime f = (OSQLFunctionRuntime) projection;
    if (!f.getRoot().equals(OSQLFunctionCount.NAME))
      return false;

    if (!(f.configuredParameters != null && f.configuredParameters.length == 1 && f.configuredParameters[0] instanceof OSQLFunctionRuntime))
      return false;

    final OSQLFunctionRuntime fConfigured = (OSQLFunctionRuntime) f.configuredParameters[0];
    if (!fConfigured.getRoot().equals(OSQLFunctionDistinct.NAME))
      return false;

    if (!(fConfigured.configuredParameters != null && fConfigured.configuredParameters.length == 1 && fConfigured.configuredParameters[0] instanceof OSQLFilterItemField))
      return false;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.