com.atlassian.jira.issue.search.managers
Class DefaultSearchHandlerManager

java.lang.Object
  extended by com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager
All Implemented Interfaces:
SearchHandlerManager

@ThreadSafe
public final class DefaultSearchHandlerManager
extends Object
implements SearchHandlerManager

Default JIRA implementation of SearchHandlerManager.

Since:
v4.0

Constructor Summary
DefaultSearchHandlerManager(FieldManager fieldManager, CustomFieldManager customFieldManager, SystemClauseHandlerFactory systemClauseHandlerFactory, QueryCache queryCache, com.atlassian.cache.CacheManager cacheManager)
           
 
Method Summary
 Collection<IssueSearcher<?>> getAllSearchers()
          Return all the active searchers in JIRA.
 Collection<ClauseHandler> getClauseHandler(String jqlClauseName)
          Return a collection of ClauseHandlers registered against the passed JQL clause name.
 Collection<ClauseHandler> getClauseHandler(com.atlassian.crowd.embedded.api.User user, String jqlClauseName)
          Return a collection of ClauseHandlers registered against the passed JQL clause name.
 Collection<String> getFieldIds(String jqlClauseName)
          Gets the field ids that are associated with the provided jqlClauseName.
 Collection<String> getFieldIds(com.atlassian.crowd.embedded.api.User searcher, String jqlClauseName)
          Gets the field ids that are associated with the provided jqlClauseName.
 Collection<ClauseNames> getJqlClauseNames(String fieldId)
          Get the ClauseNames associated with the provided field name.
 IssueSearcher<?> getSearcher(String id)
          Get a searcher by the searchers name.
 Collection<SearcherGroup> getSearcherGroups()
          Get all searcher groups.
 Collection<SearcherGroup> getSearcherGroups(SearchContext searchContext)
          Get all searcher groups with the IssueSearcher that are applicable for the context.
 Collection<IssueSearcher<?>> getSearchers(com.atlassian.crowd.embedded.api.User searcher, SearchContext context)
          Get searchers that are applicable for a given context.
 Collection<IssueSearcher<?>> getSearchersByClauseName(com.atlassian.crowd.embedded.api.User user, String jqlClauseName)
          Return a collection of IssueSearchers registered against the passed JQL clause name.
 Collection<IssueSearcher<?>> getSearchersByClauseName(com.atlassian.crowd.embedded.api.User user, String jqlClauseName, SearchContext searchContext)
          Return a collection of IssueSearchers registered against the passed JQL clause name.
 Collection<ClauseHandler> getVisibleClauseHandlers(com.atlassian.crowd.embedded.api.User searcher)
          Get all the available clause handlers that the searcher can see.
 Collection<ClauseNames> getVisibleJqlClauseNames(com.atlassian.crowd.embedded.api.User searcher)
          Get all the available clause names that the searcher can see.
 void onClearCache(ClearCacheEvent event)
           
 void onPluginModuleDisabled(com.atlassian.plugin.event.events.PluginModuleDisabledEvent event)
           
 void onPluginModuleEnabled(com.atlassian.plugin.event.events.PluginModuleEnabledEvent event)
           
 void refresh()
          Refreshes the SearchHandlerManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSearchHandlerManager

public DefaultSearchHandlerManager(FieldManager fieldManager,
                                   CustomFieldManager customFieldManager,
                                   SystemClauseHandlerFactory systemClauseHandlerFactory,
                                   QueryCache queryCache,
                                   com.atlassian.cache.CacheManager cacheManager)
Method Detail

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

onPluginModuleEnabled

@EventListener
public void onPluginModuleEnabled(com.atlassian.plugin.event.events.PluginModuleEnabledEvent event)

onPluginModuleDisabled

@EventListener
public void onPluginModuleDisabled(com.atlassian.plugin.event.events.PluginModuleDisabledEvent event)

getClauseHandler

public Collection<ClauseHandler> getClauseHandler(com.atlassian.crowd.embedded.api.User user,
                                                  String jqlClauseName)
