org.dspace.app.xmlui.aspect.administrative
Class SystemwideAlerts

java.lang.Object
  extended by org.apache.cocoon.util.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.transformation.AbstractTransformer
                  extended by org.dspace.app.xmlui.wing.AbstractWingTransformer
                      extended by org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer
                          extended by org.dspace.app.xmlui.aspect.administrative.SystemwideAlerts
All Implemented Interfaces:
org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.cocoon.caching.CacheableProcessingComponent, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.transformation.Transformer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer, org.apache.excalibur.xml.sax.XMLConsumer, DSpaceTransformer, WingTransformer, ContentHandler, LexicalHandler

public class SystemwideAlerts
extends AbstractDSpaceTransformer
implements org.apache.cocoon.caching.CacheableProcessingComponent

This class maintains any system-wide alerts. If any alerts are activated then they are added to the page's metadata for display by the theme. This class also creates an interface for the alert system to be maintained.

Author:
Scott Phillips

Field Summary
static int STATE_ALL_SESSIONS
          Possible user restricted states
static int STATE_CURRENT_SESSIONS
           
static int STATE_ONLY_ADMINISTRATIVE_SESSIONS
           
 
Fields inherited from class org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer
context, contextPath, eperson, knot, objectModel, parameters, servletPath, sitemapURI, url
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
SystemwideAlerts()
           
 
Method Summary
static void activateAlert()
          Activate the current alert.
 void addPageMeta(PageMeta pageMeta)
          If an alert is activated then add a count down message.
static boolean canUserMaintainSession()
          Are users able to maintain a session, will return false if there is a current alert activated and sessions are restricted.
static boolean canUserStartSession()
          Are users able to start a new session, will return false if there is a current alert activated and sessions are restricted.
static void deactivateAlert()
          Deactivate the current alert.
static long getCountDownToo()
          Get the time, in millieseconds, when the countdown timer is scheduled to end.
 Serializable getKey()
          Generate the unique caching key.
static String getMessage()
           
static int getRestrictSessions()
           
 org.apache.excalibur.source.SourceValidity getValidity()
          Generate the cache validity object.
static boolean isAlertActive()
          Check whether an alert is active.
static void setCountDownToo(long countDownTo)
          Set the time, in millieseconds, to which the countdown timer should end.
static void setMessage(String message)
          Set the current alert's message.
static void setRestrictSessions(int restrictsessions)
           
 
Methods inherited from class org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer
addBody, addOptions, addUserMeta, decodeFromURL, dispose, encodeForURL, generateURL, getComponentName, getObjectManager, handleException, recycle, setup
 
Methods inherited from class org.dspace.app.xmlui.wing.AbstractWingTransformer
createWingDocument, endDocument, endElement, endPrefixMapping, getDefaultMessageCatalogue, message, message, setupWing, startDocument, startElement, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDTD, endEntity, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startEntity
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

STATE_ALL_SESSIONS

public static final int STATE_ALL_SESSIONS
Possible user restricted states

See Also:
Constant Field Values

STATE_CURRENT_SESSIONS

public static final int STATE_CURRENT_SESSIONS
See Also:
Constant Field Values

STATE_ONLY_ADMINISTRATIVE_SESSIONS

public static final int STATE_ONLY_ADMINISTRATIVE_SESSIONS
See Also:
Constant Field Values
Constructor Detail

SystemwideAlerts

public SystemwideAlerts()
Method Detail

getKey

public Serializable getKey()
Generate the unique caching key.

Specified by:
getKey in interface org.apache.cocoon.caching.CacheableProcessingComponent

getValidity

public org.apache.excalibur.source.SourceValidity getValidity()
Generate the cache validity object.

Specified by:
getValidity in interface org.apache.cocoon.caching.CacheableProcessingComponent

addPageMeta

public void addPageMeta(PageMeta pageMeta)
                 throws WingException
If an alert is activated then add a count down message.

Specified by:
addPageMeta in interface DSpaceTransformer
Specified by:
addPageMeta in interface WingTransformer
Overrides:
addPageMeta in class AbstractDSpaceTransformer
Throws:
WingException

isAlertActive

public static boolean isAlertActive()
Check whether an alert is active.


activateAlert

public static void activateAlert()
Activate the current alert.


deactivateAlert

public static void deactivateAlert()
Deactivate the current alert.


setMessage

public static void setMessage(String message)
Set the current alert's message.

Parameters:
message - The new message

getMessage

public static String getMessage()
Returns:
the current alert's message

getCountDownToo

public static long getCountDownToo()
Get the time, in millieseconds, when the countdown timer is scheduled to end.


setCountDownToo

public static void setCountDownToo(long countDownTo)
Set the time, in millieseconds, to which the countdown timer should end. Note, that once the countdown has expried, the alert is still active. However the countdown will disappear.


getRestrictSessions

public static int getRestrictSessions()

setRestrictSessions

public static void setRestrictSessions(int restrictsessions)

canUserStartSession

public static boolean canUserStartSession()
Are users able to start a new session, will return false if there is a current alert activated and sessions are restricted.

Returns:
if false do not allow user to start a new session, otherwise no restriction.

canUserMaintainSession

public static boolean canUserMaintainSession()
Are users able to maintain a session, will return false if there is a current alert activated and sessions are restricted.

Returns:
if false do not allow user to maintain their current session or start a new session, otherwise no restriction.


Copyright © 2011 DuraSpace. All Rights Reserved.