com.qanavigation.Basics
Class Rslt

java.lang.Object
  extended by com.qanavigation.Basics.Rslt
All Implemented Interfaces:
IRslt
Direct Known Subclasses:
RsltHTMLString, RsltString, SQLRslt, TransRslt, XMLDBbasics, XMLRslt

public class Rslt
extends java.lang.Object
implements IRslt

Author:
RDG 'Rslt' is a base class for all results that an application might return. Its purpose is to transport, attached to the original result, information about the state of the result. Services can also be derived from result. The status of the requested service is then inquirable through the result state of the object, rather then through return codes. Due to the fact that the name 'Result' was unfortunatly arlready taken by the Interface 'Result' for javax.xml.transform (very shortsighted decision) and 'Outcome' was too clumsy for my taste I decided to abbreviate by dropping the vowels, thus resulting in 'Rslt'.

Constructor Summary
Rslt()
          Default constructor.
Rslt(boolean p_isOK)
          Construct with default status 'OK' (true) or 'inError' (false).
Rslt(java.lang.Class p_c)
          Constructor for a specific class
Rslt(IRslt p_aRes)
          Copy constructor for an Interface implementer.
Rslt(Rslt p_aRes)
          Copy constructor for a Rslt object.
 
Method Summary
 void addRsltAddFailInfo(java.lang.String p_Class, java.lang.String p_Fnct, java.lang.String p_AddInf1, java.lang.String p_AddInf2)
          Is plugged together to 'p_Class + "." + p_Fnct + "()" + p_AddInf1 + " failed. " + p_AddInf2'.
 void addRsltAddFailInfoIf(java.lang.String p_Class, java.lang.String p_Fnct, java.lang.String p_AddInf1, java.lang.String p_AddInf2)
          Is plugged together to 'p_Class + "." + p_Fnct + "()" + p_AddInf1 + " failed. " + p_AddInf2'.
 void addRsltAddInfo(IRslt p_aRes)
          Copies the result information from the other Rslt.
 void addRsltAddInfo(java.lang.String p_AddInfo)
          Add additional information to the Rslt.
 void addRsltFinalInfo(java.lang.String p_FinalInfo)
          Add the final information to the Rslt.
 void addRsltInitialInfo(java.lang.String p_AddInfo)
          Add initial information to the Rslt.
 boolean checkRslt(IRslt p_Res)
          Checks the status of the given Rslt and clones the information if its not OK.
 boolean checkRslt(IRslt p_Res, boolean p_EmptyIsOK)
          Same as checkRslt( IRslt p_Res ) but tolerates if the result or itself isEmpty.
 boolean checkRslt(Rslt p_Res)
          Simplify "if( m_DB.notOK() ) { setResStat( m_DB ); } if( isOK() ) { ..."
 boolean checkRslt(Rslt p_Res, boolean p_EmptyIsOK)
           
 IRslt getRslt()
           
 java.util.ArrayList<java.lang.String> getRsltAddInfo()
           
 java.util.ArrayList<java.lang.String> getRsltFinalInfo()
           
 java.lang.String getRsltFinalMsg()
          Returns the last final message.
 java.util.ArrayList<java.lang.String> getRsltInitialInfo()
           
 java.lang.String getRsltInitialMsg()
          Returns the first of the messages on the message stack.
 int getRsltStatVal()
           
 java.lang.String getRsltStatValLbl()
           
 boolean isInStat(int p_Stat)
          Check for the requested status.
 boolean isOK()
          If it is RsltStatVal.isOK it's OK;
 boolean isOK(boolean p_EmptyIsOK)
           
 boolean notOK()
          Anything that is not isOK() is not OK;
 boolean notOK(boolean p_EmptyIsOK)
           
 void resetRslt()
          Set back to OK, dumps all messages.
 void setInError(java.lang.String p_ErrMsg)
          Sets the status to "In Error" and adds the messages to the list of messages.
 void setOK()
           
 void setRsltByExcp(java.lang.Exception p_Excp)
          Sets the Rslt in Error and collects the information from the exception.
 void setRsltByExcp(java.io.IOException p_Excp)
          Sets the Rslt in Error and collects the information from the exception.
 void setRsltByExcp(java.lang.Throwable p_Excp)
          Sets the Rslt in Error and collects the information from the exception.
 void setRsltStat(int p_aResStat)
          Sets the status to the given state.
 void setRsltStat(int p_aResStat, java.lang.String p_ErrMsg)
          Set Rslt status by status value, with message.
 void setRsltStat(IRslt p_aRes)
          Set Rslt status from another Rslt.
 void setRsltStat(IRslt p_aRes, java.lang.String p_ErrMsg)
          Set Rslt status from another Rslt with message.
 void setSelfReflect()
          Gets information about the class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rslt

