public class DefaultSearchRequestManager extends Object implements SearchRequestManager
SharedEntityAccessor.Factory, SharedEntityAccessor.RetrievalDescriptor
Constructor and Description |
---|
DefaultSearchRequestManager(ColumnLayoutManager columnLayoutManager,
SubscriptionManager subscriptionManager,
ShareManager shareManager,
SearchRequestStore searchRequestStore,
SharedEntityIndexer indexer,
SearchService searchService) |
Modifier and Type | Method and Description |
---|---|
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(ApplicationUser user,
SharedEntityAccessor.RetrievalDescriptor descriptor)
Used to get
sharable entities from a search result. |
EnclosedIterable<SearchRequest> |
get(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(ApplicationUser user)
Retrieves a collection of SearchRequest objects that a user created.
|
SearchRequest |
getOwnedSearchRequestByName(ApplicationUser author,
String name)
Find a search request given the author and the request name.
|
SearchRequest |
getSearchRequestById(ApplicationUser user,
Long id)
Return the search request as stored in the database if the user has permission to see it.
|
SearchRequest |
getSearchRequestById(Long id)
Return the search request as stored in the database without any permission checks.
|
ApplicationUser |
getSearchRequestOwner(Long id) |
String |
getSearchRequestOwnerUserName(Long id) |
EnclosedIterable<SearchRequest> |
getSearchRequests(ApplicationUser user,
SharedEntityAccessor.RetrievalDescriptor descriptor)
Used to get
sharable entities from a search result filtered
to only those that are shared with the searcher. |
SearchRequest |
getSharedEntity(ApplicationUser user,
Long entityId)
This is called to get
SharedEntity by id If the user is allows to see it |
SearchRequest |
getSharedEntity(Long entityId)
This will call back to ask for a
SharedEntity based on id. |
SharedEntity.TypeDescriptor<SearchRequest> |
getType()
Returns the type that this object can work with.
|
boolean |
hasPermissionToUse(ApplicationUser user,
SearchRequest entity)
Returns true if the user has permission to use the
SharedEntity |
SharedEntitySearchResult<SearchRequest> |
search(SharedEntitySearchParameters searchParameters,
ApplicationUser 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.
|
public DefaultSearchRequestManager(ColumnLayoutManager columnLayoutManager, SubscriptionManager subscriptionManager, ShareManager shareManager, SearchRequestStore searchRequestStore, SharedEntityIndexer indexer, SearchService searchService)
public EnclosedIterable<SearchRequest> get(SharedEntityAccessor.RetrievalDescriptor descriptor)
SharedEntityAccessor
sharable entities
from a search result.get
in interface SharedEntityAccessor<SearchRequest>
descriptor
- retrieval descriptorEnclosedIterable
of SharedEntity
'spublic EnclosedIterable<SearchRequest> get(ApplicationUser user, SharedEntityAccessor.RetrievalDescriptor descriptor)
SharedEntityAccessor
sharable entities
from a search result.
The entities returned may be modified by the user parameter (e.g. permissions or clause sanitisation).get
in interface SharedEntityAccessor<SearchRequest>
user
- the user performing the searchdescriptor
- retrieval descriptorEnclosedIterable
of SharedEntity
'spublic EnclosedIterable<SearchRequest> getSearchRequests(ApplicationUser user, SharedEntityAccessor.RetrievalDescriptor descriptor)
SearchRequestManager
sharable entities
from a search result filtered
to only those that are shared with the searcher.
The entities returned may be modified by the user parameter (e.g. permissions or clause sanitisation).getSearchRequests
in interface SearchRequestManager
user
- the user performing the searchdescriptor
- retrieval descriptorEnclosedIterable
of SharedEntity
'spublic EnclosedIterable<SearchRequest> getAll()
SearchRequestManager
getAll
in interface SearchRequestManager
getAll
in interface SharedEntityAccessor<SearchRequest>
EnclosedIterable
of SearchRequestspublic void visitAll(Visitor<SearchRequestEntity> visitor)
SearchRequestManager
visitAll
in interface SearchRequestManager
public EnclosedIterable<SharedEntity> getAllIndexableSharedEntities()
SharedEntityAccessor
sharable entities
this accessor can see for use in indexing.getAllIndexableSharedEntities
in interface SharedEntityAccessor<SearchRequest>
EnclosedIterable
of SharedEntity
'spublic Collection<SearchRequest> getAllOwnedSearchRequests(ApplicationUser user)
SearchRequestManager
getAllOwnedSearchRequests
in interface SearchRequestManager
user
- The user who created the SearchRequestsSearchRequest
that user created.public SearchRequest getOwnedSearchRequestByName(ApplicationUser author, String name)
SearchRequestManager
getOwnedSearchRequestByName
in interface SearchRequestManager
author
- The author of the SearchRequestname
- The name of the SearchRequestpublic SearchRequest getSearchRequestById(ApplicationUser user, Long id)
SearchRequestManager
getSearchRequestById
in interface SearchRequestManager
user
- The user to check shares withid
- The id of the filterSearchRequestManager.getSearchRequestById(Long)
public SearchRequest getSearchRequestById(Long id)
SearchRequestManager
getSearchRequestById
in interface SearchRequestManager
id
- The id of the filterpublic List<SearchRequest> findByNameIgnoreCase(String name)
findByNameIgnoreCase
in interface SearchRequestManager
public String getSearchRequestOwnerUserName(Long id)
getSearchRequestOwnerUserName
in interface SearchRequestManager
id
- the identifier of the SearchRequest.public ApplicationUser getSearchRequestOwner(Long id)
getSearchRequestOwner
in interface SearchRequestManager
public SearchRequest create(SearchRequest request)
SearchRequestManager
create
in interface SearchRequestManager
request
- SearchResult that should be persistedpublic SearchRequest update(SearchRequest request)
SearchRequestManager
update
in interface SearchRequestManager
request
- the request to persistSearchRequest
that was persisted to the databasepublic void delete(Long id)
SearchRequestManager
delete
in interface SearchRequestManager
id
- of the search request to be removed from storagepublic SharedEntity.TypeDescriptor<SearchRequest> getType()
SharedEntityAccessor
getType
in interface SharedEntityAccessor<SearchRequest>
public void adjustFavouriteCount(SharedEntity entity, int adjustmentValue)
SharedEntityAccessor
adjustFavouriteCount
in interface SharedEntityAccessor<SearchRequest>
entity
- the entity to adjustadjustmentValue
- the value to adjust by.public SharedEntitySearchResult<SearchRequest> search(SharedEntitySearchParameters searchParameters, ApplicationUser user, int pagePosition, int pageWidth)
SearchRequestManager
search
in interface SearchRequestManager
searchParameters
- the searchParameters to query.user
- the user performing the search.pagePosition
- the page to return.pageWidth
- the number of results per page.public SearchRequest getSharedEntity(Long entityId)
SharedEntityAccessor
SharedEntity
based on id.getSharedEntity
in interface SharedEntityAccessor<SearchRequest>
entityId
- the id of the SharedEntity
SharedEntity
or null if it cant be foundpublic SearchRequest getSharedEntity(ApplicationUser user, Long entityId)
SharedEntityAccessor
SharedEntity
by id If the user is allows to see itgetSharedEntity
in interface SharedEntityAccessor<SearchRequest>
user
- the user in playentityId
- the id of the SharedEntity
SharedEntity
if it exists and the user can see it and null otherwisepublic boolean hasPermissionToUse(ApplicationUser user, SearchRequest entity)
SharedEntityAccessor
SharedEntity
hasPermissionToUse
in interface SharedEntityAccessor<SearchRequest>
user
- the user in playentity
- the SharedEntity
to checkCopyright © 2002-2015 Atlassian. All Rights Reserved.