Examples of JPQLExpression


Examples of org.eclipse.persistence.jpa.jpql.parser.JPQLExpression

   * list if the JPQL query is invalid or incomplete
   */
  public List<ClassDescriptor> getClassDescriptors(CharSequence jpqlQuery, AbstractSession session) {

    // Parse the JPQL query
    JPQLExpression jpqlExpression = new JPQLExpression(jpqlQuery, jpqlGrammar, true);

    // Create the context and cache the information
    JPQLQueryContext queryContext = new JPQLQueryContext(jpqlGrammar);
    queryContext.cache(session, null, jpqlExpression, jpqlQuery);

    // Visit the JPQL query and collect the descriptors defined in the declaration clauses
    DescriptorCollector collector = new DescriptorCollector(queryContext);
    jpqlExpression.accept(collector);

    return new ArrayList<ClassDescriptor>(collector.descriptors);
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.JPQLExpression

   * setting the {@link IQuery}.
   */
  protected void initializeRoot() {

    if (jpqlExpression == null) {
      jpqlExpression = new JPQLExpression(query.getExpression(), jpqlGrammar, tolerant);
    }

    currentQuery = jpqlExpression;
    contexts.put(currentQuery, this);
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.JPQLExpression

   * list if the JPQL query is invalid or incomplete
   */
  public List<ClassDescriptor> getClassDescriptors(CharSequence jpqlQuery, AbstractSession session) {

    // Parse the JPQL query
    JPQLExpression jpqlExpression = new JPQLExpression(jpqlQuery, jpqlGrammar, true);

    // Create the context and cache the information
    JPQLQueryContext queryContext = new JPQLQueryContext(jpqlGrammar);
    queryContext.cache(session, null, jpqlExpression, jpqlQuery);

    // Visit the JPQL query and collect the descriptors defined in the declaration clauses
    DescriptorCollector collector = new DescriptorCollector(queryContext);
    jpqlExpression.accept(collector);

    return new ArrayList<ClassDescriptor>(collector.descriptors);
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.JPQLExpression

                                           String selectionCriteria,
                                           AbstractSession session) {

    try {
      // Create the parsed tree representation of the selection criteria
      JPQLExpression jpqlExpression = new JPQLExpression(
        selectionCriteria,
        DefaultEclipseLinkJPQLGrammar.instance(),
        ConditionalExpressionBNF.ID,
        isTolerant()
      );

      // Caches the info and add a virtual range variable declaration
      JPQLQueryContext queryContext = new JPQLQueryContext(jpqlGrammar());
      queryContext.cache(session, null, jpqlExpression, selectionCriteria);
      queryContext.addRangeVariableDeclaration(entityName, "this");

      // Validate the JPQL query, which will use the JPQL grammar matching the validation
      // level, for now, only validate the query statement because there could be an unknown
      // ending that is an order by clause
      validate(queryContext, jpqlExpression.getQueryStatement());

      // Create the Expression representing the selection criteria
      return queryContext.buildExpression(jpqlExpression.getQueryStatement());
    }
    catch (JPQLException exception) {
      throw exception;
    }
    catch (Exception exception) {
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.JPQLExpression

                                         DatabaseQuery query,
                                         AbstractSession session) {

    try {
      // Parse the JPQL query with the most recent JPQL grammar
      JPQLExpression jpqlExpression = new JPQLExpression(
        jpqlQuery,
        DefaultEclipseLinkJPQLGrammar.instance(),
        isTolerant()
      );

      // Create a context that caches the information contained in the JPQL query
      // (especially from the FROM clause)
      JPQLQueryContext queryContext = new JPQLQueryContext(jpqlGrammar());
      queryContext.cache(session, query, jpqlExpression, jpqlQuery);

      // Validate the JPQL query, which will use the JPQL grammar matching the validation level
      validate(queryContext, jpqlExpression);

      // Create the DatabaseQuery by visiting the parsed tree
      DatabaseQueryVisitor visitor = new DatabaseQueryVisitor(queryContext, jpqlQuery);
      jpqlExpression.accept(visitor);

      // Add the input parameter types to the DatabaseQuery
      if (query == null) {
        query = queryContext.getDatabaseQuery();
        addArguments(queryContext, query);
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.JPQLExpression

    sb.append(TRIM);
    sb.append(LEFT_PARENTHESIS);
    sb.append(jpqlFragment);
    sb.append(RIGHT_PARENTHESIS);

    JPQLExpression jpqlExpression = new JPQLExpression(
      sb,
      getGrammar(),
      FunctionsReturningStringsBNF.ID,
      true
    );

    TrimExpression trimExpression = (TrimExpression) jpqlExpression.getQueryStatement();
    setSpecification(trimExpression.getSpecification());
    parseTrimCharacter(trimExpression.getTrimCharacter().toParsedText());
    super.parse(trimExpression.getExpression().toParsedText());

    // The trim character is actually the string primary
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.JPQLExpression

   * @return The proposals that are valid choices for the given position
   * @since 2.5
   */
  public ContentAssistProposals buildProposals(int position, ContentAssistExtension extension) {

    JPQLExpression jpqlExpression = getJPQLExpression();

    QueryPosition queryPosition = jpqlExpression.buildPosition(
      getQueryExpression(),
      position
    );

    prepare(queryPosition, extension);
    jpqlExpression.accept(this);
    return proposals;
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.JPQLExpression

    return parameterTypeVisitor;
  }

  private JPQLExpression parse(String jpqlQuery) {
    return new JPQLExpression(jpqlQuery, jpqlGrammar);
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.JPQLExpression

   *
   * @return The root of the parsed tree
   */
  public JPQLExpression getExpression() {
    if (jpqlExpression == null) {
      jpqlExpression = new JPQLExpression(getJPQLFragment(), jpqlGrammar, isTolerant());
    }
    return jpqlExpression;
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.JPQLExpression

   * @return The proposals that are valid choices for the given position
   * @since 2.5
   */
  public ContentAssistProposals buildProposals(int position, ContentAssistProposalsHelper helper) {

    JPQLExpression jpqlExpression = getJPQLExpression();

    QueryPosition queryPosition = jpqlExpression.buildPosition(
      getQueryExpression(),
      position
    );

    prepare(queryPosition, helper);
    jpqlExpression.accept(this);
    return proposals;
  }
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.