public Rslt()
Default constructor. Status is "notInit",.


Rslt

public Rslt(boolean p_isOK)
Construct with default status 'OK' (true) or 'inError' (false).

Parameters:
p_isOK -

Rslt

public Rslt(java.lang.Class p_c)
Constructor for a specific class

Parameters:
p_c -

Rslt

public Rslt(IRslt p_aRes)
Copy constructor for an Interface implementer.

Parameters:
p_aRes -

Rslt

public Rslt(Rslt p_aRes)
Copy constructor for a Rslt object.

Parameters:
p_aRes -
Method Detail

addRsltAddFailInfo

public void addRsltAddFailInfo(java.lang.String p_Class,
                               java.lang.String p_Fnct,
                               java.lang.String p_AddInf1,
                               java.lang.String p_AddInf2)
Is plugged together to 'p_Class + "." + p_Fnct + "()" + p_AddInf1 + " failed. " + p_AddInf2'.

Specified by:
addRsltAddFailInfo in interface IRslt
Parameters:
p_Class -
p_Fnct -
p_AddInf1 -
p_AddInf2 -

addRsltAddFailInfoIf

public void addRsltAddFailInfoIf(java.lang.String p_Class,
                                 java.lang.String p_Fnct,
                                 java.lang.String p_AddInf1,
                                 java.lang.String p_AddInf2)
Is plugged together to 'p_Class + "." + p_Fnct + "()" + p_AddInf1 + " failed. " + p_AddInf2'. Appended only if notOK().

Parameters:
p_Class -
p_Fnct -
p_AddInf1 -
p_AddInf2 -

addRsltAddInfo

public void addRsltAddInfo(IRslt p_aRes)
Copies the result information from the other Rslt.

Specified by:
addRsltAddInfo in interface IRslt
Parameters:
p_aRes -

addRsltAddInfo

public void addRsltAddInfo(java.lang.String p_AddInfo)
Add additional information to the Rslt. Makes it the initial info, if no initial info is available.

Specified by:
addRsltAddInfo in interface IRslt
Parameters:
p_AddInfo -

addRsltFinalInfo

public void addRsltFinalInfo(java.lang.String p_FinalInfo)
Add the final information to the Rslt.

Specified by:
addRsltFinalInfo in interface IRslt
Parameters:
p_FinalInfo -

addRsltInitialInfo

public void addRsltInitialInfo(java.lang.String p_AddInfo)
Add initial information to the Rslt.

Specified by:
addRsltInitialInfo in interface IRslt
Parameters:
p_AddInfo -

checkRslt

