fr.paris.lutece.portal.service.page
Class OldPageService

java.lang.Object
  extended by fr.paris.lutece.portal.service.cache.AbstractCacheableService
      extended by fr.paris.lutece.portal.service.content.ContentService
          extended by fr.paris.lutece.portal.service.page.OldPageService
All Implemented Interfaces:
CacheableService, ImageResourceProvider, IPageService, PageEventListener, LuteceService, java.lang.Cloneable, java.util.EventListener, net.sf.ehcache.event.CacheEventListener

public class OldPageService
extends ContentService
implements IPageService, ImageResourceProvider, PageEventListener

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.


Nested Class Summary
 class OldPageService.CustomAction
          CustomAction define a customized action for portlet types
 
Field Summary
static java.lang.String REDIRECTION_KEY
           
static java.lang.String TEMPLATE_PAGE_ACCESS_CONTROLED
          Access Controled template
static java.lang.String TEMPLATE_PAGE_ACCESS_DENIED
          Access denied template
 
Constructor Summary
OldPageService()
          Creates a new PageService object.
 
Method Summary
 void addPageEventListener(PageEventListener listener)
          Add a new page event listener
 java.lang.String buildPageContent(java.lang.String strIdPage, int nMode, javax.servlet.http.HttpServletRequest request, java.lang.Boolean bCanBeCached)
          Build the page content.
 java.lang.Object clone()
           
 void createPage(Page page)
          Create a page
static java.lang.String getBaseUrl(javax.servlet.http.HttpServletRequest request)
          Evaluate base URL from request Useful when a Lutece instance can be accessed from different virtual hosts
 ImageResource getImageResource(int nIdResource)
          Gets the image resource for a given resource
 java.lang.String getName()
          Returns the Content Service name
 java.lang.String getPage(javax.servlet.http.HttpServletRequest request, int nMode)
          Returns the page for a given ID.
 java.lang.String getPage(java.lang.String strIdPage, int nMode, javax.servlet.http.HttpServletRequest request)
          Returns the page for a given ID.
 java.lang.String getPageContent(int nIdPage, int nMode, javax.servlet.http.HttpServletRequest request)
          Build the page content.
 java.lang.String getResourceTypeId()
          Returns the resource type Id
 void invalidateContent(int nPageId)
          Invalidate Page Content
 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 and his workgroups
 boolean isInvoked(javax.servlet.http.HttpServletRequest request)
          Analyzes request's parameters to see if the request should be handled by the current Content Service
 void notifyElementEvicted(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element element)
          
 void notifyElementExpired(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element element)
          
 void notifyElementRemoved(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element element)
          
 void notifyRemoveAll(net.sf.ehcache.Ehcache cache)
          
 void processPageEvent(PageEvent event)
          Process a page event
 void removeKeyFromMap(net.sf.ehcache.Element element)
           
 void removePage(int nPageId)
          Remove a given page
 void setCacheKeyService(ICacheKeyService cacheKeyService)
           
 void updatePage(Page page)
          Update a given page
 
Methods inherited from class fr.paris.lutece.portal.service.content.ContentService
getPluginName, setPluginName
 
Methods inherited from class fr.paris.lutece.portal.service.cache.AbstractCacheableService
dispose, enableCache, getCache, getCacheSize, getFromCache, getInfos, getKeys, getMaxElements, getMemorySize, getTimeToLive, initCache, initCache, isCacheEnable, notifyElementPut, notifyElementUpdated, putInCache, resetCache
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REDIRECTION_KEY

public static final java.lang.String REDIRECTION_KEY
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 Controled template

See Also:
Constant Field Values
Constructor Detail

OldPageService

public OldPageService()
Creates a new PageService object.

Method Detail

getName

public java.lang.String getName()
Returns the Content Service name

Specified by:
getName in interface LuteceService
Returns:
The name as a String

isInvoked

public boolean isInvoked(javax.servlet.http.HttpServletRequest request)
Analyzes request's parameters to see if the request should be handled by the current Content Service

Specified by:
isInvoked in class ContentService
Parameters:
request - The HTTP request
Returns:
true if this ContentService should handle this request

getBaseUrl

public static java.lang.String getBaseUrl(javax.servlet.http.HttpServletRequest request)
Evaluate base URL from request Useful when a Lutece instance can be accessed from different virtual hosts

Parameters:
request - The HTTP servlet request
Returns:
URL de base du site

getPage

public java.lang.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:
getPage in interface IPageService
Specified by:
getPage in class ContentService
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 java.lang.String getPage(java.lang.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:
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 java.lang.String buildPageContent(java.lang.String strIdPage,
                                         int nMode,
                                         javax.servlet.http.HttpServletRequest request,
                                         java.lang.Boolean bCanBeCached)
                                  throws SiteMessageException
Build the page content.

Parameters:
strIdPage - The page ID
nMode - The current mode.
request - The HttpRequest
bCanBeCached - The boolean
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 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

setCacheKeyService

public void setCacheKeyService(ICacheKeyService cacheKeyService)
Parameters:
cacheKeyService - the _cacheKeyService to set

addPageEventListener

public 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:
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(PageEvent event)
Process a page event

Specified by:
processPageEvent in interface PageEventListener
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,
                                     java.lang.String strPermission,
                                     AdminUser user)
Check that a given user is allowed to access a page for a given permission and his workgroups

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

notifyElementEvicted

public void notifyElementEvicted(net.sf.ehcache.Ehcache cache,
                                 net.sf.ehcache.Element element)
Description copied from class: AbstractCacheableService

Specified by:
notifyElementEvicted in interface net.sf.ehcache.event.CacheEventListener
Overrides:
notifyElementEvicted in class AbstractCacheableService
Parameters:
cache - The Ehcache object
element - The Element object
See Also:
CacheEventListener.notifyElementEvicted(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)

notifyElementExpired

public void notifyElementExpired(net.sf.ehcache.Ehcache cache,
                                 net.sf.ehcache.Element element)
Description copied from class: AbstractCacheableService

Specified by:
notifyElementExpired in interface net.sf.ehcache.event.CacheEventListener
Overrides:
notifyElementExpired in class AbstractCacheableService
Parameters:
cache - The Ehcache object
element - The Element object
See Also:
CacheEventListener.notifyElementExpired(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)

notifyElementRemoved

public void notifyElementRemoved(net.sf.ehcache.Ehcache cache,
                                 net.sf.ehcache.Element element)
Description copied from class: AbstractCacheableService

Specified by:
notifyElementRemoved in interface net.sf.ehcache.event.CacheEventListener
Overrides:
notifyElementRemoved in class AbstractCacheableService
Parameters:
cache - The Ehcache object
element - The Element object
See Also:
CacheEventListener.notifyElementRemoved(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)

notifyRemoveAll

public void notifyRemoveAll(net.sf.ehcache.Ehcache cache)
Description copied from class: AbstractCacheableService

Specified by:
notifyRemoveAll in interface net.sf.ehcache.event.CacheEventListener
Overrides:
notifyRemoveAll in class AbstractCacheableService
Parameters:
cache - .
cache - The Ehcache object
See Also:
CacheEventListener.notifyRemoveAll(net.sf.ehcache.Ehcache)

removeKeyFromMap

public void removeKeyFromMap(net.sf.ehcache.Element element)
Parameters:
element - The Element object

clone

public java.lang.Object clone()
Specified by:
clone in interface net.sf.ehcache.event.CacheEventListener
Overrides:
clone in class AbstractCacheableService
Returns:
the instance
See Also:
Object.clone()


Copyright © 2011 Mairie de Paris. All Rights Reserved.