﻿//--------------------------------------------------------------------------------------------------
function xFormValidatorFilter() {
  this.ns = xFormValidatorFilter.getNS();
  this.enabled = true;
  this.run = 0;
}
/** filter interface */
xFormValidatorFilter.prototype.isEnabled = function() {
  return this.enabled;
}
xFormValidatorFilter.getNS = function() {
  return 'restriction';
}
xFormValidatorFilter.prototype.getName = function() {
  return 'formValidator';
}
xFormValidatorFilter.prototype.process = function(element, logBuffer) {
  this.run++;
  xFormValidatorFactory.setLogBuffer(logBuffer);
  var validator = xFormValidatorFactory.createValidator(element.getDataType());
  var restriction = new xFormElementRestriction(element);
  var result = validator.validate(restriction, element, this.run);
  xFormValidatorFactory.handleCallBack(restriction, element, result, this.run);
  return result;
}