|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sptci.echo2.binding.ViewValidator<V>
com.sptci.echo2.binding.JDOViewValidator<V,M>
V - The class name of the view that is to be validated.M - The class name of the model object that backs the view. This
parameter is used only if using the constructor that takes two
parameters.public class JDOViewValidator<V,M>
A validator for view components that represent objects persisted using JDO. This validator attempts to perform standard validation on fields in the model object that have been annotated as unique. Runs a query to determine existence of an object and reports an appropriate error message.
© Copyright 2008 Sans Pareil Technologies, Inc.
| Field Summary | |
|---|---|
protected M |
model
The model object backing the ViewValidator.view. |
| Fields inherited from class com.sptci.echo2.binding.ViewValidator |
|---|
fields, view |
| Constructor Summary | |
|---|---|
JDOViewValidator(V view)
Create a new instance of the validator for the specified view. |
|
JDOViewValidator(V view,
M model)
Create a new instance of the validator for the specified view and backing model. |
|
| Method Summary | |
|---|---|
protected boolean |
checkUnique(Collection<Field> viewFields)
Check that the combination of the values represented by the specified fields in the ViewValidator.view do not represent an existing model
object in the data store. |
protected Collection<Field> |
fetchViewFields(javax.jdo.annotations.Unique unique)
Process the unqiue annotation specified at the class level in model or its super-class. |
protected Object |
getValue(Field field)
Return the value of the specified Field in
ViewValidator.view. |
protected void |
processUnique(Collection<String> messages)
Process unique constraint annotations in model and perform
validation on the corresponding data in ViewValidator.view. |
Collection<String> |
validate()
Perform the validation on the child components. |
| Methods inherited from class com.sptci.echo2.binding.ViewValidator |
|---|
checkConfirm, checkText, processListComponent, processRegex, processTextComponent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final M model
ViewValidator.view.
| Constructor Detail |
|---|
public JDOViewValidator(V view)
throws BindingException
getModel method that
returns the model object.
view - The view that is to be validated.
BindingException - If errors are encountered while executing the
getModel method.
public JDOViewValidator(V view,
M model)
view - The view that is to be validated.model - The model object backing the view.| Method Detail |
|---|
public Collection<String> validate()
validate in class ViewValidator<V>ViewValidator.validate()protected void processUnique(Collection<String> messages)
model and perform
validation on the corresponding data in ViewValidator.view.
messages - The collection to which appropriate error messages
are to be added.fetchViewFields(javax.jdo.annotations.Unique),
checkUnique(java.util.Collection) protected Collection<Field> fetchViewFields(javax.jdo.annotations.Unique unique)
model or its super-class. This method may be called
recursively to process all annotations in the class hierarchy.
unique - The annotation that is to be processed.
protected boolean checkUnique(Collection<Field> viewFields)
ViewValidator.view do not represent an existing model
object in the data store.
viewFields - The fields corresponding to the fields in the
model whose values are to be checked.
true if the values in the ViewValidator.view
represents a unique combination that may be persisted to the data
store.protected Object getValue(Field field)
Field in
ViewValidator.view.
field - The field whose value is to be retrieved.
ViewValidator.view.
|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||