com.atlassian.jira.issue.search
Class SearchRequest

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

@PublicApi
public class SearchRequest
extends Object
implements SharedEntity

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.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.sharing.SharedEntity
SharedEntity.Identifier, SharedEntity.SharePermissions, SharedEntity.TypeDescriptor<S extends SharedEntity>
 
Field Summary
static SharedEntity.TypeDescriptor<SearchRequest> ENTITY_TYPE
           
 
Constructor Summary
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 .
SearchRequest(Query query)
          Creates a SearchRequest with the specified Query and no other attributes.
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.
SearchRequest(Query query, ApplicationUser owner, String name, String description, Long id, long favouriteCount)
          Build a SearchRequest with the provided attributes.
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.
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.
SearchRequest(SearchRequest oldRequest)
          Used to create a SearchRequest that copies all the information from the old search request.
 
Method Summary
 boolean equals(Object o)
           
 String getDescription()
          A general description of the entity.
 SharedEntity.TypeDescriptor<SearchRequest> getEntityType()
          The type of entity it is.
 Long getFavouriteCount()
          The number of users who have marked this entity as one of their favourites.
 Long getId()
          The id of the entity.
 String getName()
          The name of the entity.
 ApplicationUser getOwner()
           
 String getOwnerUserName()
           
 SharedEntity.SharePermissions getPermissions()
          The permissions for this entity.
 Query getQuery()
          Gets the SearchQuery that defines the search that will be performed for this SearchRequest.
 int hashCode()
           
 boolean isLoaded()
           
 boolean isModified()
           
 void setDescription(String description)
           
protected  void setFavouriteCount(Long favouriteCount)
           
 void setModified(boolean modified)
           
 void setName(String name)
           
 void setOwner(ApplicationUser owner)
          Set the owner of the SearchRequest.
 void setOwnerUserName(String ownerUserName)
          Deprecated. Use setOwner(com.atlassian.jira.user.ApplicationUser) instead. Since v6.0. Set the owner of the SearchRequest.
 void setPermissions(SharedEntity.SharePermissions sharePermissions)
           
 void setQuery(Query query)
           
 void setUseColumns(boolean useColumns)
           
 String toString()
           
 boolean useColumns()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ENTITY_TYPE

public static final SharedEntity.TypeDescriptor<SearchRequest> ENTITY_TYPE
Constructor Detail

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 Detail

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)

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)

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.


Copyright © 2002-2014 Atlassian. All Rights Reserved.