Class PageService
- java.lang.Object
-
- fr.paris.lutece.portal.service.page.PageService
-
- All Implemented Interfaces:
ImageResourceProvider,IPageService,PageEventListener,PortletEventListener,EventListener
public class PageService extends 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 StringREDIRECTION_KEYKey for redirectionsstatic StringTEMPLATE_PAGE_ACCESS_CONTROLEDAccess Controlled templatestatic StringTEMPLATE_PAGE_ACCESS_DENIEDAccess denied template
-
Constructor Summary
Constructors Constructor Description PageService(PageCacheService pageCacheService, PortletCacheService portletCacheService)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 listenerStringbuildPageContent(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 resourceStringgetName()Returns the Content Service nameStringgetPage(String strIdPage, int nMode, javax.servlet.http.HttpServletRequest request)Returns the page for a given ID.StringgetPage(javax.servlet.http.HttpServletRequest request, int nMode)Returns the page for a given ID.PageCacheServicegetPageCacheService()Gets the page cache service.StringgetPageContent(int nIdPage, int nMode, javax.servlet.http.HttpServletRequest request)Build the page content.PortletCacheServicegetPortletCacheService()Gets the portlet cache serviceStringgetResourceImagePage(String strPageId)Management of the image associated to the pageStringgetResourceTypeId()Returns the resource type IdvoidinvalidateContent(int nPageId)Invalidate Page ContentbooleanisAuthorizedAdminPage(int nIdPage, 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 servicevoidsetPortletCacheKeyService(ICacheKeyService cacheKeyService)voidsetPortletCacheService(PortletCacheService portletCacheService)Gets the portlet cache servicevoidsetRoleRemovalService(RemovalListenerService removalService)static voidupdateChildrenAuthorizationNode(int nIdParentPage, 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 String REDIRECTION_KEY
Key for redirections- See Also:
- Constant Field Values
-
TEMPLATE_PAGE_ACCESS_DENIED
public static final String TEMPLATE_PAGE_ACCESS_DENIED
Access denied template- See Also:
- Constant Field Values
-
TEMPLATE_PAGE_ACCESS_CONTROLED
public static final String TEMPLATE_PAGE_ACCESS_CONTROLED
Access Controlled template- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PageService
@Inject public PageService(PageCacheService pageCacheService, PortletCacheService portletCacheService)
Creates a new PageService object.- Parameters:
pageCacheService- the page cache serviceportletCacheService- the portlet cache service
-
-
Method Detail
-
getName
public String getName()
Returns the Content Service name- Returns:
- The name as a String
-
getPage
public String getPage(javax.servlet.http.HttpServletRequest request, int nMode) throws SiteMessageException
Returns 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 String getPage(String strIdPage, int nMode, javax.servlet.http.HttpServletRequest request) throws SiteMessageException
Returns 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 String buildPageContent(String strIdPage, int nMode, javax.servlet.http.HttpServletRequest request) throws SiteMessageException
Build 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 String getPageContent(int nIdPage, int nMode, javax.servlet.http.HttpServletRequest request) throws SiteMessageException
Build 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
-
setPortletCacheKeyService
public void setPortletCacheKeyService(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 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, 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 String getResourceImagePage(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
-
getPortletCacheService
public PortletCacheService getPortletCacheService()
Gets the portlet cache service- Returns:
- the porlet cache service
-
setPortletCacheService
public void setPortletCacheService(PortletCacheService portletCacheService)
Gets the portlet cache service- Parameters:
portletCacheService- the portlet cache service
-
updateChildrenAuthorizationNode
public static void updateChildrenAuthorizationNode(int nIdParentPage, Integer nIdNewAuthorizationNode)update authorization node of children page- Parameters:
nIdParentPage- id of the parent pagenIdNewAuthorizationNode- the new authorization id
-
-