Interface ParameterUsableInQuery

All Known Subinterfaces:
BooleanParameter, DateParameter, EnumParameter, IntegerParameter, StringParameter

public interface ParameterUsableInQuery
Since:
3.9.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value formated in such way that it can be used in Lucene query
    Returns the value formated in such way that it can be used in SQL query
  • Method Details

    • toLucene

      @NotNull String toLucene()
      Returns the value formated in such way that it can be used in Lucene query

      This method is called automatically when the parameter is used in the Lucene + Velocity in data set parameter, so you can use it like this: severity:$pageParameters.myEnumParameter

      For String parameter the value is escaped as described in: http://lucene.apache.org/core/3_6_1/queryparsersyntax.html#Escaping Special Characters But the * and ? are not escaped to allow wild card searches. If the value contains spaces it is surrounded by double quotes (")

      For enumeration parameter: @see EnumParameter.toLucene()

      For date parameter it returns the value in format yyyyMMdd

      For boolean parameter it returns true or false which works only for Polarion built in fields, so for custom fields it must be handled in different way. See how the "Query Bubbles" handle it in the Polarion UI.

      For empty or not specified parameter it returns "*" which works only for Polarion built in fields, so for custom fields it must be handled in different way. See how the "Query Bubbles" handle this situation in the Polarion UI.

    • toSql

      @NotNull String toSql()
      Returns the value formated in such way that it can be used in SQL query

      This method is called automatically when the parameter is used in the SQL + Velocity in data set parameter, so you can use it like this: ... WHERE ... = '$pageParameters.myEnumParameter'

      For String parameter the value is escaped by replacing every single quote (') with two single quotes, so it can be used in the WHERE clause in the SQL

      For enumeration parameter: @see EnumParameter.toSql()

      For date parameter it returns the value in format yyyy-MM-dd

      For boolean parameter it returns true or false

      For empty or not specified parameter it returns empty string