Package org.eclipse.persistence.jpa.jpql.parser

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


   * @param position The position of the cursor within the JPQL query
   * @return The proposals that are valid choices for the given position
   */
  public ContentAssistProposals buildProposals(int position) {

    JPQLExpression jpqlExpression = getJPQLExpression();

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

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


                                               CharSequence jpqlQuery,
                                               String queryBNFId,
                                               boolean tolerant) {

    // First parse the JPQL query
    JPQLExpression jpqlExpression = parse(jpqlQuery, getGrammar(), tolerant);

    // Now visit the parsed expression and create the state object hierarchy
    BasicStateObjectBuilder builder = getStateObjectBuilder();

    try {
      builder.jpqlQueryBuilder    = this;
      builder.managedTypeProvider = provider;

      jpqlExpression.accept(wrap(builder));

      return builder.parent;
    }
    finally {
      builder.jpqlQueryBuilder    = null;
View Full Code Here

  public StateObject buildStateObject(StateObject parent,
                                      CharSequence jpqlFragment,
                                      String queryBNFId) {

    // First parse the JPQL fragment
    JPQLExpression jpqlExpression = parse(jpqlFragment, parent.getGrammar(), queryBNFId);

    // We keep track of the old stuff because during the creation of a JPQLQueryStateObject,
    // it is possible the state model uses this builder to create some objects
    BasicStateObjectBuilder builder  = getStateObjectBuilder();
    IJPQLQueryBuilder oldBuilder     = builder.jpqlQueryBuilder;
    IManagedTypeProvider oldProvider = builder.managedTypeProvider;
    JPQLQueryStateObject oldParent   = builder.parent;
    StateObject oldStateObject       = builder.stateObject;

    try {
      builder.jpqlQueryBuilder    = this;
      builder.managedTypeProvider = parent.getManagedTypeProvider();
      builder.parent              = parent.getRoot();
      builder.stateObject         = parent;

      // Visit the Expression for which a StateObject is needed
      jpqlExpression.getQueryStatement().accept(wrap(builder));

      return builder.stateObject;
    }
    finally {
      builder.jpqlQueryBuilder    = oldBuilder;
View Full Code Here

   * @param tolerant Determines if the parsing system should be tolerant, meaning if it should try
   * to parse invalid or incomplete queries
   * @return The root of the parsed tree representation of the JPQL query
   */
  protected JPQLExpression parse(CharSequence jpqlQuery, JPQLGrammar jpqlGrammar, boolean tolerant) {
    return new JPQLExpression(jpqlQuery, jpqlGrammar, tolerant);
  }
View Full Code Here

   */
  protected JPQLExpression parse(CharSequence jpqFragment,
                                 JPQLGrammar jpqlGrammar,
                                 String queryBNFId) {

    return new JPQLExpression(jpqFragment, jpqlGrammar, queryBNFId, true);
  }
View Full Code Here

   */
  public ContentAssistProposals buildProposals(int position, ContentAssistExtension extension) {

    try {

      JPQLExpression jpqlExpression = queryContext.getJPQLExpression();
      String jpqlQuery = queryContext.getJPQLQuery();

      // Calculate the position of the cursor within the parsed tree
      queryPosition = jpqlExpression.buildPosition(jpqlQuery, position);

      // Retrieve the word from the JPQL query (which is the text before the position of the cursor)
      wordParser = new WordParser(jpqlQuery);
      wordParser.setPosition(position);
      word = wordParser.partialWord();
View Full Code Here

   *
   * @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

   * 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

TOP

Related Classes of org.eclipse.persistence.jpa.jpql.parser.JPQLExpression

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.