Package com.atlassian.jira.jql.builder
Class JqlQueryBuilder
java.lang.Object
com.atlassian.jira.jql.builder.JqlQueryBuilder
Used to build
Query's that can be used to perform issue searching in JIRA.
This gives you access to a JqlClauseBuilder which can be used to build up the
where clause of the JQL and also a JqlOrderByBuilder which can be used to build
up the order by clause of the JQL.
This object can also be used as a factory for JqlClauseBuilder and
JqlOrderByBuilder instances.
Note that the results of an empty query may vary depending on
application property flag.
If this flag is set to true, then no result will be returned instead of returning all existing items.invalid reference
com.atlassian.jira.config.properties.APKeys.JIRA_EMPTY_JQL_RETURNS_NO_DATA_ENABLED
- Since:
- v4.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionThis will find the root of the clause tree and build aQuerywhos where clause will return the generated clause and Order By clause will return the generated search order.clear()Reset the builder to its empty state.static JqlQueryBuilderstatic JqlQueryBuildernewBuilder(Query existingQuery) Creates a new builder that clones the state of the passed in query so that you can use the resulting builder to create a slightly modified query.static JqlClauseBuilderBuild a newJqlClauseBuilder.static JqlClauseBuildernewClauseBuilder(Clause copy) Build a newJqlClauseBuilderand initialise it with the passed clause.static JqlClauseBuildernewClauseBuilder(Query query) Build a newJqlClauseBuilderand initialise it with the clause from the passed query.static JqlOrderByBuilderBuild a newJqlOrderByBuilder.static JqlOrderByBuildernewOrderByBuilder(OrderBy copy) Build a newJqlOrderByBuilderand initialise it with the passed order.static JqlOrderByBuildernewOrderByBuilder(Query query) Build a newJqlOrderByBuilderand initialise it with the order from the passed query.orderBy()Creates anJqlOrderByBuilderthat can be used to modify the order by statements of theJqlQueryBuilderinstance.where()Creates anJqlClauseBuilderwhich is used to modify the where clause portion of theJqlQueryBuilderinstance.
-
Method Details
-
newBuilder
- Returns:
- a new builder that can be used to build a JQL query.
-
newBuilder
Creates a new builder that clones the state of the passed in query so that you can use the resulting builder to create a slightly modified query.- Parameters:
existingQuery- the template to clone, both the where clause and order by clause will be cloned.- Returns:
- a new builder that clones the state of the passed in query.
-
newClauseBuilder
Build a newJqlClauseBuilder. The returned builder will have no associatedJqlQueryBuilder.- Returns:
- the new clause builder.
-
newClauseBuilder
Build a newJqlClauseBuilderand initialise it with the passed clause. The returned builder will have no associatedJqlQueryBuilder.- Parameters:
copy- the claue to add to the new builder. Can be null.- Returns:
- the new clause builder.
-
newClauseBuilder
Build a newJqlClauseBuilderand initialise it with the clause from the passed query. The returned builder will have no associatedJqlQueryBuilder.- Parameters:
query- the query whose where clause will be copied into the new builder. Can be null.- Returns:
- the new clause builder.
-
newOrderByBuilder
Build a newJqlOrderByBuilder. The returned builder will have no associatedJqlQueryBuilder.- Returns:
- the new clause builder.
-
newOrderByBuilder
Build a newJqlOrderByBuilderand initialise it with the passed order. The returned builder will have no associatedJqlQueryBuilder.- Parameters:
copy- the order to copy. Can be null.- Returns:
- the new clause builder.
-
newOrderByBuilder
Build a newJqlOrderByBuilderand initialise it with the order from the passed query. The returned builder will have no associatedJqlQueryBuilder.- Parameters:
query- the query whose order will be copied into the new builder. Can be null.- Returns:
- the new clause builder.
-
orderBy
Creates anJqlOrderByBuilderthat can be used to modify the order by statements of theJqlQueryBuilderinstance.- Returns:
- an OrderBy builder associated with the
JqlQueryBuilderinstance.
-
where
Creates anJqlClauseBuilderwhich is used to modify the where clause portion of theJqlQueryBuilderinstance.- Returns:
- a WhereClause builder associated with the
JqlQueryBuilderinstance.
-
buildQuery
This will find the root of the clause tree and build aQuerywhos where clause will return the generated clause and Order By clause will return the generated search order.NOTE: Calling this method does not change the state of the builder, there are no limitations on the number of times this method can be invoked.
- Returns:
- a Query whos where clause contains the built clauses and search order contains the built OrderBy clauses.
-
clear
Reset the builder to its empty state.- Returns:
- this builder with its state cleared.
-