Class ApplicationDraftService
java.lang.Object
io.meeds.layout.service.ApplicationDraftService
Resolves the windows a tool write addresses on the user's layout, the way
every draft tool does: the layout read is the user's draft when their
co-editing revision names one, the published layout otherwise; an id the
read does not show does not exist, a container id is refused; and when no
draft exists yet the write creates it first and finds each window again
on the draft at the place its live window held. Every refusal is a fixed
text, the texts the tools answer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateDraft(DraftWindows resolution, String username) Creates the user's draft of the resolved layout and finds each window again on it, at the place its live window held and of the same application; the live layout read again after the clone still holds each window at its place, no publication came in between (a publication gives every window a new id), else the layout is outdated.<T> TonCreatedDraft(LayoutWrite<T> write) Runs a write on the draft this call created: a failure is answered naming the draft, which stays, so the caller reads the layout again for its ids; a failure the write did not name itself is loggedorg.exoplatform.portal.config.model.PortalConfigreadDraftSite(long siteId, String username) The user's draft of a site, as the site layout editor resumes it: the one the user's co-editing revision names, read through the permission-checked service readorg.exoplatform.portal.config.model.PagereadEditablePage(org.exoplatform.portal.mop.page.PageKey pageKey, String username) org.exoplatform.portal.config.model.PortalConfigreadEditableSite(long siteId, String username) longrequireLiveNodeId(org.exoplatform.portal.mop.page.PageKey pageKey, String username) resolvePage(org.exoplatform.portal.mop.page.PageKey pageKey, String pageRef, List<String> applicationIds, String username) The windows the ids name on the user's page, with no writeresolveSite(long siteId, List<String> applicationIds, String username) The windows the ids name on the user's site, with no writetranslateWriteFailure(RuntimeException e, Object layoutKey, String username, String refusal) A layout write refused by the storage answers a fixed text: the outdated draft its own, every other failure the given one, its cause logged
-
Field Details
-
PAGE_NOT_FOUND
- See Also:
-
PAGE_NOT_ALLOWED
- See Also:
-
DRAFT_NOT_FOUND
- See Also:
-
SITE_NOT_FOUND
- See Also:
-
SITE_NOT_ALLOWED
- See Also:
-
NODE_NOT_FOUND
- See Also:
-
NAVIGATION_NOT_ALLOWED
- See Also:
-
APPLICATION_NOT_FOUND
- See Also:
-
APPLICATION_ID_NOT_ACCEPTED
- See Also:
-
LAYOUT_OUTDATED
- See Also:
-
DRAFT_CREATED_BEFORE_FAILURE
- See Also:
-
PAGE_LAYOUT_NOT_SAVED
- See Also:
-
SITE_LAYOUT_NOT_SAVED
- See Also:
-
PAGE_OUTDATED_MESSAGE
- See Also:
-
-
Constructor Details
-
ApplicationDraftService
public ApplicationDraftService()
-
-
Method Details
-
resolvePage
public DraftWindows resolvePage(org.exoplatform.portal.mop.page.PageKey pageKey, String pageRef, List<String> applicationIds, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException The windows the ids name on the user's page, with no write- Parameters:
pageKey- the live pagepageRef- the live page reference as the caller gave itapplicationIds- the application ids the read answeredusername- the user- Returns:
- the resolution
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the page, its navigation item, the draft or an application does not existIllegalAccessException- when the user may not edit the page
-
resolveSite
public DraftWindows resolveSite(long siteId, List<String> applicationIds, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException The windows the ids name on the user's site, with no write- Parameters:
siteId- the live siteapplicationIds- the application ids the read answeredusername- the user- Returns:
- the resolution
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the site or an application does not existIllegalAccessException- when the user may not edit the site
-
createDraft
public List<ApplicationSettingsContext> createDraft(DraftWindows resolution, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Creates the user's draft of the resolved layout and finds each window again on it, at the place its live window held and of the same application; the live layout read again after the clone still holds each window at its place, no publication came in between (a publication gives every window a new id), else the layout is outdated. A failure of the mapping names the draft just created, as every failure after it does- Parameters:
resolution- the windows resolved on the live layoutusername- the user- Returns:
- the windows' contexts on the draft, in the ids' order
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the page or the site no longer existsIllegalAccessException- when the user may not create the draft
-
onCreatedDraft
Runs a write on the draft this call created: a failure is answered naming the draft, which stays, so the caller reads the layout again for its ids; a failure the write did not name itself is logged- Type Parameters:
T- what the write returns- Parameters:
write- the write- Returns:
- what the write returns
-
translateWriteFailure
public RuntimeException translateWriteFailure(RuntimeException e, Object layoutKey, String username, String refusal) A layout write refused by the storage answers a fixed text: the outdated draft its own, every other failure the given one, its cause logged- Parameters:
e- the storage's failurelayoutKey- the page or site key, for the logusername- the user, for the logrefusal- the fixed text every other failure answers- Returns:
- the exception to throw
-
readEditablePage
public org.exoplatform.portal.config.model.Page readEditablePage(org.exoplatform.portal.mop.page.PageKey pageKey, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Parameters:
pageKey- a live pageusername- the user- Returns:
- the stored live page the user may edit, never a draft page
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when no live page has that keyIllegalAccessException- when the user may not edit it
-
requireLiveNodeId
public long requireLiveNodeId(org.exoplatform.portal.mop.page.PageKey pageKey, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
pageKey- a live pageusername- the user- Returns:
- the navigation node of the page, the key its draft is resolved by
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when no navigation item references it
-
readEditableSite
public org.exoplatform.portal.config.model.PortalConfig readEditableSite(long siteId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Parameters:
siteId- a live siteusername- the user- Returns:
- the live site the user may edit, never a draft site
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when no live site has that idIllegalAccessException- when the user may not edit it
-
readDraftSite
The user's draft of a site, as the site layout editor resumes it: the one the user's co-editing revision names, read through the permission-checked service read- Parameters:
siteId- a live siteusername- the user- Returns:
- the draft site, null when the user has none
-