@Override public Element getJDOMConfigElement() { Element configElement = null; try { if (this.isEmpty()) { return null; } configElement = new Element(VALIDATIONS_ELEMENT_NAME); this.fillJDOMConfigElement(configElement); } catch (Throwable t) { _logger.error("Error detected while creating jdom element", t); throw new RuntimeException("Error detected while creating jdom element", t); } return configElement; }
@Override public Element getJDOMConfigElement() { Element configElement = null; try { if (this.isEmpty()) { return null; } configElement = new Element(VALIDATIONS_ELEMENT_NAME); this.fillJDOMConfigElement(configElement); } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "getJDOMConfigElement"); throw new RuntimeException("Error detected while creating jdom element", t); } return configElement; }
@Override public boolean isEmpty() { return (super.isEmpty() && (null == this.getRangeStart()) && (null == this.getRangeEnd()) && (null == this.getValue()) && (null == this.getRangeStartAttribute() || this.getRangeStartAttribute().trim().length() == 0) && (null == this.getRangeEndAttribute() || this.getRangeEndAttribute().trim().length() == 0) && (null == this.getValueAttribute() || this.getValueAttribute().trim().length() == 0) ); }
@Override public boolean isEmpty() { return (super.isEmpty() && (null == this.getRangeStart()) && (null == this.getRangeEnd()) && (null == this.getValue()) && (null == this.getRangeStartAttribute() || this.getRangeStartAttribute().trim().length() == 0) && (null == this.getRangeEndAttribute() || this.getRangeEndAttribute().trim().length() == 0) && (null == this.getValueAttribute() || this.getValueAttribute().trim().length() == 0) ); }
@Override public List<AttributeFieldError> validate(AttributeInterface attribute, AttributeTracer tracer, ILangManager langManager) { List<AttributeFieldError> errors = new ArrayList<>(); if (this.isEmpty()) { return errors; } try { if (this.isRequired() && attribute.getStatus().equals(AttributeInterface.Status.EMPTY)) { AttributeTracer tracerClone = tracer.clone(); tracerClone.setLang(langManager.getDefaultLang()); errors.add(new AttributeFieldError(attribute, FieldError.MANDATORY, tracerClone)); } OgnlValidationRule ognlValidationRule = this.getOgnlValidationRule(); if (null != ognlValidationRule) { AttributeFieldError error = ognlValidationRule.validate(attribute, tracer, langManager); if (null != error) { errors.add(error); } } } catch (Throwable t) { _logger.error("Error validating Attribute '{}'", attribute.getName(), t); throw new RuntimeException("Error validating Attribute '" + attribute.getName() + "'", t); } return errors; }
@Override public List<AttributeFieldError> validate(AttributeInterface attribute, AttributeTracer tracer, ILangManager langManager) { List<AttributeFieldError> errors = new ArrayList<AttributeFieldError>(); if (this.isEmpty()) { return errors; } try { if (this.isRequired() && attribute.getStatus().equals(AttributeInterface.Status.EMPTY)) { AttributeTracer tracerClone = tracer.clone(); tracerClone.setLang(langManager.getDefaultLang()); errors.add(new AttributeFieldError(attribute, FieldError.MANDATORY, tracerClone)); } OgnlValidationRule ognlValidationRule = this.getOgnlValidationRule(); if (null != ognlValidationRule) { AttributeFieldError error = ognlValidationRule.validate(attribute, tracer, langManager); if (null != error) { errors.add(error); } } } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "validate", "Error validating Attribute '" + attribute.getName() + "'"); throw new RuntimeException("Error validating Attribute '" + attribute.getName() + "'", t); } return errors; }