Package com.atlassian.jira.issue.search
Interface SearchContext
- All Known Implementing Classes:
MockSearchContext
,SearchContextImpl
@PublicApi
public interface SearchContext
Represents the Project and IssueType combination which is used to determine the allowable fields and values
when searching for Issues. In JIRA Schemes generally define what is customised on a per "Context" basis.
-
Method Summary
Modifier and TypeMethodDescriptionGets the search context as a list ofIssueContext
objectsIssue ids as StringsReturns issue types objects in this SearchContextReturns selected category IDs.Project ids as Longs.Returns project objects in this SearchContextReturns the single Project for this SearchContext.boolean
Returns true if no specific issue types have been selectedboolean
Returns whether the context is global or not.boolean
Returns true if there is exactly one Project in this SearchContext.void
verify()
Verifies that all issue types and projects in the context actually still exists.
-
Method Details
-
isForAnyProjects
boolean isForAnyProjects()Returns whether the context is global or not. A context is global when there are no project restrictions and no project category restrictions.- Returns:
- boolean
-
isForAnyIssueTypes
boolean isForAnyIssueTypes()Returns true if no specific issue types have been selected- Returns:
- boolean
-
isSingleProjectContext
boolean isSingleProjectContext()Returns true if there is exactly one Project in this SearchContext.- Returns:
- true if there is exactly one Project in this SearchContext.
-
getSingleProject
Project getSingleProject()Returns the single Project for this SearchContext.You should first call
isSingleProjectContext()
to check if this is valid.- Returns:
- the single Project for this SearchContext.
- Throws:
IllegalStateException
- if there is not exactly one Project in this SearchContext.- See Also:
-
getProjectCategoryIds
Returns selected category IDs.- Returns:
- Empty list if no categories were selected
-
getProjectIds
Project ids as Longs.- Returns:
- List of Long objects, possibly empty.
-
getIssueTypeIds
Issue ids as Strings- Returns:
- List of issue type ids possibly empty.
-
getAsIssueContexts
List<IssueContext> getAsIssueContexts()Gets the search context as a list ofIssueContext
objects- Returns:
- List of
IssueContext
. If no issue types or projects selected. A blank issue context is returned. Never null.
-
verify
void verify()Verifies that all issue types and projects in the context actually still exists. This might not be the case. Also removes any projects or issue types from this SearchContext that do not (any longer) exist in the backing store. -
getProjects
Returns project objects in this SearchContext- Returns:
- List of
Project
. If no projects are selected, returns an empty list.
-
getIssueTypes
Returns issue types objects in this SearchContext- Returns:
- List of
IssueType
. If no issue types are selected, returns an empty list
-