com.bowstreet.builderutilities
Class PageAutomationMessages

java.lang.Object
  extended by com.bowstreet.builderutilities.PageAutomationMessages

public class PageAutomationMessages
extends java.lang.Object

Author:
szagieboylo This class will be instantiated when there is any PageAutomation with validation active for a page. The purpose is to provide a clean API that users can interact with.

Constructor Summary
PageAutomationMessages()
           
 
Method Summary
 void addMessage(java.lang.String fieldName, java.lang.String message)
          Add an error message
 void addMessageWithAppend(java.lang.String fieldName, java.lang.String message, java.lang.String append)
          Add an error message
 void clear()
          Clear all errors for the page
 java.lang.String getCompleteMessageHTML()
          Get the complete error message, one line per field with an error, Lines are constructed as [readable name]: [message]
 java.lang.String getCompleteMessageString()
          Get the complete error message, one line per field with an error, Lines are constructed as [readable name]: [message]
 java.lang.String getErrorIntroString()
           
 java.lang.String getMessage(java.lang.String fieldName)
          Get an error message
 java.lang.String getMessageInRepeatedSection(java.lang.String fieldName, java.lang.String additionalName)
          Get an error message where there is name-morphing
 java.lang.String getRequiredMessage()
           
static boolean hasError(WebAppAccess waa, java.lang.String errorVar, java.lang.String fieldName)
          Checks where there is an error message for a field.
 boolean hasMessages()
          check if there were any errors on the page
 void setErrorIntroString(java.lang.String errorIntroString)
           
 void setReadableName(java.lang.String fieldName, java.lang.String readableName)
          Set the readable name for a field.
 void setRequiredMessage(java.lang.String requiredMessage)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PageAutomationMessages

public PageAutomationMessages()
Method Detail

addMessage

public void addMessage(java.lang.String fieldName,
                       java.lang.String message)
Add an error message

Parameters:
fieldName - The name of the field for which the error applies
message - The error message

addMessageWithAppend

public void addMessageWithAppend(java.lang.String fieldName,
                                 java.lang.String message,
                                 java.lang.String append)
Add an error message

Parameters:
fieldName - The name of the field for which the error applies
message - The error message

clear

public void clear()
Clear all errors for the page


getCompleteMessageHTML

public java.lang.String getCompleteMessageHTML()
Get the complete error message, one line per field with an error, Lines are constructed as [readable name]: [message]

Returns:
complete error message, separated by BR tags and newlines

getCompleteMessageString

public java.lang.String getCompleteMessageString()
Get the complete error message, one line per field with an error, Lines are constructed as [readable name]: [message]

Returns:
complete error message, separated by newlines

getErrorIntroString

public final java.lang.String getErrorIntroString()
Returns:
the errorIntroString

getMessage

public java.lang.String getMessage(java.lang.String fieldName)
Get an error message

Parameters:
fieldName - The name of the field for which the error applies
Returns:
The error message -- possibly null

getMessageInRepeatedSection

public java.lang.String getMessageInRepeatedSection(java.lang.String fieldName,
                                                    java.lang.String additionalName)
Get an error message where there is name-morphing

Parameters:
fieldName - base field name
additionalName - additional part for morphing
Returns:
The error message -- null if no error.

getRequiredMessage

public java.lang.String getRequiredMessage()

hasError

public static boolean hasError(WebAppAccess waa,
                               java.lang.String errorVar,
                               java.lang.String fieldName)
Checks where there is an error message for a field.

Parameters:
waa -
errorVar -
fieldName -

hasMessages

public boolean hasMessages()
check if there were any errors on the page

Returns:
true if there were errors

setErrorIntroString

public final void setErrorIntroString(java.lang.String errorIntroString)
Parameters:
errorIntroString - the errorIntroString to set

setReadableName

public void setReadableName(java.lang.String fieldName,
                            java.lang.String readableName)
Set the readable name for a field. Any field that does not have a readable name set will use the fieldname for its readable name. Generally, users do not have to call this function ever, because the PageAutomation tools will construct the instance of this class with the readable names already set.

Parameters:
fieldName -
readableName -

setRequiredMessage

public void setRequiredMessage(java.lang.String requiredMessage)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2009 IBM. All Rights Reserved.