Class LayoutDraftService
java.lang.Object
io.meeds.layout.service.LayoutDraftService
Resolves the draft a user is editing through the co-editing revision the
layout editors record, never through a draft page or a draft site found in
storage: the editors re-clone the live layout whenever no revision names a
draft, so a leftover draft is a stale copy nobody edits.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.exoplatform.portal.mop.page.PageKeycreateDraftPage(long liveNodeId, String username) Creates the user's draft of a page through the editor's own path and records the draft node id as the user's co-editing revision on the live node, so the editor resumes it and the read tools return it; an existing draft page of the same user is written again from the live page and the draft node re-pointed, as the editor's "start again" does.org.exoplatform.portal.mop.SiteKeycreateDraftSite(org.exoplatform.portal.config.model.PortalConfig liveSite, String username) Creates the user's draft of a site through the editor's own path and records the draft site id as the user's co-editing revision, so the editor resumes it and the read tools return it; an existing draft of the same user is replaced, as the editor's "start again" does.org.exoplatform.portal.mop.page.PageKeydiscardDraftPage(org.exoplatform.portal.mop.page.PageKey livePageKey, long liveNodeId, String username) Drops the draft the user's revision names and starts a new one from the live page, as the editor's "start again" does.org.exoplatform.portal.mop.SiteKeydiscardDraftSite(org.exoplatform.portal.config.model.PortalConfig liveSite, String username) Drops the draft the user's revision names and starts a new one from the live layout, as the editor's "start again" does.draftNodeName(String liveNodeName, String username) org.exoplatform.portal.mop.page.PageKeydraftPageKey(org.exoplatform.portal.mop.page.PageKey livePageKey, String username) draftSiteName(org.exoplatform.portal.config.model.PortalConfig liveSite, String username) findLiveNodeId(org.exoplatform.portal.mop.page.PageKey pageKey, String username) org.exoplatform.portal.mop.page.PageKeygetDraftPageKey(long liveNodeId, String username) org.exoplatform.portal.mop.SiteKeygetDraftSiteKey(long siteId, String username) booleanisDraftNode(String nodeName) voidpublishPage(org.exoplatform.portal.mop.page.PageKey livePageKey, long liveNodeId, String username) Publishes the draft the user's revision names over the live page, as the editor's publish does, then removes the revision; a leftover draft without a revision is never published, nor a page the draft node was re-pointed at.voidpublishSite(org.exoplatform.portal.config.model.PortalConfig liveSite, String username) Publishes the draft the user's revision names over the live site, as the editor's save does from the stored draft, then removes the revision; a leftover draft without a revision is never published, and the draft is read under the view rule a draft site carries, as the read tools read it.
-
Field Details
-
NAVIGATION_OBJECT_TYPE
- See Also:
-
SITE_OBJECT_TYPE
- See Also:
-
DRAFT_NAME_MARKER
- See Also:
-
NO_DRAFT_MESSAGE
- See Also:
-
NO_PAGE_DRAFT_MESSAGE
- See Also:
-
-
Constructor Details
-
LayoutDraftService
public LayoutDraftService()
-
-
Method Details
-
getDraftPageKey
- Parameters:
liveNodeId- the navigation node of the live pageusername- the user whose draft is looked up- Returns:
- the key of the draft page the user's revision names, null when the user has no draft of that page: the named node must be the draft node the editor creates for this user and this live node, and point at the page clonePage names for them, since the node's page reference is the user's to re-point through the navigation and would otherwise make any page their draft
-
getDraftSiteKey
- Parameters:
siteId- the live siteusername- the user whose draft is looked up- Returns:
- the key of the draft site the user's revision names, null when the user has no draft of that site: the named site must be the draft site the editor creates for this user and this live site
-
createDraftSite
public org.exoplatform.portal.mop.SiteKey createDraftSite(org.exoplatform.portal.config.model.PortalConfig liveSite, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Creates the user's draft of a site through the editor's own path and records the draft site id as the user's co-editing revision, so the editor resumes it and the read tools return it; an existing draft of the same user is replaced, as the editor's "start again" does.- Parameters:
liveSite- the site draftedusername- the editing user- Returns:
- the draft site's key
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the live site does not existIllegalAccessException- when the user may not edit the site
-
publishSite
public void publishSite(org.exoplatform.portal.config.model.PortalConfig liveSite, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Publishes the draft the user's revision names over the live site, as the editor's save does from the stored draft, then removes the revision; a leftover draft without a revision is never published, and the draft is read under the view rule a draft site carries, as the read tools read it.- Parameters:
liveSite- the site publishedusername- the editing user- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the user has no draft of the siteIllegalAccessException- when the user may not edit the site
-
discardDraftSite
public org.exoplatform.portal.mop.SiteKey discardDraftSite(org.exoplatform.portal.config.model.PortalConfig liveSite, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Drops the draft the user's revision names and starts a new one from the live layout, as the editor's "start again" does.- Parameters:
liveSite- the site draftedusername- the editing user- Returns:
- the new draft site's key
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the user has no draft of the siteIllegalAccessException- when the user may not edit the site
-
createDraftPage
public org.exoplatform.portal.mop.page.PageKey createDraftPage(long liveNodeId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Creates the user's draft of a page through the editor's own path and records the draft node id as the user's co-editing revision on the live node, so the editor resumes it and the read tools return it; an existing draft page of the same user is written again from the live page and the draft node re-pointed, as the editor's "start again" does.- Parameters:
liveNodeId- the navigation node of the live pageusername- the editing user- Returns:
- the draft page's key
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the live node does not existIllegalAccessException- when the user may not edit the page, or may not edit the navigation on the first creation of the draft node
-
publishPage
public void publishPage(org.exoplatform.portal.mop.page.PageKey livePageKey, long liveNodeId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Publishes the draft the user's revision names over the live page, as the editor's publish does, then removes the revision; a leftover draft without a revision is never published, nor a page the draft node was re-pointed at. The draft, which the user must be able to edit, is read as stored, unfiltered, so a window the user cannot see is published in place as the editor publishes it, and the live page keeps its own permissions.- Parameters:
livePageKey- the page publishedliveNodeId- the navigation node of the live pageusername- the editing user- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the user has no draft of the pageIllegalAccessException- when the user may not edit the page
-
discardDraftPage
public org.exoplatform.portal.mop.page.PageKey discardDraftPage(org.exoplatform.portal.mop.page.PageKey livePageKey, long liveNodeId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Drops the draft the user's revision names and starts a new one from the live page, as the editor's "start again" does.- Parameters:
livePageKey- the page draftedliveNodeId- the navigation node of the live pageusername- the editing user- Returns:
- the new draft page's key
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the user has no draft of the pageIllegalAccessException- when the user may not edit the page
-
findLiveNodeId
- Parameters:
pageKey- a pageusername- the user whose draft is looked up- Returns:
- the id of the navigation node of the page's own site the tools work from: the non-draft node referencing the page on which the user's revision names a draft, so a draft built in the editor from any item of the page is the one resumed, else the first such node in tree order; null when no node references the page
-
isDraftNode
-
draftNodeName
-
draftPageKey
public org.exoplatform.portal.mop.page.PageKey draftPageKey(org.exoplatform.portal.mop.page.PageKey livePageKey, String username) - Parameters:
livePageKey- the live pageusername- the editing user- Returns:
- the key PageLayoutService.clonePage gives that user's draft page
-
draftSiteName
-