Interface StructureQueryBuilder.BasicConstraintStep<B extends StructureQueryBuilder<B>>

All Known Implementing Classes:
StructureQueryBuilder.StartStep
Enclosing class:
StructureQueryBuilder<B extends StructureQueryBuilder<B>>

public static interface StructureQueryBuilder.BasicConstraintStep<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 Details

    • jql

      B jql(@Nullable Query query)
      Matches issues that satisfy the specified JQL query. It is also referred to as "nested JQL constraint."
      Parameters:
      query - a JQL query; if null, matches all issues in the forest.
    • issueKey

      B issueKey(@NotNull String issueKey)
      See Also:
    • issueKeys

      B issueKeys(@NotNull Iterable<String> issueKeys)
      See Also:
    • issueKeys

      B issueKeys(@NotNull String... issueKeys)
      See Also:
    • issueId

      B issueId(long issueId)
      See Also:
    • issueIds

      B issueIds(@NotNull LongList issueIds)
      See Also:
    • issueIds

      B issueIds(@NotNull long... issueIds)
      See Also:
    • issues

      B issues(@Nullable Iterable<String> issueKeys, @Nullable LongList issueIds)
      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 null or 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:

      • child.is.empty() matches all rows that have no sub-rows (equivalent of leaf());
      • child.isNot.empty() matches all rows that have at least one sub-row (equivalent of not().leaf());
      • child.of.empty() matches all rows that are not sub-rows of any row (equivalent of root()).
    • all

      B all()
      Matches all rows. Equivalent of not().empty().
    • constraint

      B constraint(@NotNull String name, @NotNull String... arguments)

      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 to fname attribute of <structure-query-constraint> module in atlassian-plugin.xml
      arguments - constraint arguments. Both the list and all of its elements must not be null , otherwise NullPointerException is thrown
      Throws:
      NullPointerException - if name, arguments, or any of the arguments list elements is null
      See Also:
    • constraint

      B constraint(@NotNull String name, @NotNull Iterable<String> arguments)
      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 basicConstraint in a relational constraint. For examples, see queries q9 and q10 in the class documentation.
    • query

      B query(@NotNull StructureQuery query)
      Matches all rows that match the specified Structure query. Note that only those instances of StructureQuery that have originated from this API will work; any other implementation of StructureQuery will not be recognized, and this constraint will be equivalent to all().
      Parameters:
      query - Structure query obtained either from StructureQueryBuilder or StructureQueryParser.