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
public class UGCPageHandler extends AbstractLogEnabled implements Component, Serviceable
Component providing methods to retrieve ugc virtual pages, such as the ugc root, transitional page and ugc content page.
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentTypeExtensionPoint
_cTypeEP
The content type extension pointprotected I18nUtils
_i18nUtils
The i18n utilsprotected AmetysObjectResolver
_resolver
The ametys object resolverstatic String
ATTRIBUTE_TRANSITIONAL_PAGE_METADATA_VALUE
The attribute to get the name of transitional pagestatic String
ATTRIBUTE_TRANSITIONAL_PAGE_TITLE
The attribute to get the title of transitional pagestatic String
CLASSIFICATION_ATTRIBUTE_DATA_NAME
The data name for the classification attribute of the ugcstatic String
CONTENT_TYPE_DATA_NAME
The data name for the content type of the ugcstatic String
ROLE
The avalon role.
-
Constructor Summary
Constructors Constructor Description UGCPageHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ClassificationType
_getClassificationType(Page rootPage)
private String
_getPath(Page ugcRootPage, Content ugcContent)
private UGCPage
_silentResolve(String id)
String
computePageId(String path, Page root, Content ugcContent)
Computes a page idString
getClassificationAttribute(Page rootPage)
Gets the path of the classification attributeAmetysObjectIterable<Content>
getContentsForRootPage(Page rootPage)
Get orgUnit contents from rootPageAmetysObjectIterable<Content>
getContentsForTransitionalPage(Page rootPage, String metadataValue)
Get contents under transitional pageString
getContentTypeId(Page rootPage)
Gets the content type idprotected org.slf4j.Logger
getLogger()
Returns theLogger
.Map<String,Map<String,String>>
getTransitionalPage(Page rootPage)
Get the map of transitional page (name : (id, title))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 typeOptional<UGCPage>
getUgcPage(Page ugcRootPage, Content ugcContent)
Gets the UGC page related to the given UG Content for given UGC rootPage
getUGCRootPage(String siteName, String sitemapName, String contentTypeId)
Gets the ugc root pages from the given content type id.Set<Page>
getUGCRootPages(String siteName, String sitemapName)
Get the ugc root pagesvoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
setLogger
-
-
-
-
Field Detail
-
ATTRIBUTE_TRANSITIONAL_PAGE_METADATA_VALUE
public static final String ATTRIBUTE_TRANSITIONAL_PAGE_METADATA_VALUE
The attribute to get the name of transitional page- See Also:
- Constant Field Values
-
ATTRIBUTE_TRANSITIONAL_PAGE_TITLE
public static final String ATTRIBUTE_TRANSITIONAL_PAGE_TITLE
The attribute to get the title of transitional page- See Also:
- Constant Field Values
-
CONTENT_TYPE_DATA_NAME
public static final String CONTENT_TYPE_DATA_NAME
The data name for the content type of the ugc- See Also:
- Constant Field Values
-
CLASSIFICATION_ATTRIBUTE_DATA_NAME
public static final String CLASSIFICATION_ATTRIBUTE_DATA_NAME
The data name for the classification attribute of the ugc- See Also:
- Constant Field Values
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The content type extension point
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils
-
-
Constructor Detail
-
UGCPageHandler
public UGCPageHandler()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getLogger
protected org.slf4j.Logger getLogger()
Description copied from class:AbstractLogEnabled
Returns theLogger
.- Overrides:
getLogger
in classAbstractLogEnabled
- Returns:
- the
Logger
.
-
getClassificationAttribute
public String getClassificationAttribute(Page rootPage)
Gets the path of the classification attribute- Parameters:
rootPage
- The ugc root page- Returns:
- the path of the classification attribute
-
getContentTypeId
public String getContentTypeId(Page rootPage)
Gets the content type id- Parameters:
rootPage
- The ugc root page- Returns:
- the content type id
-
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
public AmetysObjectIterable<Content> getContentsForRootPage(Page rootPage)
Get orgUnit contents from rootPage- Parameters:
rootPage
- the root page- Returns:
- the list of orgUnit contents
-
getTransitionalPage
public Map<String,Map<String,String>> getTransitionalPage(Page rootPage)
Get the map of transitional page (name : (id, title))- Parameters:
rootPage
- the root page- Returns:
- The map of transitional page
-
_getClassificationType
private ClassificationType _getClassificationType(Page rootPage)
-
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
public String computePageId(String path, Page root, Content ugcContent)
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
public Optional<UGCPage> getUgcPage(Page ugcRootPage, Content ugcContent)
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
-
_silentResolve
private UGCPage _silentResolve(String id)
-
-