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,
com.atlassian.event.api.EventPublisher eventPublisher) |
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 |
boolean |
hasShareRights(ApplicationUser user,
SearchRequest searchRequest,
ShareRight shareRights)
Checks if provided user has share rights for given search request.
|
SharedEntitySearchResult<SearchRequest> |
search(SharedEntitySearchParameters searchParameters,
ApplicationUser user,
int pagePosition,
int pageWidth)
Search for the SearchRequests that match the passed searchParameters.
|
SearchRequest |
update(ApplicationUser editor,
SearchRequest requestToPersist)
Updates an existing search request in the database.
|
SearchRequest |
update(SearchRequest requestToPersist)
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, com.atlassian.event.api.EventPublisher eventPublisher)
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
WARNING: This method will run horribly slow on systems with a lot of saved filters.
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 requestToPersist)
SearchRequestManager
update
in interface SearchRequestManager
requestToPersist
- the request to persistSearchRequest
that was persisted to the database and by default sanitized for the owner of the request.
To change the default behaviour use SearchRequestManager.update(ApplicationUser, SearchRequest)
insteadpublic SearchRequest update(ApplicationUser editor, SearchRequest requestToPersist)
SearchRequestManager
update
in interface SearchRequestManager
editor
- application user which updates the search requestrequestToPersist
- the request to persistSearchRequest
that was persisted to the database and sanitized for the editorpublic 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
search
in interface SharedEntityAccessor<SearchRequest>
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 checkpublic boolean hasShareRights(@Nullable ApplicationUser user, @Nonnull SearchRequest searchRequest, @Nonnull ShareRight shareRights)
SearchRequestManager
hasShareRights
in interface SearchRequestManager
user
- user which wants for example view or edit the entitysearchRequest
- search request which permissions and ownership are going to be checkedshareRights
- share right which will be checked if user has itCopyright © 2002-2021 Atlassian. All Rights Reserved.