Class PageService

java.lang.Object
fr.paris.lutece.portal.service.page.PageService
All Implemented Interfaces:
ImageResourceProvider, IPageService

@ApplicationScoped @Named("pageService") public class PageService extends Object implements IPageService, ImageResourceProvider
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 Details

    • REDIRECTION_KEY

      public static final String REDIRECTION_KEY
      Key for redirections
      See Also:
    • TEMPLATE_PAGE_ACCESS_DENIED

      public static final String TEMPLATE_PAGE_ACCESS_DENIED
      Access denied template
      See Also:
    • TEMPLATE_PAGE_ACCESS_CONTROLED

      public static final String TEMPLATE_PAGE_ACCESS_CONTROLED
      Access Controlled template
      See Also:
  • Constructor Details

    • PageService

      public PageService()
  • Method Details

    • getName

      public String getName()
      Returns the Content Service name
      Returns:
      The name as a String
    • getPage

      public String getPage(jakarta.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:
      getPage in interface IPageService
      Parameters:
      request - The page ID
      nMode - 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, jakarta.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:
      getPage in interface IPageService
      Parameters:
      strIdPage - The page ID
      nMode - 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, jakarta.servlet.http.HttpServletRequest request) throws SiteMessageException
      Build the page content.
      Parameters:
      strIdPage - The page ID
      nMode - 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, jakarta.servlet.http.HttpServletRequest request) throws SiteMessageException
      Build the page content.
      Specified by:
      getPageContent in interface IPageService
      Parameters:
      nIdPage - The page ID
      nMode - 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

      @Inject public void setRoleRemovalService(@Named("roleRemovalService") RemovalListenerService removalService)
      Parameters:
      removalService - the removal listener service
    • getResourceTypeId

      public String getResourceTypeId()
      Returns the resource type Id
      Specified by:
      getResourceTypeId in interface ImageResourceProvider
      Specified by:
      getResourceTypeId in interface IPageService
      Returns:
      The resource type Id
    • getImageResource

      public ImageResource getImageResource(int nIdResource)
      Gets the image resource for a given resource
      Specified by:
      getImageResource in interface ImageResourceProvider
      Parameters:
      nIdResource - The Resource id
      Returns:
      The image resource
    • createPage

      public void createPage(Page page)
      Create a page
      Specified by:
      createPage in interface IPageService
      Parameters:
      page - The page to create
    • updatePage

      public void updatePage(Page page)
      Update a given page
      Specified by:
      updatePage in interface IPageService
      Parameters:
      page - The page to update
    • removePage

      public void removePage(int nPageId)
      Remove a given page
      Specified by:
      removePage in interface IPageService
      Parameters:
      nPageId - The page Id
    • processPageEvent

      public void processPageEvent(@Observes PageEvent event)
      Process a page event
      Parameters:
      event - The event to process
    • processPortletEvent

      public void processPortletEvent(@Observes PortletEvent event)
      Process a portlet event
      Parameters:
      event - The event to process
    • invalidateContent

      public void invalidateContent(int nPageId)
      Invalidate Page Content
      Specified by:
      invalidateContent in interface IPageService
      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:
      isAuthorizedAdminPage in interface IPageService
      Parameters:
      nIdPage - the id of the page to check
      strPermission - the permission needed
      user - 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 page
      nIdNewAuthorizationNode - the new authorization id