Class PageService
- java.lang.Object
-
- fr.paris.lutece.portal.service.page.PageService
-
- All Implemented Interfaces:
ImageResourceProvider,IPageService,PageEventListener,PortletEventListener,java.util.EventListener
public class PageService extends java.lang.Object implements IPageService, ImageResourceProvider, PageEventListener, PortletEventListener
This class delivers pages to web componants. It handles XML tranformation to HTML and provides a cache feature in order to reduce the number of tranformations.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringREDIRECTION_KEYKey for redirectionsstatic java.lang.StringTEMPLATE_PAGE_ACCESS_CONTROLEDAccess Controlled templatestatic java.lang.StringTEMPLATE_PAGE_ACCESS_DENIEDAccess denied template
-
Constructor Summary
Constructors Constructor Description PageService(PageCacheService pageCacheService, PortletContentService portletContentService)Creates a new PageService object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddPageEventListener(PageEventListener listener)Add a new page event listenerjava.lang.StringbuildPageContent(java.lang.String strIdPage, int nMode, javax.servlet.http.HttpServletRequest request)Build the page content.voidcreatePage(Page page)Create a pageImageResourcegetImageResource(int nIdResource)Gets the image resource for a given resourcejava.lang.StringgetName()Returns the Content Service namejava.lang.StringgetPage(java.lang.String strIdPage, int nMode, javax.servlet.http.HttpServletRequest request)Returns the page for a given ID.java.lang.StringgetPage(javax.servlet.http.HttpServletRequest request, int nMode)Returns the page for a given ID.PageCacheServicegetPageCacheService()Gets the page cache service.java.lang.StringgetPageContent(int nIdPage, int nMode, javax.servlet.http.HttpServletRequest request)Build the page content.java.lang.StringgetResourceImagePage(java.lang.String strPageId)Management of the image associated to the pagejava.lang.StringgetResourceTypeId()Returns the resource type IdvoidinvalidateContent(int nPageId)Invalidate Page ContentbooleanisAuthorizedAdminPage(int nIdPage, java.lang.String strPermission, AdminUser user)Check that a given user is allowed to access a page for a given permissionvoidprocessPageEvent(PageEvent event)Process a page eventvoidprocessPortletEvent(PortletEvent event)Process a portlet eventvoidremovePage(int nPageId)Remove a given pagevoidsetPageCacheKeyService(ICacheKeyService cacheKeyService)voidsetPageCacheService(PageCacheService pageCacheService)Sets the cache page servicevoidsetRoleRemovalService(RemovalListenerService removalService)static voidupdateChildrenAuthorizationNode(int nIdParentPage, java.lang.Integer nIdNewAuthorizationNode)update authorization node of children pagevoidupdatePage(Page page)Update a given page-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface fr.paris.lutece.portal.service.image.ImageResourceProvider
addImageResource
-
-
-
-
Field Detail
-
REDIRECTION_KEY
public static final java.lang.String REDIRECTION_KEY
Key for redirections- See Also:
- Constant Field Values
-
TEMPLATE_PAGE_ACCESS_DENIED
public static final java.lang.String TEMPLATE_PAGE_ACCESS_DENIED
Access denied template- See Also:
- Constant Field Values
-
TEMPLATE_PAGE_ACCESS_CONTROLED
public static final java.lang.String TEMPLATE_PAGE_ACCESS_CONTROLED
Access Controlled template- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PageService
@Inject public PageService(PageCacheService pageCacheService, PortletContentService portletContentService)
Creates a new PageService object.- Parameters:
pageCacheService- the page cache serviceportletCacheService- the portlet cache service
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the Content Service name- Returns:
- The name as a String
-
getPage
public java.lang.String getPage(javax.servlet.http.HttpServletRequest request, int nMode) throws SiteMessageExceptionReturns the page for a given ID. The page is built using XML data of each portlet or retrieved from the cache if it's enable.- Specified by:
getPagein interfaceIPageService- Parameters:
request- The page IDnMode- The current mode.- Returns:
- The HTML code of the page as a String.
- Throws:
SiteMessageException- If a message shouldbe displayed
-
getPage
public java.lang.String getPage(java.lang.String strIdPage, int nMode, javax.servlet.http.HttpServletRequest request) throws SiteMessageExceptionReturns the page for a given ID. The page is built using XML data of each portlet or retrieved from the cache if it's enable.- Specified by:
getPagein interfaceIPageService- Parameters:
strIdPage- The page IDnMode- The current mode.request- The HttpRequest- Returns:
- The HTML code of the page as a String.
- Throws:
SiteMessageException- occurs when a site message need to be displayed
-
buildPageContent
public java.lang.String buildPageContent(java.lang.String strIdPage, int nMode, javax.servlet.http.HttpServletRequest request) throws SiteMessageExceptionBuild the page content.- Parameters:
strIdPage- The page IDnMode- The current mode.request- The HttpRequest- Returns:
- The HTML code of the page as a String.
- Throws:
SiteMessageException- occurs when a site message need to be displayed
-
getPageContent
public java.lang.String getPageContent(int nIdPage, int nMode, javax.servlet.http.HttpServletRequest request) throws SiteMessageExceptionBuild the page content.- Specified by:
getPageContentin interfaceIPageService- Parameters:
nIdPage- The page IDnMode- The current mode.request- The HttpRequest- Returns:
- The HTML code of the page as a String.
- Throws:
SiteMessageException- occurs when a site message need to be displayed
-
setPageCacheKeyService
public void setPageCacheKeyService(ICacheKeyService cacheKeyService)
- Parameters:
cacheKeyService- the _cacheKeyService to set
-
setRoleRemovalService
public void setRoleRemovalService(RemovalListenerService removalService)
- Parameters:
removalService- the removal listener service
-
addPageEventListener
public static void addPageEventListener(PageEventListener listener)
Add a new page event listener- Parameters:
listener- An event listener to add
-
getResourceTypeId
public java.lang.String getResourceTypeId()
Returns the resource type Id- Specified by:
getResourceTypeIdin interfaceImageResourceProvider- Specified by:
getResourceTypeIdin interfaceIPageService- Returns:
- The resource type Id
-
getImageResource
public ImageResource getImageResource(int nIdResource)
Gets the image resource for a given resource- Specified by:
getImageResourcein interfaceImageResourceProvider- Parameters:
nIdResource- The Resource id- Returns:
- The image resource
-
createPage
public void createPage(Page page)
Create a page- Specified by:
createPagein interfaceIPageService- Parameters:
page- The page to create
-
updatePage
public void updatePage(Page page)
Update a given page- Specified by:
updatePagein interfaceIPageService- Parameters:
page- The page to update
-
removePage
public void removePage(int nPageId)
Remove a given page- Specified by:
removePagein interfaceIPageService- Parameters:
nPageId- The page Id
-
processPageEvent
public void processPageEvent(PageEvent event)
Process a page event- Specified by:
processPageEventin interfacePageEventListener- Parameters:
event- The event to process
-
processPortletEvent
public void processPortletEvent(PortletEvent event)
Process a portlet event- Specified by:
processPortletEventin interfacePortletEventListener- Parameters:
event- The event to process
-
invalidateContent
public void invalidateContent(int nPageId)
Invalidate Page Content- Specified by:
invalidateContentin interfaceIPageService- Parameters:
nPageId- The Page ID
-
isAuthorizedAdminPage
public boolean isAuthorizedAdminPage(int nIdPage, java.lang.String strPermission, AdminUser user)Check that a given user is allowed to access a page for a given permission- Specified by:
isAuthorizedAdminPagein interfaceIPageService- Parameters:
nIdPage- the id of the page to checkstrPermission- the permission neededuser- The current user- Returns:
- true if authorized, otherwise false
-
getResourceImagePage
public java.lang.String getResourceImagePage(java.lang.String strPageId)
Management of the image associated to the page- Parameters:
strPageId- The page identifier- Returns:
- The url
-
getPageCacheService
public PageCacheService getPageCacheService()
Gets the page cache service.- Returns:
- the page cache service
-
setPageCacheService
public void setPageCacheService(PageCacheService pageCacheService)
Sets the cache page service- Parameters:
pageCacheService- the page cache service
-
updateChildrenAuthorizationNode
public static void updateChildrenAuthorizationNode(int nIdParentPage, java.lang.Integer nIdNewAuthorizationNode)update authorization node of children page- Parameters:
nIdParentPage- id of the parent pagenIdNewAuthorizationNode- the new authorization id
-
-