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_cTypeEPThe content type extension pointprotected I18nUtils_i18nUtilsThe i18n utilsprotected AmetysObjectResolver_resolverThe ametys object resolverstatic StringATTRIBUTE_TRANSITIONAL_PAGE_METADATA_VALUEThe attribute to get the name of transitional pagestatic StringATTRIBUTE_TRANSITIONAL_PAGE_TITLEThe attribute to get the title of transitional pagestatic StringCLASSIFICATION_ATTRIBUTE_DATA_NAMEThe data name for the classification attribute of the ugcstatic StringCONTENT_TYPE_DATA_NAMEThe data name for the content type of the ugcstatic StringROLEThe 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)StringcomputePageId(String path, Page root, Content ugcContent)Computes a page idStringgetClassificationAttribute(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 pageStringgetContentTypeId(Page rootPage)Gets the content type idprotected org.slf4j.LoggergetLogger()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 rootPagegetUGCRootPage(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 pagesvoidservice(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:
servicein interfaceServiceable- Throws:
ServiceException
-
getLogger
protected org.slf4j.Logger getLogger()
Description copied from class:AbstractLogEnabledReturns theLogger.- Overrides:
getLoggerin 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)
-
-