com.atlassian.jira.issue.search
Class DefaultSearchRequestManager

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

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, SearchService searchService, UserUtil userUtil)
           
 
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
 List<SearchRequest> findByNameIgnoreCase(String name)
           
 EnclosedIterable<SearchRequest> get(SharedEntityAccessor.RetrievalDescriptor descriptor)
          Used to get sharable entities from a search result.
 EnclosedIterable<SearchRequest> get(com.atlassian.crowd.embedded.api.User user, SharedEntityAccessor.RetrievalDescriptor descriptor)
          Used to get sharable entities from a search result.
 EnclosedIterable<SearchRequest> getAll()
          Get all SearchRequests.
 EnclosedIterable<SharedEntity> getAllIndexableSharedEntities()
          Get all sharable entities this accessor can see for use in indexing.
 Collection<SearchRequest> getAllOwnedSearchRequests(com.atlassian.crowd.embedded.api.User user)
          Retrieves a collection of SearchRequest objects that a user created.
 SearchRequest getOwnedSearchRequestByName(com.atlassian.crowd.embedded.api.User author, String name)
          Find a search request given the author and the request name.
 SearchRequest getSearchRequestById(Long id)
          Return the search request as stored in the database without any permission checks.
 SearchRequest getSearchRequestById(com.atlassian.crowd.embedded.api.User user, Long id)
          Return the search request as stored in the database if the user has permission to see it.
 String getSearchRequestOwnerUserName(Long id)
          Return the owner of the passed SearchRequest.
 SearchRequest getSharedEntity(Long entityId)
          This will call back to ask for a SharedEntity based on id.
 SearchRequest getSharedEntity(com.atlassian.crowd.embedded.api.User user, Long entityId)
          This is called to get SharedEntity by id If the user is allows to see it
 SharedEntity.TypeDescriptor<SearchRequest> getType()
          Returns the type that this object can work with.
 boolean hasPermissionToUse(com.atlassian.crowd.embedded.api.User user, SearchRequest entity)
          Returns true if the user has permission to use the SharedEntity
 SharedEntitySearchResult<SearchRequest> search(SharedEntitySearchParameters searchParameters, com.atlassian.crowd.embedded.api.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 visitAll(Visitor<SearchRequestEntity> visitor)
          Iterates over all SearchRequests using a Visitor pattern callback.
 
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,
                                   SearchService searchService,
                                   UserUtil userUtil)
Method Detail

get

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

Specified by:
get in interface SharedEntityAccessor<SearchRequest>
Parameters:
descriptor - retrieval descriptor
Returns:
a EnclosedIterable of SharedEntity's

get

public EnclosedIterable<SearchRequest> get(com.atlassian.crowd.embedded.api.User user,
                                           SharedEntityAccessor.RetrievalDescriptor descriptor)
Description copied from interface: SharedEntityAccessor
Used to get sharable entities from a search result. The entities returned may be modified by the user parameter (e.g. permissions or clause sanitisation).

Specified by:
get in interface SharedEntityAccessor<SearchRequest>
Parameters:
user - the user performing the search
descriptor - retrieval descriptor
Returns:
a EnclosedIterable of SharedEntity's

getAll

public EnclosedIterable<SearchRequest> getAll()
Description copied from interface: SearchRequestManager
Get all SearchRequests. WARNING: This method will run horribly slow on systems with a lot of saved filters.

Specified by:
getAll in interface SearchRequestManager
Specified by:
getAll in interface SharedEntityAccessor<SearchRequest>
Returns:
an EnclosedIterable of SearchRequests

visitAll

public void visitAll(Visitor<SearchRequestEntity> visitor)
Description copied from interface: SearchRequestManager
Iterates over all SearchRequests using a Visitor pattern callback.

Specified by:
visitAll in interface SearchRequestManager

getAllIndexableSharedEntities

public EnclosedIterable<SharedEntity> getAllIndexableSharedEntities()
Description copied from interface: SharedEntityAccessor
Get all sharable entities this accessor can see for use in indexing.

Specified by:
getAllIndexableSharedEntities in interface SharedEntityAccessor<SearchRequest>
Returns:
a EnclosedIterable of SharedEntity's

getAllOwnedSearchRequests

public Collection<SearchRequest> getAllOwnedSearchRequests(com.atlassian.crowd.embedded.api.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(com.atlassian.crowd.embedded.api.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(com.atlassian.crowd.embedded.api.User user,
                                          Long id)
Description copied from interface: SearchRequestManager
Return the search request as stored in the database if the user has permission to see it.

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
See Also:
SearchRequestManager.getSearchRequestById(Long)

getSearchRequestById

public SearchRequest getSearchRequestById(Long id)
Description copied from interface: SearchRequestManager
Return the search request as stored in the database without any permission checks.

Specified by:
getSearchRequestById in interface SearchRequestManager
Parameters:
id - The id of the filter
Returns:
The SearchRequest, or null if the request id does not exist
See Also:
SearchRequestManager.getSearchRequestById(User, Long)

findByNameIgnoreCase

public List<SearchRequest> findByNameIgnoreCase(String name)
Specified by:
findByNameIgnoreCase in interface SearchRequestManager

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<SearchRequest> getType()
Description copied from interface: SharedEntityAccessor
Returns the type that this object can work with.

Specified by:
getType in interface SharedEntityAccessor<SearchRequest>
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<SearchRequest>
Parameters:
entity - the entity to adjust
adjustmentValue - the value to adjust by.

search

public SharedEntitySearchResult<SearchRequest> search(SharedEntitySearchParameters searchParameters,
                                                      com.atlassian.crowd.embedded.api.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 SearchRequest 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<SearchRequest>
Parameters:
entityId - the id of the SharedEntity
Returns:
a SharedEntity or null if it cant be found

getSharedEntity

public SearchRequest getSharedEntity(com.atlassian.crowd.embedded.api.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<SearchRequest>
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(com.atlassian.crowd.embedded.api.User user,
                                  SearchRequest entity)
Description copied from interface: SharedEntityAccessor
Returns true if the user has permission to use the SharedEntity

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


Copyright © 2002-2013 Atlassian. All Rights Reserved.