public class UserDirectoryPageHandler extends AbstractLogEnabled implements Component, Serviceable, Initializable
Modifier and Type | Field and Description |
---|---|
protected ContentTypeExtensionPoint |
_contentTypeEP
The extension point for content types
|
protected AmetysObjectResolver |
_resolver
The ametys object resolver.
|
protected Map<String,Map<String,Map<String,SortedSet<String>>>> |
_transitionalPagesCache
The list of transitional page workspace --> contentType --> (key : page name -- list<> children pages names)
|
protected Map<String,Map<String,Map<String,Set<String>>>> |
_userDirectoryRootPages
The user directory root pages, indexed by workspace, site and sitemap name.
|
protected Map<String,Map<String,Map<String,SortedMap<String,String>>>> |
_userPagesCache
The list of user page workspace --> contentType --> (key : page name --> Map(page name, content id))
|
protected WorkspaceSelector |
_workspaceSelector
The workspace selector.
|
static String |
ABSTRACT_USER_CONTENT_TYPE
The parent content type id
|
static String |
CLASSIFICATION_METADATA_METADATA_NAME
The metadata name for the classification metadata of the user directory
|
static String |
CONTENT_TYPE_METADATA_NAME
The metadata name for the content type of the user directory
|
static String |
DEPTH_METADATA_NAME
The metadata name for the depth of the user directory
|
static String |
ROLE
The avalon role.
|
Constructor and Description |
---|
UserDirectoryPageHandler() |
Modifier and Type | Method and Description |
---|---|
private void |
_buildTransitionalPageCache(Set<String> transformedValues,
Map<String,SortedSet<String>> transitionalPageCache) |
private void |
_buildUserPageCache(Map<Content,String> transformedValuesByContent,
int depth,
Map<String,SortedMap<String,String>> userPageCache) |
private String |
_filterName(String name) |
private String |
_getClassificationMetadata(Content content,
String metadataPath) |
private AmetysObjectIterable<Content> |
_getContentsForRootPage(Page rootPage) |
protected Set<Page> |
_getUserDirectoryRootPages(String siteName,
String sitemapName)
Get the user directory root pages, without searching in the cache.
|
private void |
_initializeCaches(Page rootPage,
String workspace,
String contentType) |
void |
clearCache(Page rootPage)
Clear root page cache
|
void |
clearCache(String contentTypeId)
Clear root page cache
|
String |
getClassificationMetadata(Page rootPage)
Gets the name of the classification metadata
|
ContentType |
getContentType(Page rootPage)
Gets the content type
|
String |
getContentTypeId(Page rootPage)
Gets the content type id
|
int |
getDepth(Page rootPage)
Gets the depth of the user directory root page
|
String |
getName(String pathName)
Gets name form path name
|
String |
getPathName(String name)
Checks if name contains only Unicode digits and if so, prefix it with "page-"
|
String |
getTransformedClassificationMetadataValue(Page rootPage,
Content content)
Gets the value of the classification metadata 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" |
SortedSet<String> |
getTransitionalPagesName(Page rootPage,
String pagePath)
Get all transitional page child from page name
|
Page |
getUserDirectoryRootPage(String siteName,
String sitemapName,
String contentTypeId)
Gets the user directory root page of a specific content type.
|
Set<Page> |
getUserDirectoryRootPages(String contentTypeId)
Gets the user directory root pages from the given content type id, whatever the site.
|
Set<Page> |
getUserDirectoryRootPages(String siteName,
String sitemapName)
Gets the user directory root pages.
|
Map<String,String> |
getUserPagesContent(Page rootPage,
String pagePath)
Get all user page child from page name
|
void |
initialize() |
void |
service(ServiceManager manager) |
getLogger, setLogger
public static final String CONTENT_TYPE_METADATA_NAME
public static final String CLASSIFICATION_METADATA_METADATA_NAME
public static final String DEPTH_METADATA_NAME
public static final String ABSTRACT_USER_CONTENT_TYPE
protected WorkspaceSelector _workspaceSelector
protected AmetysObjectResolver _resolver
protected ContentTypeExtensionPoint _contentTypeEP
protected Map<String,Map<String,Map<String,Set<String>>>> _userDirectoryRootPages
protected Map<String,Map<String,Map<String,SortedSet<String>>>> _transitionalPagesCache
public UserDirectoryPageHandler()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void initialize() throws Exception
initialize
in interface Initializable
Exception
public Set<Page> getUserDirectoryRootPages(String contentTypeId) throws AmetysRepositoryException
contentTypeId
- The content type idAmetysRepositoryException
- if an error occured.public Page getUserDirectoryRootPage(String siteName, String sitemapName, String contentTypeId) throws AmetysRepositoryException
siteName
- The site namesitemapName
- The sitemapcontentTypeId
- The content type idAmetysRepositoryException
- if an error occured.public Set<Page> getUserDirectoryRootPages(String siteName, String sitemapName) throws AmetysRepositoryException
siteName
- The site namesitemapName
- The sitemapAmetysRepositoryException
- if an error occured.protected Set<Page> _getUserDirectoryRootPages(String siteName, String sitemapName) throws AmetysRepositoryException
siteName
- the current site.sitemapName
- the sitemap name.AmetysRepositoryException
- if an error occured.public int getDepth(Page rootPage)
rootPage
- The user directory root pagepublic String getClassificationMetadata(Page rootPage)
rootPage
- The user directory root pagepublic String getContentTypeId(Page rootPage)
rootPage
- The user directory root pagepublic ContentType getContentType(Page rootPage)
rootPage
- The user directory root pagepublic String getTransformedClassificationMetadataValue(Page rootPage, Content content)
rootPage
- The user directory root pagecontent
- The contentprivate String _filterName(String name)
public SortedSet<String> getTransitionalPagesName(Page rootPage, String pagePath)
rootPage
- the root pagepagePath
- the page pathprivate void _initializeCaches(Page rootPage, String workspace, String contentType)
private void _buildTransitionalPageCache(Set<String> transformedValues, Map<String,SortedSet<String>> transitionalPageCache)
private void _buildUserPageCache(Map<Content,String> transformedValuesByContent, int depth, Map<String,SortedMap<String,String>> userPageCache)
private String _getClassificationMetadata(Content content, String metadataPath) throws UnknownMetadataException
UnknownMetadataException
public Map<String,String> getUserPagesContent(Page rootPage, String pagePath)
rootPage
- the root pagepagePath
- the page pathprivate AmetysObjectIterable<Content> _getContentsForRootPage(Page rootPage)
public String getName(String pathName)
pathName
- the path namepublic String getPathName(String name)
name
- The page namepublic void clearCache(Page rootPage)
rootPage
- the root pagepublic void clearCache(String contentTypeId)
contentTypeId
- the content type id