Interface StructureQueryBuilder.BasicConstraintStep<B extends StructureQueryBuilder<B>>
- All Known Implementing Classes:
StructureQueryBuilder.StartStep
- Enclosing class:
- StructureQueryBuilder<B extends StructureQueryBuilder<B>>
This class allows to specify a basic constraint, either on its own, or as the last step of building a
relational constraint.
A basic constraint is a simply a constraint on rows; it does not involve its relatives, as relation
constraint does. For examples, see queries q1 and q2 in the class documentation.
Note that a relational constraint, or even a Boolean combination thereof, can behave as a
basic constraint if taken into parentheses; this is useful if you are building a relation
constraint, and you need to have a complex constraint in place of basicConstraint. Examples
of it are queries q9 and q10 in the class documentation.
-
Method Summary
Modifier and TypeMethodDescriptionall()Matches all rows.constraint(String name, Iterable<String> arguments) constraint(String name, String... arguments) Matches rows using a custom constraint specified by its name, supplying it with the specified arguments.empty()Matches no rows.issueId(long issueId) issueIds(long... issueIds) issueIds(LongList issueIds) Matches the specified issues.jql(Query query) Matches issues that satisfy the specified JQL query.leaf()Matches rows at the bottom level of the hierarchy.query(StructureQuery query) Matches all rows that match the specified Structure query.root()Matches rows at the top level of the hierarchy.sub()This method starts a new constraint, remembering the currently built constraint.
-
Method Details
-
jql
Matches issues that satisfy the specified JQL query. It is also referred to as "nested JQL constraint."- Parameters:
query- a JQL query; ifnull, matches all issues in the forest.
-
issueKey
-
issueKeys
-
issueKeys
-
issueId
-
issueIds
-
issueIds
-
issues
Matches the specified issues. If any of the specified issues is present several times in the forest, all entries are matched.If both parameters are
nullor both are empty, matches no issues. -
leaf
B leaf()Matches rows at the bottom level of the hierarchy. Put otherwise, matches rows that do not have sub-rows. -
root
B root()Matches rows at the top level of the hierarchy. Put otherwise, matches rows that do not have a parent. -
empty
B empty()Matches no rows.
This basic condition is useful for
relational constraints:relation.operator.empty()matches all rows that do not have corresponding relatives. For example: -
all
B all()Matches all rows. Equivalent ofnot().empty(). -
constraint
Matches rows using a custom constraint specified by its name, supplying it with the specified arguments.
Structure plugin comes bundled with a few constraints, see the list in S-JQL documentation. Constraints can also be added by other plugins by the means of implementing
StructureQueryConstraint.See also query q13 in the examples section in the class documentation.
- Parameters:
name- constraint name - should be either a name of the bundled constraint or, in case of a custom constraint provided via a plugin, correspond tofnameattribute of<structure-query-constraint>module inatlassian-plugin.xmlarguments- constraint arguments. Both the list and all of its elements must not benull, otherwiseNullPointerExceptionis thrown- Throws:
NullPointerException- if name, arguments, or any of the arguments list elements isnull- See Also:
-
constraint
- See Also:
-
sub
This method starts a new constraint, remembering the currently built constraint. When you finish building the new constraint, call
StructureQueryBuilder.Sub.endsub(), and the new constraint will be attached to this builder as if it were a basic constraint. This is a programmatic equivalent of taking an expression into parentheses: this method "opens" a new pair of parentheses.There are several cases when you would want to use this method:
- overriding default precedence of Boolean operators AND and OR (for an example, see query q11 in the
class documentation); - using a complex constraint (a relational constraint, or a Boolean combination thereof) in place of
basicConstraintin arelational constraint. For examples, see queries q9 and q10 in theclass documentation.
- overriding default precedence of Boolean operators AND and OR (for an example, see query q11 in the
-
query
Matches all rows that match the specified Structure query. Note that only those instances ofStructureQuerythat have originated from this API will work; any other implementation ofStructureQuerywill not be recognized, and this constraint will be equivalent toall().- Parameters:
query- Structure query obtained either fromStructureQueryBuilderorStructureQueryParser.
-