protected void checkTextLengths(AttributeInterface attribute, AttributeTracer tracer, Lang lang, List<AttributeFieldError> errors) { Integer maxLength = this.getMaxLength(); Integer minLength = this.getMinLength(); if ((null != maxLength && maxLength > -1) || (null != minLength && minLength > -1)) { String text = this.getTextForCheckLength(attribute, lang); if (text != null && text.trim().length() > 0) { text = text.trim(); if ((null != maxLength && maxLength > -1) && text.length() > maxLength) { AttributeFieldError error = new AttributeFieldError(attribute, FieldError.INVALID_MAX_LENGTH, tracer); error.setMessage("Lang '" + lang.getDescr() + "' - length " + text.length() + " upper than " + maxLength); errors.add(error); } if ((null != minLength && minLength > -1) && text.length() < minLength) { AttributeFieldError error = new AttributeFieldError(attribute, FieldError.INVALID_MIN_LENGTH, tracer); error.setMessage("Lang '" + lang.getDescr() + "' - length " + text.length() + " lower than " + minLength); errors.add(error); } } } }
protected void checkTextLengths(AttributeInterface attribute, AttributeTracer tracer, Lang lang, List<AttributeFieldError> errors) { Integer maxLength = this.getMaxLength(); Integer minLength = this.getMinLength(); if ((null != maxLength && maxLength > -1) || (null != minLength && minLength > -1)) { String text = this.getTextForCheckLength(attribute, lang); if (text != null && text.trim().length() > 0) { text = text.trim(); if ((null != maxLength && maxLength > -1) && text.length() > maxLength) { AttributeFieldError error = new AttributeFieldError(attribute, FieldError.INVALID_MAX_LENGTH, tracer); error.setMessage("Lang '" + lang.getDescr() + "' - length " + text.length() + " upper than " + maxLength); errors.add(error); } if ((null != minLength && minLength > -1) && text.length() < minLength) { AttributeFieldError error = new AttributeFieldError(attribute, FieldError.INVALID_MIN_LENGTH, tracer); error.setMessage("Lang '" + lang.getDescr() + "' - length " + text.length() + " lower than " + minLength); errors.add(error); } } } }