Package com.atlassian.jira.bc.filter
Interface SearchRequestService
- All Known Implementing Classes:
DefaultSearchRequestService
@PublicApi
public interface SearchRequestService
Service exposing Search Request Management and retrieval.
- Since:
- v3.13
-
Method Summary
Modifier and TypeMethodDescriptioncreateFilter
(JiraServiceContext serviceCtx, SearchRequest request) Persists aSearchRequest
to the database.createFilter
(JiraServiceContext serviceCtx, SearchRequest request, boolean isFavourite) Persists aSearchRequest
to the database.void
deleteAllFiltersForUser
(JiraServiceContext serviceCtx, ApplicationUser user) Delete all filters for a given uservoid
deleteFilter
(JiraServiceContext serviceCtx, Long filterId) Delete a given filter.Retrieve all filters a user has favourited.getFilter
(JiraServiceContext serviceCtx, Long filterId) Retrieve a given filter by id.Get filters owned by a given user that have been favourited by at least one other userGet a user's non private filters.Retrieve all filters a user owns/has created.boolean
hasShareRights
(ApplicationUser user, SearchRequest searchRequest, ShareRight shareRight) Checks if provided user has share rights for given search request.search
(JiraServiceContext serviceCtx, SharedEntitySearchParameters searchParameters, int pagePosition, int pageWidth) Search for the SearchRequests that match the passed searchParameters.updateFilter
(JiraServiceContext serviceCtx, SearchRequest request) Persists aSearchRequest
to the database.updateFilter
(JiraServiceContext serviceCtx, SearchRequest request, boolean isFavourite) Persists aSearchRequest
to the database.updateFilterOwner
(JiraServiceContext serviceCtx, ApplicationUser user, SearchRequest request) Persists aSearchRequest
to the database - only available to administrators.updateFilterOwner
(JiraServiceContext serviceCtx, Long filterId, ApplicationUser newOwner) Changes the owner of the portal page.updateSearchParameters
(JiraServiceContext serviceCtx, SearchRequest request) Persists changes to passedSearchRequest
's search parameters and search sorts.void
validateFilterForChangeOwner
(JiraServiceContext serviceCtx, SearchRequest request) Validates that the proposed owner can take over the ownership of the filtervoid
validateFilterForCreate
(JiraServiceContext serviceCtx, SearchRequest request) Validates that a filter is in a correct state to be created.void
validateFilterForUpdate
(JiraServiceContext serviceCtx, SearchRequest request) Validates that a filter is in a correct state to be updated.void
validateForDelete
(JiraServiceContext serviceCtx, Long filterId) Validates that the filter can be deleted successfully.void
validateForSearch
(JiraServiceContext serviceCtx, SharedEntitySearchParameters searchParameters) This will validate that the input parameters are valid for a search that encompasses ANY share entity type.boolean
validateUpdateSearchParameters
(JiraServiceContext serviceContext, SearchRequest request) Validate that the passedSearchRequest
's search parameters and search sorts can be persisted.
-
Method Details
-
getFavouriteFilters
Retrieve all filters a user has favourited. Permission checks are done to ensure the user can see the filter, as visibility may have been removed from underneath them.- Parameters:
user
- The user who has favourite filters. Also to test visibility and with- Returns:
- a Collection of
SearchRequest
objects that represent filters the user has favourited.
-
getOwnedFilters
Retrieve all filters a user owns/has created.- Parameters:
user
- The user who created the filters.- Returns:
- a Collection of
SearchRequest
objects that represent filters the user has created.
-
getNonPrivateFilters
Get a user's non private filters. I.e. filters that other users can possibly see.- Parameters:
user
- The author of the filters- Returns:
- Collection of SearchRequest objects that do not have private scope.
-
getFiltersFavouritedByOthers
Get filters owned by a given user that have been favourited by at least one other user- Parameters:
user
- The author of the filters- Returns:
- Collection of SearchRequest objects owned by the given user and favourited by at least one other user
-
deleteFilter
Delete a given filter.- Parameters:
serviceCtx
- JIRA Service context containing an error collection and user performing action. User must be owner of filter, else error is passed back through the error collection.filterId
- The id of the filter to delete. Id must not be null, else error is passed back through the error collection.
-
deleteAllFiltersForUser
Delete all filters for a given user- Parameters:
serviceCtx
- JIRA Service context containing an error collection and user performing actionuser
- The user to remove all filters for
-
getFilter
Retrieve a given filter by id.- Parameters:
serviceCtx
- JIRA Service context containing an error collection and user requesting (to run) the filter. The filter must exist and the user must be able to see filter else an error will result.filterId
- The id of the filter to retrieve. Id must not be null.- Returns:
- The Filter as specified by the id, or null if none exists for the user.
-
validateFilterForUpdate
Validates that a filter is in a correct state to be updated.- Parameters:
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the SearchRequest to validate
-
validateUpdateSearchParameters
Validate that the passedSearchRequest
's search parameters and search sorts can be persisted. This method does *not* check the validity of the name, description, share permissions or any other fields in the SearchRequest. Any errors will be reported in the passed context.- Parameters:
serviceContext
- Context containing user, error collection and i18n beanrequest
- the request to validate.- Returns:
true
iff the passed request's parameters can be saved.
-
validateFilterForCreate
Validates that a filter is in a correct state to be created.- Parameters:
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the SearchRequest to validate
-
validateForDelete
Validates that the filter can be deleted successfully.- Parameters:
serviceCtx
- context of the calling user.filterId
- the filter to delete.
-
validateFilterForChangeOwner
Validates that the proposed owner can take over the ownership of the filter- Parameters:
serviceCtx
- containing proposed ownerrequest
- the SearchRequest that you want to change ownership of
-
createFilter
Persists aSearchRequest
to the database.- Parameters:
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the request to save- Returns:
- the SearchRequest that was persisted to the database.
-
createFilter
SearchRequest createFilter(JiraServiceContext serviceCtx, SearchRequest request, boolean isFavourite) Persists aSearchRequest
to the database.- Parameters:
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the request to saveisFavourite
- saves the SearchRequest as a favourite (or not)- Returns:
- the SearchRequest that was persisted to the database.
-
updateFilter
Persists aSearchRequest
to the database.- Parameters:
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the request to update- Returns:
- the SearchRequest that was persisted to the database.
-
updateFilter
SearchRequest updateFilter(JiraServiceContext serviceCtx, SearchRequest request, boolean isFavourite) Persists aSearchRequest
to the database.- Parameters:
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the request to updateisFavourite
- saves the SearchRequest as a favourite (or not)- Returns:
- the SearchRequest that was persisted to the database.
-
updateFilterOwner
SearchRequest updateFilterOwner(JiraServiceContext serviceCtx, ApplicationUser user, SearchRequest request) Persists aSearchRequest
to the database - only available to administrators.- Parameters:
serviceCtx
- Context containing the new owner, error collection and i18n beanuser
- the user requesting the update, must have Permissions.ADMINISTER permissionsrequest
- the request to update- Returns:
- the SearchRequest that was persisted to the database
-
updateFilterOwner
@Nullable SearchRequest updateFilterOwner(JiraServiceContext serviceCtx, Long filterId, ApplicationUser newOwner) Changes the owner of the portal page. User performing this operation must be an administrator.You should call
validateFilterForChangeOwner(JiraServiceContext, SearchRequest)
prior to calling this method.- Parameters:
serviceCtx
- the context of the service callfilterId
- the id of the filter to updatenewOwner
- the new owner- Returns:
- a newly updated SearchRequest, or null if user is not an admin
-
updateSearchParameters
Persists changes to passedSearchRequest
's search parameters and search sorts. Changes to the SearchRequest's other fields (name, description, share permissions, ...) are not saved. Any errors will be reported in the passed context.This method does not check the validity of the SearchRequest's share permissions when saving. This is to allow JIRA to save search parameter changes even when the SearchRequest's permissions are invalid.
- Parameters:
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the request to update.- Returns:
- the SearchRequest that was persisted to the database. May return
null
if an error occurs. The passed service context will have details of any errors.
-