Class PageContentUtils
java.lang.Object
ch.tocco.nice2.optional.cms.impl.utils.PageContentUtils
This utility provides static methods to "navigate" around in the page content entity structure.
Entity structure of the page content:
Page
+- relContent (to 1 Page_content, Reverse: relContent_page)
+- relContent_published (to 1 Page_content, Reverse: relContent_published_page)
Page_content
+- relPage_content_to_section (to n Page_content_to_section)
Page_content_to_section
+- container_name (String)
+- position (Integer, position of this section within the container)
+- relSection (to 1 Section)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A simple bean containing a Page entity and a boolean value to determine if the page was resolved by the published Page_content entity or the one to edit. -
Method Summary
Modifier and TypeMethodDescriptionstatic EntityList
getContentToSectionByContent
(Entity content) Resolve Page_content_to_section entities which are linked to a Page_content (ordered by position)getContentToSectionBySection
(Entity section) Resolve Page_content_to_section from Section.getPageByEditContent
(Entity pageContent) Resolve Page from "edit" Page_content.getPageByEditSection
(Entity section) Resolve Page from Section to edit.getPageByPageContent
(Entity pageContent) Resolve Page from Page_content.getPageByPublishedContent
(Entity pageContent) Resolve Page from published Page_content.getPageByPublishedSection
(Entity section) Resolve Page from published Section.static Entity
getPageContentByContentToSection
(Entity contentToSection) Resolve Page_content from Page_content_to_section.getPageContentBySection
(Entity section) Resolve Page_content from Section.static Entity
getSectionByContentToSection
(Entity contentToSection) Resolve Section from Page_content_to_section (either direct or via snippet).
-
Method Details
-
getPageByPublishedSection
Resolve Page from published Section. The Page has two relations to Page_content. One for the published (frozen) content and one to edit. We assume that the given Section entity is a published section and try to resolve the page by going the relation relContent_published_page up to the page. IfOptional.empty()
is returned, the given section must have been a section entity to edit andgetPageByEditSection(Entity)
might resolve the page successfully.- Parameters:
section
- The published Section entity to find the Page entity for.- Returns:
- the Page entity if the given entity was a published section or
Optional.empty()
. - See Also:
-
getPageByEditSection
Resolve Page from Section to edit. The Page has two relations to Page_content. One for the published (frozen) content and one to edit. We assume that the given Section entity is a section to edit and try to resolve the page by going the relation relContent_page up to the page. IfOptional.empty()
is returned, the given section must have been a published section entity andgetPageByPublishedSection(Entity)
might resolve the page successfully.- Parameters:
section
- The "edit" Section entity to find the Page entity for.- Returns:
- the Page entity if the given entity was a section to edit or
Optional.empty()
. - See Also:
-
getPageByPageContent
Resolve Page from Page_content. The Page has two relations to Page_content. One for the published (frozen) content and one to edit. We try both relations up to the Page (one of them must resolve successfully)- Parameters:
pageContent
- The Page_content entity to find the Page entity for.- Returns:
- the page entity and the information if the given Page_content entity was the published content or the one to edit.
-
getPageByPublishedContent
Resolve Page from published Page_content. The Page has two relations to Page_content. One for the published (frozen) content and one to edit. We assume that the given Page_content entity is the published Page_content and try to resolve the page by going this relation (relContent_published_page) up to the page. IfOptional.empty()
is returned, the given page content must have been the content entity to edit andgetPageByEditContent(Entity)
might resolve the page successfully.- Parameters:
pageContent
- The published Page_content entity to find the Page entity for.- Returns:
- the Page entity if the given entity was the published content or
Optional.empty()
. - See Also:
-
getPageByEditContent
Resolve Page from "edit" Page_content. The Page has two relations to Page_content. One for the published (frozen) content and one to edit. We assume that the given Page_content entity is the Page_content to edit and try to resolve the page by going this relation (relContent_page) up to the page. IfOptional.empty()
is returned, the given page content must have been a published content entity andgetPageByPublishedContent(Entity)
might resolve the page successfully.- Parameters:
pageContent
- The edit Page_content entity to find the Page entity for.- Returns:
- the Page entity if the given entity was the edit content or
Optional.empty()
. - See Also:
-
getPageContentBySection
Resolve Page_content from Section. ยง- Parameters:
section
- The Section entity to find the Page_content entity for.- Returns:
- the Page_content entity for the given entity (must be exactly one).
-
getPageContentByContentToSection
Resolve Page_content from Page_content_to_section.- Parameters:
contentToSection
- The Page_content_to_section entity to find the Page_content entity for.- Returns:
- the Page_content entity for the given entity (must be exactly one).
-
getContentToSectionBySection
Resolve Page_content_to_section from Section.- Parameters:
section
- The Section entity to find the Page_content_to_section entity for.- Returns:
- the Page_content_to_section entity for the given entity (must be exactly one or none (in case of a snippet section)).
-
getSectionByContentToSection
Resolve Section from Page_content_to_section (either direct or via snippet).- Parameters:
contentToSection
- The Page_content_to_section entity to find the Section entity for.- Returns:
- the resolved Section entity.
-
getContentToSectionByContent
Resolve Page_content_to_section entities which are linked to a Page_content (ordered by position)- Parameters:
content
- The Page_content entity to find the Page_content_to_section entities for.- Returns:
- the linked Page_content_to_section entities.
-