com.plumtree.uiinfrastructure.errordisplay
Class UIErrorHandler

java.lang.Object
  extended by com.plumtree.uiinfrastructure.errordisplay.UIErrorHandler

public class UIErrorHandler
extends java.lang.Object

Author:
Ben Geislinger This class provides static methods for managing the current user's collection of UIError objects. UIError objects describe those errors which need to be communicated to users.

UIError objects are created and raised by ui code encountering an error condition. Raised errors are then added to the error collections of the appropriate users.

UIError objects are retrieved by ui code responsible for presenting error messages to the users of the portal.

Constructor Summary
UIErrorHandler()
           
 
Method Summary
static void ClearError(java.lang.String sKey, ISessionManager sessionManager, IApplication application)
          Call this method to clear the specified error from the current user's collection of UIError objects.
static void ClearError(UIError error, ISessionManager sessionManager, IApplication application)
          Call this method to clear the specified error from the current user's collection of UIError objects.
static void ClearErrors(ISessionManager sessionManager, IApplication application)
          Call this method to clear all errors from the current user's collection of errors.
static void ClearErrorsForASChange(java.lang.String sNewASName, ISessionManager sessionManager, IApplication application)
          Call this method to clear those errors that are associated with a specific activity space.
static void ClearErrorsRequiringASeparateDisplayPage(ISessionManager sessionManager, IApplication application, AActivitySpace space, boolean bForThisAs, boolean bIncludeAdminErrors)
           
static boolean GetDisplayAdminErrors(AActivitySpace space)
          Call this method to determine whether or not the current user should see admin-only errors.
static boolean GetDisplayAdminErrors(java.lang.Object session)
          Call this method to obtain a boolean value indicating whether or not the current user should see errors intended for administrators.
static IXPEnumerator GetErrors(ISessionManager sessionManager, IApplication application)
          Deprecated.  
static IXPEnumerator GetErrors(ISessionManager sessionManager, IApplication application, AActivitySpace space, boolean bForThisAs, boolean bIncludeAdminErrors)
          Call this method to obtain an enumeration of the current user's collection of errors that are associated with a given activity space.
static boolean IsErrorPageRequired(ISessionManager sessionManager, IApplication application, boolean bIncludeAdminErrors)
          Call this method to determine whether or not there are any errors for this user requiring their own error display page.
static void RaiseError(UIError error, ISessionManager sessionManager, IApplication application)
          Call this method to raise an error for display.
static void StaticInit(IAdminUIErrorHelper _adminUIErrorHelper)
          Initializes static admin error helper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UIErrorHandler

public UIErrorHandler()
Method Detail

StaticInit

public static void StaticInit(IAdminUIErrorHelper _adminUIErrorHelper)
Initializes static admin error helper. Can only be called once globally.

Parameters:
IAdminUIErrorHelper - a helper class

ClearError

public static void ClearError(UIError error,
                              ISessionManager sessionManager,
                              IApplication application)
Call this method to clear the specified error from the current user's collection of UIError objects.

This method should be called when it is no longer appropriate for users to see error messages generated for the passed error.

Parameters:
error - Pass the UIError object you wish cleared from the current user's collection of errors.
sessionManager - Pass the current user's ISessionManager
application - Pass the IApplication

ClearError

public static void ClearError(java.lang.String sKey,
                              ISessionManager sessionManager,
                              IApplication application)
Call this method to clear the specified error from the current user's collection of UIError objects.

This method should be called when it is no longer appropriate for users to see error messages generated for the passed error.

Parameters:
sKey - Pass the key used to store the error you wish to clear.
sessionManager - Pass the current user's ISessionManager
application - Pass the IApplication

ClearErrors

public static void ClearErrors(ISessionManager sessionManager,
                               IApplication application)
Call this method to clear all errors from the current user's collection of errors.

Note that this will clear all errors having scope ALL_USERS, and all errors having scope ADMIN_USERS, and all errors having scope CURRENT_USER raised under usage of the current users. Errors raised during usage of other users will not be cleared.

