@Override public String getRegexp() { return ((TextAttributeValidationRules) this.getValidationRules()).getRegexp(); }
@Override public String getRegexp() { return ((TextAttributeValidationRules) this.getValidationRules()).getRegexp(); }
protected void checkRegExp(AttributeInterface attribute, AttributeTracer tracer, Lang lang, List<AttributeFieldError> errors) { String text = ((ITextAttribute)attribute).getTextForLang(lang.getCode()); if (null != text && text.trim().length() > 0 && null != this.getRegexp() && this.getRegexp().trim().length() > 0) { Pattern pattern = Pattern.compile(this.getRegexp()); Matcher matcher = pattern.matcher(text); if (!matcher.matches()) { AttributeFieldError error = new AttributeFieldError(attribute, FieldError.INVALID_FORMAT, tracer); error.setMessage("Lang '" + lang.getDescr() + "' - invalid format"); errors.add(error); } } }
protected void checkRegExp(AttributeInterface attribute, AttributeTracer tracer, Lang lang, List<AttributeFieldError> errors) { String text = ((ITextAttribute)attribute).getTextForLang(lang.getCode()); if (null != text && text.trim().length() > 0 && null != this.getRegexp() && this.getRegexp().trim().length() > 0) { Pattern pattern = Pattern.compile(this.getRegexp()); Matcher matcher = pattern.matcher(text); if (!matcher.matches()) { AttributeFieldError error = new AttributeFieldError(attribute, FieldError.INVALID_FORMAT, tracer); error.setMessage("Lang '" + lang.getDescr() + "' - invalid format"); errors.add(error); } } }
@Override protected void fillJDOMConfigElement(Element configElement) { super.fillJDOMConfigElement(configElement); if (null != this.getMinLength() && this.getMinLength() > -1) { Element element = new Element("minlength"); element.setText(String.valueOf(this.getMinLength())); configElement.addContent(element); } if (null != this.getMaxLength() && this.getMaxLength() > -1) { Element element = new Element("maxlength"); element.setText(String.valueOf(this.getMaxLength())); configElement.addContent(element); } if (null != this.getRegexp() && this.getRegexp().trim().length() > 0) { Element regexpElem = new Element("regexp"); CDATA cdata = new CDATA(this.getRegexp()); regexpElem.addContent(cdata); configElement.addContent(regexpElem); } String toStringEqualValue = (this.getValue() != null) ? String.valueOf(this.getValue()) : null; this.insertJDOMConfigElement("value", this.getValueAttribute(), toStringEqualValue, configElement); String toStringStartValue = (this.getRangeStart() != null) ? String.valueOf(this.getRangeStart()) : null; this.insertJDOMConfigElement("rangestart", this.getRangeStartAttribute(), toStringStartValue, configElement); String toStringEndValue = (this.getRangeEnd() != null) ? String.valueOf(this.getRangeEnd()) : null; this.insertJDOMConfigElement("rangeend", this.getRangeEndAttribute(), toStringEndValue, configElement); }
@Override protected void fillJDOMConfigElement(Element configElement) { super.fillJDOMConfigElement(configElement); if (null != this.getMinLength() && this.getMinLength() > -1) { Element element = new Element("minlength"); element.setText(String.valueOf(this.getMinLength())); configElement.addContent(element); } if (null != this.getMaxLength() && this.getMaxLength() > -1) { Element element = new Element("maxlength"); element.setText(String.valueOf(this.getMaxLength())); configElement.addContent(element); } if (null != this.getRegexp() && this.getRegexp().trim().length() > 0) { Element regexpElem = new Element("regexp"); CDATA cdata = new CDATA(this.getRegexp()); regexpElem.addContent(cdata); configElement.addContent(regexpElem); } String toStringEqualValue = (this.getValue() != null) ? String.valueOf(this.getValue()) : null; this.insertJDOMConfigElement("value", this.getValueAttribute(), toStringEqualValue, configElement); String toStringStartValue = (this.getRangeStart() != null) ? String.valueOf(this.getRangeStart()) : null; this.insertJDOMConfigElement("rangestart", this.getRangeStartAttribute(), toStringStartValue, configElement); String toStringEndValue = (this.getRangeEnd() != null) ? String.valueOf(this.getRangeEnd()) : null; this.insertJDOMConfigElement("rangeend", this.getRangeEndAttribute(), toStringEndValue, configElement); }
@Override public IAttributeValidationRules clone() { TextAttributeValidationRules clone = (TextAttributeValidationRules) super.clone(); clone.setMaxLength(this.getMaxLength()); clone.setMinLength(this.getMinLength()); clone.setRegexp(this.getRegexp()); return clone; }
@Override public IAttributeValidationRules clone() { TextAttributeValidationRules clone = (TextAttributeValidationRules) super.clone(); clone.setMaxLength(this.getMaxLength()); clone.setMinLength(this.getMinLength()); clone.setRegexp(this.getRegexp()); return clone; }
this.setMinLength(textValRule.getMinLength()); this.setRegexp(textValRule.getRegexp()); this.setRangeEndString((String) textValRule.getRangeEnd()); this.setRangeStartString((String) textValRule.getRangeStart());
this.setMinLength(textValRule.getMinLength()); this.setRegexp(textValRule.getRegexp()); this.setRangeEndString((String) textValRule.getRangeEnd()); this.setRangeStartString((String) textValRule.getRangeStart());
this.setMinLength(textValRule.getMinLength()); this.setRegexp(textValRule.getRegexp()); this.setRangeEndString((String) textValRule.getRangeEnd()); this.setRangeStartString((String) textValRule.getRangeStart());
this.setMinLength(textValRule.getMinLength()); this.setRegex(textValRule.getRegexp()); this.setRangeEndString((String) textValRule.getRangeEnd()); this.setRangeStartString((String) textValRule.getRangeStart());