com.atlassian.jira.issue.search
Class CachingSearchRequestStore

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

public class CachingSearchRequestStore
extends java.lang.Object
implements SearchRequestStore, Startable

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, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
Method Summary
 SearchRequest adjustFavouriteCount(java.lang.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(java.lang.Long searchId)
          Removes the SearchRequest GenericValue from the database based on its id
 EnclosedIterable<SearchRequest> get(SharedEntityAccessor.RetrievalDescriptor descriptor)
          Get a EnclosedIterable of SearchRequests for the specified List of ids.
 EnclosedIterable<SearchRequest> getAll()
          Get a EnclosedIterable of all SearchRequests in the database.
 EnclosedIterable<IndexableSharedEntity<SearchRequest>> getAllIndexableSharedEntities()
          Get a EnclosedIterable of all IndexableSharedEntities representing SearchRequests in the database.
 java.util.Collection<SearchRequest> getAllOwnedSearchRequests(com.opensymphony.user.User owner)
          Retrieves a collection of SearchRequest objects that a user created.
 java.util.Collection<SearchRequest> getAllRequests()
          Retrieves all the SearchRequests
 SearchRequest getRequestByAuthorAndName(com.opensymphony.user.User author, java.lang.String name)
          Find a search request given the author and the request name.
 SearchRequest getSearchRequest(java.lang.Long searchRequestId)
          Return the search request as stored in the database
 EnclosedIterable<SearchRequest> getSearchRequests(com.opensymphony.user.Group group)
          Get all search requests associated with a given Group.
 EnclosedIterable<SearchRequest> getSearchRequests(Project project)
          Get all search requests associate with a given Project.
 void onClearCache(ClearCacheEvent event)
           
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 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,
                                 com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail

start

public void start()
           throws java.lang.Exception
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable
Throws:
java.lang.Exception - Allows implementations to throw an Exception.

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

getAllRequests

public java.util.Collection<SearchRequest> getAllRequests()
Description copied from interface: SearchRequestStore
Retrieves all the SearchRequests

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

get

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

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

getAll

public EnclosedIterable<SearchRequest> getAll()
Description copied from interface: SearchRequestStore
Get a EnclosedIterable of all SearchRequests in the database.

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

getAllIndexableSharedEntities

public EnclosedIterable<IndexableSharedEntity<SearchRequest>> getAllIndexableSharedEntities()
Description copied from interface: SearchRequestStore
Get a EnclosedIterable of all IndexableSharedEntities representing SearchRequests in the database. Note: this is used so that we can retrieve all the meta data about a SearchRequest without having to deal with the Query.

Specified by:
getAllIndexableSharedEntities in interface SearchRequestStore
Returns:
CloseableIterable that contains reference to all IndexableSharedEntities representing SearchRequests.

getAllOwnedSearchRequests

public java.util.Collection<SearchRequest> getAllOwnedSearchRequests(com.opensymphony.user.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(com.opensymphony.user.User author,
                                               java.lang.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(java.lang.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(java.lang.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(java.lang.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 EnclosedIterable<SearchRequest> 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 EnclosedIterable<SearchRequest> getSearchRequests(com.opensymphony.user.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-2010 Atlassian. All Rights Reserved.