public class AmetysXSLTHelper extends AmetysXSLTHelper
Modifier and Type | Field and Description |
---|---|
private static URIPrefixHandler |
_prefixHandler |
private static RenderingContextHandler |
_renderingContextHandler |
private static RightManager |
_rightManager |
private static ServiceExtensionPoint |
_serviceEP |
private static SiteConfigurationExtensionPoint |
_siteConf |
private static SiteManager |
_siteManager |
private static SourceResolver |
_sourceResolver |
_ametysObjectResolver, _contentHelper, _context, _cTypeExtensionPoint, _logger, _tagProviderExtPt
_currentUserProvider, _groupManager, _i18nUtils, _jsonUtils, _LOGGER, _userHelper, _userManager, _versionHandler
Constructor and Description |
---|
AmetysXSLTHelper() |
Modifier and Type | Method and Description |
---|---|
private static String |
_convertTagName(String name) |
private static String |
_getMetadata(CompositeMetadata cm,
String metadataName) |
private static Page |
_getPage(String id) |
private static Page |
_getPage(String sitename,
String lang,
String path) |
private static Map<String,MapElement.MapNode> |
_getParameterValue(String paramName,
CompositeMetadata parentMetadata,
ServiceParameterOrRepeater paramDef,
String defaultValue) |
private static String |
_getResourceBase64(FileSource source)
Get the base 64 encoding for the given source
|
private static String |
_getResourceURL(Request request,
Site site,
String resourcePath) |
private static boolean |
_hasRightOnPage(String rightId,
Page page)
Returns true if the current user has the specified right on the specified page
|
static String |
absoluteSiteUriPrefix()
Returns the absolute URI prefix corresponding to the current site, depending on the rendering context.
|
static String |
absoluteSiteUriPrefix(String siteName)
Returns the absolute URI prefix corresponding to the given site, depending on the rendering context.
|
static String |
absoluteUriPrefix()
Returns the absolute URI prefix, depending on the rendering context.
|
static NodeList |
accessibleReferencedPages(String contentId)
Returns the id of pages referencing the content and for which the Front-office user can access
|
static NodeList |
breadcrumb()
Computes the breadcrumb of the current page.
|
static NodeList |
findPagesIdsByTag(String tag)
Returns the ids of the pages
|
static NodeList |
findPagesIdsByTag(String sitename,
String lang,
String tag)
Returns the ids of the pages
|
static boolean |
hasRightOnPage(String rightId)
Returns true if the current user has the specified right on the current page
|
static boolean |
hasRightOnPage(String rightId,
String pageId)
Returns true if the current user has the specified right on the specified page
|
static boolean |
isCacheable()
Determines if the current zone item or (if there is no current zone item) the current page is cacheable
This method is only valid for a page.
|
static boolean |
isEditionMode()
Determines if we are in an edition mode
|
static String |
lang()
Returns the current sitemap name.
|
static String |
lang(String pageId)
Returns the current sitemap name.
|
static boolean |
pageHasRestrictedAccess(String pageId)
Returns true if the given page has restricted access.
|
static boolean |
pageHasRestrictedAccess(String sitename,
String lang,
String path)
Returns true if the given page has restricted access.
|
static String |
pageId()
Returns the id of the current page.
|
static boolean |
pageIsVisible(String pageId)
Returns true if the given page is visible into navigation elements
|
static boolean |
pageIsVisible(String sitename,
String lang,
String path)
Returns true if the given page is visible into navigation elements
|
static String |
pageLongTitle(String pageId)
Get the long title of a page
|
static String |
pageLongTitle(String sitename,
String lang,
String path)
Get the long title of a page
|
static String |
pageMetadata(String pageId,
String metadataName)
Get the meta of a page
|
static String |
pageMetadata(String sitename,
String lang,
String path,
String metadataName)
Get the meta of a page
|
static String |
pagePath()
Returns the path of the current page, relative to the sitemap's root.
|
static String |
pagePath(String pageId)
Returns the path in sitemap of a page
|
static String |
pageSiteName(String pageId)
Get the site name of a page.
|
static String |
pageTitle(String pageId)
Get the title of a page.
|
static String |
pageTitle(String sitename,
String lang,
String path)
Get the title of a page.
|
static String |
pluginImageBase64(String plugin,
String path)
Computes the base 64 representation of the image at the specified path in the given plugin.
|
static String |
pluginResourceURL(String plugin,
String path)
Computes the URI for the given resource in the given plugin.
If the URI is requested by the front-office, it will be absolutized. |
static NodeList |
referencedPages(String contentId)
Returns the id of pages referencing the content
|
static String |
renderingContext()
Returns the current
RenderingContext . |
static Node |
resourceByPath(String path)
Returns a DOM
Element representing a single file of the resources explorer. |
static Node |
resourcesById(String collectionId)
Returns a DOM
Element representing files and folder of the resources explorer,
under the ResourceCollection corresponding to the given id. |
static Node |
resourcesByPath(String path)
Returns a DOM
Element representing files and folder of the resources explorer,
under the ResourceCollection corresponding to the given path. |
void |
service(ServiceManager manager) |
static Node |
serviceParameter(String parameter)
Returns the value of the given parameter for the current service, or the empty string if the parameter does not exist.
|
static Node |
serviceParameter(String parameter,
String defaultValue)
Returns the value of the given parameter for the current service, or the provided default value if the parameter does not exist.
|
static Node |
serviceParameters()
Get the service parameters as a
Node . |
static String |
site()
Returns the current site
|
static String |
site(String pageId)
Returns the current site
|
static Node |
sitemap()
Return the current sitemap as a
Node . |
static Node |
sitemap(boolean includeInvisiblePages)
Return the current sitemap as a
Node . |
static Node |
sitemap(String pageId)
Return the subsitemap of the given page as a
Node . |
static Node |
sitemap(String pageId,
boolean includeInvisiblePages)
Return the subsitemap of the given page as a
Node . |
static String |
siteParameter(String parameter)
Return the value of a site parameter as a String.
|
static String |
siteParameter(String siteName,
String parameter)
Return the value of a site parameter as a String.
|
static String |
siteUriPrefix()
Returns the URI prefix corresponding to the current site, depending on the rendering context.
|
static String |
skin()
Returns the current skin name.
|
static String |
skinBoundedImageURL(String path,
int maxHeight,
int maxWidth)
Computes the URI for the given image with a given heigth and width in the current site's skin.
If the URI is requested by the front-office, it will be absolutized. |
static String |
skinImageBase64(String path)
Computes the base 64 representation of the image at the specified path.
|
static String |
skinImageURL(String path,
int height,
int width)
Computes the URI for the given image with a given heigth and width in the current site's skin.
If the URI is requested by the front-office, it will be absolutized. |
static Node |
skinResources(String path)
Returns a DOM
Element representing files and folder of a skin directory. |
static String |
skinURL(String path)
Computes the URI for the given resource in the current site's skin.
If the URI is requested by the front-office, it will be absolutized. |
static String |
template()
Returns the current template name.
|
static String |
templateURL(String path)
Computes the URI for the given resource in the current template.
If the URI is requested by the front-office, it will be absolutized. |
static String |
uriPrefix()
Returns the current URI prefix, depending on the rendering context.
|
static String |
zone(String defaultValue)
Return the name of the zone beeing handled
|
static String |
zoneItemId()
Returns the id of the current zone item id.
|
contentAttachments, contentAttachments, contentMetadata, contentMetadata, contentMixinTypes, contentTags, contentTypes, contentTypeTags, contextualize, enableLogging, isReferenceTableContent, setCurrentContent, setCurrentContent, tagDescription, tagLabel, tagParent, tagPath, tagVisibility
absoluteUriPrefix, config, escapeJS, getAbsoluteUriPrefix, getUriPrefix, getValueFromJsonObject, getWorkspaceName, getWorkspacePrefix, groups, groups, groups, isDeveloperMode, requestParameter, splitText, splitText, translate, translate, uriPrefix, urlEncode, user, user, user, versions, workspaceName, workspacePrefix, workspaceTheme, workspaceThemeURL
private static SiteManager _siteManager
private static RenderingContextHandler _renderingContextHandler
private static SiteConfigurationExtensionPoint _siteConf
private static RightManager _rightManager
private static URIPrefixHandler _prefixHandler
private static SourceResolver _sourceResolver
private static ServiceExtensionPoint _serviceEP
public AmetysXSLTHelper()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
service
in class AmetysXSLTHelper
ServiceException
public static String uriPrefix()
public static String siteUriPrefix()
public static String absoluteUriPrefix()
public static String absoluteSiteUriPrefix()
public static String absoluteSiteUriPrefix(String siteName)
siteName
- The site name. Can be null to get the current site.public static String template()
public static String lang()
public static String lang(String pageId)
pageId
- The page identifier to get sitemap onpublic static String skinURL(String path)
path
- the resource path.public static String skinImageURL(String path, int height, int width)
path
- the resource pathheight
- the height for the resource to getwidth
- the width for the resource to getpublic static String skinImageBase64(String path) throws IOException
path
- the path of the imageIOException
- if an error occurs while trying to get the filepublic static String skinBoundedImageURL(String path, int maxHeight, int maxWidth)
path
- the resource pathmaxHeight
- the maximum height for the resource to getmaxWidth
- the maximum width for the resource to getpublic static String templateURL(String path)
path
- the resource path.public static String pluginResourceURL(String plugin, String path)
plugin
- the plugin name.path
- the resource path.public static String pluginImageBase64(String plugin, String path) throws MalformedURLException, IOException
plugin
- the plugin's name.path
- the resource path.IOException
- if an error occurs when trying to get the fileMalformedURLException
- if the url is invalidprivate static String _getResourceURL(Request request, Site site, String resourcePath)
private static String _getResourceBase64(FileSource source)
source
- the sourcepublic static String renderingContext()
RenderingContext
.RenderingContext
.public static String zone(String defaultValue)
defaultValue
- If no page is handled currently, this value is returned (can be null, empty...)public static String siteParameter(String parameter)
parameter
- the parameter ID.public static String siteParameter(String siteName, String parameter)
siteName
- the site nameparameter
- the parameter ID.public static Node serviceParameters()
Node
.Node
.public static Node serviceParameter(String parameter)
parameter
- the parameter name.public static Node serviceParameter(String parameter, String defaultValue)
parameter
- the parameter name or path.defaultValue
- the default value. Note that default value is ignored if the parameter is a composite parameter.private static String _convertTagName(String name)
private static Map<String,MapElement.MapNode> _getParameterValue(String paramName, CompositeMetadata parentMetadata, ServiceParameterOrRepeater paramDef, String defaultValue)
public static String site(String pageId)
pageId
- The identifier ot the pagepublic static Node sitemap()
Node
.
Invisible pages will not be displayedpublic static Node sitemap(boolean includeInvisiblePages)
Node
.includeInvisiblePages
- Should return child invisible pagespublic static Node sitemap(String pageId)
Node
.
Invisible child pages will not be returned;pageId
- The root pagepublic static Node sitemap(String pageId, boolean includeInvisiblePages)
Node
.pageId
- The root pageincludeInvisiblePages
- Should return child invisible pagespublic static NodeList breadcrumb()
public static Node resourcesById(String collectionId)
Element
representing files and folder of the resources explorer,
under the ResourceCollection
corresponding to the given id.collectionId
- the id of the root ResourceCollection
.public static Node resourcesByPath(String path)
Element
representing files and folder of the resources explorer,
under the ResourceCollection
corresponding to the given path. path
- the path of the root ResourceCollection
, relative to the current site's resource explorer.public static Node resourceByPath(String path)
Element
representing a single file of the resources explorer. path
- the path of the Resource
, relative to the current site's resource explorer.public static Node skinResources(String path) throws IOException
Element
representing files and folder of a skin directory. path
- the path of the root ResourceCollection
, relative to the current skin's 'resources' directory. Can be a file path to test its existance.IOException
- if an error occured while listing files.private static String _getMetadata(CompositeMetadata cm, String metadataName)
public static String pageSiteName(String pageId)
pageId
- The page id.public static String pageTitle(String sitename, String lang, String path)
sitename
- the site name.lang
- the sitemap name.path
- the page path.public static String pageTitle(String pageId)
pageId
- The page id.public static String pageLongTitle(String sitename, String lang, String path)
sitename
- the site namelang
- the page's languagepath
- the page's pathpublic static String pageLongTitle(String pageId)
pageId
- The page idpublic static String pageMetadata(String sitename, String lang, String path, String metadataName)
sitename
- the site namelang
- the page's languagepath
- the page's pathmetadataName
- The meta name (/ for composite)public static String pageMetadata(String pageId, String metadataName)
pageId
- The page idmetadataName
- The meta name (/ for composite)public static boolean pageIsVisible(String pageId)
pageId
- the page id.public static boolean pageIsVisible(String sitename, String lang, String path)
sitename
- the site namelang
- the page's languagepath
- the page's pathpublic static boolean pageHasRestrictedAccess(String pageId)
pageId
- the page id.public static boolean hasRightOnPage(String rightId)
rightId
- Right Idpublic static boolean hasRightOnPage(String rightId, String pageId)
rightId
- Right IdpageId
- Page Idprivate static boolean _hasRightOnPage(String rightId, Page page)
rightId
- Right Idpage
- Pagepublic static boolean pageHasRestrictedAccess(String sitename, String lang, String path)
sitename
- the site namelang
- the page's languagepath
- the page's pathpublic static String pagePath()
public static String pagePath(String pageId)
pageId
- The id of pagepublic static String pageId()
public static String zoneItemId()
public static boolean isCacheable()
public static boolean isEditionMode()
public static NodeList accessibleReferencedPages(String contentId)
contentId
- The content's idpublic static NodeList referencedPages(String contentId)
contentId
- The content's idpublic static NodeList findPagesIdsByTag(String sitename, String lang, String tag)
sitename
- The site idlang
- The language codetag
- The tag idpublic static NodeList findPagesIdsByTag(String tag)
tag
- The tag id