Package com.atlassian.confluence.pages
Interface DraftsTransitionHelper
-
- All Known Implementing Classes:
DefaultDraftsTransitionHelper
@Internal public interface DraftsTransitionHelper
Class intended to help during the transition period from legacy drafts to shared drafts.- See Also:
ContentEntityObject.DRAFT
,Draft
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description ContentEntityObject
createDraft(String contentType, String spaceKey)
This method should attempt to create a draft based on whether or not the Shared Drafts Dark Feature is enabled or disabled.ContentEntityObject
createDraft(String contentType, String spaceKey, long parentPageId)
This method should attempt to create a draft based on whether or not the Shared Drafts Dark Feature is enabled or disabled.static Long
getContentId(ContentEntityObject draft)
static String
getContentType(ContentEntityObject draft)
ContentEntityObject
getDraft(long draftId)
This method should attempt to retrieve a draft, and based on whether or not the Shared Draft dark feature is enabled (determined by the isSharedDraftsFeatureEnabled method) or disabled should return a Shared Draft or Legacy Draft respectively.ContentEntityObject
getDraftForPage(AbstractPage abstractPage)
This method should retrieve a draft from a given AbstractPage respecting the Shared Drafts feature state.String
getEditMode(String spaceKey)
This method is used to determine what's the current edit mode regarding collaborative editing (legacy, limited or collaborative), the method is provided a spaceKey and returns the current edit mode for that space.static String
getSpaceKey(ContentEntityObject draft)
boolean
isFallbackModeEnabled(String spaceKey)
Deprecated.static boolean
isLegacyDraft(ContentEntityObject draft)
boolean
isLimitedModeEnabled(String spaceKey)
Deprecated.since 7.5.0.static boolean
isSharedDraft(ContentEntityObject draft)
boolean
isSharedDraftsFeatureEnabled(String spaceKey)
This method is used to determine whether or not the Shared Drafts Dark Feature is enabled or disabled on a per space basis, the method is provided a spaceKey and returns whether or not the feature is enabled.void
transitionContentObjects(ContentEntityObject from, ContentEntityObject to)
Transitions content objects such as attachments, content properties, labels and permissions from one content object to another.
-
-
-
Method Detail
-
getDraftForPage
ContentEntityObject getDraftForPage(AbstractPage abstractPage)
This method should retrieve a draft from a given AbstractPage respecting the Shared Drafts feature state.- Parameters:
abstractPage
- the page we want the draft for (for legacy drafts, we get the current users per-page draft).- Returns:
- a ContentEntityObject of the draft for the given AbstractPage.
-
createDraft
ContentEntityObject createDraft(String contentType, String spaceKey)
This method should attempt to create a draft based on whether or not the Shared Drafts Dark Feature is enabled or disabled.- Parameters:
contentType
- specifies the type of Draft, either "blogpost" or "page" as of 5.9.1.spaceKey
- is used to specify the key of the Space the draft will belong to.- Returns:
- a ContentEntityObject of the newly created draft.
-
createDraft
ContentEntityObject createDraft(String contentType, String spaceKey, long parentPageId)
This method should attempt to create a draft based on whether or not the Shared Drafts Dark Feature is enabled or disabled. The draft will be created as a child of the provided parent page.- Parameters:
contentType
- specifies the type of Draft, either "blogpost" or "page" as of 5.9.1.spaceKey
- is used to specify the key of the Space the draft will belong to.parentPageId
- is the parent ID of the draft.- Returns:
- a ContentEntityObject of the newly created draft.
-
getDraft
ContentEntityObject getDraft(long draftId)
This method should attempt to retrieve a draft, and based on whether or not the Shared Draft dark feature is enabled (determined by the isSharedDraftsFeatureEnabled method) or disabled should return a Shared Draft or Legacy Draft respectively.There is no need to provide a spaceKey because the spaceKey of the draft (if found) will be used in the Shared Draft dark feature check
- Parameters:
draftId
- specifies the ID of the draft to be retrieved.- Returns:
- a ContentEntityObject of that draft.
-
transitionContentObjects
void transitionContentObjects(ContentEntityObject from, ContentEntityObject to)
Transitions content objects such as attachments, content properties, labels and permissions from one content object to another. Attachments are moved, everything else is copied.- Parameters:
from
-to
-
-
isSharedDraftsFeatureEnabled
boolean isSharedDraftsFeatureEnabled(String spaceKey)
This method is used to determine whether or not the Shared Drafts Dark Feature is enabled or disabled on a per space basis, the method is provided a spaceKey and returns whether or not the feature is enabled.- Parameters:
spaceKey
- is used to specify the key of the Space we want to check.- Returns:
- true if the Shared Drafts feature is enabled in the specified space.
-
isLimitedModeEnabled
@Deprecated boolean isLimitedModeEnabled(String spaceKey)
Deprecated.since 7.5.0. Limited mode is no longer supported since 7.5.0This method is used to determine whether or not the instance is in limited mode. Limited mode is defined as:- shared-drafts dark feature is ENABLED
- synchrony dark feature is DISABLED
- Returns:
- true if limited mode is on, false otherwise (since 7.5.0 this method always returns
false
)
-
getEditMode
String getEditMode(String spaceKey)
This method is used to determine what's the current edit mode regarding collaborative editing (legacy, limited or collaborative), the method is provided a spaceKey and returns the current edit mode for that space.- Parameters:
spaceKey
- is used to specify the key of the Space we want to check.- Returns:
- edit mode: legacy, limited or collaborative.
-
isFallbackModeEnabled
@Deprecated boolean isFallbackModeEnabled(String spaceKey)
Deprecated.
-
isLegacyDraft
static boolean isLegacyDraft(ContentEntityObject draft)
-
isSharedDraft
static boolean isSharedDraft(ContentEntityObject draft)
-
getSpaceKey
static String getSpaceKey(ContentEntityObject draft)
-
getContentType
static String getContentType(ContentEntityObject draft)
-
getContentId
static Long getContentId(ContentEntityObject draft)
-
-