Package org.ametys.plugins.userdirectory
Class UserDirectoryPageHandler
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.userdirectory.UserDirectoryPageHandler
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Serviceable
public class UserDirectoryPageHandler
extends AbstractLogEnabled
implements Component, Serviceable, Initializable
Component providing methods to retrieve user directory virtual pages, such as the user directory root,
transitional page and user page.
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentTypeExtensionPoint
The extension point for content typesprotected AmetysObjectResolver
The ametys object resolver.The list of transitional page workspace --> contentType --> site --> language --> (key : page name -- list<> children pages names)The user directory root pages, indexed by workspace, site and sitemap name.The list of user page workspace --> contentType --> site --> language --> (key : page name --> Map(page name, content id))protected WorkspaceSelector
The workspace selector.static final String
The parent content type idstatic final String
The metadata name for the classification metadata of the user directorystatic final String
The attribute name for the content type of the user directorystatic final String
The metadata name for the depth of the user directorystatic final String
The avalon role. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_getUserDirectoryRootPages
(String siteName, String sitemapName) Get the user directory root pages, without searching in the cache.void
clearCache
(String contentTypeId) Clear root page cachevoid
clearCache
(Page rootPage) Clear root page cachegetClassificationAttribute
(Page rootPage) Gets the name of the classification metadatagetContentType
(Page rootPage) Gets the content typegetContentTypeId
(Page rootPage) Gets the content type idint
Gets the depth of the user directory root pageGets name form path namegetPathName
(String name) Checks if name contains only Unicode digits and if so, prefix it with "page-"getTransformedClassificationValue
(Page rootPage, Content content) Gets the value of the classification attribute for the given content, transformed for building tree hierarchy
The transformation takes the lower-case of all characters, removes non-alphanumeric characters, and takes the first characters to not have a string with a size bigger than the depth
For instance, if the value for the content is "Aéa Foo-bar" and the depth is 7, then this method will return "aeafoob"getTransitionalPagesName
(Page rootPage, String pagePath) Get all transitional page child from page namegetUserDirectoryRootPage
(String siteName, String sitemapName, String contentTypeId) Gets the user directory root page of a specific content type.getUserDirectoryRootPages
(String contentTypeId) Gets the user directory root pages from the given content type id, whatever the site.getUserDirectoryRootPages
(String siteName, String sitemapName) Gets the user directory root pages.getUserPagesContent
(Page rootPage, String pagePath) Get all user page child from page namevoid
void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The avalon role. -
CONTENT_TYPE_METADATA_NAME
The attribute name for the content type of the user directory- See Also:
-
CLASSIFICATION_METADATA_METADATA_NAME
The metadata name for the classification metadata of the user directory- See Also:
-
DEPTH_METADATA_NAME
The metadata name for the depth of the user directory- See Also:
-
ABSTRACT_USER_CONTENT_TYPE
The parent content type id- See Also:
-
_workspaceSelector
The workspace selector. -
_resolver
The ametys object resolver. -
_contentTypeEP
The extension point for content types -
_userDirectoryRootPages
The user directory root pages, indexed by workspace, site and sitemap name. -
_transitionalPagesCache
protected Map<String,Map<String, _transitionalPagesCacheMap<String, Map<String, Map<String, SortedSet<String>>>>>> The list of transitional page workspace --> contentType --> site --> language --> (key : page name -- list<> children pages names) -
_userPagesCache
protected Map<String,Map<String, _userPagesCacheMap<String, Map<String, Map<String, Map<String, String>>>>>> The list of user page workspace --> contentType --> site --> language --> (key : page name --> Map(page name, content id))
-
-
Constructor Details
-
UserDirectoryPageHandler
public UserDirectoryPageHandler()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getUserDirectoryRootPages
Gets the user directory root pages from the given content type id, whatever the site.- Parameters:
contentTypeId
- The content type id- Returns:
- the user directory root pages.
- Throws:
AmetysRepositoryException
- if an error occured.
-
getUserDirectoryRootPage
public Page getUserDirectoryRootPage(String siteName, String sitemapName, String contentTypeId) throws AmetysRepositoryException Gets the user directory root page of a specific content type.- Parameters:
siteName
- The site namesitemapName
- The sitemapcontentTypeId
- The content type id- Returns:
- the user directory root pages.
- Throws:
AmetysRepositoryException
- if an error occured.
-
getUserDirectoryRootPages
public Set<Page> getUserDirectoryRootPages(String siteName, String sitemapName) throws AmetysRepositoryException Gets the user directory root pages.- Parameters:
siteName
- The site namesitemapName
- The sitemap- Returns:
- the user directory root pages.
- Throws:
AmetysRepositoryException
- if an error occured.
-
_getUserDirectoryRootPages
protected Set<Page> _getUserDirectoryRootPages(String siteName, String sitemapName) throws AmetysRepositoryException Get the user directory root pages, without searching in the cache.- Parameters:
siteName
- the current site.sitemapName
- the sitemap name.- Returns:
- the user directory root pages
- Throws:
AmetysRepositoryException
- if an error occured.
-
getDepth
Gets the depth of the user directory root page- Parameters:
rootPage
- The user directory root page- Returns:
- the depth of the user directory root page
-
getClassificationAttribute
Gets the name of the classification metadata- Parameters:
rootPage
- The user directory root page- Returns:
- the name of the classification metadata
-
getContentTypeId
Gets the content type id- Parameters:
rootPage
- The user directory root page- Returns:
- the content type id
-
getContentType
Gets the content type- Parameters:
rootPage
- The user directory root page- Returns:
- the content type
-
getTransformedClassificationValue
Gets the value of the classification attribute for the given content, transformed for building tree hierarchy
The transformation takes the lower-case of all characters, removes non-alphanumeric characters, and takes the first characters to not have a string with a size bigger than the depth
For instance, if the value for the content is "Aéa Foo-bar" and the depth is 7, then this method will return "aeafoob"- Parameters:
rootPage
- The user directory root pagecontent
- The content- Returns:
- the transformed value of the classification attribute for the given content. Can be null
-
getTransitionalPagesName
Get all transitional page child from page name- Parameters:
rootPage
- the root pagepagePath
- the page path- Returns:
- all transitional page child from page name
-
getUserPagesContent
Get all user page child from page name- Parameters:
rootPage
- the root pagepagePath
- the page path- Returns:
- all user page child from page name
-
getName
Gets name form path name- Parameters:
pathName
- the path name- Returns:
- the name
-
getPathName
Checks if name contains only Unicode digits and if so, prefix it with "page-"- Parameters:
name
- The page name- Returns:
- The potentially prefixed page name
-
clearCache
Clear root page cache- Parameters:
rootPage
- the root page
-
clearCache
Clear root page cache- Parameters:
contentTypeId
- the content type id
-