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.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static final class
Key to index a user directory page in a cacheprotected static final class
Key to index a user directory root page in a cacheprotected static final record
User directory pages cache -
Field Summary
Modifier and TypeFieldDescriptionprotected AbstractCacheManager
The cache managerprotected ContentTypeExtensionPoint
The extension point for content typesprotected AmetysObjectResolver
The ametys object resolver.protected WorkspaceSelector
The workspace selector.static final String
The parent content type idstatic final String
The data name for the classification attribute of the user directorystatic final String
The data name for the content type of the user directorystatic final String
The data name for the depth of the user directorystatic final String
The avalon role.protected static final String
The user directory root pages cache idprotected static final String
The user directory user pages cache idstatic final String
The data name for the users' view to use -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_getTransformedValuesByContent
(Page rootPage) Get all transformed values by content_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 attributegetContentsForRootPage
(Page rootPage) Get the user contents for a given root pagegetContentType
(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-"protected Cache<UserDirectoryPageHandler.RootPageCacheKey,
Set<String>> Cache of the user directory root pages.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 nameCache of the user directory user pages and transitional page.getUserDirectoryRootPage
(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_DATA_NAME
The data name for the content type of the user directory- See Also:
-
USER_VIEW_NAME
The data name for the users' view to use- See Also:
-
CLASSIFICATION_ATTRIBUTE_DATA_NAME
The data name for the classification attribute of the user directory- See Also:
-
DEPTH_DATA_NAME
The data name for the depth of the user directory- See Also:
-
ABSTRACT_USER_CONTENT_TYPE
The parent content type id- See Also:
-
ROOT_PAGES_CACHE
The user directory root pages cache id -
UD_PAGES_CACHE
The user directory user pages cache id -
_workspaceSelector
The workspace selector. -
_resolver
The ametys object resolver. -
_contentTypeEP
The extension point for content types -
_abstractCacheManager
The cache manager
-
-
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 attribute- Parameters:
rootPage
- The user directory root page- Returns:
- the name of the classification attribute
-
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
-
_getTransformedValuesByContent
Get all transformed values by content- Parameters:
rootPage
- the root page- Returns:
- the map of transformed values by content
-
getContentsForRootPage
Get the user contents for a given root page- Parameters:
rootPage
- the root page- Returns:
- the user contents
-
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
-
getRootPagesCache
Cache of the user directory root pages. The cache store a Set of TODO indexed by the workspaceName, siteName, siteMapName- Returns:
- the cache
-
getUDPagesCache
protected Cache<UserDirectoryPageHandler.PageCacheKey,UserDirectoryPageHandler.UDPagesCache> getUDPagesCache()Cache of the user directory user pages and transitional page. The cache store aUserDirectoryPageHandler.UDPagesCache
containing the transitional pages cache and the user pages cache. The cache is indexed by workspaceName, siteName, siteMapName, pageName.- Returns:
- the cache
-