DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.input
Class SchemEditErrors

java.lang.Object
  extended by org.dlese.dpc.schemedit.input.SchemEditErrors

public class SchemEditErrors
extends Object

Methods to create ActionErrors for the Metadata Editor. Most create two error messages :

  1. At the top of the page with a hyperlink to the field in which the error occurs
  2. At the field itself
MsgKey naming convention: The two-part errors require two keyed messages in the ApplicationsResource file. The key for the linked message is named as follows: msgKey+".link". For example, if the msgKey was "invalid.value", then the linked message key is named "invalid.value.link"

Author:
ostwald

Constructor Summary
SchemEditErrors()
           
 
Method Summary
static void addAnyTypeError(SchemEditActionErrors errors, InputField field, String errorMsg)
          Adds a feature to the AnyTypeError attribute of the SchemEditErrors class
static void addDuplicateUrlError(SchemEditActionErrors errors, String uniqueUrlPath, String msgKey)
          Create a duplicateURL error(s) and attach to provided errors lsit
static void addDuplicateValueError(SchemEditActionErrors errors, InputField inputField, String dupRecId)
          Creates two ActionErrors signifying a duplicateValue error, one for the top of page message, and one for the error message that is attached to a specific field.
static void addEntityError(SchemEditActionErrors errors, InputField field, String errorMsg)
          Creates two ActionErrors, one for the top of page message, and one for the error message that is attached to a specific field.
static void addError(SchemEditActionErrors errors, InputField field, String msgKey)
          Creates two ActionErrors, one for the top of page message, and one for the error message that is attached to a specific field.
static void addError(SchemEditActionErrors errors, String fieldProperty, String msgKey, String elementName, String pathArg)
          Creates two ActionErrors, one for the top of page message, and one for the error message that is attached to a specific field.
static void addGenericError(SchemEditActionErrors errors, String xpath, String msg)
          Creates two ActionErrors signifying a Generic error, one for the top of page message, and one for the error message that is attached to a specific field.
static void addInvalidUrlError(SchemEditActionErrors errors, String uniqueUrlPath, String msg)
          Creates two ActionErrors signifying an invalidUrlError error, one for the top of page message, and one for the error message that is attached to a specific field.
static void addSimilarUrlError(SchemEditActionErrors errors, String uniqueUrlPath, String msgKey)
          Creates two ActionErrors signifying a similarURL, one for the top of page message, and one for the error message that is attached to a specific field.
static void addUniqueUrlError(SchemEditActionErrors errors, String uniqueUrlPath, String msgKey, String msgProperty)
          Creates two ActionErrors for a "nonUniqueUrl", one for the top of page message, and one for the error message that is attached to a specific field.
static void addXSDdatatypeError(SchemEditActionErrors errors, InputField field, String msgKey, String errorMsg)
          Adds errors in the case where an invalid value message has been supplied by the XSDDataType validator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemEditErrors

public SchemEditErrors()
Method Detail

addError

public static void addError(SchemEditActionErrors errors,
                            String fieldProperty,
                            String msgKey,
                            String elementName,
                            String pathArg)
Creates two ActionErrors, one for the top of page message, and one for the error message that is attached to a specific field. Used when no InputField is available, so fieldProperty and elementName must be passed explicitly.

Example use: to notify of an element that could not be deleted. Here there is not a specific InputField involved, but rather an branch of the XML document (which is identified by xpath).

