Class SearchRequest

java.lang.Object
com.atlassian.jira.issue.search.SearchRequest
All Implemented Interfaces:
Favourite, SharedEntity, Serializable
Direct Known Subclasses:
MockJqlSearchRequest

@PublicApi public class SearchRequest extends Object implements SharedEntity, Serializable
A shareable representation of a search for issues. Officially known as a "Filter" or "Saved Filter".

This class binds the Query, which is used to perform the actual search, and the saved information (such as name, description), and any permissions that may be associated with the saved search together.

See Also:
  • Field Details

  • Constructor Details

    • SearchRequest

      public SearchRequest()
      A no-arg constructor that will build a SearchRequest with an empty Query, this will be a search that will find all issues with the default system sorting . You can then use the setter methods to set the attributes you wish this SearchRequest to contain.
    • SearchRequest

      public SearchRequest(Query query)
      Creates a SearchRequest with the specified Query and no other attributes. This can be used to create a programtic SearchRequest that can be used to perform a search but is not ready to be saved.
      Parameters:
      query - provides the details of the search that will be performed with this SearchRequest.
    • SearchRequest

      public SearchRequest(SearchRequest oldRequest)
      Used to create a SearchRequest that copies all the information from the old search request. This includes the name, description, author, id, favCount and the SearchQuery.
      Parameters:
      oldRequest - defines all the attributes that this SearchRequest will contain.
    • SearchRequest

      public SearchRequest(Query query, ApplicationUser owner, String name, String description)
      Build a SearchRequest with the provided attributes, this can be used if you want to create a SearchRequest that can be persisted.
      Parameters:
      query - defines what this SearchRequest will search for.
      owner - the owner, user who initially create the request.
      name - the name associated with this SearchRequest, can be set even if this is not persistent yet.
      description - the description associated with this SearchRequest, can be set even if this is not persistent yet. filter.
    • SearchRequest

      public SearchRequest(Query query, ApplicationUser owner, String name, String description, Long id, long favouriteCount)
      Build a SearchRequest with the provided attributes.
      Parameters:
      query - defines what this SearchRequest will search for.
      owner - the owner, user who initially create the request.
      name - the name associated with this SearchRequest, can be set even if this is not persistent yet.
      description - the description associated with this SearchRequest, can be set even if this is not persistent yet.
      id - the persistent id of the SearchRequest, null if the SearchRequest is not persistent.
      favouriteCount - the number of users that have this filter as a favortie, will only be set if this is a persistent filter.
    • SearchRequest

      public SearchRequest(Query query, String ownerUserName, String name, String description)
      Deprecated.
      Use SearchRequest(com.atlassian.query.Query, com.atlassian.jira.user.ApplicationUser, String, String) instead. Since v6.0.

      Build a SearchRequest with the provided attributes, this can be used if you want to create a SearchRequest that can be persisted.

      Parameters:
      query - defines what this SearchRequest will search for.
      ownerUserName - the owner, user who initially create the request.
      name - the name associated with this SearchRequest, can be set even if this is not persistent yet.
      description - the description associated with this SearchRequest, can be set even if this is not persistent yet. filter.
    • SearchRequest

      public SearchRequest(Query query, String ownerUserName, String name, String description, Long id, long favouriteCount)
      Deprecated.
      Use SearchRequest(com.atlassian.query.Query, com.atlassian.jira.user.ApplicationUser, String, String, Long, long) instead. Since v6.0.

      Build a SearchRequest with the provided attributes.

      Parameters:
      query - defines what this SearchRequest will search for.
      ownerUserName - the owner, user who initially create the request.
      name - the name associated with this SearchRequest, can be set even if this is not persistent yet.
      description - the description associated with this SearchRequest, can be set even if this is not persistent yet.
      id - the persistent id of the SearchRequest, null if the SearchRequest is not persistent.
      favouriteCount - the number of users that have this filter as a favortie, will only be set if this is a persistent filter.
  • Method Details

    • getQuery

      @Nonnull public Query getQuery()
      Gets the SearchQuery that defines the search that will be performed for this SearchRequest.
      Returns:
      the SearchQuery that defines the search that will be performed for this SearchRequest, not null.
    • setQuery

      public void setQuery(Query query)
    • getCsvDelimiter

      public char getCsvDelimiter()
      Get the delimiter being used when exporting to CSV.
      Returns:
      character being used when exporting to CSV.
    • setCsvDelimiter

      public void setCsvDelimiter(char csvDelimiter)
      Set the delimiter being used when exporting to CSV.
      Parameters:
      csvDelimiter - defines character being used when exporting to CSV.
    • getName

      public String getName()
      Description copied from interface: SharedEntity
      The name of the entity.
      Specified by:
      getName in interface SharedEntity
      Returns:
      the name. Must not be null or empty.
    • setName

      public void setName(String name)
    • getId

      public Long getId()
      Description copied from interface: SharedEntity
      The id of the entity.
      Specified by:
      getId in interface SharedEntity
      Returns:
      the id. May be null if not yet persisted. Some components may not accept a non-persisted entity.
    • getPermissions

      public SharedEntity.SharePermissions getPermissions()
      Description copied from interface: SharedEntity
      The permissions for this entity.
      Specified by:
      getPermissions in interface SharedEntity
      Returns:
      the permissions object. Must not be null.
    • setPermissions

      public void setPermissions(SharedEntity.SharePermissions sharePermissions)
    • getDescription

      public String getDescription()
      Description copied from interface: SharedEntity
      A general description of the entity.
      Specified by:
      getDescription in interface SharedEntity
      Returns:
      the description. May be null or empty.
    • getOwner

      public ApplicationUser getOwner()
      Specified by:
      getOwner in interface SharedEntity
    • getOwnerUserName

      public String getOwnerUserName()
      Specified by:
      getOwnerUserName in interface SharedEntity
      Returns:
      The user name of the user who owns this entity. May be null for anonymous user.
    • setDescription

      public void setDescription(String description)
    • setFavouriteCount

      protected void setFavouriteCount(Long favouriteCount)
    • getFavouriteCount

      public Long getFavouriteCount()
      Description copied from interface: Favourite
      The number of users who have marked this entity as one of their favourites.
      Specified by:
      getFavouriteCount in interface Favourite
      Returns:
      long the user count
    • setOwner

      public void setOwner(ApplicationUser owner)
      Set the owner of the SearchRequest.
      Parameters:
      owner - the user who is the search requests owner.
    • setOwnerUserName

      public void setOwnerUserName(String ownerUserName)
      Deprecated.
      Use setOwner(com.atlassian.jira.user.ApplicationUser) instead. Since v6.0. Set the owner of the SearchRequest.
      Parameters:
      ownerUserName - the name of the user who is the search requests owner.
    • isModified

      public boolean isModified()
    • setModified

      public void setModified(boolean modified)
    • isLoaded

      public boolean isLoaded()
    • useColumns

      public boolean useColumns()
      Returns:
      true if this SearchRequest should be displayed using the saved column layout, false otherwise
    • setUseColumns

      public void setUseColumns(boolean useColumns)
    • setWithBom

      public void setWithBom(boolean withBom)
    • isWithBom

      public boolean isWithBom()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getEntityType

      public final SharedEntity.TypeDescriptor<SearchRequest> getEntityType()
      Description copied from interface: SharedEntity
      The type of entity it is. Examples include SearchRequest ("SearchRequest") and PortalPage ("PortalPage")
      Specified by:
      getEntityType in interface SharedEntity
      Returns:
      the type of entity.