Class ViewLabelAction
- java.lang.Object
-
- com.opensymphony.xwork2.ActionSupport
-
- com.atlassian.confluence.core.ConfluenceActionSupport
-
- com.atlassian.confluence.spaces.actions.AbstractSpaceAction
-
- com.atlassian.confluence.plugins.labels.actions.AbstractLabelDisplayingAction
-
- com.atlassian.confluence.plugins.labels.actions.ViewLabelAction
-
- All Implemented Interfaces:
WebInterface
,SpaceAware
,Spaced
,MessageHolderAware
,com.opensymphony.xwork2.Action
,com.opensymphony.xwork2.interceptor.ValidationAware
,com.opensymphony.xwork2.LocaleProvider
,com.opensymphony.xwork2.TextProvider
,com.opensymphony.xwork2.Validateable
,Serializable
public class ViewLabelAction extends AbstractLabelDisplayingAction
Action for viewing a label. The label can be specified by either using the labels name(s) or the labels id(s), but not both.The names and ids are the parameters passed in, and used for null-input validation, but are not "maintained" once the labels they point to are retrieved. This means that the names and ids fields have trivial state after retrieveLabels has been called and should not be accessed via getter methods.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
ITEMS_PER_PAGE
The default number of content to be displayed on each page.protected PaginationSupport
paginationSupport
Pagination support to assist in the display of the list of content associated with the label.-
Fields inherited from class com.atlassian.confluence.plugins.labels.actions.AbstractLabelDisplayingAction
MAX_LABELS
-
Fields inherited from class com.atlassian.confluence.spaces.actions.AbstractSpaceAction
key, notificationManager, space, spaceManager, themeManager, wikiStyleRenderer
-
Fields inherited from class com.atlassian.confluence.core.ConfluenceActionSupport
accessModeService, CANCEL, DEVMODE, eventManager, i18NBeanFactory, labelManager, languageManager, LICENSE_EXPIRED, LICENSE_USERS_EXCEEDED, messageHolder, permissionManager, permitted, personService, pluginAccessor, PREVIEW, settingsManager, spacePermissionManager, userAccessor, webInterfaceManager
-
-
Constructor Summary
Constructors Constructor Description ViewLabelAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
execute()
DisplayableLabel
getAddLabel(Label label)
Returns a DisplayableLabel representing the currently viewed labels and the given label.List
getContent()
String
getDescription()
FriendlyDateFormatterHelper
getFriendlyDateFormatterHelper()
DisplayableLabel
getLabel()
Returns a DisplayableLabel based on all the labels being viewed.List
getLabels()
List<DisplayableLabel>
getOtherLabels(Labelable content)
Returns the first nine global labels on the given content that are not this.label.PaginationSupport
getPaginationSupport()
String
getPaginationUrl()
List
getRelated()
DisplayableLabel
getRemoveLabel(Label label)
Returns a DisplayableLabel representing the currently viewed labels, minus the given label.SiteSearchPermissionsQueryFactory
getSiteSearchPermissionsQueryFactory()
WebInterfaceContext
getWebInterfaceContext()
Returns a context which can be passed to web items when rendering them.boolean
isViewPermissionRequired()
For viewing individual labels, we don't require view permission on any particular space (actually, this doesn't matter right now - but might in the future!)void
setDescription(String description)
void
setIds(long[] ids)
void
setSearchManager(SearchManager searchManager)
void
setSiteSearchPermissionsQueryFactory(SiteSearchPermissionsQueryFactory siteSearchPermissionsQueryFactory)
void
setStartIndex(int startIndex)
void
validate()
-
Methods inherited from class com.atlassian.confluence.plugins.labels.actions.AbstractLabelDisplayingAction
getPopularLabels, getRecentLabels, isSpaceRequired
-
Methods inherited from class com.atlassian.confluence.spaces.actions.AbstractSpaceAction
getKey, getPermissionTypes, getSpace, getSpaceKey, getSubscribableName, getThemeManager, hasSpaceIA, isPermitted, isPersonalSpace, isUserWatchingSpace, isValidSpaceKey, setKey, setNotificationManager, setSpace, setSpaceManager, setThemeManager, setWikiStyleRenderer
-
Methods inherited from class com.atlassian.confluence.core.ConfluenceActionSupport
addActionError, addActionMessage, addFieldError, addPermissionTypeTo, addToHistory, doDefault, formatFriendlyDate, getAccessMode, getActionName, getActionName, getAuthenticatedUser, getBootstrapManager, getBootstrapStatusProvider, getCancel, getCancelResult, getConfluenceAccessManager, getContext, getCurrentRequest, getCurrentSession, getDateFormatSetting, getDateFormatter, getDefaultResourceBundle, getDefaultTimeZone, getDocLink, getEventManager, getFriendlyDateFormatter, getFrontendServiceURL, getGlobalSettings, getHelper, getI18n, getInstalledLanguages, getLabelManager, getLanguageJs, getLanguageManager, getLanguageUserFriendly, getLocale, getLocaleManager, getLocaleString, getMessageHolder, getNiceContentType, getPermissionManager, getPermittedEntitiesOf, getPermittedEntitiesOf, getPermittedEntitiesOf, getPersonService, getPreviousLoginDate, getRemoteUser, getSession, getSystemInformationService, getText, getText, getText, getText, getText, getText, getText, getText, getTextStatic, getTextStatic, getTextStrict, getTimeZone, getUserAccessor, getUserByName, getUserFullName, getUserHasBrowseUsersPermission, getUserHasLicensedAccess, getUserInterfaceState, getUserLocaleDefaultDatePattern, getUserProfilePicUrl, getWebInterfaceManager, hasPermissionForSpace, isAnonymousUser, isCanceled, isDevMode, isEmailVisible, isExternalUserManagementEnabled, isLabelable, isPrintableVersion, isSkipAccessCheck, isUserStatusPluginEnabled, isUsingH2, isUsingHSQL, setAccessModeService, setApiContentUiSupport, setApiDateFormatService, setApiPersonService, setBootstrapManager, setCancel, setConfluenceAccessManager, setContentUiSupport, setEventManager, setFormatSettingsManager, setI18NBean, setI18NBeanFactory, setLabelManager, setLanguageManager, setLocaleManager, setLoginManager, setMessageHolder, setPermissionManager, setPluginAccessor, setPreviousLoginDate, setServletRequestSupplier, setSettingsManager, setSkipAccessCheck, setSpacePermissionManager, setSystemInformationService, setTimeZoneManager, setUserAccessor, setWebInterfaceManager, withServletRequestSupplier
-
Methods inherited from class com.opensymphony.xwork2.ActionSupport
addActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, getActionErrors, getActionMessages, getContainer, getFieldErrors, getFormatted, getLocaleProvider, getText, getText, getTextProvider, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, input, isValidLocale, isValidLocaleString, pause, setActionErrors, setActionMessages, setContainer, setFieldErrors
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.opensymphony.xwork2.LocaleProvider
isValidLocale, isValidLocaleString
-
Methods inherited from interface com.atlassian.confluence.spaces.actions.SpaceAware
setSpace
-
-
-
-
Field Detail
-
ITEMS_PER_PAGE
public static final int ITEMS_PER_PAGE
The default number of content to be displayed on each page.- See Also:
- Constant Field Values
-
paginationSupport
protected PaginationSupport paginationSupport
Pagination support to assist in the display of the list of content associated with the label.
-
-
Method Detail
-
setIds
public void setIds(long[] ids)
-
setStartIndex
public void setStartIndex(int startIndex)
-
setSearchManager
public void setSearchManager(SearchManager searchManager)
-
getLabels
public List getLabels()
-
getContent
public List getContent()
-
getRelated
public List getRelated()
-
getPaginationSupport
public PaginationSupport getPaginationSupport()
-
validate
public void validate()
- Specified by:
validate
in interfaceMessageHolderAware
- Specified by:
validate
in interfacecom.opensymphony.xwork2.Validateable
- Overrides:
validate
in classcom.opensymphony.xwork2.ActionSupport
-
execute
public String execute() throws Exception
- Specified by:
execute
in interfacecom.opensymphony.xwork2.Action
- Overrides:
execute
in classcom.opensymphony.xwork2.ActionSupport
- Throws:
Exception
-
isViewPermissionRequired
public boolean isViewPermissionRequired()
For viewing individual labels, we don't require view permission on any particular space (actually, this doesn't matter right now - but might in the future!)- Specified by:
isViewPermissionRequired
in interfaceSpaceAware
- Overrides:
isViewPermissionRequired
in classAbstractLabelDisplayingAction
- Returns:
- true if the action requires view space permission
-
getOtherLabels
public List<DisplayableLabel> getOtherLabels(Labelable content)
Returns the first nine global labels on the given content that are not this.label. It is expected that the view will only display the first eight such labels, and use the ninth as a signal that a "..." is required- Parameters:
content
- the content to get labels for- Returns:
- a list of
Label
s with size between 0 and 8 inclusive. Not null.
-
getLabel
public DisplayableLabel getLabel()
Returns a DisplayableLabel based on all the labels being viewed.
-
getAddLabel
public DisplayableLabel getAddLabel(Label label)
Returns a DisplayableLabel representing the currently viewed labels and the given label.For example, if the current viewed labels are "a+b" and the passed label is "c", it returns a DisplayableLabel of "a+b+c"
Sorts the labels by title before returning them, so the order is canonical.
-
getRemoveLabel
public DisplayableLabel getRemoveLabel(Label label)
Returns a DisplayableLabel representing the currently viewed labels, minus the given label.For example, if the current viewed labels are "a+b+c" and the passed label is "a", it returns a DisplayableLabel of "b+c"
Sorts the labels by title before returning them, so the order is canonical.
-
getPaginationUrl
public String getPaginationUrl()
-
getWebInterfaceContext
public WebInterfaceContext getWebInterfaceContext()
Description copied from interface:WebInterface
Returns a context which can be passed to web items when rendering them.Typically, Struts actions will implement this to provide extra details in the context such as content objects, and so on.
- Specified by:
getWebInterfaceContext
in interfaceWebInterface
- Overrides:
getWebInterfaceContext
in classConfluenceActionSupport
-
getDescription
public String getDescription()
-
setDescription
public void setDescription(String description)
-
getFriendlyDateFormatterHelper
public FriendlyDateFormatterHelper getFriendlyDateFormatterHelper()
-
getSiteSearchPermissionsQueryFactory
public SiteSearchPermissionsQueryFactory getSiteSearchPermissionsQueryFactory()
-
setSiteSearchPermissionsQueryFactory
public void setSiteSearchPermissionsQueryFactory(SiteSearchPermissionsQueryFactory siteSearchPermissionsQueryFactory)
-
-