Package org.opencms.ade.detailpage
Class CmsDetailPageUtil
java.lang.Object
org.opencms.ade.detailpage.CmsDetailPageUtil
This is a utility class which provides convenience methods for finding detail page names for resources which include
the URL names of the resources themselves.
- Since:
- 8.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetAllDetailPagesWithUrlName(CmsObject cms, CmsResource res) Gets a list of detail page URIs for the given resource, with its URL name appended.static StringgetBestUrlName(CmsObject cms, CmsUUID id) Returns either the newest URL name for a structure id, or the structure id as a string if there is no URL name.static CmsResourcelookupPage(CmsObject cms, String uri) Looks up a page by URI (which may be a detail page URI, or a normal VFS uri).static CmsDetailResolutionresolveDetail(CmsObject cms, String uri) Resolves a URI to the detail page that renders it and to the detail content it shows.static CmsDetailResolutionresolveDetail(CmsObject cms, String uri, BiPredicate<CmsResource, CmsResource> detailPageValidator) Resolves a URI to the detail page that renders it and to the detail content it shows, using the given check for whether a detail page is valid for a detail content.
-
Method Details
-
getAllDetailPagesWithUrlName
public static List<String> getAllDetailPagesWithUrlName(CmsObject cms, CmsResource res) throws CmsException Gets a list of detail page URIs for the given resource, with its URL name appended.- Parameters:
cms- the current CMS contextres- the resource for which the detail pages should be retrieved- Returns:
- the list of detail page URIs
- Throws:
CmsException- if something goes wrong
-
getBestUrlName
Returns either the newest URL name for a structure id, or the structure id as a string if there is no URL name.- Parameters:
cms- the current CMS contextid- the structure id of a resource- Returns:
- the best URL name for the structure id
- Throws:
CmsException- if something goes wrong
-
lookupPage
Looks up a page by URI (which may be a detail page URI, or a normal VFS uri).- Parameters:
cms- the current CMS contexturi- the detail page or VFS uri- Returns:
- the resource with the given uri
- Throws:
CmsException- if something goes wrong
-
resolveDetail
Resolves a URI to the detail page that renders it and to the detail content it shows.This is the resolution
CmsDetailPageResourceHandlerperforms for a browser request, but without the servlet request and without any side effect: neither the request context nor any request attribute is changed, so the same lookup can be used outside the request cycle.- Parameters:
cms- the CMS context, initialized with the site root the URI belongs touri- the site relative URI to resolve- Returns:
- the detail resolution, or
nullif the URI is not a detail page URI - Throws:
CmsException- if something goes wrong
-
resolveDetail
public static CmsDetailResolution resolveDetail(CmsObject cms, String uri, BiPredicate<CmsResource, CmsResource> detailPageValidator) throws CmsExceptionResolves a URI to the detail page that renders it and to the detail content it shows, using the given check for whether a detail page is valid for a detail content.The check is a parameter because
CmsDetailPageResourceHandler.isValidDetailPage(CmsObject, CmsResource, CmsResource)is an extension point of that handler; useresolveDetail(CmsObject, String)to resolve with the standard check.- Parameters:
cms- the CMS context, initialized with the site root the URI belongs touri- the site relative URI to resolvedetailPageValidator- checks whether a detail page (first argument) is valid for a detail content (second argument)- Returns:
- the detail resolution, or
nullif the URI is not a detail page URI - Throws:
CmsException- if something goes wrong
-