Interface WebInterfaceContext
-
- All Known Implementing Classes:
DefaultWebInterfaceContext
public interface WebInterfaceContextWhen 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 bytoMap()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)orhasParameter(String).- Since:
- 2.8
- See Also:
BaseConfluenceCondition,ConfluenceWebInterfaceManager
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTEXT_KEY_ATTACHMENTstatic StringCONTEXT_KEY_COMMENTstatic StringCONTEXT_KEY_CONTENT_DRAFTDeprecated.since 5.9static StringCONTEXT_KEY_DRAFTDeprecated.since 5.9static StringCONTEXT_KEY_EDIT_PAGE_RESTRICTEDDeprecated.since 5.9static StringCONTEXT_KEY_LABELstatic StringCONTEXT_KEY_PAGEstatic StringCONTEXT_KEY_PARENT_PAGEstatic StringCONTEXT_KEY_PERSONAL_INFORMATIONstatic StringCONTEXT_KEY_SPACEstatic StringCONTEXT_KEY_SPACE_IDstatic StringCONTEXT_KEY_SPACE_KEYstatic StringCONTEXT_KEY_TARGET_USERstatic StringCONTEXT_KEY_USER
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description @Nullable AttachmentgetAttachment()Returns the attachment related to the web interface state, or null if there is no attachment.@Nullable CommentgetComment()Returns the comment related to the web interface state, or null if there is no comment.@Nullable ContentEntityObjectgetContentDraft()Deprecated.since 5.9.@Nullable ConfluenceUsergetCurrentUser()@Nullable DraftgetDraft()Deprecated.since 5.9.@Nullable DisplayableLabelgetLabel()Returns the label related to the web interface state, or null if there is no label.@Nullable AbstractPagegetPage()Returns the page related to the web interface state, or null if there is no page.@Nullable ObjectgetParameter(String key)Returns a custom parameter, or null if the parameter has not been set.@Nullable AbstractPagegetParentPage()Returns the parent page related to the web interface state, or null if there is no parent page.@Nullable PersonalInformationgetPersonalInformation()Returns the personal information (i.e.@Nullable SpacegetSpace()Returns the space related to the web interface state, or null if there is no space.Optional<Long>getSpaceId()Returns the space-id of the space related to the web interface state, if such space exists.@Nullable StringgetSpaceKey()Returns the space-key related to the web interface state, or null if there is no space-key.@Nullable ConfluenceUsergetTargetedUser()booleanhasParameter(String key)Returns true if the parameter has been set (even if it is set to null).booleanisEditPageRestricted()Deprecated.since 5.9.Map<String,Object>toMap()Converts the parameters into a map using the "context keys" defined as constants in this class.
-
-
-
Field Detail
-
CONTEXT_KEY_USER
static final String CONTEXT_KEY_USER
- See Also:
- Constant Field Values
-
CONTEXT_KEY_TARGET_USER
static final String CONTEXT_KEY_TARGET_USER
- See Also:
- Constant Field Values
-
CONTEXT_KEY_PAGE
static final String CONTEXT_KEY_PAGE
- See Also:
- Constant Field Values
-
CONTEXT_KEY_SPACE
static final String CONTEXT_KEY_SPACE
- See Also:
- Constant Field Values
-
CONTEXT_KEY_SPACE_ID
static final String CONTEXT_KEY_SPACE_ID
- See Also:
- Constant Field Values
-
CONTEXT_KEY_SPACE_KEY
static final String CONTEXT_KEY_SPACE_KEY
- See Also:
- Constant Field Values
-
CONTEXT_KEY_COMMENT
static final String CONTEXT_KEY_COMMENT
- See Also:
- Constant Field Values
-
CONTEXT_KEY_LABEL
static final String CONTEXT_KEY_LABEL
- See Also:
- Constant Field Values
-
CONTEXT_KEY_ATTACHMENT
static final String CONTEXT_KEY_ATTACHMENT
- See Also:
- Constant Field Values
-
CONTEXT_KEY_PERSONAL_INFORMATION
static final String CONTEXT_KEY_PERSONAL_INFORMATION
- See Also:
- Constant Field Values
-
CONTEXT_KEY_PARENT_PAGE
static final String CONTEXT_KEY_PARENT_PAGE
- See Also:
- Constant Field Values
-
CONTEXT_KEY_DRAFT
@Deprecated static final String CONTEXT_KEY_DRAFT
Deprecated.since 5.9- See Also:
- Constant Field Values
-
CONTEXT_KEY_CONTENT_DRAFT
@Deprecated static final String CONTEXT_KEY_CONTENT_DRAFT
Deprecated.since 5.9- See Also:
- Constant Field Values
-
CONTEXT_KEY_EDIT_PAGE_RESTRICTED
@Deprecated static final String CONTEXT_KEY_EDIT_PAGE_RESTRICTED
Deprecated.since 5.9- See Also:
- Constant Field Values
-
-
Method Detail
-
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 usegetPage()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. 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
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.
-
isEditPageRestricted
@Deprecated boolean 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.
-
-