Parameters:
sessionManager - Pass the current user's ISessionManager
application - Pass the IApplication

ClearErrorsForASChange

public static void ClearErrorsForASChange(java.lang.String sNewASName,
                                          ISessionManager sessionManager,
                                          IApplication application)
Call this method to clear those errors that are associated with a specific activity space.

UIError objects can be associated with a particular activity space. When the user leaves that activity space, such errors should be cleared from the user's collection of errors.

Parameters:
sNewASName - Pass the name of the activity space which the user is entering.
sessionManager - Pass the current user's ISessionManager
application - Pass the IApplication

ClearErrorsRequiringASeparateDisplayPage

public static void ClearErrorsRequiringASeparateDisplayPage(ISessionManager sessionManager,
                                                            IApplication application,
                                                            AActivitySpace space,
                                                            boolean bForThisAs,
                                                            boolean bIncludeAdminErrors)
Parameters:
sessionManager -
application -
space -
bForThisAs -
bIncludeAdminErrors -

GetDisplayAdminErrors

public static boolean GetDisplayAdminErrors(AActivitySpace space)
Call this method to determine whether or not the current user should see admin-only errors.

This implementation of this method will always return false. More specific subclasses of UIErrorHandler will return more meaningful values. For example, PTErrorHandler will determine if the current user is an admin users, and return a value based on this fact.

Parameters:
space - AActivitySpace
Returns:
boolean value

GetDisplayAdminErrors

public static boolean GetDisplayAdminErrors(java.lang.Object session)
Call this method to obtain a boolean value indicating whether or not the current user should see errors intended for administrators.

Parameters:
Object - session
Returns:
boolean value

GetErrors

public static IXPEnumerator GetErrors(ISessionManager sessionManager,
                                      IApplication application)
Deprecated. 

Call this method to obtain an enumeration of the current user's collection of errors.

Parameters:
sessionManager - Pass the current user's ISessionManager
application - Pass the IApplication
Returns:
An IXPEnumerator containing UIError objects appropriate for the current user.

GetErrors

public static IXPEnumerator GetErrors(ISessionManager sessionManager,
                                      IApplication application,
                                      AActivitySpace space,
                                      boolean bForThisAs,
                                      boolean bIncludeAdminErrors)
Call this method to obtain an enumeration of the current user's collection of errors that are associated with a given activity space.

Parameters:
sessionManager - Pass the current user's ISessionManager
application - Pass the IApplication
activitySpace - Pass the activity space for which you wish to obtain appropriate errors.
bForThisSpace - Pass a boolean value indicating if you wish to obtain only errors associated with the passed activity space. If you pass true, you will also obtain those errors not associated with any activity space, you will only not obtain those errors associated with another activity space. If you pass false, you will obtain all errors for this user.
bIncludeAdminErrors - Pass a boolean indicating whether or not you wish to include errors for admin users. Use ErrorHanlder.GetDisplayAdminErrors() to obtain the correct value for this parameter.
Returns:
An IXPEnumerator containing UIError objects appropriate for the current user.

IsErrorPageRequired

public static boolean IsErrorPageRequired(ISessionManager sessionManager,
                                          IApplication application,
                                          boolean bIncludeAdminErrors)
Call this method to determine whether or not there are any errors for this user requiring their own error display page. Some errors are displayed on the current portal page, other errors require their own separate display page.

Parameters:
sessionManager - Pass the current user's ISessionManager
application - Pass the IApplication
Returns:
boolean value indicating whether or not to include errors of scope ADMIN_USERS. Use UIErrorHandler.GetDisplayAdminErrors() to obtain the appropriate value for this parameter.

RaiseError

public static void RaiseError(UIError error,
                              ISessionManager sessionManager,
                              IApplication application)
Call this method to raise an error for display. The appropriate users will see this error displayed in the appropriate way.

Calling this method will log error information.

Calling this method will cause the passed UIError object to be saved on the session or application as appropriate.

Parameters:
error - Pass a UIError object.
sessionManager - Pass an ISessionManager
application - Pass an IApplication



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.