Description copied from interface: SearchHandlerManager
Return a collection of ClauseHandlers registered against the passed JQL clause name. This will only return the handlers that the user has permission to see as specified by the ClausePermissionChecker.hasPermissionToUseClause(User) method. The reason this is returning a collection is that custom fields can have the same JQL clause name and therefore resolve to multiple clause handlers, this will never be the case for System fields, we don't allow it!

Specified by:
getClauseHandler in interface SearchHandlerManager
Parameters:
user - that will be used to perform a permission check.
jqlClauseName - the clause name to search for.
Returns:
A collection of ClauseHandler that are associated with the passed JQL clause name. An empty collection will be returned to indicate failure.

getClauseHandler

public Collection<ClauseHandler> getClauseHandler(String jqlClauseName)
Description copied from interface: SearchHandlerManager
Return a collection of ClauseHandlers registered against the passed JQL clause name. This will return all available handlers, regardless of permissions. The reason this is returning a collection is that custom fields can have the same JQL clause name and therefore resolve to multiple clause handlers, this will never be the case for System fields, we don't allow it!

Specified by:
getClauseHandler in interface SearchHandlerManager
Parameters:
jqlClauseName - the clause name to search for.
Returns:
A collection of ClauseHandler that are associated with the passed JQL clause name. An empty collection will be returned to indicate failure.

getJqlClauseNames

public Collection<ClauseNames> getJqlClauseNames(String fieldId)
Description copied from interface: SearchHandlerManager
Get the ClauseNames associated with the provided field name. A collection can be returned because it is possible for multiple clause handlers to register against the same field.

Specified by:
getJqlClauseNames in interface SearchHandlerManager
Parameters:
fieldId - the Field.getId().
Returns:
the ClauseNames associated with the provided field name. Empty collection is returned when the field has no JQL names (i.e. no clause handlers) associated with it.

getVisibleJqlClauseNames

public Collection<ClauseNames> getVisibleJqlClauseNames(com.atlassian.crowd.embedded.api.User searcher)
Description copied from interface: SearchHandlerManager
Get all the available clause names that the searcher can see.

Specified by:
getVisibleJqlClauseNames in interface SearchHandlerManager
Parameters:
searcher - that will be used to perform a permission check.
Returns:
the ClauseNames visible to the user. Empty collection is returned when the can see no clauses.

getVisibleClauseHandlers

public Collection<ClauseHandler> getVisibleClauseHandlers(com.atlassian.crowd.embedded.api.User searcher)
Description copied from interface: SearchHandlerManager
Get all the available clause handlers that the searcher can see.

Specified by:
getVisibleClauseHandlers in interface SearchHandlerManager
Parameters:
searcher - that will be used to perform a permission check.
Returns:
the ClauseHandler visible to the user. Empty collection is returned when the can see no clauses.

getFieldIds

public Collection<String> getFieldIds(com.atlassian.crowd.embedded.api.User searcher,
                                      String jqlClauseName)
Description copied from interface: SearchHandlerManager
Gets the field ids that are associated with the provided jqlClauseName. The reason this returns a collection is that custom fields can have the same JQL clause name and therefore resolve to multiple field ids. This will only return the fields associated with clause handlers that the user has permission to see as specified by the ClausePermissionChecker.hasPermissionToUseClause(com.atlassian.crowd.embedded.api.User) method.

Specified by:
getFieldIds in interface SearchHandlerManager
Parameters:
searcher - that will be used to perform a permission check.
jqlClauseName - the clause name to find the field id for.
Returns:
the field ids that are associated with the provided jqlClauseName, empty collection if not found

getFieldIds

public Collection<String> getFieldIds(String jqlClauseName)
Description copied from interface: SearchHandlerManager
Gets the field ids that are associated with the provided jqlClauseName. The reason this returns a collection is that custom fields can have the same JQL clause name and therefore resolve to multiple field ids.

Specified by:
getFieldIds in interface SearchHandlerManager
Parameters:
jqlClauseName - the clause name to find the field id for.
Returns:
the field ids that are associated with the provided jqlClauseName, empty collection if not found

getSearchersByClauseName

