project35.soa.validation
Class AbstractEditFieldValidationService

java.lang.Object
  extended by project35.soa.validation.AbstractEditFieldValidationService
All Implemented Interfaces:
java.io.Serializable, ServiceClass, EditFieldValidationService, FieldValidationService
Direct Known Subclasses:
BooleanValidator, Choose1FromNValidator, DateTimeValidator, DateValidator, NumericValidator, RequiredFieldValidator, StringMaskValidator, StringValidator, URLValidator

public abstract class AbstractEditFieldValidationService
extends java.lang.Object
implements EditFieldValidationService, java.io.Serializable

Has routines for validating required fields.


Copyright (c) 2008 Kevin Garwood for Project35. The original code was developed by Kevin Garwood for the University of Manchester. Revisions have been made for Project35, a project that is independent of that institution. This code is licensed under the Academic Free License version 3.0. The code attribution for the original code is included here:

Copyright (c) Kevin Garwood and University of Manchester 2007. All rights reserved. Licensed under the Academic Free License version 3.0. For more information on the terms and conditions, please see the file "LICENSE" that is included in this distribution.


Version:
1.0
Author:
Kevin Garwood (kgarwood@users.sourceforge.net)
See Also:
Serialized Form

Field Summary
protected  java.text.Collator collator
           
 
Constructor Summary
AbstractEditFieldValidationService()
           
 
Method Summary
protected  java.lang.String getFieldName()
          returns the name of the field
 Parameter[] getInitialisationParameters()
           
 void initialiseService(java.net.URL resourceDirectory, Parameter[] initialisationParameters)
           
 boolean isEmpty(java.lang.String value)
          checks to see if value is an empty string
protected  boolean isFieldRequired()
          returns whether the data field is required return true if field is required; otherwise false
 void setFieldName(java.lang.String fieldName)
          sets the field name
 void setRequiredField(boolean isFieldRequired)
          sets whether the field is required or optional.
abstract  java.util.ArrayList validate(Project35FormContext project35FormContext, java.lang.String value)
          validates the field value and returns any error messages
protected  java.lang.String validateRequiredField(java.lang.String value)
          checks to make sure that a required field has a non-empty value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

collator

protected java.text.Collator collator
Constructor Detail

AbstractEditFieldValidationService

public AbstractEditFieldValidationService()
Method Detail

getFieldName

protected java.lang.String getFieldName()
returns the name of the field

Returns:
the field name

isEmpty

public boolean isEmpty(java.lang.String value)
checks to see if value is an empty string

Parameters:
value - the value
Returns:
true if the value is an empty string; otherwise false

isFieldRequired

protected boolean isFieldRequired()
returns whether the data field is required return true if field is required; otherwise false


setFieldName

public void setFieldName(java.lang.String fieldName)
sets the field name

Specified by:
setFieldName in interface FieldValidationService
Parameters:
fieldName - the field name

setRequiredField

public void setRequiredField(boolean isFieldRequired)
sets whether the field is required or optional.

Specified by:
setRequiredField in interface FieldValidationService
Parameters:
isFieldRequired - true if the field is required; false if field is optional.

validateRequiredField

protected java.lang.String validateRequiredField(java.lang.String value)
checks to make sure that a required field has a non-empty value

Parameters:
value - the value of the field
Returns:
an error message or null if there is no error

validate

public abstract java.util.ArrayList validate(Project35FormContext project35FormContext,
                                             java.lang.String value)
Description copied from interface: EditFieldValidationService
validates the field value and returns any error messages

Specified by:
validate in interface EditFieldValidationService
value - the value of the field
Returns:
a collection of Alert instances that represent errors,warnings,points of information or requests for more information if no errors were found

getInitialisationParameters

public Parameter[] getInitialisationParameters()
Specified by:
getInitialisationParameters in interface ServiceClass

initialiseService

public void initialiseService(java.net.URL resourceDirectory,
                              Parameter[] initialisationParameters)
                       throws java.lang.Exception
Specified by:
initialiseService in interface ServiceClass
Throws:
java.lang.Exception