]> git.mxchange.org Git - addressbook-lib.git/commitdiff
No caching in a validator, else it cannot be updated
authorRoland Haeder <roland@mxchange.org>
Thu, 15 Oct 2015 09:32:59 +0000 (11:32 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 15 Oct 2015 09:32:59 +0000 (11:32 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/addressbook/validator/user/UserIdValidator.java

index ae994302604d57e70f4e3043151f1e74d9996be9..e8836f6d1aae858dda257bf9e80b49ae102b6ea6 100644 (file)
@@ -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