From: Roland Haeder Date: Thu, 15 Oct 2015 09:32:59 +0000 (+0200) Subject: No caching in a validator, else it cannot be updated X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8a1c327e1fa36a632b449dbd7cbba00878495d1f;p=addressbook-lib.git No caching in a validator, else it cannot be updated Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/addressbook/validator/user/UserIdValidator.java b/src/org/mxchange/addressbook/validator/user/UserIdValidator.java index ae99430..e8836f6 100644 --- a/src/org/mxchange/addressbook/validator/user/UserIdValidator.java +++ b/src/org/mxchange/addressbook/validator/user/UserIdValidator.java @@ -57,10 +57,16 @@ public class UserIdValidator extends BaseLongValidator implements Validator { // Pre-validation (example: not null, not a string, empty string ...) super.preValidate(context, component, value, requiredFileds, false); + // Cast value + Long number = (Long) value; + + // Get status + Boolean ifUserExists = this.userBean.ifUserIdExists(number); + // Is the address book id valid? - if (!this.userBean.ifUserIdExists((Long) value)) { + if (!ifUserExists) { // Is not valid - throw new ValidatorException(new FacesMessage(MessageFormat.format("No user found with id {0}. Please check your link.", value))); //NOI18N + throw new ValidatorException(new FacesMessage(MessageFormat.format("No user found with id {0}. Please check your link.", number))); //NOI18N } // Trace message