Interface WebInterfaceContext
- All Known Implementing Classes:
DefaultWebInterfaceContext
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:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
Deprecated.since 5.9static final String
Deprecated.since 5.9static final String
Deprecated.since 5.9static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Method Summary
Modifier and TypeMethodDescription@Nullable Attachment
Returns the attachment related to the web interface state, or null if there is no attachment.@Nullable Comment
Returns the comment related to the web interface state, or null if there is no comment.@Nullable ContentEntityObject
Deprecated.since 5.9.@Nullable ConfluenceUser
@Nullable Draft
getDraft()
Deprecated.since 5.9.@Nullable DisplayableLabel
getLabel()
Returns the label related to the web interface state, or null if there is no label.@Nullable AbstractPage
getPage()
Returns the page related to the web interface state, or null if there is no page.@Nullable Object
getParameter
(String key) Returns a custom parameter, or null if the parameter has not been set.@Nullable AbstractPage
Returns the parent page related to the web interface state, or null if there is no parent page.@Nullable PersonalInformation
Returns the personal information (i.e.@Nullable Space
getSpace()
Returns the space related to the web interface state, or null if there is no space.Returns the space-id of the space related to the web interface state, if such space exists.@Nullable String
Returns the space-key related to the web interface state, or null if there is no space-key.@Nullable ConfluenceUser
boolean
hasParameter
(String key) Returns true if the parameter has been set (even if it is set to null).boolean
Deprecated.since 5.9.toMap()
Converts the parameters into a map using the "context keys" defined as constants in this class.Methods inherited from interface com.atlassian.confluence.plugin.descriptor.web.ContextMap
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
CONTEXT_KEY_USER
- See Also:
-
CONTEXT_KEY_TARGET_USER
- See Also:
-
CONTEXT_KEY_PAGE
- See Also:
-
CONTEXT_KEY_SPACE
- See Also:
-
CONTEXT_KEY_SPACE_ID
- See Also:
-
CONTEXT_KEY_SPACE_KEY
- See Also:
-
CONTEXT_KEY_COMMENT
- See Also:
-
CONTEXT_KEY_LABEL
- See Also:
-
CONTEXT_KEY_ATTACHMENT
- See Also:
-
CONTEXT_KEY_PERSONAL_INFORMATION
- See Also:
-
CONTEXT_KEY_PARENT_PAGE
- See Also:
-
CONTEXT_KEY_DRAFT
Deprecated.since 5.9- See Also:
-
CONTEXT_KEY_CONTENT_DRAFT
Deprecated.since 5.9- See Also:
-
CONTEXT_KEY_EDIT_PAGE_RESTRICTED
Deprecated.since 5.9- See Also:
-
-
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.since 5.9. Use only if you still need access to legacy drafts, otherwise usegetPage()
Returns a draft related to the web interface state, or null if there is no draft. -
getContentDraft
Deprecated.since 5.9. UsegetPage()
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
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
Returns a custom parameter, or null if the parameter has not been set. -
hasParameter
Returns true if the parameter has been set (even if it is set to null). Useful for checking boolean custom parameters. -
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 interfaceContextMap<String,
Object>
-
isEditPageRestricted
Deprecated.since 5.9. Use proper permissions checks on the contentIndicates 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.
-