Interface ContentAssistProposals

  • All Known Implementing Classes:
    DefaultContentAssistProposals

    public interface ContentAssistProposals
    This object stores the various proposals available for content assist for a certain position within a JPQL query. The proposals are stored in categories (abstract schema types, identifiers, identification variables and mappings).

    Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

    Version:
    2.5
    Author:
    Pascal Filion
    Since:
    2.3
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Iterable<IEntity> abstractSchemaTypes()
      Returns the collection of possible abstract schema types.
      ResultQuery buildEscapedQuery​(java.lang.String jpqlQuery, java.lang.String proposal, int position, boolean insert)
      Creates a new JPQL query by inserting the given proposal at the given position.
      ResultQuery buildQuery​(java.lang.String jpqlQuery, java.lang.String proposal, int position, boolean insert)
      Creates a new JPQL query by inserting the given proposal at the given position.
      ResultQuery buildXmlQuery​(java.lang.String jpqlQuery, java.lang.String proposal, int position, boolean insert)
      Creates a new JPQL query by inserting the given proposal at the given position.
      java.lang.Iterable<java.lang.String> classNames()
      Returns the filtered list of possible class names.
      java.lang.Iterable<java.lang.String> columnNames()
      Returns the filtered list of possible column names.
      java.lang.Iterable<ContentAssistProposals.EnumProposals> enumConstant()
      Returns the filtered list of possible enum constant names.
      IEntity getAbstractSchemaType​(java.lang.String identificationVariable)
      Retrieves the abstract schema type that is mapped with the given identification variable.
      ContentAssistProposals.ClassType getClassType()  
      IdentifierRole getIdentifierRole​(java.lang.String identifier)
      Returns the role of the given JPQL identifier.
      boolean hasProposals()
      Determines whether there is at least one proposals.
      java.lang.Iterable<java.lang.String> identificationVariables()
      Returns the collection of possible identification variables.
      java.lang.Iterable<java.lang.String> identifiers()
      Returns the collection of possible JPQL identifiers.
      java.lang.Iterable<IMapping> mappings()
      Returns the collection of possible mappings, which can be state fields, association fields and/or collection fields depending on the location used to retrieve the possible proposals.
      java.lang.Iterable<java.lang.String> tableNames()
      Returns the filtered list of possible table names.
    • Method Detail

      • abstractSchemaTypes

        java.lang.Iterable<IEntity> abstractSchemaTypes()
        Returns the collection of possible abstract schema types.
        Returns:
        The entities defined in the persistence context
      • buildEscapedQuery

        ResultQuery buildEscapedQuery​(java.lang.String jpqlQuery,
                                      java.lang.String proposal,
                                      int position,
                                      boolean insert)
        Creates a new JPQL query by inserting the given proposal at the given position. The updated JPQL query and position will be adjusted by converting some characters into their corresponding escaped characters, for instance '\r' will be converted to '\\r.

        The replacement will also handle compound JPQL identifiers when updating the JPQL query.

        Example: If the cursor is within "IS NOT N|" and the proposal is "IS NOT NULL", then "IS NOT" will not be added twice. If the word to replace is "IS NULL" and the proposal is "IS NOT NULL", then "NOT" will be inserted between "IS" and "NULL".

        Parameters:
        jpqlQuery - The JPQL query to modify with the given proposal
        proposal - The proposal to insert into the query
        position - The position of insertion
        insert - Flag that determines if the partial word following the cursor should be left intact or should be replaced by the proposal
        Returns:
        The result of inserting the proposal into the query, including the adjust position, if it was required
      • buildQuery

        ResultQuery buildQuery​(java.lang.String jpqlQuery,
                               java.lang.String proposal,
                               int position,
                               boolean insert)
        Creates a new JPQL query by inserting the given proposal at the given position.

        The replacement will also handle compound JPQL identifiers when updating the JPQL query.

        Example: If the cursor is within "IS NOT N|" and the proposal is "IS NOT NULL", then "IS NOT" will not be added twice. If the word to replace is "IS NULL" and the proposal is "IS NOT NULL", then "NOT" will be inserted between "IS" and "NULL".

        Parameters:
        jpqlQuery - The JPQL query to modify with the given proposal
        proposal - The proposal to insert into the query
        position - The position of insertion
        insert - Flag that determines if the partial word following the cursor should be left intact or should be replaced by the proposal
        Returns:
        The result of inserting the proposal into the query, including the adjust position, if it was required
      • buildXmlQuery

        ResultQuery buildXmlQuery​(java.lang.String jpqlQuery,
                                  java.lang.String proposal,
                                  int position,
                                  boolean insert)
        Creates a new JPQL query by inserting the given proposal at the given position. The updated JPQL query and position will be adjusted by converting some characters into their corresponding escaped characters, for instance '>' will be converted to '&gt;'.

        The replacement will also handle compound JPQL identifiers when updating the JPQL query.

        Example: If the cursor is within "IS NOT N|" and the proposal is "IS NOT NULL", then "IS NOT" will not be added twice. If the word to replace is "IS NULL" and the proposal is "IS NOT NULL", then "NOT" will be inserted between "IS" and "NULL".

        Parameters:
        jpqlQuery - The JPQL query to modify with the given proposal, which should be the non- converted string, i.e. any escaped characters should not be converted
        proposal - The proposal to insert into the query
        position - The position of insertion, which was derived from the parsed tree representation of the JPQL query
        insert - Flag that determines if the partial word following the cursor should be left intact or should be replaced by the proposal
        Returns:
        The result of inserting the proposal into the query, including the adjust position, if it was required
        Since:
        2.5
      • classNames

        java.lang.Iterable<java.lang.String> classNames()
        Returns the filtered list of possible class names. This is usually available when the cursor is within the constructor name of the constructor expression.
        Returns:
        The filtered list of possible class names
        See Also:
        ConstructorExpression
        Since:
        2.5
      • columnNames

        java.lang.Iterable<java.lang.String> columnNames()
        Returns the filtered list of possible column names.
        Returns:
        The filtered list of possible column names
        Since:
        2.5
      • enumConstant

        java.lang.Iterable<ContentAssistProposals.EnumProposals> enumConstant()
        Returns the filtered list of possible enum constant names. This is usually available when the cursor is after the dot separating a fully qualified enum type and the enum constant.
        Returns:
        The filtered list of possible enum constant names associated with its enum type
        Since:
        2.5
      • getAbstractSchemaType

        IEntity getAbstractSchemaType​(java.lang.String identificationVariable)
        Retrieves the abstract schema type that is mapped with the given identification variable.
        Parameters:
        identificationVariable - The identification variable that, if defined as a range variable, will be mapped to a managed type
        Returns:
        The abstract schema type mapped with the given identification variable or null if the given variable is mapped to something else or not mapped to anything
      • getIdentifierRole

        IdentifierRole getIdentifierRole​(java.lang.String identifier)
        Returns the role of the given JPQL identifier.
        Parameters:
        identifier - The JPQL identifier to retrieve its role
        Returns:
        The IdentifierRole for the given JPQL identifier or null if no role was defined or if the given string is not a valid JPQL identifier
        Since:
        2.4
      • hasProposals

        boolean hasProposals()
        Determines whether there is at least one proposals.
        Returns:
        true if there is at least one proposal; otherwise false
      • identificationVariables

        java.lang.Iterable<java.lang.String> identificationVariables()
        Returns the collection of possible identification variables.
        Returns:
        The list of possible identification variables
      • identifiers

        java.lang.Iterable<java.lang.String> identifiers()
        Returns the collection of possible JPQL identifiers.
        Returns:
        The list of possible JPQL identifiers
      • mappings

        java.lang.Iterable<IMapping> mappings()
        Returns the collection of possible mappings, which can be state fields, association fields and/or collection fields depending on the location used to retrieve the possible proposals.
        Returns:
        The list of possible proposals mappings
      • tableNames

        java.lang.Iterable<java.lang.String> tableNames()
        Returns the filtered list of possible table names.
        Returns:
        The filtered list of possible table names
        Since:
        2.5