Package org.ametys.plugins.ugc.page
Class UGCPageHandler
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.ugc.page.UGCPageHandler
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
,Serviceable
public class UGCPageHandler
extends AbstractLogEnabled
implements Component, Serviceable, Contextualizable
Component providing methods to retrieve ugc virtual pages, such as the ugc root,
transitional page and ugc content page.
-
Field Summary
Modifier and TypeFieldDescriptionprotected Context
The avalon contextprotected ContentTypeExtensionPoint
The content type extension pointprotected ContentTypesHelper
The content types helperprotected I18nUtils
The i18n utilsprotected AmetysObjectResolver
The ametys object resolverstatic final String
The attribute to get the name of transitional pagestatic final String
The attribute to get the title of transitional pagestatic final String
The data name for the classification attribute of the ugcstatic final String
The data name for the visibility of transitional page of the ugcstatic final String
The data name for the content type of the ugcstatic final String
The avalon role. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomputePageId
(String path, Page root, Content ugcContent) Computes a page idvoid
contextualize
(Context context) getClassificationAttribute
(Page rootPage) Gets the path of the classification attributegetContentsForRootPage
(Page rootPage) Get UGC contents from rootPagegetContentsForTransitionalPage
(Page rootPage, String metadataValue) Get contents under transitional pagegetContentTypeId
(Page rootPage) Gets the content type idprotected Logger
Returns theLogger
.getTransitionalPage
(Page rootPage) Get the map of transitional page (name : (id, title))getUgcPage
(String contentId, String siteName) Gets the UGC page related to the given UG Content idgetUgcPage
(Content ugcContent, String site, String sitemap, String contentType) Gets the UGC page related to the given UG Content for given site, sitemap and typegetUgcPage
(Page ugcRootPage, Content ugcContent) Gets the UGC page related to the given UG Content for given UGC rootgetUGCRootPage
(String siteName, String sitemapName, String contentTypeId) Gets the ugc root pages from the given content type id.getUGCRootPages
(String siteName, String sitemapName) Get the ugc root pagesboolean
hasContentForRootPage
(Page rootPage, Content content) Determines if content is part of UGC root pageboolean
hasContentForTransitionalPage
(Page rootPage, String metadataValue, Content content) Determines if given content is part of a transitional pageboolean
isClassificationPagesVisible
(Page rootPage) true
if the classification pages are visiblevoid
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
setLogger
-
Field Details
-
ATTRIBUTE_TRANSITIONAL_PAGE_METADATA_VALUE
The attribute to get the name of transitional page- See Also:
-
ATTRIBUTE_TRANSITIONAL_PAGE_TITLE
The attribute to get the title of transitional page- See Also:
-
ROLE
The avalon role. -
CONTENT_TYPE_DATA_NAME
The data name for the content type of the ugc- See Also:
-
CLASSIFICATION_ATTRIBUTE_DATA_NAME
The data name for the classification attribute of the ugc- See Also:
-
CLASSIFICATION_PAGE_VISIBLE_DATA_NAME
The data name for the visibility of transitional page of the ugc- See Also:
-
_resolver
The ametys object resolver -
_cTypeEP
The content type extension point -
_cTypeHelper
The content types helper -
_i18nUtils
The i18n utils -
_context
The avalon context
-
-
Constructor Details
-
UGCPageHandler
public UGCPageHandler()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
getLogger
Description copied from class:AbstractLogEnabled
Returns theLogger
.- Overrides:
getLogger
in classAbstractLogEnabled
- Returns:
- the
Logger
.
-
getClassificationAttribute
Gets the path of the classification attribute- Parameters:
rootPage
- The ugc root page- Returns:
- the path of the classification attribute
-
getContentTypeId
Gets the content type id- Parameters:
rootPage
- The ugc root page- Returns:
- the content type id
-
isClassificationPagesVisible
true
if the classification pages are visible- Parameters:
rootPage
- The ugc root page- Returns:
true
if the classification pages are visible
-
getUGCRootPage
public Page getUGCRootPage(String siteName, String sitemapName, String contentTypeId) throws AmetysRepositoryException Gets the ugc root pages from the given content type id.- Parameters:
siteName
- the site namesitemapName
- the sitemap namecontentTypeId
- The content type id- Returns:
- the ugc root page.
- Throws:
AmetysRepositoryException
- if an error occured.
-
getUGCRootPages
public Set<Page> getUGCRootPages(String siteName, String sitemapName) throws AmetysRepositoryException Get the ugc root pages- Parameters:
siteName
- the current site.sitemapName
- the sitemap name.- Returns:
- the ugc root pages
- Throws:
AmetysRepositoryException
- if an error occured.
-
getContentsForRootPage
Get UGC contents from rootPage- Parameters:
rootPage
- the root page- Returns:
- the list of UGC contents
-
hasContentForRootPage
Determines if content is part of UGC root page- Parameters:
rootPage
- The root pagecontent
- the content- Returns:
- true if content is part of UGC root page
-
getTransitionalPage
Get the map of transitional page (name : (id, title))- Parameters:
rootPage
- the root page- Returns:
- The map of transitional page
-
getContentsForTransitionalPage
public AmetysObjectIterable<Content> getContentsForTransitionalPage(Page rootPage, String metadataValue) Get contents under transitional page- Parameters:
rootPage
- the root pagemetadataValue
- the metadata value (linked to the transitional page)- Returns:
- list of contents under transitional page
-
hasContentForTransitionalPage
Determines if given content is part of a transitional page- Parameters:
rootPage
- the root pagemetadataValue
- the metadata value (linked to the transitional page). Cannot be null.content
- the content- Returns:
- true if content is part of the transitional page
-
computePageId
Computes a page id- Parameters:
path
- The pathroot
- The root pageugcContent
- The UGC content- Returns:
- The id
-
getUgcPage
Gets the UGC page related to the given UG Content id- Parameters:
contentId
- the id of UG ContentsiteName
- The site name. Can be nul to get site from content or current site.- Returns:
- the UGC page or null if not found
-
getUgcPage
public Optional<UGCPage> getUgcPage(Content ugcContent, String site, String sitemap, String contentType) Gets the UGC page related to the given UG Content for given site, sitemap and type- Parameters:
ugcContent
- the UG Contentsite
- the site namesitemap
- the sitemap namecontentType
- the content type id- Returns:
- the UGC page
-
getUgcPage
Gets the UGC page related to the given UG Content for given UGC root- Parameters:
ugcRootPage
- the UGC root pageugcContent
- the UG Content- Returns:
- the UGC page
-