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 -
Constructor Summary
ConstructorsConstructorDescriptionPageService(PageCacheService pageCacheService, PortletContentService portletContentService) Creates a new PageService object. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddPageEventListener(PageEventListener listener) Add a new page event listenerbuildPageContent(String strIdPage, int nMode, javax.servlet.http.HttpServletRequest request) Build the page content.voidcreatePage(Page page) Create a pagegetImageResource(int nIdResource) Gets the image resource for a given resourcegetName()Returns the Content Service nameReturns the page for a given ID.getPage(javax.servlet.http.HttpServletRequest request, int nMode) Returns the page for a given ID.Gets the page cache service.getPageContent(int nIdPage, int nMode, javax.servlet.http.HttpServletRequest request) Build the page content.getResourceImagePage(String strPageId) Management of the image associated to the pageReturns 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 servicevoidsetRoleRemovalService(RemovalListenerService removalService) static voidupdateChildrenAuthorizationNode(int nIdParentPage, Integer nIdNewAuthorizationNode) update authorization node of children pagevoidupdatePage(Page page) Update a given pageMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface fr.paris.lutece.portal.service.image.ImageResourceProvider
addImageResource
-
Field Details
-
REDIRECTION_KEY
Key for redirections- See Also:
-
TEMPLATE_PAGE_ACCESS_DENIED
Access denied template- See Also:
-
TEMPLATE_PAGE_ACCESS_CONTROLED
Access Controlled template- See Also:
-
-
Constructor Details
-
PageService
@Inject public PageService(PageCacheService pageCacheService, PortletContentService portletContentService) Creates a new PageService object.- Parameters:
pageCacheService- the page cache serviceportletCacheService- the portlet cache service
-
-
Method Details
-
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
- Parameters:
cacheKeyService- the _cacheKeyService to set
-
setRoleRemovalService
- Parameters:
removalService- the removal listener service
-
addPageEventListener
Add a new page event listener- Parameters:
listener- An event listener to add
-
getResourceTypeId
Returns the resource type Id- Specified by:
getResourceTypeIdin interfaceImageResourceProvider- Specified by:
getResourceTypeIdin interfaceIPageService- Returns:
- The resource type Id
-
getImageResource
Gets the image resource for a given resource- Specified by:
getImageResourcein interfaceImageResourceProvider- Parameters:
nIdResource- The Resource id- Returns:
- The image resource
-
createPage
Create a page- Specified by:
createPagein interfaceIPageService- Parameters:
page- The page to create
-
updatePage
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
Process a page event- Specified by:
processPageEventin interfacePageEventListener- Parameters:
event- The event to process
-
processPortletEvent
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
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
Management of the image associated to the page- Parameters:
strPageId- The page identifier- Returns:
- The url
-
getPageCacheService
Gets the page cache service.- Returns:
- the page cache service
-
setPageCacheService
Sets the cache page service- Parameters:
pageCacheService- the page 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
-