com.atlassian.confluence.labels.actions
Class ViewLabelAction

java.lang.Object
  extended by com.opensymphony.xwork.ActionSupport
      extended by com.atlassian.confluence.core.ConfluenceActionSupport
          extended by com.atlassian.confluence.labels.actions.AbstractLabelDisplayingAction
              extended by com.atlassian.confluence.labels.actions.ViewLabelAction
All Implemented Interfaces:
WebInterface, SpaceAware, Spaced, com.opensymphony.xwork.Action, com.opensymphony.xwork.LocaleProvider, com.opensymphony.xwork.TextProvider, com.opensymphony.xwork.Validateable, com.opensymphony.xwork.ValidationAware, java.io.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
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.
 java.util.List preloadedPage
           
 
Fields inherited from class com.atlassian.confluence.labels.actions.AbstractLabelDisplayingAction
MAX_LABELS, space
 
Fields inherited from class com.atlassian.confluence.core.ConfluenceActionSupport
CANCEL, DEVMODE, eventManager, i18NBeanFactory, labelManager, languageManager, LICENSE_EXPIRED, LICENSE_USERS_EXCEEDED, log, permissionManager, permitted, pluginAccessor, PREVIEW, settingsManager, spacePermissionManager, userAccessor, webInterfaceManager
 
Fields inherited from class com.opensymphony.xwork.ActionSupport
LOG
 
Fields inherited from interface com.opensymphony.xwork.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
ViewLabelAction()
           
 
Method Summary
 java.lang.String execute()
           
 DisplayableLabel getAddLabel(Label label)
          Returns a DisplayableLabel representing the currently viewed labels and the given label.
 java.util.List getContent()
           
 DisplayableLabel getLabel()
          Returns a DisplayableLabel based on all the labels being viewed.
 java.util.List getLabels()
           
 java.util.List<DisplayableLabel> getOtherLabels(ContentEntityObject content)
          Returns the first nine global labels on the given content that are not this.label.
 PaginationSupport getPaginationSupport()
           
 java.lang.String getPaginationUrl()
           
 java.util.List getPreloadedPage()
           
 java.util.List getRelated()
           
 DisplayableLabel getRemoveLabel(Label label)
          Returns a DisplayableLabel representing the currently viewed labels, minus the given label.
 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 setIds(long[] ids)
           
 void setSmartListManager(SmartListManager smartListManager)
           
 void setStartIndex(int startIndex)
           
 void validate()
           
 
Methods inherited from class com.atlassian.confluence.labels.actions.AbstractLabelDisplayingAction
getPopularLabels, getRecentLabels, getSpace, isSpaceRequired, setSpace
 
Methods inherited from class com.atlassian.confluence.core.ConfluenceActionSupport
addActionError, addFieldError, addPermissionTypeTo, addToHistory, doDefault, formatFriendlyDate, getActionName, getBootstrapManager, getCancelResult, getDateFormatter, getDefaultResourceBundle, getEventManager, getFriendlyDateFormatter, getGlobalHelper, getGlobalSettings, getHelper, getI18n, getInstalledLanguages, getLabelManager, getLanguageManager, getLanguageUserFriendly, getLocale, getLocaleManager, getLocaleString, getNiceContentType, getPermissionTypes, getPermittedEntitiesOf, getPermittedEntitiesOf, getPermittedEntitiesOf, getPreviousLoginDate, getRandom, getRemoteUser, getSession, getSpaceHelper, getText, getText, getText, getText, getTextStatic, getTextStatic, getTextStrict, getTimeZone, getUser, getUserAccessor, getUserFullName, getUserInterfaceState, getWebInterfaceManager, hasPermissionForSpace, isAnonymousUser, isCanceled, isDevMode, isEmailVisible, isExternalUserManagementEnabled, isLabelable, isPermissionCheck, isPermitted, isPermittedAsString, isPrintableVersion, isSharedMode, isUserStatusPluginEnabled, isUsingHSQL, setBootstrapManager, setCancel, setEventManager, setFormatSettingsManager, setI18NBean, setI18NBeanFactory, setLabelManager, setLanguageManager, setLocaleManager, setPermissionCheck, setPermissionManager, setPluginAccessor, setPreviousLoginDate, setSettingsManager, setSpacePermissionManager, setUserAccessor, setWebInterfaceManager
 
Methods inherited from class com.opensymphony.xwork.ActionSupport
addActionError, addActionMessage, addFieldError, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, setActionErrors, setActionMessages, setFieldErrors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.


preloadedPage

public java.util.List preloadedPage
Constructor Detail

ViewLabelAction

public ViewLabelAction()
Method Detail

setIds

public void setIds(long[] ids)

setStartIndex

public void setStartIndex(int startIndex)

setSmartListManager

public void setSmartListManager(SmartListManager smartListManager)

getLabels

public java.util.List getLabels()

getContent

public java.util.List getContent()

getRelated

public java.util.List getRelated()

getPaginationSupport

public PaginationSupport getPaginationSupport()

validate

public void validate()
Specified by:
validate in interface com.opensymphony.xwork.Validateable
Overrides:
validate in class com.opensymphony.xwork.ActionSupport

execute

public java.lang.String execute()
                         throws java.lang.Exception
Specified by:
execute in interface com.opensymphony.xwork.Action
Overrides:
execute in class com.opensymphony.xwork.ActionSupport
Throws:
java.lang.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 interface SpaceAware
Overrides:
isViewPermissionRequired in class AbstractLabelDisplayingAction
Returns:
true if the action requires view space permission

getOtherLabels

public java.util.List<DisplayableLabel> getOtherLabels(ContentEntityObject 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 Labels with size between 0 and 8 inclusive. Not null.

getPreloadedPage

public java.util.List getPreloadedPage()

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 java.lang.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, WebWork actions will implement this to provide extra details in the context such as content objects, and so on.

Specified by:
getWebInterfaceContext in interface WebInterface
Overrides:
getWebInterfaceContext in class ConfluenceActionSupport


Copyright © 2003-2009 Atlassian Pty Ltd. All Rights Reserved.