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
,Serviceable
Component providing methods to retrieve ugc virtual pages, such as the ugc root,
transitional page and ugc content page.
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentTypeExtensionPoint
The content type extension pointprotected 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 idgetClassificationAttribute
(Page rootPage) Gets the path of the classification attributegetContentsForRootPage
(Page rootPage) Get orgUnit 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
(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
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 -
_i18nUtils
The i18n utils
-
-
Constructor Details
-
UGCPageHandler
public UGCPageHandler()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
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 orgUnit contents from rootPage- Parameters:
rootPage
- the root page- Returns:
- the list of orgUnit contents
-
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
-
computePageId
Computes a page id- Parameters:
path
- The pathroot
- The root pageugcContent
- The UGC content- Returns:
- The id
-
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
-