Class AbstractPageTemplateAction

All Implemented Interfaces:
WebInterface, Spaced, BreadcrumbAware, MessageHolderAware, Serializable, org.apache.struts2.action.Action, org.apache.struts2.interceptor.ValidationAware, org.apache.struts2.locale.LocaleProvider, org.apache.struts2.text.TextProvider, org.apache.struts2.Validateable
Direct Known Subclasses:
AbstractEditPageTemplateAction, EditPageTemplateDescriptionAction, ListPageTemplatesAction, RemovePageTemplateAction, ViewPageTemplateAction

public abstract class AbstractPageTemplateAction extends AbstractSpaceAction implements BreadcrumbAware
See Also:
  • Field Details

    • pageTemplateManager

      protected PageTemplateManager pageTemplateManager
    • pageTemplate

      protected PageTemplate pageTemplate
    • entityId

      protected long entityId
    • originalPageTemplate

      protected PageTemplate originalPageTemplate
    • labelsString

      protected String labelsString
  • Constructor Details

    • AbstractPageTemplateAction

      public AbstractPageTemplateAction()
  • Method Details

    • validate

      public void validate()
      Ensure that the size of the labels associated with the template are less than the column size for storing them (255).
      Specified by:
      validate in interface MessageHolderAware
      Specified by:
      validate in interface org.apache.struts2.Validateable
      Overrides:
      validate in class org.apache.struts2.ActionSupport
    • setBreadcrumbGenerator

      public void setBreadcrumbGenerator(BreadcrumbGenerator breadcrumbGenerator)
    • setPageTemplateManager

      public void setPageTemplateManager(PageTemplateManager pageTemplateManager)
    • getEntityId

      public long getEntityId()
    • setEntityId

      public void setEntityId(long entityId)
    • getDraftId

      public long getDraftId()
    • setDraftId

      public void setDraftId(long draftId)
    • getPageTemplate

      public PageTemplate getPageTemplate()
    • getPageTemplateByName

      public PageTemplate getPageTemplateByName(String name)
    • getLabelsString

      public String getLabelsString()
      Returns:
      the label String that has been set on the action. If there is none then return the label String from the pageTemplate if one has been set.
    • setLabelsString

      public void setLabelsString(String labelsString)
    • getLabels

      public List<Label> getLabels()
    • setLabels

      protected void setLabels(List<Label> labels)
    • isPermitted

      public boolean isPermitted()
      We should really be splitting up each of the template actions (create, edit, list) and getting them to implement SpaceAdministrative or Administrative to enforce space or global permissions.

      We will determine the permission type required based on the type of template being served or modified If the template id does not exist (ie when we are browsing templates, use the space key to determine permissions

      Overrides:
      isPermitted in class AbstractSpaceAction
    • 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 interface WebInterface
      Overrides:
      getWebInterfaceContext in class ConfluenceActionSupport
    • globalTemplateSuffix

      protected String globalTemplateSuffix()
      Returns:
      returns "-global" if the spacekey is _not_ set, empty string otherwise. Use this suffix to create action results that differentiate between global templates and space templates.
    • getBreadcrumb

      public Breadcrumb getBreadcrumb()
      Description copied from interface: BreadcrumbAware
      Returns the breadcrumb to be shown when the action is accessed.
      Specified by:
      getBreadcrumb in interface BreadcrumbAware
      Returns:
      Breadcrumb