|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.issue.search.SearchRequest
public class SearchRequest
A class representing a Search Request. Sometimes also referred to as a "Saved search", "Saved Filter", "Search Filter". This sits in the session so all non-serializable properties should be transient and accessed through accessors.
TODO SearchRequest has traditionally been backed by a collection (so you could have mutliple SP with the same name). Is this intended? I don't really see where this is used & all helper methods (getValues) picks out the first named SP anyway. Not sure if we should remove and enforce a single SR only
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.atlassian.jira.sharing.SharedEntity |
---|
SharedEntity.Indentifier, SharedEntity.SharePermissions, SharedEntity.TypeDescriptor |
Field Summary | |
---|---|
static SharedEntity.TypeDescriptor |
ENTITY_TYPE
|
Constructor Summary | |
---|---|
SearchRequest(boolean turnOffSecurity)
This constructor should only be used by internal JIRA queries, as the results will be unprotected (ie no permission checks are done). |
|
SearchRequest(electric.xml.Document doc)
Construct a SearchRequest from its XML representation. |
|
SearchRequest(electric.xml.Document doc,
User searcher)
|
|
SearchRequest(org.ofbiz.core.entity.GenericValue gv)
|
|
SearchRequest(SearchRequest oldSearchRequest,
User searcher)
|
|
SearchRequest(String searcherUserName)
|
|
SearchRequest(String searcherUserName,
String name,
String description)
|
|
SearchRequest(User searcher)
Deprecated. since v3.13. Use SearchRequest(String) instead. |
|
SearchRequest(User searcher,
String name,
String description)
Deprecated. since v3.13. Use SearchRequest(String, String, String) instead. |
Method Summary | |
---|---|
void |
addParameter(SearchParameter parameter)
Add a SearchParameter to this search. |
void |
addParameters(Collection searchParams)
|
void |
addSearchSort(SearchSort searchSort)
|
SearchRequest |
asSearchRequestWithParameters(Collection searchParameters,
Collection searchSorts)
Return a new a copy of this SearchRequest with its search parameters and search sorts replaced with
the passed arguments. |
SearchRequest |
cloneSearchRequest()
|
SearchRequest |
copy()
Return a copy of the SearchRequest . |
void |
createSearchSorts(Map params)
Adds SearchSort parameters to the searchRequest, to specify ordering and sorting of results. |
boolean |
equals(Object o)
|
User |
getAuthor()
Deprecated. since v3.13. Use getOwnerUserName() instead. |
String |
getDescription()
A general description of the entity. |
SharedEntity.TypeDescriptor |
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. |
List |
getLuceneParameters()
|
String |
getName()
The name of the entity. |
String |
getOwnerUserName()
The user name of the owner of the entity. |
SearchParameter |
getParam(String paramName)
Returns the first SearchParameter that matches the given name. |
List |
getParameters()
Returns all the parameters for the search request as a List of SearchParameter |
SharedEntity.SharePermissions |
getPermissions()
The permissions for this entity. |
org.ofbiz.core.entity.GenericValue |
getProject()
Deprecated. since 3.5 (for removal in 3.8). To retrieve the projects that are being searched by a search request check for the existance of ProjectParameter :
SearchParameter projParam = searchRequest.getParam(DocumentConstants.PROJECT_ID)If the projParam is null then all projects are being searched. (TODO Check that this is indeed true). If the param is not null, to retrieve the project ids that are being searched, call: Collection searchedProjectIds = projParam.getValues();searchedProjectIds should be a Collection of Long s. |
String |
getQueryString()
Returns the encoded query string of the current search request |
String |
getQueryStringWithSorts()
Returns the encoded query string of the current search request with sort info |
List |
getReleventSearchers()
|
SearchContext |
getSearchContext()
|
org.ofbiz.core.entity.GenericValue |
getSearchFilterGV()
|
Long |
getSearchFilterId()
|
SearchRequest |
getSearchRequestWithSubstitutions(List substitutions)
This method will return an new instance of a SearchRequest that will have the same parameters as in this SearchRequest except that any parameters listed in the substitutions list will exist in the new SearchRequest in place of any of the same parameters that may have been in this SearchRequest. |
Collection |
getSearchSorts()
|
Collection |
getSearchSortsReverse()
|
List |
getValues(String paramName)
Returns the values of the first SearchParameter that matches the given name. |
electric.xml.Document |
getXml()
Returns the search request as an XML document |
int |
hashCode()
|
boolean |
isContainsParam(String paramName)
Whether the SR contains this param name |
boolean |
isLoaded()
|
boolean |
isModified()
|
boolean |
isOverRideSecurity()
|
void |
removeParameter(SearchParameter parameter)
This method will remove a parameter by name. |
void |
setAuthor(User author)
Deprecated. since v3.13. Use setOwnerUserName(String) instead. |
void |
setDescription(String description)
|
protected void |
setFavouriteCount(Long favouriteCount)
|
protected void |
setId(Long id)
|
void |
setLoaded(boolean loaded)
|
void |
setModified(boolean modified)
|
void |
setName(String name)
|
void |
setOwnerUserName(String ownerUserName)
Set the owner of the SearchRequest. |
void |
setPermissions(SharedEntity.SharePermissions sharePermissions)
|
void |
setSearchContext(SearchContext searchContext)
|
void |
setSearchSorts(Collection searchSorts)
|
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 |
---|
public static final SharedEntity.TypeDescriptor ENTITY_TYPE
Constructor Detail |
---|
public SearchRequest(User searcher)
SearchRequest(String)
instead.
public SearchRequest(User searcher, String name, String description)
SearchRequest(String, String, String)
instead.
public SearchRequest(String searcherUserName)
public SearchRequest(String searcherUserName, String name, String description)
public SearchRequest(boolean turnOffSecurity)
turnOffSecurity
- security on/off flagpublic SearchRequest(electric.xml.Document doc)
doc
- DOM document to construct this search request frompublic SearchRequest(electric.xml.Document doc, User searcher)
public SearchRequest(SearchRequest oldSearchRequest, User searcher)
public SearchRequest(org.ofbiz.core.entity.GenericValue gv) throws SearchException
SearchException
Method Detail |
---|
public SearchContext getSearchContext()
public void setSearchContext(SearchContext searchContext)
public List getReleventSearchers()
public void addParameter(SearchParameter parameter)
parameter
- to be added to this requestpublic void addParameters(Collection searchParams)
public void removeParameter(SearchParameter parameter)
parameter
- the type of parameter to remove.public List getParameters()
SearchParameter
SearchParameter
public List getLuceneParameters()
public List getValues(String paramName)
SearchParameter
that matches the given name.
paramName
- name of a the SearchParameter
SearchParameter
foundpublic SearchParameter getParam(String paramName)
SearchParameter
that matches the given name.
paramName
- name of a the SearchParameter
SearchParameter
found else the SearchParameter
itselfpublic boolean isContainsParam(String paramName)
paramName
- name of a the SearchParameter
public String getQueryString()
public String getQueryStringWithSorts()
public SearchRequest getSearchRequestWithSubstitutions(List substitutions)
substitutions
- a list containing SearchParameter objects that will be inserted into the new SearchRequest object.
public SearchRequest asSearchRequestWithParameters(Collection searchParameters, Collection searchSorts)
SearchRequest
with its search parameters and search sorts replaced with
the passed arguments.
We are currently assuming that the search parameters are not modified once they are saved.
searchParameters
- a collection of SearchParameter
objects for the new request. Cannot be null.searchSorts
- a collection of SearchSort
objects for the the new request. Cannot be null.
IllegalArgumentException
- if either searchParameters or searchSorts is null.public SearchRequest cloneSearchRequest()
public electric.xml.Document getXml()
public void createSearchSorts(Map params)
SearchSort
parameters to the searchRequest, to specify ordering and sorting of results.
params
- sortspublic void addSearchSort(SearchSort searchSort)
public Collection getSearchSorts()
public void setSearchSorts(Collection searchSorts)
public Collection getSearchSortsReverse()
public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public org.ofbiz.core.entity.GenericValue getSearchFilterGV()
public org.ofbiz.core.entity.GenericValue getProject()
ProjectParameter
:
SearchParameter projParam = searchRequest.getParam(DocumentConstants.PROJECT_ID)If the projParam is null then all projects are being searched. (TODO Check that this is indeed true). If the param is not null, to retrieve the project ids that are being searched, call:
Collection searchedProjectIds = projParam.getValues();searchedProjectIds should be a
Collection
of Long
s.
GenericValue
representing the project that is being searched, or null if multiple or
all projects are being searched. Do not use this method, it is evil.public String getName()
SharedEntity
getName
in interface SharedEntity
public void setName(String name)
public Long getId()
SharedEntity
getId
in interface SharedEntity
protected void setId(Long id)
public final SharedEntity.TypeDescriptor getEntityType()
SharedEntity
getEntityType
in interface SharedEntity
public SharedEntity.SharePermissions getPermissions()
SharedEntity
getPermissions
in interface SharedEntity
public void setPermissions(SharedEntity.SharePermissions sharePermissions)
public String getDescription()
SharedEntity
getDescription
in interface SharedEntity
public void setDescription(String description)
protected void setFavouriteCount(Long favouriteCount)
public Long getFavouriteCount()
Favourite
getFavouriteCount
in interface Favourite
public User getAuthor() throws SearchException
getOwnerUserName()
instead.
SearchException
public void setAuthor(User author)
setOwnerUserName(String)
instead.
author
- the new owner of the SearchRequest.public String getOwnerUserName()
SharedEntity
getOwnerUserName
in interface SharedEntity
public void setOwnerUserName(String ownerUserName)
ownerUserName
- the user name of the user who is the search requests owner.public Long getSearchFilterId()
public boolean isModified()
public void setModified(boolean modified)
public boolean isLoaded()
public void setLoaded(boolean loaded)
public boolean useColumns()
public void setUseColumns(boolean useColumns)
public boolean isOverRideSecurity()
public SearchRequest copy()
SearchRequest
. We are currently assuming that the search parameters are
not modified once they are saved.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |