public class DefaultSearchRequestService extends Object implements SearchRequestService
Constructor and Description |
---|
DefaultSearchRequestService(SearchRequestManager searchRequestManager,
FavouritesManager<SearchRequest> favouritesManager,
ShareTypeValidatorUtils shareTypeValidatorUtils,
UserUtil userUtil,
PermissionManager permissionManager,
FeatureManager featureManager,
com.atlassian.event.api.EventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
SearchRequest |
createFilter(JiraServiceContext serviceCtx,
SearchRequest request)
Persists a
SearchRequest to the database. |
SearchRequest |
createFilter(JiraServiceContext serviceCtx,
SearchRequest request,
boolean isFavourite)
Persists a
SearchRequest to the database. |
void |
deleteAllFiltersForUser(JiraServiceContext serviceCtx,
ApplicationUser user)
Delete all filters for a given user
|
void |
deleteFilter(JiraServiceContext serviceCtx,
Long filterId)
Delete a given filter.
|
Collection<SearchRequest> |
getFavouriteFilters(ApplicationUser user)
Retrieve all filters a user has favourited.
|
SearchRequest |
getFilter(JiraServiceContext serviceCtx,
Long filterId)
Retrieve a given filter by id.
|
Collection<SearchRequest> |
getFiltersFavouritedByOthers(ApplicationUser user)
Get filters owned by a given user that have been favourited by at least one other user
|
Collection<SearchRequest> |
getNonPrivateFilters(ApplicationUser user)
Get a user's non private filters.
|
Collection<SearchRequest> |
getOwnedFilters(ApplicationUser user)
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.
|
SharedEntitySearchResult<SearchRequest> |
search(JiraServiceContext serviceCtx,
SharedEntitySearchParameters searchParameters,
int pagePosition,
int pageWidth)
Search for the SearchRequests that match the passed searchParameters.
|
SearchRequest |
updateFilter(JiraServiceContext serviceCtx,
SearchRequest request)
Persists a
SearchRequest to the database. |
SearchRequest |
updateFilter(JiraServiceContext serviceCtx,
SearchRequest request,
boolean isFavourite)
Persists a
SearchRequest to the database. |
SearchRequest |
updateFilterOwner(JiraServiceContext serviceCtx,
ApplicationUser user,
SearchRequest request)
Persists a
SearchRequest to the database - only available to administrators. |
SearchRequest |
updateFilterOwner(JiraServiceContext serviceCtx,
Long filterId,
ApplicationUser newOwner)
Changes the owner of the portal page.
|
SearchRequest |
updateSearchParameters(JiraServiceContext serviceCtx,
SearchRequest request)
Persists changes to passed
SearchRequest 's search parameters and search sorts. |
void |
validateFilterForChangeOwner(JiraServiceContext serviceCtx,
SearchRequest request)
Validates that the proposed owner can take over the ownership of the filter
|
void |
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 serviceCtx,
SearchRequest request)
Validate that the passed
SearchRequest 's search parameters and search sorts can be persisted. |
public DefaultSearchRequestService(SearchRequestManager searchRequestManager, FavouritesManager<SearchRequest> favouritesManager, ShareTypeValidatorUtils shareTypeValidatorUtils, UserUtil userUtil, PermissionManager permissionManager, FeatureManager featureManager, com.atlassian.event.api.EventPublisher eventPublisher)
public Collection<SearchRequest> getFavouriteFilters(ApplicationUser user)
SearchRequestService
getFavouriteFilters
in interface SearchRequestService
user
- The user who has favourite filters. Also to test visibility and withSearchRequest
objects that represent filters the user has favourited.public Collection<SearchRequest> getOwnedFilters(ApplicationUser user)
SearchRequestService
getOwnedFilters
in interface SearchRequestService
user
- The user who created the filters.SearchRequest
objects that represent filters the user has created.public Collection<SearchRequest> getNonPrivateFilters(ApplicationUser user)
SearchRequestService
getNonPrivateFilters
in interface SearchRequestService
user
- The author of the filterspublic Collection<SearchRequest> getFiltersFavouritedByOthers(ApplicationUser user)
SearchRequestService
getFiltersFavouritedByOthers
in interface SearchRequestService
user
- The author of the filterspublic void deleteFilter(JiraServiceContext serviceCtx, Long filterId)
SearchRequestService
deleteFilter
in interface SearchRequestService
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.public void deleteAllFiltersForUser(JiraServiceContext serviceCtx, ApplicationUser user)
SearchRequestService
deleteAllFiltersForUser
in interface SearchRequestService
serviceCtx
- JIRA Service context containing an error collection and user performing actionuser
- The user to remove all filters forpublic SearchRequest getFilter(JiraServiceContext serviceCtx, Long filterId)
SearchRequestService
getFilter
in interface SearchRequestService
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.public void validateFilterForUpdate(JiraServiceContext serviceCtx, SearchRequest request)
SearchRequestService
validateFilterForUpdate
in interface SearchRequestService
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the SearchRequest to validatepublic boolean validateUpdateSearchParameters(JiraServiceContext serviceCtx, SearchRequest request)
SearchRequestService
SearchRequest
'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.validateUpdateSearchParameters
in interface SearchRequestService
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the request to validate.true
iff the passed request's parameters can be saved.public void validateFilterForCreate(JiraServiceContext serviceCtx, SearchRequest request)
SearchRequestService
validateFilterForCreate
in interface SearchRequestService
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the SearchRequest to validatepublic void validateForDelete(JiraServiceContext serviceCtx, Long filterId)
SearchRequestService
validateForDelete
in interface SearchRequestService
serviceCtx
- context of the calling user.filterId
- the filter to delete.public SearchRequest createFilter(JiraServiceContext serviceCtx, SearchRequest request)
SearchRequestService
SearchRequest
to the database.createFilter
in interface SearchRequestService
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the request to savepublic SearchRequest createFilter(JiraServiceContext serviceCtx, SearchRequest request, boolean isFavourite)
SearchRequestService
SearchRequest
to the database.createFilter
in interface SearchRequestService
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the request to saveisFavourite
- saves the SearchRequest as a favourite (or not)public SearchRequest updateFilter(JiraServiceContext serviceCtx, SearchRequest request)
SearchRequestService
SearchRequest
to the database.updateFilter
in interface SearchRequestService
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the request to updatepublic SearchRequest updateFilter(JiraServiceContext serviceCtx, SearchRequest request, boolean isFavourite)
SearchRequestService
SearchRequest
to the database.updateFilter
in interface SearchRequestService
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the request to updateisFavourite
- saves the SearchRequest as a favourite (or not)public void validateFilterForChangeOwner(JiraServiceContext serviceCtx, SearchRequest request)
SearchRequestService
validateFilterForChangeOwner
in interface SearchRequestService
serviceCtx
- containing proposed ownerrequest
- the SearchRequest that you want to change ownership ofpublic SearchRequest updateFilterOwner(JiraServiceContext serviceCtx, ApplicationUser user, SearchRequest request)
SearchRequestService
SearchRequest
to the database - only available to administrators.updateFilterOwner
in interface SearchRequestService
serviceCtx
- Context containing the new owner, error collection and i18n beanuser
- the user requesting the update, must have Permissions.ADMINISTER permissionsrequest
- the request to updatepublic SearchRequest updateFilterOwner(JiraServiceContext serviceCtx, Long filterId, ApplicationUser newOwner)
SearchRequestService
You should call SearchRequestService.validateFilterForChangeOwner(JiraServiceContext, SearchRequest)
prior to calling this method.
updateFilterOwner
in interface SearchRequestService
serviceCtx
- the context of the service callfilterId
- the id of the filter to updatenewOwner
- the new ownerpublic SearchRequest updateSearchParameters(JiraServiceContext serviceCtx, SearchRequest request)
SearchRequestService
SearchRequest
'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.
updateSearchParameters
in interface SearchRequestService
serviceCtx
- Context containing user, error collection and i18n beanrequest
- the request to update.null
if an error
occurs. The passed service context will have details of any errors.public void validateForSearch(JiraServiceContext serviceCtx, SharedEntitySearchParameters searchParameters)
SearchRequestService
validateForSearch
in interface SearchRequestService
serviceCtx
- Context containing user, error collection and i18n beansearchParameters
- the SharedEntitySearchParameters to validatepublic SharedEntitySearchResult<SearchRequest> search(JiraServiceContext serviceCtx, SharedEntitySearchParameters searchParameters, int pagePosition, int pageWidth)
SearchRequestService
search
in interface SearchRequestService
serviceCtx
- Context containing user, error collection and i18n beansearchParameters
- the searchParameters to query.pagePosition
- the page to return.pageWidth
- the number of results per page.public boolean hasShareRights(@Nullable ApplicationUser user, @Nonnull SearchRequest searchRequest, @Nonnull ShareRight shareRight)
SearchRequestService
hasShareRights
in interface SearchRequestService
user
- user which wants for example view or edit the entitysearchRequest
- search request which permissions and ownership are going to be checkedshareRight
- share rights which will be checked if user has itCopyright © 2002-2022 Atlassian. All Rights Reserved.