public final class PortalManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PortalManager.CatDiscrimComparator
This inner class compare two categories.
|
static class |
PortalManager.DisplayContextParameters
A structure to handle method parameters
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CSS_INNER |
static java.lang.String |
CSS_OUTER |
static java.lang.String |
HIGHLIGHT_DEFAULT_MODE |
static java.lang.String |
HIGHLIGHT_ENABLED |
static java.lang.String |
HIGHLIGHT_MODE |
static java.lang.String |
HIGHLIGHT_TEXT |
static java.lang.String |
PORTAL_ACTION |
static java.lang.String |
PORTAL_ACTION_CACHE |
static java.lang.String |
PORTAL_ACTION_CUT |
static java.lang.String |
PORTAL_ACTION_MODE |
static java.lang.String |
PORTAL_ACTION_PAST |
static org.apache.oro.text.regex.Pattern |
PORTAL_ACTION_REGEXP |
static java.lang.String |
PORTAL_ACTION_REMOVE |
static java.lang.String |
PORTAL_AJAX_URI |
static java.lang.String |
PORTAL_CLIPBOARD |
static java.lang.String |
PORTAL_CONTEXTE_INCLUDE |
static java.lang.String |
PORTAL_CSS_DIRECTORY |
static java.lang.String |
PORTAL_CTXCATEGORIES |
static java.lang.String |
PORTAL_CURRENTCATEGORY |
static java.lang.String |
PORTAL_DEFAULT_CACHE |
static java.lang.String |
PORTAL_MODE_ENABLE |
static java.lang.String |
PORTAL_PORTAL |
static java.lang.String |
PORTAL_PORTALCATEGORY |
static java.lang.String |
PORTAL_PORTALELEMENT |
static java.lang.String |
PORTAL_PORTLET_FAKE |
static java.lang.String |
PORTAL_PUBLICATION |
static java.lang.String |
PORTAL_TEMPLATEUSAGE |
static java.lang.String |
PORTLET_SEARCH_TOPBAR_EXTRADATA |
static java.lang.String |
REVISION |
Constructor and Description |
---|
PortalManager() |
Modifier and Type | Method and Description |
---|---|
static void |
addHighlightAttributes(javax.servlet.http.HttpServletRequest request,
java.lang.String text,
java.lang.String mode)
Adds the given text and mode parameters as request attributes,
and set the hlOk attribute to true to allow doDisplayHeader.jsp to
provide highlight button.
|
static boolean |
canWorkOnSome(PortalInterface portal,
Member loggedMember) |
static boolean |
checkPortal(Category cat,
DisplayContext context,
Member loggedMember,
boolean skipRedirect,
boolean skipExact)
This method looks for a matching Portal for a given Category.
|
protected static boolean |
checkPortal(Publication pub,
DisplayContext context,
Member loggedMember,
boolean skipRedirect,
boolean skipExact)
Check the validity of the given Publication to be a convenient Portal.
|
protected static boolean |
checkPortal(Publication pub,
DisplayContext context,
Member loggedMember,
boolean skipRedirect,
boolean skipExact,
boolean preview)
Check the validity of the given Publication to be a convenient Portal.
|
static void |
clearHighlightAttributes(javax.servlet.http.HttpServletRequest request)
Remove the highlight attributes from the current request to disable
highlighting for the rest of the page
|
protected static boolean |
containsAction(javax.servlet.http.HttpServletRequest request,
PortalElement portlet)
Looking for an action in the HttpRequest
|
static boolean |
disableCache(javax.servlet.http.HttpServletRequest request,
PortalElement portlet,
Member loggedMember)
Return true if the portlet should disable its cache
Remove the cache parameter only if its the portlet itself that ask for a refresh (not one of it's parent)
|
static boolean |
findPortal(Category cat,
DisplayContext context,
Member loggedMember,
boolean skipRedirect,
boolean skipExact,
boolean recursive)
Recursive methode that try to find the right portal for a given category
otherwise may call parent category.
|
static boolean |
findPortal(Publication pub,
DisplayContext context,
Member loggedMember,
boolean skipRedirect,
boolean skipExact,
boolean preview,
Category[] ctxCategories)
Fill a display context with all the elements usefull for navigation,
using the given steps:
1- Iterate on publication categories starting with sibling of contextual categories 2- Recursive call with parents until finding a Portal 3- Then set the portalCategory and the currentCategory |
static java.lang.String |
getActionParam(PortalElement portlet,
java.lang.String action)
Return the parameter for an action of a Portlet
|
static java.lang.String |
getAjaxPortalRedirect(javax.servlet.http.HttpServletRequest request)
Build an URL working with in AjaxContext redirects
|
static java.lang.String |
getAjaxPortalUrl(javax.servlet.http.HttpServletRequest request)
Build an URL working with in AjaxContext redirects
|
static java.lang.String |
getAjaxPortalUrl(PortalElement portlet)
Deprecated.
use #getAjaxPortalUrl()
|
protected static java.util.List |
getAllCategories(java.util.Collection categoryCollec)
Return all categories at a given levels
|
static java.lang.String |
getCacheParam(PortalElement portlet)
Return the parameter for a cache of a Portlet
|
static java.io.File[] |
getCssFiles()
This method return an array of CSS in directory css/portal.
|
static java.util.Map |
getCSSMap(java.lang.String skinType,
java.lang.Class clazz) |
static Category[] |
getCtxCategories(javax.servlet.http.HttpServletRequest request)
Get all Categories from cid parameters in the request
|
static PortalInterface |
getDefaultPortal()
Return the default portal according to the property channel.default-portal
Implementation note : since jcms-7.1.2, this default portal can be overrided by any custom PortalPolicyFilter. |
static DisplayContext |
getDisplayContext(JcmsContext context)
This is a convenient method to compute display.jsp display context.
|
static DisplayContext |
getDisplayContext(java.lang.String id,
PortalInterface overrided,
Category[] ctxCategories,
Member loggedMember,
boolean preview,
java.lang.String queryString)
This method compute a display context of parameters for display.jsp.
|
static java.lang.String |
getHightlightParams(javax.servlet.http.HttpServletRequest request)
Build query string parameters from the information currently available
in the request attributes.
|
static Category |
getHomeCategory()
Return by default the Category associated to property
channel.default-index . |
static java.lang.String |
getInnerClasses(PortalElement portlet)
This method return classes to apply on the given portlet's inside.
|
static java.lang.String |
getInnerStyles(PortalElement portlet)
This method return style to apply on the given portlet's inside.
|
static java.lang.String |
getOutterClasses(PortalElement portlet)
This method return classes to apply on the given portlet's outside.
|
static java.lang.String |
getOutterStyles(PortalElement portlet)
This method return style to apply on the given portlet's outside.
|
static java.lang.String |
getPermalink(Data data)
Deprecated.
|
static java.lang.String |
getPermalink(Data data,
java.util.Locale locale)
Returns an url representing the permanent link
for the given data in the specified language.
|
static Portlet |
getPortletSearchTopbar()
Returns the PortletSearch used in the topbar.
|
static PortalInterface |
getPrintPortal()
Return the print portal according to the property channel.default-printportal
|
static Category[] |
getRootNavigate() |
static java.lang.String |
getUrlWithCommonUpdatedParams(javax.servlet.http.HttpServletRequest request,
java.lang.String[] names,
java.lang.String[] values,
boolean encodeParams) |
static java.lang.String |
getUrlWithUpdateCtxCategories(Category cat,
Category[] ctxArray,
javax.servlet.http.HttpServletRequest request,
boolean ctx)
Return an Url with updated cids
|
static java.lang.String |
getUrlWithUpdateCtxCategories(Category cat,
Category[] ctxArray,
java.lang.String resourcePath,
java.util.Map parameterMap,
boolean ctx)
Return an Url with updated cids
|
static void |
handleDisplayRequest(JcmsJspContext context,
DisplayContext display,
long startPageRequest)
Called by display.jsp to set all request attributes
from computed display context.
|
static boolean |
handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Member loggedMember)
Handle Request to check if parameters are Action of Portlets
if true then remove them from request and put them to session.
|
static boolean |
hasFullDisplay(PortalElement portlet,
Member loggedMember)
Checks if there is a full display anywere inside the specified PortalElement (including the specified portlet itself).
|
static boolean |
isBehaviourBackCompatible()
This method will check if the portal mecanic use the new behaviour
or the old one.
|
static boolean |
isNewBehaviour()
This method will check if the portal mecanic use the new behaviour
or the old one.
|
static boolean |
isPreview(javax.servlet.http.HttpServletRequest request,
PortalElement portlet)
Return true if the portlet is in preview mode
|
static void |
printPortletException(javax.servlet.jsp.JspWriter out,
java.lang.Throwable ex,
PortalElement portlet,
org.apache.log4j.Logger portletLogger) |
static void |
printPortletException(javax.servlet.jsp.JspWriter out,
java.lang.Throwable ex,
java.lang.String location,
org.apache.log4j.Logger portletLogger) |
static void |
processActions(javax.servlet.http.HttpServletRequest request,
java.util.List portlets,
Member loggedMember,
java.util.List actions,
java.util.List messages,
java.util.List fullParams) |
static java.lang.String |
receiveAction(javax.servlet.http.HttpServletRequest request,
PortalElement portlet,
java.lang.String action)
Return a Message set for this Portlet by sendAction()
|
static boolean |
refreshCache(javax.servlet.http.HttpServletRequest request,
PortalElement portlet,
Member loggedMember)
Return true if the portlet should refresh its cache
Remove the cache parameter only if its the portlet itself that ask for a refresh (not one of it's parent)
|
static java.lang.String |
removeAction(javax.servlet.http.HttpServletRequest request,
PortalElement portlet,
java.lang.String action)
Remove an action from the session.
|
static java.lang.String |
sendAction(javax.servlet.http.HttpServletRequest request,
PortalElement portlet,
java.lang.String action,
java.lang.String message)
Return a well formated a URL with a paramameter to do an Action for the portlet
|
static void |
setPreview(javax.servlet.http.HttpServletRequest request,
PortalElement portlet,
boolean isPreview)
Sets the portlet preview mode
|
protected static boolean |
updateFullDisplay(javax.servlet.http.HttpServletRequest request,
PortalElement portlet,
Member loggedMember)
Looking for a FullDisplay Portlet
|
static void |
updateProperties()
Init
defaultPortal , homeCategory , printPortal and rootNavigate
given following properties :defaultPortal : based on channel.default-portal id property, or "j_193" if property not set. |
public static final java.lang.String REVISION
public static final java.lang.String PORTAL_ACTION
public static final java.lang.String PORTAL_ACTION_REMOVE
public static final java.lang.String PORTAL_ACTION_CACHE
public static final java.lang.String PORTAL_ACTION_MODE
public static final java.lang.String PORTAL_PORTLET_FAKE
public static final java.lang.String PORTAL_CSS_DIRECTORY
public static final java.lang.String PORTAL_ACTION_CUT
public static final java.lang.String PORTAL_ACTION_PAST
public static final org.apache.oro.text.regex.Pattern PORTAL_ACTION_REGEXP
public static final java.lang.String PORTAL_MODE_ENABLE
public static final java.lang.String PORTAL_CLIPBOARD
public static final java.lang.String PORTAL_DEFAULT_CACHE
public static final java.lang.String PORTAL_PUBLICATION
public static final java.lang.String PORTAL_PORTALELEMENT
public static final java.lang.String PORTAL_PORTAL
public static final java.lang.String PORTAL_CURRENTCATEGORY
public static final java.lang.String PORTAL_PORTALCATEGORY
public static final java.lang.String PORTAL_CTXCATEGORIES
public static final java.lang.String PORTAL_TEMPLATEUSAGE
public static final java.lang.String PORTAL_CONTEXTE_INCLUDE
public static final java.lang.String PORTAL_AJAX_URI
public static final java.lang.String PORTLET_SEARCH_TOPBAR_EXTRADATA
public static final java.lang.String HIGHLIGHT_ENABLED
public static final java.lang.String HIGHLIGHT_TEXT
public static final java.lang.String HIGHLIGHT_MODE
public static final java.lang.String HIGHLIGHT_DEFAULT_MODE
public static final java.lang.String CSS_INNER
public static final java.lang.String CSS_OUTER
public static java.lang.String getActionParam(PortalElement portlet, java.lang.String action)
portlet
- public static java.lang.String sendAction(javax.servlet.http.HttpServletRequest request, PortalElement portlet, java.lang.String action, java.lang.String message)
request
- portlet
- action
- message
- public static java.lang.String receiveAction(javax.servlet.http.HttpServletRequest request, PortalElement portlet, java.lang.String action)
request
- portlet
- public static java.lang.String removeAction(javax.servlet.http.HttpServletRequest request, PortalElement portlet, java.lang.String action)
request
- portlet
- action
- public static void processActions(javax.servlet.http.HttpServletRequest request, java.util.List portlets, Member loggedMember, java.util.List actions, java.util.List messages, java.util.List fullParams)
public static java.lang.String getUrlWithCommonUpdatedParams(javax.servlet.http.HttpServletRequest request, java.lang.String[] names, java.lang.String[] values, boolean encodeParams)
request
- the current HttpRequestnames
- an array of parameter names added or updated the urlvalues
- an array of values added or updated the url corresponding to namesencodeParams
- whether to do a encodeURL on given param (if false, don't forget to do the encodeURL yourself on the parameters which need it! it is provided as a performance boost because encodeURL can be slow)public static boolean handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Member loggedMember) throws java.io.IOException
request
- response
- loggedMember
- java.io.IOException
public static java.lang.String getPermalink(Data data)
getPermalink(Data, Locale)
data
- the data to work withpublic static java.lang.String getPermalink(Data data, java.util.Locale locale)
data
- the data to work withlocale
- the Locale in which the data is to be access by the permalinkpublic static java.lang.String getCacheParam(PortalElement portlet)
portlet
- public static boolean refreshCache(javax.servlet.http.HttpServletRequest request, PortalElement portlet, Member loggedMember)
request
- portlet
- public static boolean disableCache(javax.servlet.http.HttpServletRequest request, PortalElement portlet, Member loggedMember)
request
- portlet
- protected static boolean containsAction(javax.servlet.http.HttpServletRequest request, PortalElement portlet)
request
- portlet
- protected static boolean updateFullDisplay(javax.servlet.http.HttpServletRequest request, PortalElement portlet, Member loggedMember)
request
- portlet
- loggedMember
- public static boolean hasFullDisplay(PortalElement portlet, Member loggedMember)
portlet
- the portlet from which to start FullDisplay searchloggedMember
- the current loggedMemberpublic static boolean isPreview(javax.servlet.http.HttpServletRequest request, PortalElement portlet)
request
- portlet
- public static void setPreview(javax.servlet.http.HttpServletRequest request, PortalElement portlet, boolean isPreview)
request
- portlet
- isPreview
- (true to set it, false to remove)public static boolean canWorkOnSome(PortalInterface portal, Member loggedMember)
public static PortalInterface getDefaultPortal()
BasicPortalPolicyFilter.getDefaultPortal(PortalInterface, Member)
.public static PortalInterface getPrintPortal()
public static Category getHomeCategory()
channel.default-index
.
BasicPortalPolicyFilter.getHomeCategory(Category, Member)
.public static Category[] getRootNavigate()
display.navigate-root
, or null.public static void updateProperties()
defaultPortal
, homeCategory
, printPortal
and rootNavigate
given following properties :defaultPortal
: based on channel.default-portal
id property, or "j_193" if property not set.homeCategory
: based on channel.default-index
id property, or null if property not set.printPortal
: based on channel.default-printportal
id property, or "j_55" if property not set.rootNavigate
: based on display.navigate-root
ids property, or null if property not set.public static boolean findPortal(Publication pub, DisplayContext context, Member loggedMember, boolean skipRedirect, boolean skipExact, boolean preview, Category[] ctxCategories)
pub
- the publication to displaycontext
- the display to fillloggedMember
- the member, the publication is displayed forskipRedirect
- should we ignore PortalRedirect ?skipExact
- should we ignore exact portal ?preview
- are we in preview mode ?ctxCategories
- the contextual categories to sort the iteration on publication categoriespublic static boolean findPortal(Category cat, DisplayContext context, Member loggedMember, boolean skipRedirect, boolean skipExact, boolean recursive)
cat
- the category to work withcontext
- the list to fillloggedMember
- the member, the publication is displayed forskipRedirect
- should we ignore PortalRedirect ? Usefull when called by findPortal(Publication).skipExact
- should we ignore portal accepting only exact matchrecursive
- is it a recursive call with parent category ?public static boolean checkPortal(Category cat, DisplayContext context, Member loggedMember, boolean skipRedirect, boolean skipExact)
This method looks for a matching Portal for a given Category. Then set the portal Category in display context.
Portal with ExactCategory option are priority checked
cat
- The current categorycontext
- display contextloggedMember
- The current memberskipRedirect
- Should skip redirect portalskipExact
- Should skip exact portalprotected static boolean checkPortal(Publication pub, DisplayContext context, Member loggedMember, boolean skipRedirect, boolean skipExact)
protected static boolean checkPortal(Publication pub, DisplayContext context, Member loggedMember, boolean skipRedirect, boolean skipExact, boolean preview)
protected static java.util.List getAllCategories(java.util.Collection categoryCollec)
public static Category[] getCtxCategories(javax.servlet.http.HttpServletRequest request)
request
- the current requestpublic static java.lang.String getUrlWithUpdateCtxCategories(Category cat, Category[] ctxArray, java.lang.String resourcePath, java.util.Map parameterMap, boolean ctx)
cat
- the categoryctxArray
- the contextual category arrayresourcePath
- the request resource pathparameterMap
- the request parameter mapctx
- is sctx category or navigate categorypublic static java.lang.String getUrlWithUpdateCtxCategories(Category cat, Category[] ctxArray, javax.servlet.http.HttpServletRequest request, boolean ctx)
cat
- the categoryctxArray
- the contextual category arrayrequest
- the request to call ServletUtilctx
- is sctx category or navigate categorypublic static DisplayContext getDisplayContext(JcmsContext context)
context
- the JcmsContextgetDisplayContext(String, PortalInterface, Category[], Member, boolean, String)
public static DisplayContext getDisplayContext(java.lang.String id, PortalInterface overrided, Category[] ctxCategories, Member loggedMember, boolean preview, java.lang.String queryString)
id
- the request parameter id describing the working dataoverrided
- the overrided portal (request parameter portal)ctxCategories
- the contextual categories (request parameter cid)loggedMember
- the loggedmemberpreview
- boolean indicate if it is a previewqueryString
- the request querystring used by redirect parameterspublic static void handleDisplayRequest(JcmsJspContext context, DisplayContext display, long startPageRequest)
context
- a JcmsContext handling page requestdisplay
- a computed display.jsp display contextstartPageRequest
- long indicating start page requestgetDisplayContext(String, PortalInterface, Category[], Member, boolean, String)
public static void addHighlightAttributes(javax.servlet.http.HttpServletRequest request, java.lang.String text, java.lang.String mode)
request
- text
- The text to highlightmode
- the mode to use to search the text (same mode used in query, all, any, etc)public static void clearHighlightAttributes(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getHightlightParams(javax.servlet.http.HttpServletRequest request)
@Deprecated public static java.lang.String getAjaxPortalUrl(PortalElement portlet)
portlet
- the Portlet to displaypublic static java.lang.String getAjaxPortalUrl(javax.servlet.http.HttpServletRequest request)
request
- the HttpServletRequestpublic static java.lang.String getAjaxPortalRedirect(javax.servlet.http.HttpServletRequest request)
request
- the HttpServletRequestpublic static boolean isNewBehaviour()
public static boolean isBehaviourBackCompatible()
public static java.lang.String getOutterStyles(PortalElement portlet)
portlet
- a PortalElement to work withpublic static java.lang.String getInnerStyles(PortalElement portlet)
portlet
- a PortalElement to work withpublic static java.lang.String getOutterClasses(PortalElement portlet)
portlet
- a PortalElement to work withpublic static java.lang.String getInnerClasses(PortalElement portlet)
portlet
- a PortalElement to work withpublic static java.io.File[] getCssFiles()
public static java.util.Map getCSSMap(java.lang.String skinType, java.lang.Class clazz)
public static void printPortletException(javax.servlet.jsp.JspWriter out, java.lang.Throwable ex, PortalElement portlet, org.apache.log4j.Logger portletLogger) throws java.io.IOException
java.io.IOException
public static void printPortletException(javax.servlet.jsp.JspWriter out, java.lang.Throwable ex, java.lang.String location, org.apache.log4j.Logger portletLogger) throws java.io.IOException
java.io.IOException
public static Portlet getPortletSearchTopbar()
Copyright © 2001-2010 Jalios SA. All Rights Reserved.