Class LayoutDescriptionService
java.lang.Object
io.meeds.layout.service.LayoutDescriptionService
Converts a page or site container tree into the description the MCP tools
return. The section grammar lives in the editor's cssClass tokens only
(FlexContainer/GridContainer over CellContainer, grid-cols/grid-rows and
the cell spans, a missing token reading as 1); style values are read from
the model's style fields, never parsed back from the generated tokens.
-
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 Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbreakpointValue(String cssClass, String prefix) describeApplications(Long categoryId, String keyword, String username, Locale locale) describeNavigation(org.exoplatform.portal.mop.SiteKey siteKey, boolean includeHidden, String username) describeNavigationItem(org.exoplatform.portal.mop.SiteKey siteKey, long nodeId, String username) One navigation item with its children, as describeNavigation lists it, for a user who edits the site's navigation, the writer of the item: the hidden items are included, and the item itself is not filtered by the view right on its page, which the permissions just written may have taken from them; its labels are, as the navigation drawer's own label read is, so they are omitted then; its children are listed as describeNavigation lists them.describeSites(String username, String keyword) org.exoplatform.portal.config.model.ModelObjectfilterAccessible(org.exoplatform.portal.config.model.ModelObject modelObject, String username) Drops, recursively, every container and application the user has no access permission on.toDisplayedPage(List<ElementDisplay> elements, org.exoplatform.portal.config.model.Page stored, String username) toDisplayedSite(List<ElementDisplay> elements, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username) toMovedPage(String applicationId, ApplicationPosition position, org.exoplatform.portal.config.model.Page stored, String username) toMovedSite(String applicationId, ApplicationPosition position, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username) toPageDescription(org.exoplatform.portal.config.model.ModelObject pageTree, String pageRef, LayoutVersion version) toPageDescription(org.exoplatform.portal.config.model.ModelObject pageTree, String pageRef, LayoutVersion version, String username) toPageLayout(List<SectionDescription> sections, org.exoplatform.portal.config.model.Page stored, String username, Locale locale) toPageLayout(List<SectionDescription> sections, org.exoplatform.portal.config.model.Page stored, String username, Locale locale, ImageConsumption images) toPlacedPage(ApplicationToPlace application, ApplicationPosition position, org.exoplatform.portal.config.model.Page stored, String username, Locale locale) toPlacedSite(ApplicationToPlace application, ApplicationPosition position, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username, Locale locale) toRemovedPage(String applicationId, org.exoplatform.portal.config.model.Page stored, String username) toRemovedSite(String applicationId, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username) toSiteDescription(org.exoplatform.portal.config.model.PortalConfig site, org.exoplatform.portal.config.model.ModelObject layout, String label, String description, boolean draft) toSiteDescription(org.exoplatform.portal.config.model.PortalConfig site, org.exoplatform.portal.config.model.ModelObject layout, String label, String description, org.exoplatform.portal.mop.SiteKey layoutSiteKey, boolean draft, String username) toSiteLayout(SiteLayoutUpdate update, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username, Locale locale) Rebuilds a site layout from a set_site_layout call over the stored tree, every value checked before anything is written.toSiteLayout(SiteLayoutUpdate update, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username, Locale locale, ImageConsumption images) toStyledPage(List<ElementStyling> elements, org.exoplatform.portal.config.model.Page stored, String username) toStyledPage(List<ElementStyling> elements, org.exoplatform.portal.config.model.Page stored, String username, ImageConsumption images) toStyledSite(List<ElementStyling> elements, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username) toStyledSite(List<ElementStyling> elements, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username, ImageConsumption images) toStyling(LayoutModel model, StylingDestination destination)
-
Field Details
-
FLEX_TEMPLATE
- See Also:
-
GRID_TEMPLATE
- See Also:
-
CELL_TEMPLATE
- See Also:
-
SITE_MIDDLE_TEMPLATE
- See Also:
-
SITE_MIDDLE_CENTER_TEMPLATE
- See Also:
-
SIDEBAR_TEMPLATE
- See Also:
-
SIDEBAR_CELL_TEMPLATE
- See Also:
-
BANNER_TEMPLATE
- See Also:
-
BANNER_CELL_TEMPLATE
- See Also:
-
HIDE_MOBILE_TOKEN
- See Also:
-
HIDE_DESKTOP_TOKEN
- See Also:
-
STICKY_SECTION_TOKEN
- See Also:
-
H_ALIGN_CENTER_TOKEN
- See Also:
-
H_ALIGN_END_TOKEN
- See Also:
-
V_ALIGN_CENTER_TOKEN
- See Also:
-
V_ALIGN_END_TOKEN
- See Also:
-
GRID_COLUMNS_PREFIX
- See Also:
-
GRID_ROWS_PREFIX
- See Also:
-
CELL_COLSPAN_PREFIX
- See Also:
-
CELL_ROWSPAN_PREFIX
- See Also:
-
CURRENT_BREAKPOINT
- See Also:
-
SITE_MATCH_LIMIT
public static final int SITE_MATCH_LIMIT- See Also:
-
INSTANCE_ID_NOT_ACCEPTED
- See Also:
-
CONTENT_ID_NOT_ACCEPTED
- See Also:
-
APPLICATION_NOT_ACCEPTED
- See Also:
-
-
Constructor Details
-
LayoutDescriptionService
public LayoutDescriptionService()
-
-
Method Details
-
filterAccessible
public org.exoplatform.portal.config.model.ModelObject filterAccessible(org.exoplatform.portal.config.model.ModelObject modelObject, String username) Drops, recursively, every container and application the user has no access permission on. Only page permissions are considered by the platform; an element-level permission is legacy data this filter still honours, as the page read does. -
toPageDescription
public PageDescription toPageDescription(org.exoplatform.portal.config.model.ModelObject pageTree, String pageRef, LayoutVersion version) -
toPageDescription
public PageDescription toPageDescription(org.exoplatform.portal.config.model.ModelObject pageTree, String pageRef, LayoutVersion version, String username) - Parameters:
pageTree- the page read, filtered by access permissionpageRef- the live page referenceversion- the version readusername- the reader, whose settings the configurable applications answer; null to read no settings- Returns:
- the page description
-
toSiteDescription
public SiteDescription toSiteDescription(org.exoplatform.portal.config.model.PortalConfig site, org.exoplatform.portal.config.model.ModelObject layout, String label, String description, boolean draft) - Parameters:
site- the live site, for its propertieslayout- the site layout to describe, the draft's when the user has one, already filtered by access permissionlabel- the site label resolved in the user's languagedescription- the site description resolved in the user's languagedraft- whether the layout is the user's draft- Returns:
- the site description
-
toSiteDescription
public SiteDescription toSiteDescription(org.exoplatform.portal.config.model.PortalConfig site, org.exoplatform.portal.config.model.ModelObject layout, String label, String description, org.exoplatform.portal.mop.SiteKey layoutSiteKey, boolean draft, String username) - Parameters:
site- the live site, for its propertieslayout- the site layout to describe, the draft's when the user has one, already filtered by access permissionlabel- the site label resolved in the user's languagedescription- the site description resolved in the user's languagelayoutSiteKey- the site holding the layout, the user's draft site or the live site; null to read no settingsdraft- whether the layout is the user's draftusername- the reader, whose settings the configurable applications answer; null to read no settings- Returns:
- the site description
-
toSiteLayout
public LayoutModel toSiteLayout(SiteLayoutUpdate update, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username, Locale locale) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Rebuilds a site layout from a set_site_layout call over the stored tree, every value checked before anything is written. The windows the caller cannot see stay in place; a container they cannot see refuses the call.- Parameters:
update- the four arguments of the callstored- the site whose stored layout is rebuilt, the user's draft or the live sitecopyWindows- true when the layout is the live one and the result becomes a new draft: every kept window is then a copy carrying the live window's preferences, as createDraftSite makes themusername- the callerlocale- the caller's locale, for the title of an application added from the catalog- Returns:
- the tree to save, ready for toSite, its style values checked as the save checks them, so a refusal precedes any write
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when an addressed container or window is not in the stored layoutIllegalAccessException- when the stored layout holds an element the caller cannot see and the call would not keep it in place
-
toSiteLayout
public LayoutModel toSiteLayout(SiteLayoutUpdate update, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username, Locale locale, ImageConsumption images) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Parameters:
images- the call's image consumption, on which a styling block carrying an image_upload_id claims its id before any write- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
toPageLayout
public LayoutModel toPageLayout(List<SectionDescription> sections, org.exoplatform.portal.config.model.Page stored, String username, Locale locale) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Parameters:
sections- the page's sections as set_page_layout takes themstored- the stored page the ids address, as the storage holds it: the live page when the user has no draft, their draft otherwiseusername- the editing userlocale- the user's language, for the catalog names- Returns:
- the page to write, its sections parent's children replaced
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
toPageLayout
public LayoutModel toPageLayout(List<SectionDescription> sections, org.exoplatform.portal.config.model.Page stored, String username, Locale locale, ImageConsumption images) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Parameters:
images- the call's image consumption, on which a styling block carrying an image_upload_id claims its id before any write- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
toStyledPage
public LayoutModel toStyledPage(List<ElementStyling> elements, org.exoplatform.portal.config.model.Page stored, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
elements- the elements of a set_layout_styles callstored- the stored page the ids address: the live page when the user has no draft, their draft otherwiseusername- the editing user- Returns:
- the page to write, its structure as stored
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
toStyledPage
public LayoutModel toStyledPage(List<ElementStyling> elements, org.exoplatform.portal.config.model.Page stored, String username, ImageConsumption images) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
images- the call's image consumption, on which a block carrying an image_upload_id claims its id before any write- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
toDisplayedPage
public LayoutModel toDisplayedPage(List<ElementDisplay> elements, org.exoplatform.portal.config.model.Page stored, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
elements- the elements of a set_layout_visibility callstored- the stored page the ids address: the live page when the user has no draft, their draft otherwiseusername- the editing user- Returns:
- the page to write, its structure as stored
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
toStyledSite
public LayoutModel toStyledSite(List<ElementStyling> elements, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
elements- the elements of a set_layout_styles callstored- the site whose stored layout the ids address, the user's draft or the live sitecopyWindows- whether the result becomes a new draft built from the live layout, in which case every window becomes a copy carrying its preferencesusername- the editing user- Returns:
- the site layout to write, its structure as stored
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
toStyledSite
public LayoutModel toStyledSite(List<ElementStyling> elements, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username, ImageConsumption images) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
images- the call's image consumption, on which a block carrying an image_upload_id claims its id before any write- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
toDisplayedSite
public LayoutModel toDisplayedSite(List<ElementDisplay> elements, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
elements- the elements of a set_layout_visibility callstored- the site whose stored layout the ids address, the user's draft or the live sitecopyWindows- whether the result becomes a new draft built from the live layout, in which case every window becomes a copy carrying its preferencesusername- the editing user- Returns:
- the site layout to write, its structure as stored
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
toMovedPage
public PlacedLayout toMovedPage(String applicationId, ApplicationPosition position, org.exoplatform.portal.config.model.Page stored, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
applicationId- the window of a move_layout_application callposition- where it goesstored- the stored page the ids address: the live page when the user has no draft, their draft otherwiseusername- the editing user- Returns:
- the page to write and the path of the moved window
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
toPlacedPage
public PlacedLayout toPlacedPage(ApplicationToPlace application, ApplicationPosition position, org.exoplatform.portal.config.model.Page stored, String username, Locale locale) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
application- the catalog application of a move_layout_application calllocale- the user's language, for the catalog names- Returns:
- the page to write and the path of the new window
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
toRemovedPage
public LayoutModel toRemovedPage(String applicationId, org.exoplatform.portal.config.model.Page stored, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException - Returns:
- the page to write, the window removed
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
toMovedSite
public PlacedLayout toMovedSite(String applicationId, ApplicationPosition position, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
stored- the site whose stored layout the ids address, the user's draft or the live site- Returns:
- the site layout to write and the path of the moved window
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
toPlacedSite
public PlacedLayout toPlacedSite(ApplicationToPlace application, ApplicationPosition position, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username, Locale locale) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
toRemovedSite
public LayoutModel toRemovedSite(String applicationId, org.exoplatform.portal.config.model.PortalConfig stored, boolean copyWindows, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
describeSites
- Parameters:
username- the readerkeyword- null for the portal sites alone, as the sites administration lists them; otherwise the portal sites whose name or label contains it, then the group sites whose own name (for a space, the group name it was created with, which a rename leaves as is) contains it- Returns:
- the sites the user can view, the portal sites by display order then label, sorted here because the portal's site query is cached by its predicates alone, the sort of its first caller serving every later one
-
describeApplications
public List<LayoutApplicationEntry> describeApplications(Long categoryId, String keyword, String username, Locale locale) - Parameters:
categoryId- a category, null for every categorykeyword- a text the name or description must contain, null for no filterusername- the readerlocale- the language of the names- Returns:
- the enabled catalog instances the user may place, then, with no category filter, each application a code plugin places without a catalog instance that no such instance carries
-
toDisplay
-
breakpointValue
- Parameters:
cssClass- the container's class tokensprefix- grid-cols, grid-rows, grid-cell-colspan or grid-cell-rowspan- Returns:
- the value of the token at the editor's current breakpoint, 1 when the token is absent, as the editor's parser reads it
-
toStyling
-