Package com.orientechnologies.orient.core.exception

Examples of com.orientechnologies.orient.core.exception.OQueryParsingException


    if (iName.charAt(0) == OStringSerializerHelper.PARAMETER_NAMED) {
      name = iName.substring(1);

      // CHECK THE PARAMETER NAME IS CORRECT
      if (!OStringSerializerHelper.isAlphanumeric(name)) {
        throw new OQueryParsingException("Parameter name '" + name + "' is invalid, only alphanumeric characters are allowed");
      }
    } else
      name = iName;

    final OSQLFilterItemParameter param = new OSQLFilterItemParameter(name);
View Full Code Here


          // _fieldValues.put(iPropertyName, newValue);
          return (RET) newValue;
        } catch (ParseException pe) {
          final String dateFormat = ((String) iValue).length() > config.dateFormat.length() ? config.dateTimeFormat
              : config.dateFormat;
          throw new OQueryParsingException("Error on conversion of date '" + iValue + "' using the format: " + dateFormat);
        }
      }
    }

    iValue = OType.convert(iValue, iType);
View Full Code Here

            final List<String> arguments;

            if (op.minArguments > 0) {
              arguments = OStringSerializerHelper.getParameters(part);
              if (arguments.size() < op.minArguments || arguments.size() > op.maxArguments)
                throw new OQueryParsingException(iQueryToParse.text, "Syntax error: field operator '" + op.keyword + "' needs "
                    + (op.minArguments == op.maxArguments ? op.minArguments : op.minArguments + "-" + op.maxArguments)
                    + " argument(s) while has been received " + arguments.size(), iQueryToParse.currentPos + separatorPos);
            } else
              arguments = null;

            // SPECIAL OPERATION FOUND: ADD IT IN TO THE CHAIN
            if (operationsChain == null)
              operationsChain = new ArrayList<OPair<Integer, List<String>>>();

            operationsChain.add(new OPair<Integer, List<String>>(op.id, arguments));

            separatorPos = partUpperCase.indexOf(OStringSerializerHelper.PARENTHESIS_END)
                + OSQLFilterFieldOperator.CHAIN_SEPARATOR.length();
            operatorFound = true;
            break;
          }

        if (!operatorFound) {
          separatorPos = partUpperCase.indexOf(OSQLFilterFieldOperator.CHAIN_SEPARATOR, 0);

          // CHECK IF IT'S A FIELD
          int posOpenBrace = part.indexOf('(');
          if (posOpenBrace == -1 || posOpenBrace > separatorPos && separatorPos > -1) {
            // YES, SEEMS A FIELD
            String chainedFieldName = separatorPos > -1 ? part.substring(0, separatorPos) : part;

            if (operationsChain == null)
              operationsChain = new ArrayList<OPair<Integer, List<String>>>();

            final List<String> list = new ArrayList<String>();
            list.add(chainedFieldName);
            if (chainedFieldName.charAt(0) == '@')
              operationsChain.add(new OPair<Integer, List<String>>(OSQLFilterFieldOperator.ATTRIB.id, list));
            else
              operationsChain.add(new OPair<Integer, List<String>>(OSQLFilterFieldOperator.FIELD.id, list));
          } else
            // ERROR: OPERATOR NOT FOUND OR MISPELLED
            throw new OQueryParsingException(iQueryToParse.text,
                "Syntax error: field operator not recognized between the supported ones: "
                    + Arrays.toString(OSQLFilterFieldOperator.OPERATORS), iQueryToParse.currentPos + separatorPos);
        }

        if (separatorPos >= partUpperCase.length())
View Full Code Here

    }

    try {
      return formatter.parse(stringValue);
    } catch (ParseException pe) {
      throw new OQueryParsingException("Error on conversion of date '" + stringValue + "' using the format: "
          + formatter.toString());
    }
  }
View Full Code Here

    else if (compiledFilter.getTargetIndex() != null)
      searchInIndex();
    else if (compiledFilter.getTargetRecords() != null)
      searchInRecords();
    else
      throw new OQueryParsingException("No source found in query: specify class, clusters or single records");

    applyOrderBy();
    applyFlatten();
    return processResult();
  }
View Full Code Here

  protected void extractOrderBy(final StringBuilder word) {
    int newPos = OSQLHelper.nextWord(text, textUpperCase, currentPos, word, true);

    if (!KEYWORD_BY.equals(word.toString()))
      throw new OQueryParsingException("Expected keyword " + KEYWORD_BY);

    currentPos = newPos;

    String fieldName;
    String fieldOrdering;
View Full Code Here

    if (!word.toString().equals(KEYWORD_SELECT))
      return -1;

    int fromPosition = textUpperCase.indexOf(KEYWORD_FROM, currentPos);
    if (fromPosition == -1)
      throw new OQueryParsingException("Missed " + KEYWORD_FROM, text, currentPos);

    Object projectionValue;
    final String projectionString = text.substring(currentPos, fromPosition).trim();
    if (projectionString.length() > 0 && !projectionString.equals("*")) {
      // EXTRACT PROJECTIONS
View Full Code Here

   * Delegates to the OQueryExecutor the query execution.
   */
  @SuppressWarnings("unchecked")
  public List<T> run(final Object... iArgs) {
    if (database == null)
      throw new OQueryParsingException("No database configured");

    setParameters(iArgs);
    return (List<T>) database.getStorage().command(this);
  }
View Full Code Here

          // _fieldValues.put(iPropertyName, newValue);
          return (RET) newValue;
        } catch (ParseException pe) {
          final String dateFormat = ((String) iValue).length() > config.dateFormat.length() ? config.dateTimeFormat
              : config.dateFormat;
          throw new OQueryParsingException("Error on conversion of date '" + iValue + "' using the format: " + dateFormat);
        }
      }
    }

    iValue = OType.convert(iValue, iType);
View Full Code Here

    return this;
  }

  public Object execute(final Map<Object, Object> iArgs) {
    if (!assignTarget(iArgs))
      throw new OQueryParsingException("No source found in query: specify class, cluster(s) or single record(s)");

    context = traverse.getContext();
    context.beginExecution(timeoutMs, timeoutStrategy);

    try {
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.exception.OQueryParsingException

Copyright © 2018 www.massapicom. 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.