com.paulwithers.openLog
Class OpenLogErrorHolder

java.lang.Object
  extended by com.paulwithers.openLog.OpenLogErrorHolder
All Implemented Interfaces:
java.io.Serializable

public class OpenLogErrorHolder
extends java.lang.Object
implements java.io.Serializable

Since:
1.0.0
Author:
withersp
See Also:
Serialized Form

Nested Class Summary
 class OpenLogErrorHolder.EventError
           
 
Field Summary
private  java.util.LinkedHashSet<OpenLogErrorHolder.EventError> errors
           
private  java.util.LinkedHashSet<OpenLogErrorHolder.EventError> events
           
private  java.util.LinkedHashSet<OpenLogErrorHolder.EventError> loggedErrors
           
private static long serialVersionUID
           
 
Constructor Summary
OpenLogErrorHolder()
           
 
Method Summary
 void addError(java.lang.Object je, java.lang.Object thisObj)
           
 void addError(java.lang.Object je, java.lang.Object thisObj, int severity)
           
 void addError(java.lang.Object je, java.lang.Object thisObj, int severity, java.lang.String unid)
           
 void addError(java.lang.Object je, java.lang.String msg, java.lang.Object thisObj)
           
 void addError(java.lang.Object je, java.lang.String msg, java.lang.Object thisObj, int severity)
           
 void addError(java.lang.Object je, java.lang.String msg, java.lang.Object thisObj, int severity, java.lang.String unid)
           
 void addEvent(java.lang.String msg, java.lang.Object thisObj)
           
 void addEvent(java.lang.String msg, java.lang.Object thisObj, int severity)
           
 void addEvent(java.lang.String msg, java.lang.Object thisObj, int severity, java.lang.String unid)
           
 void addFacesMessageForError(OpenLogErrorHolder.EventError newErr)
           
private  void addToErrorsList(OpenLogErrorHolder.EventError newErr)
           
private  void addToEventsList(OpenLogErrorHolder.EventError newEv)
           
private  OpenLogErrorHolder.EventError createEventError(InterpretException ie, java.lang.String msg, UIComponent control, int severity, java.lang.String unid)
           
 UIComponent getComponentFromThis(java.lang.Object thisObj)
          Gets a component based on the object passed in.
 java.util.LinkedHashSet<OpenLogErrorHolder.EventError> getErrors()
          LinkedHashSet (array of EventError objects in the order they were inserted)
 java.util.LinkedHashSet<OpenLogErrorHolder.EventError> getEvents()
          Loads a list of EventError objects, see getErrors()
 InterpretException getInterpretException(java.lang.Object je)
           
 java.util.LinkedHashSet<OpenLogErrorHolder.EventError> getLoggedErrors()
          Loads a list of EventError objects that have been logged
 void setLoggedErrors(java.util.LinkedHashSet<OpenLogErrorHolder.EventError> loggedErrors)
          Loads a list of EventError objects that have been logged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errors

private java.util.LinkedHashSet<OpenLogErrorHolder.EventError> errors

events

private java.util.LinkedHashSet<OpenLogErrorHolder.EventError> events

loggedErrors

private java.util.LinkedHashSet<OpenLogErrorHolder.EventError> loggedErrors

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

OpenLogErrorHolder

public OpenLogErrorHolder()
Method Detail

getErrors

public java.util.LinkedHashSet<OpenLogErrorHolder.EventError> getErrors()
LinkedHashSet (array of EventError objects in the order they were inserted)

Returns:
LinkedHashSet Errors or Events as a list

getEvents

public java.util.LinkedHashSet<OpenLogErrorHolder.EventError> getEvents()
Loads a list of EventError objects, see getErrors()

Returns:
LinkedHashSet

getLoggedErrors

public java.util.LinkedHashSet<OpenLogErrorHolder.EventError> getLoggedErrors()
Loads a list of EventError objects that have been logged

Returns:
LinkedHashSet

setLoggedErrors

public void setLoggedErrors(java.util.LinkedHashSet<OpenLogErrorHolder.EventError> loggedErrors)
Loads a list of EventError objects that have been logged

Parameters:
loggedErrors -

createEventError

private OpenLogErrorHolder.EventError createEventError(InterpretException ie,
                                                       java.lang.String msg,
                                                       UIComponent control,
                                                       int severity,
                                                       java.lang.String unid)
Parameters:
ie - InterpretException or null
msg - specific Event or Error message to be passed
control - component the error is associated with
severity - integer (1-7) of severity
unid - document error is related to
Returns:

getInterpretException

public InterpretException getInterpretException(java.lang.Object je)

addError

public void addError(java.lang.Object je,
                     java.lang.Object thisObj,
                     int severity,
                     java.lang.String unid)
Parameters:
ie - InterpretException thrown from SSJS. In SSJS, add a try...catch block.
The "catch" element passes an InterpretException.
thisObj - Component or eventHandler the error occurred on. To avoid hard-coding the control, use "this" in a property or an event:
severity - Integer severity level from 1 to 7, corresponding to java.util.logging Levels. 1 is severe, 7 is finest.
unid - This object is serializable to requestScope. But for safety, it shouldn't include Domino objects. The code will look for the document in the current database. If it can't be found, we won't be able to get the document. So instead we'll just write out the UNID in the error message.
 try {
        *YOUR CODE*
 } catch(e) {
        openLogBean.addError(e, this, 1, doc.getUniversalId());
 }
 
The default level is 4.

addError

public void addError(java.lang.Object je,
                     java.lang.Object thisObj,
                     int severity)
