Interface SearchRequestManager

All Superinterfaces:
SharedEntityAccessor<SearchRequest>
All Known Implementing Classes:
DefaultSearchRequestManager

@PublicApi public interface SearchRequestManager extends SharedEntityAccessor<SearchRequest>
This manager is responsible for SearchRequests. SearchRequests encapsulate all information used for searches in the issue navigator.
  • Method Details

    • getSearchRequests

      Used to get sharable entities from a search result filtered to only those that are shared with the searcher. The entities returned may be modified by the user parameter (e.g. permissions or clause sanitisation).
      Parameters:
      searcher - the user performing the search
      descriptor - retrieval descriptor
      Returns:
      a EnclosedIterable of SharedEntity's
    • getAllOwnedSearchRequests

      Collection<SearchRequest> getAllOwnedSearchRequests(ApplicationUser user)
      Retrieves a collection of SearchRequest objects that a user created.
      Parameters:
      user - The user who created the SearchRequests
      Returns:
      Collection of all SearchRequest that user created.
    • getOwnedSearchRequestByName

      SearchRequest getOwnedSearchRequestByName(ApplicationUser author, String name)
      Find a search request given the author and the request name.
      Parameters:
      author - The author of the SearchRequest
      name - The name of the SearchRequest
      Returns:
      The SearchRequest, or null if there is no matching request
    • getSearchRequestById

      SearchRequest getSearchRequestById(ApplicationUser user, Long id)
      Return the search request as stored in the database if the user has permission to see it.
      Parameters:
      user - The user to check shares with
      id - The id of the filter
      Returns:
      The SearchRequest, or null if the request id does not exist
      See Also:
    • getSearchRequestById

      SearchRequest getSearchRequestById(Long id)
      Return the search request as stored in the database without any permission checks.
      Parameters:
      id - The id of the filter
      Returns:
      The SearchRequest, or null if the request id does not exist
    • getAll

      Deprecated.
      Use visitAll(Visitor) instead. Since v5.2.
      Get all SearchRequests.

      WARNING: This method will run horribly slow on systems with a lot of saved filters.

      Specified by:
      getAll in interface SharedEntityAccessor<SearchRequest>
      Returns:
      an EnclosedIterable of SearchRequests
    • visitAll

      void visitAll(Visitor<SearchRequestEntity> visitor)
      Iterates over all SearchRequests using a Visitor pattern callback.
    • findByNameIgnoreCase

      List<SearchRequest> findByNameIgnoreCase(String name)
    • getSearchRequestOwnerUserName

      String getSearchRequestOwnerUserName(Long id)
      Deprecated.
      Use getSearchRequestOwner(Long id) instead. Since v6.0.

      Return the owner of the passed SearchRequest. This is mainly used for permission checks.

      Parameters:
      id - the identifier of the SearchRequest.
      Returns:
      the username of the owner of the SearchRequest. Null is returned if the SearchRequest does not exist.
    • getSearchRequestOwner

      ApplicationUser getSearchRequestOwner(Long id)
    • create

      SearchRequest create(SearchRequest request)
      Takes a SearchRequest, user, name of search request and description and persists the XML representation of the SearchRequest object to the database along with the rest of the details
      Parameters:
      request - SearchResult that should be persisted
      Returns:
      SearchRequest object that was persisted to the database
    • update

      Updates an existing search request in the database.
      Parameters:
      request - the request to persist
      Returns:
      A SearchRequest that was persisted to the database and by default sanitized for the owner of the request. To change the default behaviour use update(ApplicationUser, SearchRequest) instead
    • update

      @ExperimentalApi SearchRequest update(ApplicationUser editor, SearchRequest request)
      Updates an existing search request in the database.
      Parameters:
      editor - application user which updates the search request
      request - the request to persist
      Returns:
      A SearchRequest that was persisted to the database and sanitized for the editor
      Since:
      v7.12
    • delete

      void delete(Long id)
      Removes the SearchRequest GenericValue from the database based on its id
      Parameters:
      id - of the search request to be removed from storage
    • search

      SharedEntitySearchResult<SearchRequest> search(SharedEntitySearchParameters searchParameters, ApplicationUser user, int pagePosition, int pageWidth)
      Search for the SearchRequests that match the passed searchParameters. The result can be paged so that a subset of the results can be returned.
      Specified by:
      search in interface SharedEntityAccessor<SearchRequest>
      Parameters:
      searchParameters - the searchParameters to query.
      user - the user performing the search.
      pagePosition - the page to return.
      pageWidth - the number of results per page.
      Returns:
      the result of the search.
    • hasShareRights

      @ExperimentalApi boolean hasShareRights(@Nullable ApplicationUser user, @Nonnull SearchRequest searchRequest, @Nonnull ShareRight shareRight)
      Checks if provided user has share rights for given search request.
      Parameters:
      user - user which wants for example view or edit the entity
      searchRequest - search request which permissions and ownership are going to be checked
      shareRight - share right which will be checked if user has it
      Returns:
      true in case provided user has specified rights for search request, false otherwise
      Since:
      v7.12