Interface WebInterfaceContext

All Superinterfaces:
ContextMap<String,Object>, Map<String,Object>
All Known Implementing Classes:
DefaultWebInterfaceContext

public interface WebInterfaceContext extends ContextMap<String,Object>
When rendering web fragments, this context is used for retrieval of Confluence content information. It can be converted to and from a Map to fit with the Condition and WebInterfaceManager interfaces. The map returned by toMap() is also used as a Velocity context for rendering URLs.

Parameters that are only used in a couple of places can be retrieved without type-safe accessors via getParameter(String) or hasParameter(String).

Since:
2.8
See Also:
  • Field Details

  • Method Details

    • getCurrentUser

      @Nullable ConfluenceUser getCurrentUser()
      Returns:
      the current user or null if there is no user logged in.
      Since:
      5.2
    • getTargetedUser

      @Nullable ConfluenceUser getTargetedUser()
      Returns:
      the user targeted by the action, or null if there is none. The targeted user is the user the action is performing against, not necessarily the logged in user.
      Since:
      5.2
    • getPage

      @Nullable AbstractPage getPage()
      Returns the page related to the web interface state, or null if there is no page.
    • getDraft

      @Deprecated @Nullable Draft getDraft()
      Deprecated.
      since 5.9. Use only if you still need access to legacy drafts, otherwise use getPage()
      Returns a draft related to the web interface state, or null if there is no draft.
    • getContentDraft

      @Deprecated @Nullable ContentEntityObject getContentDraft()
      Deprecated.
      since 5.9. Use getPage()
      Returns a draft related to the web interface state, or null if there is no draft.
    • getSpace

      @Nullable Space getSpace()
      Returns the space related to the web interface state, or null if there is no space.
    • getSpaceId

      Optional<Long> getSpaceId()
      Returns the space-id of the space related to the web interface state, if such space exists.
      Since:
      7.5
    • getSpaceKey

      @Nullable String getSpaceKey()
      Returns the space-key related to the web interface state, or null if there is no space-key.
    • getComment

      @Nullable Comment getComment()
      Returns the comment related to the web interface state, or null if there is no comment.
    • getLabel

      @Nullable DisplayableLabel getLabel()
      Returns the label related to the web interface state, or null if there is no label.
    • getAttachment

      @Nullable Attachment getAttachment()
      Returns the attachment related to the web interface state, or null if there is no attachment.
    • getPersonalInformation

      @Nullable PersonalInformation getPersonalInformation()
      Returns the personal information (i.e. user profile) that is related to the web interface state, or null if there is no personal information.
    • getParameter

      @Nullable Object getParameter(String key)
      Returns a custom parameter, or null if the parameter has not been set.
    • hasParameter

      boolean hasParameter(String key)
      Returns true if the parameter has been set (even if it is set to null). Useful for checking boolean custom parameters.
    • toMap

      Map<String,Object> toMap()
      Converts the parameters into a map using the "context keys" defined as constants in this class. Parameters which have not been set may be omitted from the resulting map.
      Specified by:
      toMap in interface ContextMap<String,Object>
    • isEditPageRestricted

      @Deprecated boolean isEditPageRestricted()
      Deprecated.
      since 5.9. Use proper permissions checks on the content
      Indicates if the current edit page is restricted (i.e. has some kind of permissions in place).
    • getParentPage

      @Nullable AbstractPage getParentPage()
      Returns the parent page related to the web interface state, or null if there is no parent page.