Package com.atlassian.jira.bc.filter
Class DefaultSearchRequestService
java.lang.Object
com.atlassian.jira.bc.filter.DefaultSearchRequestService
- All Implemented Interfaces:
SearchRequestService
Default implementation of SearchRequestService
- Since:
- v3.13
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSearchRequestService(SearchRequestManager searchRequestManager, FavouritesManager<SearchRequest> favouritesManager, ShareTypeValidatorUtils shareTypeValidatorUtils, UserUtil userUtil, PermissionManager permissionManager, FeatureManager featureManager, com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptioncreateFilter(JiraServiceContext serviceCtx, SearchRequest request) Persists aSearchRequestto the database.createFilter(JiraServiceContext serviceCtx, SearchRequest request, boolean isFavourite) Persists aSearchRequestto the database.voiddeleteAllFiltersForUser(JiraServiceContext serviceCtx, ApplicationUser user) Delete all filters for a given uservoiddeleteFilter(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.booleanhasShareRights(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 aSearchRequestto the database.updateFilter(JiraServiceContext serviceCtx, SearchRequest request, boolean isFavourite) Persists aSearchRequestto the database.updateFilterOwner(JiraServiceContext contextWithNewOwner, ApplicationUser loggedInUser, SearchRequest requestWithNewOwner) Persists aSearchRequestto 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.voidvalidateFilterForChangeOwner(JiraServiceContext contextWithNewOwner, SearchRequest requestWithNewOwner) Validates that the proposed owner can take over the ownership of the filtervoidvalidateFilterForCreate(JiraServiceContext serviceCtx, SearchRequest request) Validates that a filter is in a correct state to be created.voidvalidateFilterForUpdate(JiraServiceContext serviceCtx, SearchRequest request) Validates that a filter is in a correct state to be updated.voidvalidateForDelete(JiraServiceContext serviceCtx, Long filterId) Validates that the filter can be deleted successfully.voidvalidateForSearch(JiraServiceContext serviceCtx, SharedEntitySearchParameters searchParameters) This will validate that the input parameters are valid for a search that encompasses ANY share entity type.booleanvalidateUpdateSearchParameters(JiraServiceContext serviceCtx, SearchRequest request) Validate that the passedSearchRequest's search parameters and search sorts can be persisted.
-
Constructor Details
-
Method Details
-
getFavouriteFilters
Description copied from interface:SearchRequestServiceRetrieve 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.- Specified by:
getFavouriteFiltersin interfaceSearchRequestService- Parameters:
user- The user who has favourite filters. Also to test visibility and with- Returns:
- a Collection of
SearchRequestobjects that represent filters the user has favourited.
-
getOwnedFilters
Description copied from interface:SearchRequestServiceRetrieve all filters a user owns/has created.- Specified by:
getOwnedFiltersin interfaceSearchRequestService- Parameters:
user- The user who created the filters.- Returns:
- a Collection of
SearchRequestobjects that represent filters the user has created.
-
getNonPrivateFilters
Description copied from interface:SearchRequestServiceGet a user's non private filters. I.e. filters that other users can possibly see.- Specified by:
getNonPrivateFiltersin interfaceSearchRequestService- Parameters:
user- The author of the filters- Returns:
- Collection of SearchRequest objects that do not have private scope.
-
getFiltersFavouritedByOthers
Description copied from interface:SearchRequestServiceGet filters owned by a given user that have been favourited by at least one other user- Specified by:
getFiltersFavouritedByOthersin interfaceSearchRequestService- 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
Description copied from interface:SearchRequestServiceDelete a given filter.- Specified by:
deleteFilterin interfaceSearchRequestService- 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
Description copied from interface:SearchRequestServiceDelete all filters for a given user- Specified by:
deleteAllFiltersForUserin interfaceSearchRequestService- Parameters:
serviceCtx- JIRA Service context containing an error collection and user performing actionuser- The user to remove all filters for
-
getFilter
Description copied from interface:SearchRequestServiceRetrieve a given filter by id.- Specified by:
getFilterin interfaceSearchRequestService- 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
Description copied from interface:SearchRequestServiceValidates that a filter is in a correct state to be updated.- Specified by:
validateFilterForUpdatein interfaceSearchRequestService- Parameters:
serviceCtx- Context containing user, error collection and i18n beanrequest- the SearchRequest to validate
-
validateUpdateSearchParameters
Description copied from interface:SearchRequestServiceValidate 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.- Specified by:
validateUpdateSearchParametersin interfaceSearchRequestService- Parameters:
serviceCtx- Context containing user, error collection and i18n beanrequest- the request to validate.- Returns:
trueiff the passed request's parameters can be saved.
-
validateFilterForCreate
Description copied from interface:SearchRequestServiceValidates that a filter is in a correct state to be created.- Specified by:
validateFilterForCreatein interfaceSearchRequestService- Parameters:
serviceCtx- Context containing user, error collection and i18n beanrequest- the SearchRequest to validate
-
validateForDelete
Description copied from interface:SearchRequestServiceValidates that the filter can be deleted successfully.- Specified by:
validateForDeletein interfaceSearchRequestService- Parameters:
serviceCtx- context of the calling user.filterId- the filter to delete.
-
createFilter
Description copied from interface:SearchRequestServicePersists aSearchRequestto the database.- Specified by:
createFilterin interfaceSearchRequestService- Parameters:
serviceCtx- Context containing user, error collection and i18n beanrequest- the request to save- Returns:
- the SearchRequest that was persisted to the database.
-
createFilter
public SearchRequest createFilter(JiraServiceContext serviceCtx, SearchRequest request, boolean isFavourite) Description copied from interface:SearchRequestServicePersists aSearchRequestto the database.- Specified by:
createFilterin interfaceSearchRequestService- 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
Description copied from interface:SearchRequestServicePersists aSearchRequestto the database.- Specified by:
updateFilterin interfaceSearchRequestService- Parameters:
serviceCtx- Context containing user, error collection and i18n beanrequest- the request to update- Returns:
- the SearchRequest that was persisted to the database.
-
updateFilter
public SearchRequest updateFilter(JiraServiceContext serviceCtx, SearchRequest request, boolean isFavourite) Description copied from interface:SearchRequestServicePersists aSearchRequestto the database.- Specified by:
updateFilterin interfaceSearchRequestService- 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.
-
validateFilterForChangeOwner
public void validateFilterForChangeOwner(JiraServiceContext contextWithNewOwner, SearchRequest requestWithNewOwner) Description copied from interface:SearchRequestServiceValidates that the proposed owner can take over the ownership of the filter- Specified by:
validateFilterForChangeOwnerin interfaceSearchRequestService- Parameters:
contextWithNewOwner- containing proposed ownerrequestWithNewOwner- the SearchRequest that you want to change ownership of
-
updateFilterOwner
public SearchRequest updateFilterOwner(JiraServiceContext contextWithNewOwner, ApplicationUser loggedInUser, SearchRequest requestWithNewOwner) Description copied from interface:SearchRequestServicePersists aSearchRequestto the database - only available to administrators.- Specified by:
updateFilterOwnerin interfaceSearchRequestService- Parameters:
contextWithNewOwner- Context containing the new owner, error collection and i18n beanloggedInUser- the user requesting the update, must have Permissions.ADMINISTER permissionsrequestWithNewOwner- the request to update- Returns:
- the SearchRequest that was persisted to the database
-
updateFilterOwner
public SearchRequest updateFilterOwner(JiraServiceContext serviceCtx, Long filterId, ApplicationUser newOwner) Description copied from interface:SearchRequestServiceChanges the owner of the portal page. User performing this operation must be an administrator.You should call
SearchRequestService.validateFilterForChangeOwner(JiraServiceContext, SearchRequest)prior to calling this method.- Specified by:
updateFilterOwnerin interfaceSearchRequestService- 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
Description copied from interface:SearchRequestServicePersists 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.
- Specified by:
updateSearchParametersin interfaceSearchRequestService- 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
nullif an error occurs. The passed service context will have details of any errors.
-