public Collection<IssueSearcher<?>> getSearchersByClauseName(com.atlassian.crowd.embedded.api.User user,
                                                             String jqlClauseName,
                                                             SearchContext searchContext)
Description copied from interface: SearchHandlerManager
Return a collection of IssueSearchers registered against the passed JQL clause name. This will only return the IssueSearchers that the user has permission to see as specified by the SearchRenderer.isShown(User, com.atlassian.jira.issue.search.SearchContext) method.

Specified by:
getSearchersByClauseName in interface SearchHandlerManager
Parameters:
user - that will be used to perform a permission check.
jqlClauseName - the clause name to search for.
searchContext - the search context under which the searchers must be shown
Returns:
A collection of IssueSearchers that are associetd with the passed JQL clause name. An empty collection will be returned to indicate failure.

getSearchersByClauseName

public Collection<IssueSearcher<?>> getSearchersByClauseName(com.atlassian.crowd.embedded.api.User user,
                                                             String jqlClauseName)
Description copied from interface: SearchHandlerManager
Return a collection of IssueSearchers registered against the passed JQL clause name. This will only return the IssueSearchers that the user has permission to see as specified by the SearchRenderer.isShown(User, com.atlassian.jira.issue.search.SearchContext) method.

Specified by:
getSearchersByClauseName in interface SearchHandlerManager
Parameters:
user - that will be used to perform a permission check.
jqlClauseName - the clause name to search for.
Returns:
A collection of IssueSearchers that are associetd with the passed JQL clause name. An empty collection will be returned to indicate failure.

getSearchers

public Collection<IssueSearcher<?>> getSearchers(com.atlassian.crowd.embedded.api.User searcher,
                                                 SearchContext context)
Description copied from interface: SearchHandlerManager
Get searchers that are applicable for a given context. This is found through the com.atlassian.jira.issue.search.searchers.IssueSearcher#getSearchRenderer()#isShown(com.atlassian.jira.issue.search.SearchContext) method.

Specified by:
getSearchers in interface SearchHandlerManager
Parameters:
searcher - performing this action.
context - for the list of searchers. Must not be null
Returns:
Collection of IssueSearcher

getAllSearchers

public Collection<IssueSearcher<?>> getAllSearchers()
Description copied from interface: SearchHandlerManager
Return all the active searchers in JIRA. It will not return the searchers unless they are associated with a field.

Specified by:
getAllSearchers in interface SearchHandlerManager
Returns:
all the searchers in JIRA.

getSearcherGroups

public Collection<SearcherGroup> getSearcherGroups(SearchContext searchContext)
Description copied from interface: SearchHandlerManager
Get all searcher groups with the IssueSearcher that are applicable for the context. com.atlassian.jira.issue.search.searchers.IssueSearcher#getSearchRenderer()#isShown(SearchContext) method. Note that the SearcherGroup will still appear even if no IssueSearcher are shown for the group.

Specified by:
getSearcherGroups in interface SearchHandlerManager
Parameters:
searchContext - for the searcher groups.
Returns:
Collection of SearcherGroup

getSearcherGroups

public Collection<SearcherGroup> getSearcherGroups()
Description copied from interface: SearchHandlerManager
Get all searcher groups. Note that the SearcherGroup will still appear even if no IssueSearcher are shown for the group.

Specified by:
getSearcherGroups in interface SearchHandlerManager
Returns:
Collection of SearcherGroup

getSearcher

public IssueSearcher<?> getSearcher(String id)
Description copied from interface: SearchHandlerManager
Get a searcher by the searchers name.

Specified by:
getSearcher in interface SearchHandlerManager
Parameters:
id - the string identifier returned by com.atlassian.jira.issue.search.searchers.IssueSearcher#getSearchInformation()#getId()
Returns:
the searcher matching the id, null if none is found.

refresh

public void refresh()
Description copied from interface: SearchHandlerManager
Refreshes the SearchHandlerManager.

Specified by:
refresh in interface SearchHandlerManager


Copyright © 2002-2015 Atlassian. All Rights Reserved.