com.atlassian.jira.jql.builder
Class JqlQueryBuilder

java.lang.Object
  extended by com.atlassian.jira.jql.builder.JqlQueryBuilder

@NotThreadSafe
public class JqlQueryBuilder
extends Object

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.

Since:
v4.0
See Also:
JqlClauseBuilder, JqlOrderByBuilder

Method Summary
 Query buildQuery()
          This will find the root of the clause tree and build a Query whos where clause will return the generated clause and Order By clause will return the generated search order.
 JqlQueryBuilder clear()
          Reset the builder to its empty state.
static JqlQueryBuilder newBuilder()
           
static JqlQueryBuilder newBuilder(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 JqlClauseBuilder newClauseBuilder()
          Build a new JqlClauseBuilder.
static JqlClauseBuilder newClauseBuilder(Clause copy)
          Build a new JqlClauseBuilder and initialise it with the passed clause.
static JqlClauseBuilder newClauseBuilder(Query query)
          Build a new JqlClauseBuilder and initialise it with the clause from the passed query.
static JqlOrderByBuilder newOrderByBuilder()
          Build a new JqlOrderByBuilder.
static JqlOrderByBuilder newOrderByBuilder(OrderBy copy)
          Build a new JqlOrderByBuilder and initialise it with the passed order.
static JqlOrderByBuilder newOrderByBuilder(Query query)
          Build a new JqlOrderByBuilder and initialise it with the order from the passed query.
 JqlOrderByBuilder orderBy()
          Creates an JqlOrderByBuilder that can be used to modify the order by statements of the JqlQueryBuilder instance.
 JqlClauseBuilder where()
          Creates an JqlClauseBuilder which is used to modify the where clause portion of the JqlQueryBuilder instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newBuilder

@NotNull
public static JqlQueryBuilder newBuilder()
Returns:
a new builder that can be used to build a JQL query.

newBuilder

@NotNull
public static JqlQueryBuilder newBuilder(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.

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

@NotNull
public static JqlClauseBuilder newClauseBuilder()
Build a new JqlClauseBuilder. The returned builder will have no associated JqlQueryBuilder.

Returns:
the new clause builder.

newClauseBuilder

@NotNull
public static JqlClauseBuilder newClauseBuilder(Clause copy)
Build a new JqlClauseBuilder and initialise it with the passed clause. The returned builder will have no associated JqlQueryBuilder.

Parameters:
copy - the claue to add to the new builder. Can be null.
Returns:
the new clause builder.

newClauseBuilder

@NotNull
public static JqlClauseBuilder newClauseBuilder(Query query)
Build a new JqlClauseBuilder and initialise it with the clause from the passed query. The returned builder will have no associated JqlQueryBuilder.

Parameters:
query - the query whose where clause will be copied into the new builder. Can be null.
Returns:
the new clause builder.

newOrderByBuilder

@NotNull
public static JqlOrderByBuilder newOrderByBuilder()
Build a new JqlOrderByBuilder. The returned builder will have no associated JqlQueryBuilder.

Returns:
the new clause builder.

newOrderByBuilder

@NotNull
public static JqlOrderByBuilder newOrderByBuilder(OrderBy copy)
Build a new JqlOrderByBuilder and initialise it with the passed order. The returned builder will have no associated JqlQueryBuilder.

Parameters:
copy - the order to copy. Can be null.
Returns:
the new clause builder.

newOrderByBuilder

@NotNull
public static JqlOrderByBuilder newOrderByBuilder(Query query)
Build a new JqlOrderByBuilder and initialise it with the order from the passed query. The returned builder will have no associated JqlQueryBuilder.

Parameters:
query - the query whose order will be copied into the new builder. Can be null.
Returns:
the new clause builder.

orderBy

@NotNull
public JqlOrderByBuilder orderBy()
Creates an JqlOrderByBuilder that can be used to modify the order by statements of the JqlQueryBuilder instance.

Returns:
an OrderBy builder associated with the JqlQueryBuilder instance.

where

@NotNull
public JqlClauseBuilder where()
Creates an JqlClauseBuilder which is used to modify the where clause portion of the JqlQueryBuilder instance.

Returns:
a WhereClause builder associated with the JqlQueryBuilder instance.

buildQuery

@NotNull
public Query buildQuery()
This will find the root of the clause tree and build a Query whos 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

public JqlQueryBuilder clear()
Reset the builder to its empty state.

Returns:
this builder with its state cleared.


Copyright © 2002-2013 Atlassian. All Rights Reserved.