Parameters:
ie - InterpretException thrown from SSJS. In SSJS, add a try...catch block.
The "catch" element passes an InterpretException.
thisObj - Component or eventHandler the error occurred on. To avoid hard-coding the control, use "this" in a property or an event:
severity - Integer severity level from 1 to 7, corresponding to java.util.logging Levels. 1 is severe, 7 is finest. EXAMPLE
 try {
        *YOUR CODE*
 } catch(e) {
        openLogBean.addError(e, this, 1);
 }
 
The default level is 4.

addError

public void addError(java.lang.Object je,
                     java.lang.Object thisObj)
Parameters:
ie - InterpretException thrown from SSJS. In SSJS, add a try...catch block.
The "catch" element passes an InterpretException.
thisObj - Component or eventHandler the error occurred on. To avoid hard-coding the control, use "this" in a property or an event: EXAMPLE
 try {
        *YOUR CODE*
 } catch(e) {
        openLogBean.addError(e, this);
 }
 
To pass no control, call openLogBean.addError(e, null)

addError

public void addError(java.lang.Object je,
                     java.lang.String msg,
                     java.lang.Object thisObj,
                     int severity,
                     java.lang.String unid)
Parameters:
ie - InterpretException thrown from SSJS. In SSJS, add a try...catch block.
The "catch" element passes an InterpretException.
msg - An additional message to pass to OpenLog.
thisObj - Component or eventHandler the error occurred on. To avoid hard-coding the control, use "this" in a property or an event:
severity - Integer severity level from 1 to 7, corresponding to java.util.logging Levels. 1 is severe, 7 is finest.
unid - This object is serializable to requestScope. But for safety, it shouldn't include Domino objects. The code will look for the document in the current database. If it can't be found, we won't be able to get the document. So instead we'll just write out the UNID in the error message. EXAMPLE
 try {
        *YOUR CODE*
 } catch(e) {
        openLogBean.addError(e, "This is an extra error message", this, 1, doc.getUniversalId());
 }
 
The default level is 4.

addError

public void addError(java.lang.Object je,
                     java.lang.String msg,
                     java.lang.Object thisObj,
                     int severity)
Parameters:
ie - InterpretException thrown from SSJS. In SSJS, add a try...catch block.
The "catch" element passes an InterpretException.
msg - An additional message to pass to OpenLog.
thisObj - Component or eventHandler the error occurred on. To avoid hard-coding the control, use "this" in a property or an event:
severity - Integer severity level from 1 to 7, corresponding to java.util.logging Levels. 1 is severe, 7 is finest. EXAMPLE
 try {
        *YOUR CODE*
 } catch(e) {
        openLogBean.addError(e, "This is an extra error message", this, 1);
 }
 
The default level is 4.

addError

public void addError(java.lang.Object je,
                     java.lang.String msg,
                     java.lang.Object thisObj)
Parameters:
ie - InterpretException thrown from SSJS. In SSJS, add a try...catch block.
The "catch" element passes an InterpretException.
msg - An additional message to pass to OpenLog.
thisObj - Component or eventHandler the error occurred on. To avoid hard-coding the control, use "this" in a property or an event: EXAMPLE
 try {
        *YOUR CODE*
 } catch(e) {
        openLogBean.addError(e, "This is an extra error message", this);
 }
 
To pass no control, call openLogBean.addError(e, null)

addToErrorsList

private void addToErrorsList(OpenLogErrorHolder.EventError newErr)
Parameters:
newErr - error to add to the list

addEvent

public void addEvent(java.lang.String msg,
                     java.lang.Object thisObj,
                     int severity,
                     java.lang.String unid)
Parameters:
msg - String message to pass to the event logger
thisObj - Component or eventHandler the error occurred on. To avoid hard-coding the control, use "this" in a property or an event:
severity - Integer severity level from 1 to 7, corresponding to java.util.logging Levels. 1 is severe, 7 is finest
unid - This object is serializable to requestScope. But for safety, it shouldn't include Domino objects. The code will look for the document in the current database. If it can't be found, we won't be able to get the document. So instead we'll just write out the UNID in the error message. EXAMPLE
 try {
        *YOUR CODE*
 } catch(e) {
        openLogBean.addEvent("This is an extra message", this, 1, doc.getUniversalId());
 }
 
The default level is 4. To pass no UNID, pass "".

addEvent

public void addEvent(java.lang.String msg,
                     java.lang.Object thisObj,
                     int severity)
Parameters:
msg - String message to pass to the event logger
thisObj - Component or eventHandler the error occurred on. To avoid hard-coding the control, use "this" in a property or an event:
severity - Integer severity level from 1 to 7, corresponding to java.util.logging Levels. 1 is severe, 7 is finest. EXAMPLE
 try {
        *YOUR CODE*
 } catch(e) {
        openLogBean.addEvent("This is an extra message", this, 1);
 }
 
The default level is 4.

addEvent

public void addEvent(java.lang.String msg,
                     java.lang.Object thisObj)
Parameters:
msg - String message to pass to the event logger
thisObj - Component or eventHandler the error occurred on. To avoid hard-coding the control, use "this" in a property or an event: EXAMPLE:
 try {
        *YOUR CODE*
 } catch(e) {
        openLogBean.addEvent("This is an extra message", this);
 }
 

getComponentFromThis

public UIComponent getComponentFromThis(java.lang.Object thisObj)
Gets a component based on the object passed in. Should be an instance of UIComponent or XspEventHandler

Parameters:
thisObj - Object instance of UIComponent (e.g. XspOutputText) or XspEventHandler or null
Returns:
UIComponent the component where the error is on
Since:
5.0.0

addToEventsList

private void addToEventsList(OpenLogErrorHolder.EventError newEv)
Parameters:
newEv - event to be added to the list

addFacesMessageForError

public void addFacesMessageForError(OpenLogErrorHolder.EventError newErr)
Parameters:
newErr - error to be added to facesMessage