Groovy Documentation

de.dewarim.goblin
[Groovy] Class InputValidationService

java.lang.Object
  de.dewarim.goblin.InputValidationService

class InputValidationService

This class is responsible for input validation and encoding.


Property Summary
static java.lang.Object transactional

 
Constructor Summary
InputValidationService()

 
Method Summary
java.lang.Boolean checkAndEncodeBoolean(java.lang.Object params, java.lang.String fieldName, java.lang.String fieldLabel)

java.lang.Integer checkAndEncodeInteger(java.lang.Object params, java.lang.String fieldName, java.lang.String fieldLabel)

java.lang.String checkAndEncodeName(java.lang.String name, java.lang.Object myObject)

Check if name is not null and does not consist of whitespace.

java.lang.String checkAndEncodeText(java.lang.Object params, java.lang.String fieldName, java.lang.String fieldLabel)

Ensure that a given input field is not empty or blank and encode its content.

java.lang.Enum checkEnum(java.lang.Object clazz, java.lang.Object name)

java.lang.Object checkObject(java.lang.Object clazz, java.lang.Object id)

Load an object of the given class by its ID.

java.lang.Object checkObject(java.lang.Object clazz, java.lang.String id, java.lang.Object nullAllowed)

Load an object of the given class by its ID.

java.lang.String checkXmlText(java.lang.Object xmlString)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Property Detail

transactional

static java.lang.Object transactional


 
Constructor Detail

InputValidationService

InputValidationService()


 
Method Detail

checkAndEncodeBoolean

java.lang.Boolean checkAndEncodeBoolean(java.lang.Object params, java.lang.String fieldName, java.lang.String fieldLabel)


checkAndEncodeInteger

java.lang.Integer checkAndEncodeInteger(java.lang.Object params, java.lang.String fieldName, java.lang.String fieldLabel)


checkAndEncodeName

java.lang.String checkAndEncodeName(java.lang.String name, java.lang.Object myObject)
Check if name is not null and does not consist of whitespace. Then check if there is already another instance of myObject with this name in the database. Return the HTML-encoded name afterwards.
throws:
RuntimeException either "error.missing.name", if the name is null or invalid, or "error.name.not.unique" there already exists another object with the same name in the database.
Parameters:
name - raw input String from client
myObject - an object whose class is GORM-enabled and has a "name" field.
Returns:
the HTML-encoded name.


checkAndEncodeText

java.lang.String checkAndEncodeText(java.lang.Object params, java.lang.String fieldName, java.lang.String fieldLabel)
Ensure that a given input field is not empty or blank and encode its content.
Parameters:
params - Map of HTTP-Request params
fieldName - the input field name
fieldLabel - the label for the input field (usually a message-id)
Returns:
the HTML-encoded input string


checkEnum

java.lang.Enum checkEnum(java.lang.Object clazz, java.lang.Object name)


checkObject

java.lang.Object checkObject(java.lang.Object clazz, java.lang.Object id)
Load an object of the given class by its ID.
Parameters:
clazz - class of the object
id - string representation of the id, which is parsed as a Long value.
Returns:
either the requested object or a RuntimeException if the object could not be found.


checkObject

java.lang.Object checkObject(java.lang.Object clazz, java.lang.String id, java.lang.Object nullAllowed)
Load an object of the given class by its ID.
Parameters:
clazz - class of the object
id - string representation of the id, which is parsed as a Long value.
nullAllowed - boolean whether to return a null if the parameter is null or the id is invalid.
Returns:
the requested object or, if the object could not be found, a RuntimeException. If nullAllowed evaluates to true, in case of a missing object / invalid id this method just returns null.


checkXmlText

java.lang.String checkXmlText(java.lang.Object xmlString)


 

Groovy Documentation