Interface WebInterfaceContext
-
- All Known Implementing Classes:
DefaultWebInterfaceContext
public interface WebInterfaceContext
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 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 String
CONTEXT_KEY_ATTACHMENT
static String
CONTEXT_KEY_COMMENT
static String
CONTEXT_KEY_CONTENT_DRAFT
Deprecated.since 5.9static String
CONTEXT_KEY_DRAFT
Deprecated.since 5.9static String
CONTEXT_KEY_EDIT_PAGE_RESTRICTED
Deprecated.since 5.9static String
CONTEXT_KEY_LABEL
static String
CONTEXT_KEY_PAGE
static String
CONTEXT_KEY_PARENT_PAGE
static String
CONTEXT_KEY_PERSONAL_INFORMATION
static String
CONTEXT_KEY_SPACE
static String
CONTEXT_KEY_SPACE_ID
static String
CONTEXT_KEY_SPACE_KEY
static String
CONTEXT_KEY_TARGET_USER
static String
CONTEXT_KEY_USER
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description @Nullable Attachment
getAttachment()
Returns the attachment related to the web interface state, or null if there is no attachment.@Nullable Comment
getComment()
Returns the comment related to the web interface state, or null if there is no comment.@Nullable ContentEntityObject
getContentDraft()
Deprecated.since 5.9.@Nullable ConfluenceUser
getCurrentUser()
@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
getParentPage()
Returns the parent page related to the web interface state, or null if there is no parent page.@Nullable PersonalInformation
getPersonalInformation()
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.Optional<Long>
getSpaceId()
Returns the space-id of the space related to the web interface state, if such space exists.@Nullable String
getSpaceKey()
Returns the space-key related to the web interface state, or null if there is no space-key.@Nullable ConfluenceUser
getTargetedUser()
boolean
hasParameter(String key)
Returns true if the parameter has been set (even if it is set to null).boolean
isEditPageRestricted()
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.
-
-