Read DATAVALIDATIONS record
767820
private function _readDataValidations()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer forward to next record
		$this->_pos += 4 + $length;
	}
33166
function cacheValid () {
    // false if cache result is null
    if (this.cached === null) {
        debug('view:select:collection:cacheValid:false:null', this.selectCacheKey)
        return false
    }
    // false if n does not match
    if (this.cached.n !== this.initialMaxRecordNumber) {
        debug('view:select:collection:cacheValid:false:maxRecordNumber', this.selectCacheKey)
        return false
    }
    // cache is valid
    debug('view:select:collection:cacheValid:true', this.selectCacheKey)
    return true
}
226141
function validateSetData (module, newData) {
    // require valid data
    if (typeof newData !== 'object' || newData === null) {
        throw new Error(`invalid data for ${module.meta.name}`)
    }
    // get data id
    var dataId = stableId(newData)
    // if data has not changed do not set
    if (dataId === module.meta.dataId) {
        return
    }
    // freeze data
    if (module.meta.options.freezeData) {
        deepFreeze(newData)
    }
    // set data id
    module.meta.dataId = dataId
    // log data set
    if (defined(module.meta.options.logClient)) {
        module.meta.options.logClient.log('setData', {
            data: newData,
            dataCreateTime: microTimestamp(),
            dataId: dataId,
            instanceId: instanceId.id,
            moduleName: module.meta.name,
        })
    }
    // return validated data
    return newData
}
1193630
private function readLabelSst()
    {
        $length = self::getInt2d($this->data, $this->pos + 2);
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);

        // move stream pointer to next record
        $this->pos += 4 + $length;

        // offset: 0; size: 2; index to row
        $row = self::getInt2d($recordData, 0);

        // offset: 2; size: 2; index to column
        $column = self::getInt2d($recordData, 2);
        $columnString = PHPExcel_Cell::stringFromColumnIndex($column);

        // Read cell?
        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
            // offset: 4; size: 2; index to XF record
            $xfIndex = self::getInt2d($recordData, 4);

            // offset: 6; size: 4; index to SST record
            $index = self::getInt4d($recordData, 6);

            // add cell
            if (($fmtRuns = $this->sst[$index]['fmtRuns']) && !$this->readDataOnly) {
                // then we should treat as rich text
                $richText = new PHPExcel_RichText();
                $charPos = 0;
                $sstCount = count($this->sst[$index]['fmtRuns']);
                for ($i = 0; $i <= $sstCount; ++$i) {
                    if (isset($fmtRuns[$i])) {
                        $text = PHPExcel_Shared_String::Substring($this->sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos);
                        $charPos = $fmtRuns[$i]['charPos'];
                    } else {
                        $text = PHPExcel_Shared_String::Substring($this->sst[$index]['value'], $charPos, PHPExcel_Shared_String::CountCharacters($this->sst[$index]['value']));
                    }

                    if (PHPExcel_Shared_String::CountCharacters($text) > 0) {
                        if ($i == 0) { // first text run, no style
                            $richText->createText($text);
                        } else {
                            $textRun = $richText->createTextRun($text);
                            if (isset($fmtRuns[$i - 1])) {
                                if ($fmtRuns[$i - 1]['fontIndex'] < 4) {
                                    $fontIndex = $fmtRuns[$i - 1]['fontIndex'];
                                } else {
                                    // this has to do with that index 4 is omitted in all BIFF versions for some strange reason
                                    // check the OpenOffice documentation of the FONT record
                                    $fontIndex = $fmtRuns[$i - 1]['fontIndex'] - 1;
                                }
                                $textRun->setFont(clone $this->objFonts[$fontIndex]);
                            }
                        }
                    }
                }
                $cell = $this->phpSheet->getCell($columnString . ($row + 1));
                $cell->setValueExplicit($richText, PHPExcel_Cell_DataType::TYPE_STRING);
            } else {
                $cell = $this->phpSheet->getCell($columnString . ($row + 1));
                $cell->setValueExplicit($this->sst[$index]['value'], PHPExcel_Cell_DataType::TYPE_STRING);
            }

            if (!$this->readDataOnly) {
                // add style information
                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
            }
        }
    }
