@ParametersAreNonnullByDefault public class DefaultWebInterfaceContext extends Object implements WebInterfaceContext
CONTEXT_KEY_ATTACHMENT, CONTEXT_KEY_COMMENT, CONTEXT_KEY_CONTENT_DRAFT, CONTEXT_KEY_DRAFT, CONTEXT_KEY_EDIT_PAGE_RESTRICTED, CONTEXT_KEY_LABEL, CONTEXT_KEY_PAGE, CONTEXT_KEY_PARENT_PAGE, CONTEXT_KEY_PERSONAL_INFORMATION, CONTEXT_KEY_SPACE, CONTEXT_KEY_SPACE_ID, CONTEXT_KEY_SPACE_KEY, CONTEXT_KEY_TARGET_USER, CONTEXT_KEY_USER| Constructor and Description |
|---|
DefaultWebInterfaceContext() |
| Modifier and Type | Method and Description |
|---|---|
static DefaultWebInterfaceContext |
copyOf(WebInterfaceContext webInterfaceContext)
Creates a new
DefaultWebInterfaceContext with a copy of the data from another context. |
static DefaultWebInterfaceContext |
createFrom(Map<String,?> contextMap)
Creates a new
DefaultWebInterfaceContext with the datas from the given Map. |
@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. Use
getPage() |
@Nullable ConfluenceUser |
getCurrentUser() |
@Nullable Draft |
getDraft()
Deprecated.
since 5.9. Use only if you still need access to legacy drafts, otherwise use
getPage() |
@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. Use proper permissions checks on the content
|
DefaultWebInterfaceContext |
putAllMissing(WebInterfaceContext source)
Put all missing parameters from source into current web interface context
|
void |
setAttachment(Attachment attachment) |
void |
setComment(Comment comment) |
void |
setCurrentUser(@Nullable ConfluenceUser user)
Set the current user on the context
|
void |
setIsEditPageRestricted(boolean restricted)
Deprecated.
since 5.9. Use proper permissions checks on the content
|
void |
setLabel(DisplayableLabel label) |
void |
setLazyParameter(String key,
com.google.common.base.Supplier<Object> supplier)
Deprecated.
since 7.0.1. Use
withLazyParameter(String, java.util.function.Supplier) |
void |
setPage(@Nullable AbstractPage page) |
void |
setParameter(String key,
@Nullable Object value) |
void |
setParameters(Map<String,Object> parameters) |
void |
setPersonalInformation(PersonalInformation personalInformation) |
void |
setSpace(@Nullable Space space) |
void |
setTargetedUser(@Nullable ConfluenceUser user) |
Map<String,Object> |
toMap()
Converts the contents of this object as a Map.
|
void |
withLazyParameter(String key,
Supplier<Object> supplier) |
public static DefaultWebInterfaceContext copyOf(WebInterfaceContext webInterfaceContext)
DefaultWebInterfaceContext with a copy of the data from another context.
If the other context is also an implementation of DefaultWebInterfaceContext, then any lazy
properties will be copied intact, and will not be evaluated.public static DefaultWebInterfaceContext createFrom(Map<String,?> contextMap)
DefaultWebInterfaceContext with the datas from the given Map. The map will be
copied.public @Nullable ConfluenceUser getCurrentUser()
getCurrentUser in interface WebInterfaceContextpublic void setCurrentUser(@Nullable ConfluenceUser user)
user - the current userpublic @Nullable AbstractPage getPage()
WebInterfaceContextgetPage in interface WebInterfaceContext@Deprecated public @Nullable Draft getDraft()
getPage()WebInterfaceContextgetDraft in interface WebInterfaceContext@Deprecated public @Nullable ContentEntityObject getContentDraft()
getPage()WebInterfaceContextgetContentDraft in interface WebInterfaceContextpublic void setPage(@Nullable AbstractPage page)
public @Nullable Space getSpace()
WebInterfaceContextgetSpace in interface WebInterfaceContextpublic Optional<Long> getSpaceId()
WebInterfaceContextgetSpaceId in interface WebInterfaceContextpublic @Nullable String getSpaceKey()
WebInterfaceContextgetSpaceKey in interface WebInterfaceContextpublic void setSpace(@Nullable Space space)
public @Nullable Comment getComment()
WebInterfaceContextgetComment in interface WebInterfaceContextpublic void setComment(Comment comment)
public @Nullable DisplayableLabel getLabel()
WebInterfaceContextgetLabel in interface WebInterfaceContextpublic void setLabel(DisplayableLabel label)
public @Nullable Attachment getAttachment()
WebInterfaceContextgetAttachment in interface WebInterfaceContextpublic void setAttachment(Attachment attachment)
public @Nullable PersonalInformation getPersonalInformation()
WebInterfaceContextgetPersonalInformation in interface WebInterfaceContextpublic void setPersonalInformation(PersonalInformation personalInformation)
public @Nullable Object getParameter(String key)
WebInterfaceContextgetParameter in interface WebInterfaceContextpublic boolean hasParameter(String key)
WebInterfaceContexthasParameter in interface WebInterfaceContext@Deprecated public void setLazyParameter(String key, com.google.common.base.Supplier<Object> supplier)
withLazyParameter(String, java.util.function.Supplier)public Map<String,Object> toMap()
toMap in interface WebInterfaceContextpublic @Nullable ConfluenceUser getTargetedUser()
getTargetedUser in interface WebInterfaceContextpublic void setTargetedUser(@Nullable ConfluenceUser user)
user - the user targeted by the current action.@Deprecated public void setIsEditPageRestricted(boolean restricted)
@Deprecated public boolean isEditPageRestricted()
WebInterfaceContextisEditPageRestricted in interface WebInterfaceContextpublic @Nullable AbstractPage getParentPage()
WebInterfaceContextgetParentPage in interface WebInterfaceContextpublic DefaultWebInterfaceContext putAllMissing(WebInterfaceContext source)
source - which contains parameters to be copied in.Copyright © 2003–2021 Atlassian. All rights reserved.