com.atlassian.jira.issue.search
Class CachingSearchRequestStore

java.lang.Object
  extended by com.atlassian.jira.issue.search.CachingSearchRequestStore
All Implemented Interfaces:
SearchRequestStore

public class CachingSearchRequestStore
extends Object
implements SearchRequestStore

Caching store for SearchRequest. The cache stores a id -> SearchRequest and a searchrequest.owner -> id mapping.

This class is not completely thread safe in that it is possible for the cache and the database to become unsynchronized.

Since:
v3.13

Constructor Summary
CachingSearchRequestStore(SearchRequestStore delegateStore)
           
 
Method Summary
 SearchRequest adjustFavouriteCount(Long searchRequestId, int incrementValue)
          Updates the favourite count of the SearchRequest in the database.
 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 searchId)
          Removes the SearchRequest GenericValue from the database based on its id
 CloseableIterable get(SharedEntityAccessor.RetrievalDescriptor descriptor)
          Get a CloseableIterable of SearchRequests for the specified List of ids.
 CloseableIterable getAll()
          Get a CloseableIterable of all SearchRequests in the database.
 Collection getAllOwnedSearchRequests(User owner)
          Retrieves a collection of SearchRequest objects that a user created.
 Collection getAllRequests()
          Retrieves all the SearchRequests
 SearchRequest getRequestByAuthorAndName(User author, String name)
          Find a search request given the author and the request name.
 SearchRequest getSearchRequest(Long searchRequestId)
          Return the search request as stored in the database
 CloseableIterable getSearchRequests(Group group)
          Get all search requests associated with a given Group.
 CloseableIterable getSearchRequests(Project project)
          Get all search requests associate with a given Project.
 SearchRequest update(SearchRequest request)
          Updates an existing search request in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingSearchRequestStore

public CachingSearchRequestStore(SearchRequestStore delegateStore)
Method Detail

getAllRequests

public Collection getAllRequests()
Description copied from interface: SearchRequestStore
Retrieves all the SearchRequests

Specified by:
getAllRequests in interface SearchRequestStore
Returns:
Returns a list of searchRequest

get

public CloseableIterable get(SharedEntityAccessor.RetrievalDescriptor descriptor)
Description copied from interface: SearchRequestStore
Get a CloseableIterable of SearchRequests for the specified List of ids.

Make sure any CloseableIterator constructed has its close method called after iterating.

Specified by:
get in interface SearchRequestStore
Parameters:
descriptor - retrieval descriptor
Returns:
CloseableIterable that contains reference to SearchRequests with the specified ids.

getAll

public CloseableIterable getAll()
Description copied from interface: SearchRequestStore
Get a CloseableIterable of all SearchRequests in the database.

Make sure any CloseableIterator constructed has its close method called after iterating.

Specified by:
getAll in interface SearchRequestStore
Returns:
CloseableIterable that contains reference to all SearchRequests.

getAllOwnedSearchRequests

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

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

getRequestByAuthorAndName

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

Specified by:
getRequestByAuthorAndName in interface SearchRequestStore
Parameters:
author - Author of the SearchRequest
name - Name of the SearchRequest
Returns:
The SearchRequest, or null if there is no matching request

getSearchRequest

public SearchRequest getSearchRequest(Long searchRequestId)
Description copied from interface: SearchRequestStore
Return the search request as stored in the database

Specified by:
getSearchRequest in interface SearchRequestStore
Parameters:
searchRequestId - Id of the SearchRequest
Returns:
The SearchRequest, or null if the request id does not exist

create

public SearchRequest create(SearchRequest request)
Description copied from interface: SearchRequestStore
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 SearchRequestStore
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: SearchRequestStore
Updates an existing search request in the database.

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

adjustFavouriteCount

public SearchRequest adjustFavouriteCount(Long searchRequestId,
                                          int incrementValue)
Description copied from interface: SearchRequestStore
Updates the favourite count of the SearchRequest in the database.

Specified by:
adjustFavouriteCount in interface SearchRequestStore
Parameters:
searchRequestId - the identifier of the search request to decrease.
incrementValue - the value to increase the favourite count by. Can be a number < 0 to decrease the favourite count.
Returns:
the updated SearchRequest.

delete

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

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

getSearchRequests

public CloseableIterable getSearchRequests(Project project)
Description copied from interface: SearchRequestStore
Get all search requests associate with a given Project.

Specified by:
getSearchRequests in interface SearchRequestStore
Parameters:
project - Project that is associated with the filters
Returns:
Collection of SearchRequest that have their project set to the given project

getSearchRequests

public CloseableIterable getSearchRequests(Group group)
Description copied from interface: SearchRequestStore
Get all search requests associated with a given Group.

Specified by:
getSearchRequests in interface SearchRequestStore
Parameters:
group - the group that is associated with the filters
Returns:
Collection of SearchRequest that have their project set to the given project


Copyright © 2002-2008 Atlassian. All Rights Reserved.