30574
protected void storeValidation(Validation v, XMLStreamWriter writer) throws Exception
   {
      writer.writeStartElement(XML.ELEMENT_VALIDATION);

      if (v.getValidConnectionChecker() != null)
      {
         storeExtension(v.getValidConnectionChecker(), writer, XML.ELEMENT_VALID_CONNECTION_CHECKER);
      }

      if (v.getCheckValidConnectionSql() != null)
      {
         writer.writeStartElement(XML.ELEMENT_CHECK_VALID_CONNECTION_SQL);
         writer.writeCharacters(v.getValue(XML.ELEMENT_CHECK_VALID_CONNECTION_SQL, v.getCheckValidConnectionSql()));
         writer.writeEndElement();
      }

      if (v.isValidateOnMatch() != null)
      {
         writer.writeStartElement(XML.ELEMENT_VALIDATE_ON_MATCH);
         writer.writeCharacters(v.getValue(XML.ELEMENT_VALIDATE_ON_MATCH, v.isValidateOnMatch().toString()));
         writer.writeEndElement();
      }

      if (v.isBackgroundValidation() != null)
      {
         writer.writeStartElement(XML.ELEMENT_BACKGROUND_VALIDATION);
         writer.writeCharacters(v.getValue(XML.ELEMENT_BACKGROUND_VALIDATION, v.isBackgroundValidation().toString()));
         writer.writeEndElement();
      }

      if (v.getBackgroundValidationMillis() != null)
      {
         writer.writeStartElement(XML.ELEMENT_BACKGROUND_VALIDATION_MILLIS);
         writer.writeCharacters(v.getValue(XML.ELEMENT_BACKGROUND_VALIDATION_MILLIS,
                                           v.getBackgroundValidationMillis().toString()));
         writer.writeEndElement();
      }

      if (v.isUseFastFail() != null)
      {
         writer.writeStartElement(XML.ELEMENT_USE_FAST_FAIL);
         writer.writeCharacters(v.getValue(XML.ELEMENT_USE_FAST_FAIL, v.isUseFastFail().toString()));
         writer.writeEndElement();
      }

      if (v.getStaleConnectionChecker() != null)
      {
         storeExtension(v.getStaleConnectionChecker(), writer, XML.ELEMENT_STALE_CONNECTION_CHECKER);
      }

      if (v.getExceptionSorter() != null)
      {
         storeExtension(v.getExceptionSorter(), writer, XML.ELEMENT_EXCEPTION_SORTER);
      }

      writer.writeEndElement();
   }
164888
private AbstractType<?> getValidatorForValue(CfDef cfDef, byte[] columnNameInBytes)
    {
        String defaultValidator = cfDef.default_validation_class;

        for (ColumnDef columnDefinition : cfDef.getColumn_metadata())
        {
            byte[] nameInBytes = columnDefinition.getName();

            if (Arrays.equals(nameInBytes, columnNameInBytes))
            {
                return getFormatType(columnDefinition.getValidation_class());
            }
        }

        if (defaultValidator != null && !defaultValidator.isEmpty())
        {
            return getFormatType(defaultValidator);
        }

        return null;
    }