public boolean checkRslt(IRslt p_Res)
Checks the status of the given Rslt and clones the information if its not OK.
Simplifies code sequences like
   "if( m_DB.notOK() ) {
            res.setResStat( m_DB );
          }
  
          if( res.isOK() ) { ..." 
 to
   "if( res.checkRes( m_DB ) ) {... "

Specified by:
checkRslt in interface IRslt
Parameters:
p_Res -
Returns:
isOK(), which also may be the state before the call!

checkRslt

public boolean checkRslt(IRslt p_Res,
                         boolean p_EmptyIsOK)
Same as checkRslt( IRslt p_Res ) but tolerates if the result or itself isEmpty.

Specified by:
checkRslt in interface IRslt
Parameters:
p_Res -
p_EmptyIsOK -
Returns:
isOK(), which also may be the state before the call!

checkRslt

public boolean checkRslt(Rslt p_Res)
Simplify 
        "if( m_DB.notOK() ) {
           setResStat( m_DB );
         }
         if( isOK() ) { ..." 
 to
        "if( checkRes( m_DB ) ) {... "

Parameters:
p_Res -
Returns:
isOK(), which also may be the state before the call!

checkRslt

public boolean checkRslt(Rslt p_Res,
                         boolean p_EmptyIsOK)
Parameters:
p_Res -
p_EmptyIsOK -

getRslt

public IRslt getRslt()
Specified by:
getRslt in interface IRslt
Returns:

getRsltAddInfo

public java.util.ArrayList<java.lang.String> getRsltAddInfo()
Specified by:
getRsltAddInfo in interface IRslt
Returns:

getRsltFinalInfo

public java.util.ArrayList<java.lang.String> getRsltFinalInfo()
Specified by:
getRsltFinalInfo in interface IRslt
Returns:

getRsltInitialInfo

public java.util.ArrayList<java.lang.String> getRsltInitialInfo()
Specified by:
getRsltInitialInfo in interface IRslt
Returns:

getRsltInitialMsg

public java.lang.String getRsltInitialMsg()
Returns the first of the messages on the message stack.

Specified by:
getRsltInitialMsg in interface IRslt
Returns:

getRsltFinalMsg

public java.lang.String getRsltFinalMsg()
Returns the last final message. If none is found it returns the last message on the message stack.

Specified by:
getRsltFinalMsg in interface IRslt
Returns:

getRsltStatVal

public int getRsltStatVal()
Specified by:
getRsltStatVal in interface IRslt
Returns:

getRsltStatValLbl

public java.lang.String getRsltStatValLbl()
Specified by:
getRsltStatValLbl in interface IRslt
Returns:

isInStat

public boolean isInStat(int p_Stat)
Check for the requested status.

Specified by:
isInStat in interface IRslt
Parameters:
p_Stat -
Returns:

isOK

public boolean isOK()
If it is RsltStatVal.isOK it's OK;

Specified by:
isOK in interface IRslt
Returns:

isOK

public boolean isOK(boolean p_EmptyIsOK)
Specified by:
isOK in interface IRslt
Parameters:
p_EmptyIsOK -
Returns:

notOK

public boolean notOK()
Anything that is not isOK() is not OK;

Specified by:
notOK in interface IRslt
Returns:

notOK

public boolean notOK(boolean p_EmptyIsOK)
Specified by:
notOK in interface IRslt
Parameters:
p_EmptyIsOK -
Returns:

resetRslt

public void resetRslt()
Set back to OK, dumps all messages.

Specified by:
resetRslt in interface IRslt

setInError

public void setInError(java.lang.String p_ErrMsg)
Sets the status to "In Error" and adds the messages to the list of messages.

Specified by:
setInError in interface IRslt
Parameters:
p_ErrMsg -

setOK

public void setOK()
Specified by:
setOK in interface IRslt

setRsltByExcp

public void setRsltByExcp(java.lang.Exception p_Excp)
Sets the Rslt in Error and collects the information from the exception.

Specified by:
setRsltByExcp in interface IRslt
Parameters:
p_Excp -

setRsltByExcp

public void setRsltByExcp(java.lang.Throwable p_Excp)
Sets the Rslt in Error and collects the information from the exception.

Parameters:
p_Excp -

setRsltByExcp

public void setRsltByExcp(java.io.IOException p_Excp)
Sets the Rslt in Error and collects the information from the exception.

Parameters:
p_Excp -

setRsltStat

public void setRsltStat(int p_aResStat)
Sets the status to the given state.

Specified by:
setRsltStat in interface IRslt
Parameters:
p_aResStat -

setRsltStat

public void setRsltStat(int p_aResStat,
                        java.lang.String p_ErrMsg)
Set Rslt status by status value, with message.

Specified by:
setRsltStat in interface IRslt
Parameters:
p_aResStat -
p_ErrMsg -

setRsltStat

public void setRsltStat(IRslt p_aRes)
Set Rslt status from another Rslt.

Specified by:
setRsltStat in interface IRslt
Parameters:
p_aRes -

setRsltStat

public void setRsltStat(IRslt p_aRes,
                        java.lang.String p_ErrMsg)
Set Rslt status from another Rslt with message.

Specified by:
setRsltStat in interface IRslt
Parameters:
p_aRes -
p_ErrMsg -

setSelfReflect

public void setSelfReflect()
Gets information about the class. Interface implementation: make a copy of this method!



Copyright © 2003 - 20011 Ronald D. Grindle. All Rights Reserved.