/** * Initiate jpql object. * * @param jpaQuery * the jpa query */ private void initiateJPQLObject(final String jpaQuery) { JPQLGrammar jpqlGrammar = EclipseLinkJPQLGrammar2_4.instance(); this.jpqlExpression = new JPQLExpression(jpaQuery, jpqlGrammar, "ql_statement", true); setKunderaQueryTypeObject(); }
/** * Parses the given JPQL fragment with tolerant mode turned on. * * @param jpqFragment The string representation of the portion of a JPQL query to parse * @param jpqlGrammar The JPQL grammar that defines how to parse a JPQL query * @param queryBNFId The unique identifier of the {@link JPQLQueryBNF} * @return The root of the parsed tree representation of the JPQL fragment */ protected JPQLExpression parse(CharSequence jpqFragment, JPQLGrammar jpqlGrammar, String queryBNFId) { return new JPQLExpression(jpqFragment, jpqlGrammar, queryBNFId, true); }
/** * Parses the given JPQL query with tolerant mode turned on. * * @param jpqlQuery The string representation of the JPQL query to parse * @param jpqlGrammar The JPQL grammar that defines how to parse a JPQL query * @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); }
private JPQLExpression parse(String jpqlQuery) { return new JPQLExpression(jpqlQuery, jpqlGrammar); }
private JPQLExpression parse(String jpqlQuery) { return new JPQLExpression(jpqlQuery, jpqlGrammar); }
/** * Initializes the parsed tree representation of the JPQL query if it has not been set before * setting the {@link IQuery}. */ protected void initializeRoot() { if (jpqlExpression == null) { jpqlExpression = new JPQLExpression(query.getExpression(), jpqlGrammar, tolerant); } currentQuery = jpqlExpression; contexts.put(currentQuery, this); }
/** * Returns the parsed tree representation of the JPQL query. * * @return The root of the parsed tree */ public JPQLExpression getExpression() { if (jpqlExpression == null) { jpqlExpression = new JPQLExpression(getJPQLFragment(), jpqlGrammar, isTolerant()); } return jpqlExpression; }
/** * Retrieves the list of {@link ClassDescriptor descriptors} corresponding to the entities used * throughout the given JPQL query. * * @param jpqlQuery The JPQL query used to gather the descriptors defined in the declaration clause * @param session The {@link AbstractSession} is used to retrieve the descriptors * @return The list of {@link ClassDescriptors descriptors} used in the JPQL query or an empty * 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); }
/** * Retrieves the list of {@link ClassDescriptor descriptors} corresponding to the entities used * throughout the given JPQL query. * * @param jpqlQuery The JPQL query used to gather the descriptors defined in the declaration clause * @param session The {@link AbstractSession} is used to retrieve the descriptors * @return The list of {@link ClassDescriptors descriptors} used in the JPQL query or an empty * 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); }
/** * {@inheritDoc} */ @Override public void parse(String jpqlFragment) { StringBuilder sb = new StringBuilder(); 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 if (!hasStateObject() && hasTrimCharacter()) { setStateObject(new StringLiteralStateObject(this, trimCharacter.toString())); trimCharacter = null; } }
JPQLExpression jpqlExpression = new JPQLExpression( jpqlQuery, DefaultEclipseLinkJPQLGrammar.instance(),
JPQLExpression jpqlExpression = new JPQLExpression( jpqlQuery, DefaultEclipseLinkJPQLGrammar.instance(),
JPQLExpression jpqlExpression = new JPQLExpression( selectionCriteria, DefaultEclipseLinkJPQLGrammar.instance(),
JPQLExpression jpqlExpression = new JPQLExpression( selectionCriteria, DefaultEclipseLinkJPQLGrammar.instance(),