Hi,

in my current project I had to meet the two following requirements:

- Validation of indexed properties has to be done for all the beans in a
collection, even if one failes

- The validation result of an indexed property has to contain the index
also, e.g. masterbean.detailbean[1].property

These are the changes I've done and I would be happy about feedback from
the developers:

Field.java (validate()-Method)
------------------------------

// PATCH-START
// REASON:
// We want to validate all fields in the array, even if one failes
// ORIGINAL:
// if (!good) {

if (!good && (fieldNumber == numberOfFieldsToValidate-1)) {
    return allResults;
}

// PATCH-END



ValidatorAction.java (executeValidationMethod()-method)
--------------------------------------------------------

if (!valid || (valid && !onlyReturnErrors(params))) {
// PATCH-START
// REASON:
// If it's an indexed field, we put the indexed key
// into the error list, which means
// e.g. master.detail[0].prop instead of master.detail[].prop

if (field.isIndexed()) {
    Field indexedField = 
(Field)paramValues[this.methodParameterList.indexOf(Validator.FIELD_PARAM)];
    results.add(indexedField, this.name, valid, result);
} else {
    results.add(field, this.name, valid, result);
}
// PATCH-END

}

Thanks in advance,
Dirk


________________________________________
http://www.epost.de - das Kommunikationsportal der Deutschen Post



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to