com.atlassian.jira.web.action.util.sharing
Class SharedEntitySearchViewHelper<E extends SharedEntity>

java.lang.Object
  extended by com.atlassian.jira.web.action.util.sharing.SharedEntitySearchViewHelper<E>
Direct Known Subclasses:
FilterViewHelper

public abstract class SharedEntitySearchViewHelper<E extends SharedEntity>
extends java.lang.Object

A class that makes searching for Shared Entities easier.

Since:
v3.13

Nested Class Summary
static class SharedEntitySearchViewHelper.SearchResult<E>
          Represents a page of results of the search.
static class SharedEntitySearchViewHelper.SortColumn
          Container for sorting constants.
 
Constructor Summary
SharedEntitySearchViewHelper(ShareTypeFactory shareTypeFactory, JiraAuthenticationContext authCtx, java.lang.String applicationContext, java.lang.String actionUrlPrefix, java.lang.String viewParameter, java.lang.String viewValue, SharedEntity.TypeDescriptor entityType)
           
 
Method Summary
protected  java.lang.StringBuffer addParameter(java.lang.StringBuffer url, java.lang.String key, java.lang.Object value)
           
protected  java.lang.StringBuffer createBasicUrlSearchParams()
          Creates the basic URL parameters needed to keep the current search state.
protected abstract  SharedEntitySearchResult<E> doExecuteSearch(JiraServiceContext ctx, SharedEntitySearchParameters searchParameters, int pageOffset, int pageWidth)
          Execute the search for the passed parameters.
 java.lang.String generateSortCssClass(java.lang.String sortColumnName)
          Return the CSS class(es) to display the passed column's sort status.
 java.lang.String generateSortIcon(java.lang.String sortColumnName)
          Return the HTML for the sort icon used to display the sort order for the passed column.
 java.lang.String generateSortUrl(java.lang.String sortColumnName)
          Return the URL that can be used to sort by the passed column.
 java.lang.String getGroupShare()
           
 java.lang.Long getPagingOffset()
           
 java.util.List<E> getPopularFilters(JiraServiceContext jiraServiceContext)
          Gets the filters which have been made favourite by the most people.
 java.lang.String getProjectShare()
           
 java.lang.String getRoleShare()
           
 java.lang.String getSearchName()
           
 java.lang.String getSearchOwnerUserName()
           
 java.lang.String getSearchShareType()
           
 java.lang.String getSearchShareTypeJSON()
          Produces a JSON representation of the current form state.
 java.util.List<ShareTypeRendererBean> getShareTypeRendererBeans()
          Returns the ShareTypeRendererBeans used by the front end to render each type of sharing that a filter could have.
 java.lang.String getSortColumn()
           
 boolean isSortAscending()
           
 SharedEntitySearchViewHelper.SearchResult<E> search(JiraServiceContext jiraServiceContext)
          Performs the search for filters based on the configured state.
 void setGroupShare(java.lang.String groupShare)
           
 void setPagingOffset(java.lang.Long pagingOffset)
           
 void setProjectShare(java.lang.String projectShare)
           
 void setRoleShare(java.lang.String roleShare)
           
 void setSearchName(java.lang.String searchName)
           
 void setSearchOwnerUserName(java.lang.String searchOwnerUserName)
           
 void setSearchShareType(java.lang.String searchShareType)
           
 void setSortAscending(boolean sortAscending)
           
 void setSortColumn(java.lang.String sortColumn)
           
protected abstract  boolean validateSearchParameters(JiraServiceContext ctx, SharedEntitySearchParameters searchParameters, int pageOffset, int pageWidth)
          Ensure that it is possible to execute a search with the passed parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedEntitySearchViewHelper

public SharedEntitySearchViewHelper(ShareTypeFactory shareTypeFactory,
                                    JiraAuthenticationContext authCtx,
                                    java.lang.String applicationContext,
                                    java.lang.String actionUrlPrefix,
                                    java.lang.String viewParameter,
                                    java.lang.String viewValue,
                                    SharedEntity.TypeDescriptor entityType)
Method Detail

getSearchName

public java.lang.String getSearchName()

setSearchName

public void setSearchName(java.lang.String searchName)

getSearchOwnerUserName

public java.lang.String getSearchOwnerUserName()

setSearchOwnerUserName

public void setSearchOwnerUserName(java.lang.String searchOwnerUserName)