1324499
function( e ) {
      var self = this, // stored this
          invalidFields = [];
      // Make invalidFields accessible
      this.getInvalidFields = function(){
        return invalidFields;
      }
      for ( var i = 0, _lengthFields = FIELDS.length; i < _lengthFields; i++ ) {
        // if field is disabled, do not check
        if ( FIELDS[ i ].disabled ) continue;
        var el = FIELDS[ i ], //current field
          errors = '', //current field's errors
          val = trim ( $( el ).val() ), //current field's value
          methods = el.getAttribute('data-validetta').split(','), //current field's control methods
          state; // Validation state
        // Create tmp
        this.tmp = {};
        // store el and val variables in tmp
        this.tmp = { el : el, val : val, parent : this.parents( el ) };
        // Start to check fields
        // Validator : Fields Control Object
        for ( var j = 0, _lengthMethods = methods.length; j < _lengthMethods; j++ ) {
          // Check Rule
          var rule = methods[ j ].match( RRULE ),
            method;
          // Does it have rule?
          if( rule !== null ) {
            // Does it have any argument ?
            if( typeof rule[2] !== 'undefined' ) this.tmp.arg = rule[2];
            // Set method name
            method = rule[1];
          } else { method = methods[ j ]; }
          // prevent empty validation if method is not required
          if ( val === '' && method !== 'required' && method !== 'equalTo' ) continue;
          // Is there a methot in Validator ?
          if( Validator.hasOwnProperty( method ) ) {
            // Validator returns error message if method invalid
            state = Validator[ method ]( self.tmp, self );
            if ( typeof state !== 'undefined' && state !== true ) {
              var _dataMsg = el.getAttribute( 'data-vd-message-' + method );
              if ( _dataMsg !== null ) state = _dataMsg;
              errors += state +'<br/>';
            }
          }
        }
        // Check the errors
        if( errors !== '' ) {
          invalidFields.push({
            field: el,
            errors: errors
          });
          // if parent element has valid class, remove and add error class
          this.addErrorClass( this.tmp.parent );
          // open error window
          this.window.open.call( this , el, errors );
        // Check remote validation
        } else if ( typeof this.tmp.remote !== 'undefined' ) {
          this.checkRemote( el, e );
        } else { // Nice, there are no error
          if( typeof state !== 'undefined' ) this.addValidClass( this.tmp.parent );
          else $( this.tmp.parent ).removeClass( this.options.errorClass +' '+ this.options.validClass );
          state = undefined; // Reset state variable
        }
      }
    }
587127
protected static int parseIntParameter (String value, String invalidDataMessage)
        throws DataValidationException
    {
        try {
            return Integer.parseInt(value);
        } catch (NumberFormatException nfe) {
            throw new DataValidationException(invalidDataMessage);
        }
    }
241896
def data_validation(self, in_nc):
        """"""
        data_nc = Dataset(in_nc)

        dims = list(data_nc.dimensions)

        if dims not in self.dims_oi:
            data_nc.close()
            raise Exception("{0} {1}".format(self.error_messages[1], dims))

        nc_vars = list(data_nc.variables)

        if nc_vars == self.vars_oi[0]:
            self.runoff_vars = [self.vars_oi[0][-1]]
        elif nc_vars == self.vars_oi[1]:
            self.runoff_vars = [self.vars_oi[1][-1]]
        else:
            data_nc.close()
            raise Exception("{0} {1}".format(self.error_messages[2], nc_vars))
        data_nc.close()
1305371
@GetMapping("/setting/param/from/url")
    public List<ValidationData> getValidationDataLists(HttpServletRequest req) {
        this.validationSessionComponent.sessionCheck(req);
        ValidationData data = ParameterMapper.requestParamaterToObject(req, ValidationData.class, "UTF-8");
        return this.msgSettingService.getValidationData(data.getParamType(), data.getMethod(), data.getUrl());
    }
1239115
def validate(record, field_name, bindings = {})
      if validations
        validations.collect do |validation|
          unless valid_value?(validation, record, field_name, bindings)
            FieldValidationError.new(validation, record, field_name, pos, width)
          end
        end.compact
      elsif record && record[field_name]
        # when no validation rules exist for the field, just check if the field exists in the record
        []
      else
        raise "found field value nil in #{record} field #{field_name}, shouldn't be possible?"
      end
    end
994654
def _validated(self, data):
        """"""
        for sub in self.schemas:
            data = sub(data)
        return data
1368461
public static Datasubtype isValid(Datatype datatype, Set<Datasubtype> datasubtypes, String code) {
        Map<Datasubtype, ValiditySet> subtable = ValidityData.data.get(datatype);
        if (subtable != null) {
            for (Datasubtype datasubtype : datasubtypes) {
                ValiditySet validitySet = subtable.get(datasubtype);
                if (validitySet != null) {
                    if (validitySet.contains(AsciiUtil.toLowerString(code))) {
                        return datasubtype;
                    }
                }
            }
        }
        return null;
    }
754959
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
   {
      in.defaultReadObject();
      validatorFactory = BeanValidationImpl.createValidatorFactory();
   }
