Interface JqlQueryTransformer

All Known Implementing Classes:
DefaultJqlQueryTransformer

public interface JqlQueryTransformer
This transformer replaces fields names in JQL queries by their ids, and the other way around.
Since:
v8.15
  • Method Details

    • transformNamesToIds

      Query transformNamesToIds(Query query)
      Returns a Query object whose fields names are replaced by fields ids. Fields which will be transformed are Custom Fields and Issue Types. To generate a JQL string representation, use JqlStringSupport.generateJqlString(Query query) instead of Query.getQueryString().

      If the field's name in the query corresponds to more than one field, it will be replaced by all the corresponding IDs connected by an OR clause. For example, for the name 'Version' which is shared by custom fields {'cf[10000]', 'cf[10001]'}, the input query 'Version = 8.15' will result in the following output query: 'cf[10000] = 8.15 OR cf[10001] = 8.15'

      Parameters:
      query - a query to be transformed
      Returns:
      a transformed query with names replaced by ids
    • transformNamesToIds

      Query transformNamesToIds(String query) throws JqlParseException
      Returns a Query object whose fields names are replaced by fields ids. Fields which will be transformed are Custom Fields and Issue Types. To generate a JQL string representation, use JqlStringSupport.generateJqlString(Query query) instead of Query.getQueryString().

      If the field's name in the query corresponds to more than one field, it will be replaced by all the corresponding IDs connected by an OR clause. For example, for the name 'Version' which is shared by custom fields {'cf[10000]', 'cf[10001]'}, the input query 'Version = 8.15' will result in the following output query: 'cf[10000] = 8.15 OR cf[10001] = 8.15'

      Parameters:
      query - a string query to be transformed
      Returns:
      a transformed query with names replaced by ids
      Throws:
      JqlParseException - if an error occurs while parsing the query.
    • transformIdsToNames

      Query transformIdsToNames(Query query)
      Returns a Query object whose fields ids are replaced by fields names. If the name of a field is ambiguous the identifier won't be replaced.

      A name is ambiguous when two or more fields have the same name but different ids, for example, for fields whose name is 'Version' and ids are {'cf[10020]', 'cf[10030]'}, the input query 'cf[10020] = 8.13 OR cf[10030] = 8.16' will result in the same output query.

      Fields which will be transformed are Custom Fields and Issue Types. To generate a JQL string representation, use JqlStringSupport.generateJqlString(Query query) instead of Query.getQueryString().

      Parameters:
      query - a query to be transformed
      Returns:
      a transformed query with ids replaced by names
    • transformIdsToNames

      Query transformIdsToNames(String query) throws JqlParseException
      Returns a Query object whose fields ids are replaced by fields names. If the name of a field is ambiguous the identifier won't be replaced.

      A name is ambiguous when two or more fields have the same name but different ids, for example, for fields whose name is 'Version' and ids are {'cf[10020]', 'cf[10030]'}, the input query 'cf[10020] = 8.13 OR cf[10030] = 8.16' will result in the same output query.

      Fields which will be transformed are Custom Fields and Issue Types. To generate a JQL string representation, use JqlStringSupport.generateJqlString(Query query) instead of Query.getQueryString().

      Parameters:
      query - a string query to be transformed
      Returns:
      a transformed query with ids replaced by names
      Throws:
      JqlParseException - if an error occurs while parsing the query.