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
 List<SearchRequest> findByNameIgnoreCase(String name)
          Find search requests matching the given name.
 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.
 Collection<SearchRequest> getAllOwnedSearchRequests(ApplicationUser owner)
          Retrieves a collection of SearchRequest objects that a user created.
 SearchRequest getRequestByAuthorAndName(ApplicationUser 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
 EnclosedIterable<SearchRequest> getSearchRequests(com.atlassian.crowd.embedded.api.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)
           
 SearchRequest update(SearchRequest request)
          Updates an existing search request in the database.
 void visitAll(Visitor<SearchRequestEntity> visitor)
           
 
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

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

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.

visitAll

public void visitAll(Visitor<SearchRequestEntity> visitor)
Specified by:
visitAll in interface SearchRequestStore

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 Collection<SearchRequest> getAllOwnedSearchRequests(ApplicationUser 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(ApplicationUser 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 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

findByNameIgnoreCase

public List<SearchRequest> findByNameIgnoreCase(String name)
Description copied from interface: SearchRequestStore
Find search requests matching the given name.

Specified by:
findByNameIgnoreCase in interface SearchRequestStore
Parameters:
name - Name of the SearchRequest
Returns:
List of all search requests matching the given name. Never null.

getSearchRequests

public EnclosedIterable<SearchRequest> getSearchRequests(com.atlassian.crowd.embedded.api.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-2013 Atlassian. All Rights Reserved.