getSearchShareType

public java.lang.String getSearchShareType()

setSearchShareType

public void setSearchShareType(java.lang.String searchShareType)

setGroupShare

public void setGroupShare(java.lang.String groupShare)

getGroupShare

public java.lang.String getGroupShare()

getPagingOffset

public java.lang.Long getPagingOffset()

setProjectShare

public void setProjectShare(java.lang.String projectShare)

getProjectShare

public java.lang.String getProjectShare()

setRoleShare

public void setRoleShare(java.lang.String roleShare)

getRoleShare

public java.lang.String getRoleShare()

setPagingOffset

public void setPagingOffset(java.lang.Long pagingOffset)

getSortColumn

public java.lang.String getSortColumn()

setSortColumn

public void setSortColumn(java.lang.String sortColumn)

isSortAscending

public boolean isSortAscending()

setSortAscending

public void setSortAscending(boolean sortAscending)

getShareTypeRendererBeans

public java.util.List<ShareTypeRendererBean> getShareTypeRendererBeans()
Returns the ShareTypeRendererBeans used by the front end to render each type of sharing that a filter could have. Does lazy initialisation so it's performant to call multiple times in a view. Is only used by the search form.

Returns:
the available ShareTypes.

generateSortUrl

public java.lang.String generateSortUrl(java.lang.String sortColumnName)
Return the URL that can be used to sort by the passed column.

Parameters:
sortColumnName - the column to sort by.
Returns:
the URL that can be used to sort the passed column.

generateSortIcon

public java.lang.String generateSortIcon(java.lang.String sortColumnName)
Return the HTML for the sort icon used to display the sort order for the passed column. The returned String can be empty if the passed passed column should not display an icon.

Parameters:
sortColumnName - the name of the column
Returns:
the HTML for the icon to display.

generateSortCssClass

public java.lang.String generateSortCssClass(java.lang.String sortColumnName)
Return the CSS class(es) to display the passed column's sort status.

Parameters:
sortColumnName - the column to get the classes for.
Returns:
the CSS class(es) to represent the passed column's sorting status.

search

public SharedEntitySearchViewHelper.SearchResult<E> search(JiraServiceContext jiraServiceContext)
Performs the search for filters based on the configured state.

Parameters:
jiraServiceContext - the service context to use for performing the search with the underlying service.
Returns:
the SearchResult for the search currently configured. null can be returned to indicate an error.

getPopularFilters

public java.util.List<E> getPopularFilters(JiraServiceContext jiraServiceContext)
Gets the filters which have been made favourite by the most people.

Parameters:
jiraServiceContext - the service context to use for performing the search.
Returns:
the list of SharedEntity objects.

getSearchShareTypeJSON

public java.lang.String getSearchShareTypeJSON()
Produces a JSON representation of the current form state. Used to pre-populate the JavaScript-controlled component in select-share-types.jsp.

Returns:
the JSON representation to be used by the client to set up the search form controls state.

createBasicUrlSearchParams

protected java.lang.StringBuffer createBasicUrlSearchParams()
Creates the basic URL parameters needed to keep the current search state.

Returns:
a string buffer containing a URL with the basic search parameters.

addParameter

protected java.lang.StringBuffer addParameter(java.lang.StringBuffer url,
                                              java.lang.String key,
                                              java.lang.Object value)

doExecuteSearch

protected abstract SharedEntitySearchResult<E> doExecuteSearch(JiraServiceContext ctx,
                                                               SharedEntitySearchParameters searchParameters,
                                                               int pageOffset,
                                                               int pageWidth)
Execute the search for the passed parameters.

Parameters:
ctx - the context to execute the search under.
searchParameters - the parameters for the search.
pageOffset - the offset of the search result page to return.
pageWidth - the width of a search result page.
Returns:
the result of the search or null if an error occurred.

validateSearchParameters

protected abstract boolean validateSearchParameters(JiraServiceContext ctx,
                                                    SharedEntitySearchParameters searchParameters,
                                                    int pageOffset,
                                                    int pageWidth)
Ensure that it is possible to execute a search with the passed parameters.

Parameters:
ctx - the context to execute the search under.
searchParameters - the parameters for the search.
pageOffset - the offset of the search result page to return.
pageWidth - the width of a search result page.
Returns:
true iff the search can be performed.


Copyright © 2002-2010 Atlassian. All Rights Reserved.