com.atlassian.jira.issue.search
Class DefaultSearchRequestManager

java.lang.Object
  extended by com.atlassian.jira.issue.search.DefaultSearchRequestManager
All Implemented Interfaces:
SearchRequestManager, SharedEntityAccessor

public class DefaultSearchRequestManager
extends Object
implements SearchRequestManager


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.sharing.SharedEntityAccessor
SharedEntityAccessor.Factory, SharedEntityAccessor.RetrievalDescriptor
 
Constructor Summary
DefaultSearchRequestManager(ColumnLayoutManager columnLayoutManager, SubscriptionManager subscriptionManager, ShareManager shareManager, SearchRequestStore searchRequestStore, SharedEntityIndexer indexer)
           
 
Method Summary
 void adjustFavouriteCount(SharedEntity entity, int adjustmentValue)
          Adjusts the favourite counts for a given entity.
 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
 void delete(Long id)
          Removes the SearchRequest GenericValue from the database based on its id
 CloseableIterable get(SharedEntityAccessor.RetrievalDescriptor descriptor)
          Used to get sharable entities from a search result.
 CloseableIterable getAll()
          Get all sharable entities this accessor can see.
 Collection getAllOwnedSearchRequests(User user)
          Retrieves a collection of SearchRequest objects that a user created.
 SearchRequest getOwnedSearchRequestByName(User author, String name)
          Find a search request given the author and the request name.
 SearchRequest getRequest(User searcher, Long id)
          Find a search request given the searcher and the search request ID.
 List getRequests()
          Deprecated. v3.13 Put in for backwards compatibility
 Collection getRequests(User author)
          Deprecated. v3.13 Put in for backwards compatibility
 SearchRequest getSearchRequest(User searcher, Long id)
          Find a search request given the searcher and the search request ID.
 SearchRequest getSearchRequestById(Long id)
           
 SearchRequest getSearchRequestById(User user, Long id)
          Return the search request as stored in the database
 String getSearchRequestOwnerUserName(Long id)
          Return the owner of the passed SearchRequest.
 SharedEntity getSharedEntity(Long entityId)
          This will call back to ask for a SharedEntity based on id.
 SharedEntity getSharedEntity(User user, Long entityId)
          This is called to get SharedEntity by id If the user is allows to see it
 SharedEntity.TypeDescriptor getType()
          Returns the type that this object can work with.
 List getVisibleRequests(User user)
          Return a list of all search requests visible to a given user.
 boolean hasPermissionToUse(User user, SharedEntity entity)
          Returns true if the user has permission to use the SharedEntity
 SharedEntitySearchResult search(SharedEntitySearchParameters searchParameters, User user, int pagePosition, int pageWidth)
          Search for the SearchRequests that match the passed searchParameters.
 SearchRequest update(SearchRequest request)
          Updates an existing search request in the database.
 void validateSearchRequestUpdate(SearchRequest request)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSearchRequestManager

public DefaultSearchRequestManager(ColumnLayoutManager columnLayoutManager,
                                   SubscriptionManager subscriptionManager,
                                   ShareManager shareManager,
                                   SearchRequestStore searchRequestStore,
                                   SharedEntityIndexer indexer)
Method Detail

get

public CloseableIterable get(SharedEntityAccessor.RetrievalDescriptor descriptor)
Description copied from interface: SharedEntityAccessor
Used to get sharable entities from a search result.

Specified by:
get in interface SharedEntityAccessor
Parameters:
descriptor - retrieval descriptor
Returns:
a CloseableIterable of SharedEntity's

getAll

public CloseableIterable getAll()
Description copied from interface: SharedEntityAccessor
Get all sharable entities this accessor can see.

Specified by:
getAll in interface SharedEntityAccessor
Returns:
a CloseableIterable of SharedEntity's

getAllOwnedSearchRequests

public Collection getAllOwnedSearchRequests(User user)
Description copied from interface: SearchRequestManager
Retrieves a collection of SearchRequest objects that a user created.

Specified by:
getAllOwnedSearchRequests in interface SearchRequestManager
Parameters:
user - The user who created the SearchRequests
Returns:
Collection of all SearchRequest that user created.

getOwnedSearchRequestByName

public SearchRequest getOwnedSearchRequestByName(User author,
                                                 String name)
Description copied from interface: SearchRequestManager
Find a search request given the author and the request name.

Specified by:
getOwnedSearchRequestByName in interface SearchRequestManager
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

public SearchRequest getSearchRequestById(Long id)

getSearchRequestById

public SearchRequest getSearchRequestById(User user,
                                          Long id)
Description copied from interface: SearchRequestManager
Return the search request as stored in the database

Specified by:
getSearchRequestById in interface SearchRequestManager
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

getSearchRequestOwnerUserName

public String getSearchRequestOwnerUserName(Long id)
Description copied from interface: SearchRequestManager
Return the owner of the passed SearchRequest. This is mainly used for permission checks.