801399
@Override
    public String validate(DTDValidatorBase v, char[] cbuf, int start, int end, boolean normalize)
        throws XMLStreamException
    {
        while (start < end && WstxInputData.isSpaceChar(cbuf[start])) {
            ++start;
        }

        // Empty value?
        if (start >= end) {
            return reportValidationProblem(v, "Empty ENTITY value");
        }
        --end; // so that it now points to the last char
        while (end > start  && WstxInputData.isSpaceChar(cbuf[end])) {
            --end;
        }

        // Ok, need to check char validity, and also calc hash code:
        char c = cbuf[start];
        if (!WstxInputData.isNameStartChar(c, mCfgNsAware, mCfgXml11) && c != ':') {
            return reportInvalidChar(v, c, "not valid as the first ID character");
        }
        for (int i = start+1; i <= end; ++i) {
            c = cbuf[i];
            if (!WstxInputData.isNameChar(c, mCfgNsAware, mCfgXml11)) {
                return reportInvalidChar(v, c, "not valid as an ID character");
            }
        }

        EntityDecl ent = findEntityDecl(v, cbuf, start, (end - start + 1));
        // only returns if it succeeded...

        return normalize ? ent.getName() : null;
    }
593431
def validate(self, data):
        """"""
        validated = self._validated(data)
        errors = []
        for validator in self.additional_validators:
            if not validator(validated):
                errors.append(
                    "%s invalidated by '%s'" % (
                        validated, _get_repr(validator)))
        if errors:
            raise NotValid(*errors)

        if self.default is UNSPECIFIED:
            return validated

        if self.null_values is not UNSPECIFIED\
                and validated in self.null_values:
            return self.default

        if validated is None:
            return self.default

        return validated
1305934
Object getValue(String str, ValidationContext vc) throws DatatypeException {
    boolean negative = false;
    int year = 2000; // any leap year will do
    int month = 1;
    int day = 1;
    int hours = 0;
    int minutes = 0;
    int seconds = 0;
    int milliseconds = 0;
    int pos = 0;
    int len = str.length();
    for (int templateIndex = 0, templateLength = template.length();
         templateIndex < templateLength;
         templateIndex++) {
      char templateChar = template.charAt(templateIndex);
      switch (templateChar) {
      case 'Y':
        negative = str.charAt(pos) == '-';
        int yearStartIndex = negative ? pos + 1 : pos;
        pos = skipDigits(str, yearStartIndex);
        try {
          year = Integer.parseInt(str.substring(yearStartIndex, pos));
        }
        catch (NumberFormatException e) {
          throw createLexicallyInvalidException();
        }
        break;
      case 'M':
        month = parse2Digits(str, pos);
        pos += 2;
        break;
      case 'D':
        day = parse2Digits(str, pos);
        pos += 2;
        break;
      case 't':
        hours = parse2Digits(str, pos);
        pos += 3;
        minutes = parse2Digits(str, pos);
        pos += 3;
        seconds = parse2Digits(str, pos);
        pos += 2;
        if (pos < len && str.charAt(pos) == '.') {
          int end = skipDigits(str, ++pos);
          for (int j = 0; j < 3; j++) {
            milliseconds *= 10;
            if (pos < end)
              milliseconds += str.charAt(pos++) - '0';
          }
          pos = end;
        }
        break;
      default:
        pos++;
        break;
      }
    }
    boolean hasTimeZone = pos < len;
    int tzOffset;
    if (hasTimeZone && str.charAt(pos) != 'Z')
      tzOffset = parseTimeZone(str, pos);
    else
      tzOffset = 0;
    int leapMilliseconds;
    if (seconds == 60) {
      leapMilliseconds = milliseconds + 1;
      milliseconds = 999;
      seconds = 59;
    }
    else
      leapMilliseconds = 0;
    try {
      GregorianCalendar cal = CalendarFactory.getCalendar();
      Date date;
      if (cal == CalendarFactory.cal) {
        synchronized (cal) {
          date = createDate(cal, tzOffset, negative, year, month, day, hours, minutes, seconds, milliseconds);
        }
      }
      else
        date = createDate(cal, tzOffset, negative, year, month, day, hours, minutes, seconds, milliseconds);
      return new DateTime(date, leapMilliseconds, hasTimeZone);
    }
    catch (IllegalArgumentException e) {
      throw createLexicallyInvalidException();
    }
  }