Note: both the pathArg and the path component of the fieldProperty contain xpaths that are encoded for jsp (e.g., the indexing notation is converted from "[1]" to "_1_".

Parameters:
errors - ActionErrors object to which the new errors are added
fieldProperty - The property to which this error is attached (e.g., "valueOf(/itemRecord/general/description_1_)")
msgKey - Reference to a message in the "ApplicationResources"
elementName - The feature to be added to the Error attribute
pathArg - xpath (encoded for jsp) to the field in which the error occurs

addGenericError

public static void addGenericError(SchemEditActionErrors errors,
                                   String xpath,
                                   String msg)
Creates two ActionErrors signifying a Generic error, one for the top of page message, and one for the error message that is attached to a specific field.

Parameters:
errors - error list to which we add
msg - error msg content
xpath - The feature to be added to the GenericError attribute

addInvalidUrlError

public static void addInvalidUrlError(SchemEditActionErrors errors,
                                      String uniqueUrlPath,
                                      String msg)
Creates two ActionErrors signifying an invalidUrlError error, one for the top of page message, and one for the error message that is attached to a specific field.

Parameters:
errors - error list to which we add
uniqueUrlPath - path of field that should contain uniqueUrl
msg - error msg content

addSimilarUrlError

public static void addSimilarUrlError(SchemEditActionErrors errors,
                                      String uniqueUrlPath,
                                      String msgKey)
Creates two ActionErrors signifying a similarURL, one for the top of page message, and one for the error message that is attached to a specific field.

Parameters:
errors - error list to which we add
msgKey - msgKey to select message from applicationResources
uniqueUrlPath - path of field that should contain uniqueUrl

addDuplicateUrlError

public static void addDuplicateUrlError(SchemEditActionErrors errors,
                                        String uniqueUrlPath,
                                        String msgKey)
Create a duplicateURL error(s) and attach to provided errors lsit

Parameters:
errors - error list to which we add
msgKey - msgKey to select message from applicationResources
uniqueUrlPath - path of field that should contain uniqueUrl

addDuplicateValueError

public static void addDuplicateValueError(SchemEditActionErrors errors,
                                          InputField inputField,
                                          String dupRecId)
Creates two ActionErrors signifying a duplicateValue error, one for the top of page message, and one for the error message that is attached to a specific field.

Parameters:
errors - the error list to which we add
inputField - the input field containing a dup value
dupRecId - The Id of a record containing a dup value

addUniqueUrlError

public static void addUniqueUrlError(SchemEditActionErrors errors,
                                     String uniqueUrlPath,
                                     String msgKey,
                                     String msgProperty)
Creates two ActionErrors for a "nonUniqueUrl", one for the top of page message, and one for the error message that is attached to a specific field.

Parameters:
errors - error list to which we add
msgKey - msgKey to select message from applicationResources
uniqueUrlPath - path of field that should contain uniqueUrl
msgProperty - identifies the type of error and how it is displayed in UI

addError

public static void addError(SchemEditActionErrors errors,
                            InputField field,
                            String msgKey)
Creates two ActionErrors, one for the top of page message, and one for the error message that is attached to a specific field.

Parameters:
errors - ActionErrors object to which the new errors are added
field - The InputField containing an error
msgKey - Reference to a message in the "ApplicationResources"

addEntityError

public static void addEntityError(SchemEditActionErrors errors,
                                  InputField field,
                                  String errorMsg)
Creates two ActionErrors, one for the top of page message, and one for the error message that is attached to a specific field.

Parameters:
errors - ActionErrors object to which the new errors are added
field - The InputField containing an error
errorMsg - The feature to be added to the EntityError attribute

addAnyTypeError

public static void addAnyTypeError(SchemEditActionErrors errors,
                                   InputField field,
                                   String errorMsg)
Adds a feature to the AnyTypeError attribute of the SchemEditErrors class

Parameters:
errors - error list to which we add
field - inputField that error message is attached
errorMsg - The text of the error message

addXSDdatatypeError

public static void addXSDdatatypeError(SchemEditActionErrors errors,
                                       InputField field,
                                       String msgKey,
                                       String errorMsg)
Adds errors in the case where an invalid value message has been supplied by the XSDDataType validator.

Parameters:
errors - error list to which we add
field - inputField that error message is attached
msgKey - msgKey to select message from applicationResources
errorMsg - The text of the error message

DLESE Tools
v1.6.0