Specified by:
getSearchRequestOwnerUserName in interface SearchRequestManager
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.

create

public SearchRequest create(SearchRequest request)
Description copied from interface: SearchRequestManager
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

Specified by:
create in interface SearchRequestManager
Parameters:
request - SearchResult that should be persisted
Returns:
SearchRequest object that was persisted to the database

update

public SearchRequest update(SearchRequest request)
Description copied from interface: SearchRequestManager
Updates an existing search request in the database.

Specified by:
update in interface SearchRequestManager
Parameters:
request - the request to persist
Returns:
A SearchRequest that was persisted to the database

delete

public void delete(Long id)
Description copied from interface: SearchRequestManager
Removes the SearchRequest GenericValue from the database based on its id

Specified by:
delete in interface SearchRequestManager
Parameters:
id - of the search request to be removed from storage

getType

public SharedEntity.TypeDescriptor getType()
Description copied from interface: SharedEntityAccessor
Returns the type that this object can work with.

Specified by:
getType in interface SharedEntityAccessor
Returns:
the type that this object can work with.

adjustFavouriteCount

public void adjustFavouriteCount(SharedEntity entity,
                                 int adjustmentValue)
Description copied from interface: SharedEntityAccessor
Adjusts the favourite counts for a given entity. This resulting value must always be greater or equal to one.

Specified by:
adjustFavouriteCount in interface SharedEntityAccessor
Parameters:
entity - the entity to adjust
adjustmentValue - the value to adjust by.

validateSearchRequestUpdate

public void validateSearchRequestUpdate(SearchRequest request)

getVisibleRequests

public List getVisibleRequests(User user)
Description copied from interface: SearchRequestManager
Return a list of all search requests visible to a given user.

Specified by:
getVisibleRequests in interface SearchRequestManager
Parameters:
user - The user to find search requests for
Returns:
A list of visible search requests

getRequest

public SearchRequest getRequest(User searcher,
                                Long id)
Description copied from interface: SearchRequestManager
Find a search request given the searcher and the search request ID.

Specified by:
getRequest in interface SearchRequestManager
Parameters:
searcher - The user to check permissions for.
id - The id of the SearchRequest
Returns:
The SearchRequest, or null if there is no matching request for this searcher.

getSearchRequest

public SearchRequest getSearchRequest(User searcher,
                                      Long id)
Description copied from interface: SearchRequestManager
Find a search request given the searcher and the search request ID.

Specified by:
getSearchRequest in interface SearchRequestManager
Parameters:
searcher - The user to check permissions for.
id - The id of the SearchRequest
Returns:
The SearchRequest, or null if there is no matching request for this searcher.

getRequests

public List getRequests()
                 throws org.ofbiz.core.entity.GenericEntityException
Deprecated. v3.13 Put in for backwards compatibility

Description copied from interface: SearchRequestManager
Retrieves all the SearchRequest GenericValues

Specified by:
getRequests in interface SearchRequestManager
Returns:
Returns a list of searchRequest GenericValues
Throws:
org.ofbiz.core.entity.GenericEntityException - thrown if error occurs in database

getRequests

public Collection getRequests(User author)
Deprecated. v3.13 Put in for backwards compatibility

Description copied from interface: SearchRequestManager
Retrieves all the SearchRequest GenericValues from a particular user

Specified by:
getRequests in interface SearchRequestManager
Parameters:
author - to retrieve all the SearchRequests for
Returns:
Returns a list of searchRequest GenericValues. Empty list if none exists

search

public SharedEntitySearchResult search(SharedEntitySearchParameters searchParameters,
                                       User user,
                                       int pagePosition,
                                       int pageWidth)
Description copied from interface: SearchRequestManager
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 SearchRequestManager
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.

getSharedEntity

public SharedEntity getSharedEntity(Long entityId)
Description copied from interface: SharedEntityAccessor
This will call back to ask for a SharedEntity based on id.

Specified by:
getSharedEntity in interface SharedEntityAccessor
Parameters:
entityId - the id of the SharedEntity
Returns:
a SharedEntity or null if it cant be found

getSharedEntity

public SharedEntity getSharedEntity(User user,
                                    Long entityId)
Description copied from interface: SharedEntityAccessor
This is called to get SharedEntity by id If the user is allows to see it

Specified by:
getSharedEntity in interface SharedEntityAccessor
Parameters:
user - the user in play
entityId - the id of the SharedEntity
Returns:
a SharedEntity if it exists and the user can see it and null otherwise

hasPermissionToUse

public boolean hasPermissionToUse(User user,
                                  SharedEntity entity)
Description copied from interface: SharedEntityAccessor
Returns true if the user has permission to use the SharedEntity

Specified by:
hasPermissionToUse in interface SharedEntityAccessor
Parameters:
user - the user in play
entity - the SharedEntity to check
Returns:
true if the user has permission to use it


Copyright © 2002-2009 Atlassian. All Rights Reserved.