src/snac/server/validation/ValidationEngine.php
/**
     * Validate a Constellation
     *
     * Validates the constellation passed in the parameter against the list of validators instantiated for this
     * validation engine.
     *
     * @param \snac\data\Constellation $constellation
     * @return boolean Successful validation: true on success, false on \Failure
     * @throws \snac\exceptions\SNACValidationException on serious validation errors
     */
Validate a Constellation
Validates the constellation passed in the parameter against the list of validators instantiated for this
validation engine.


Validate a Constellation Validates the constellation passed in the parameter against the list of validators instantiated for this validation engine .
public function validateConstellation($constellation) {
        if ($constellation == null || !($constellation instanceof \snac\data\Constellation))
            return false;
        foreach ($this->validators as $validator) {
            $validator->setConstellation($constellation);
            $validator->validateRoot($constellation);
            foreach ($constellation->getBiogHistList() as $biogHist) {
                $validator->validateBiogHist($biogHist);
            }
            foreach ($constellation->getConventionDeclarations() as $cd) {
                $validator->validateConventionDeclaration($cd);
            }
            foreach ($constellation->getDateList() as $date) {
                $validator->validateDate($date);
            }
            foreach ($constellation->getActivities() as $activity) {
                $validator->validateActivity($activity);
            }
            foreach ($constellation->getGenders() as $gender) {
                $validator->validateGender($gender);
            }
            foreach ($constellation->getGeneralContexts() as $gc) {
                $validator->validateGeneralContext($gc);
            }
            foreach ($constellation->getLanguagesUsed() as $languageUsed) {
                $validator->validateLanguage($languageUsed);
            }
            foreach ($constellation->getLegalStatuses() as $legalStatus) {
                $validator->validateLegalStatus($legalStatus);
            }
            foreach ($constellation->getMaintenanceEvents() as $maintenanceEvent) {
                $validator->validateMaintenanceEvent($maintenanceEvent);
            }
            foreach ($constellation->getMandates() as $mandate) {
                $validator->validateMandate($mandate);
            }
            foreach ($constellation->getNameEntries() as $nameEntry) {
                $validator->validateNameEntry($nameEntry);
            }
            foreach ($constellation->getNationalities() as $nationality) {
                $validator->validateNationality($nationality);
            }
            foreach ($constellation->getOccupations() as $occupation) {
                $validator->validateOccupation($occupation);
            }
            foreach ($constellation->getOtherRecordIDs() as $other) {
                $validator->validateOtherRecordID($other);
            }
            foreach ($constellation->getEntityIDs() as $other) {
                $validator->validateEntityID($other);
            }
            foreach ($constellation->getPlaces() as $place) {
                $validator->validatePlace($place);
            }
            foreach ($constellation->getRelations() as $relation) {
                $validator->validateRelation($relation);
            }
            foreach ($constellation->getResourceRelations() as $relation) {
                $validator->validateResourceRelation($relation);
            }
            foreach ($constellation->getSNACControlMetadata() as $scm) {
                $validator->validateSNACControlMetadata($scm);
            }
            foreach ($constellation->getSources() as $source) {
                $validator->validateSource($source);
            }
            foreach ($constellation->getStructureOrGenealogies() as $sog) {
                $validator->validateStructureOrGenealogy($sog);
            }
            foreach ($constellation->getSubjects() as $subject) {
                $validator->validateSubject($subject);
            }
            $validator->postValidation();
            if ($validator->errorOccurred()) {
                $this->errors[$validator->getName()] = $validator->getErrorArray();
            }
        }
        if (count($this->errors) < 1) {
            return true;
        } else {
            throw new \snac\exceptions\SNACValidationException(
                    json_encode($this->errors, JSON_PRETTY_PRINT));
            return false; 
        }
    }
public function validateConstellation ( $ constellation ) { if ( $ constellation == null || ! ( $ constellation instanceof \ snac \ data \ Constellation ) ) return false ; foreach ( $ this -> validators as $ validator ) { $ validator -> setConstellation ( $ constellation ) ; $ validator -> validateRoot ( $ constellation ) ; foreach ( $ constellation -> getBiogHistList ( ) as $ biogHist ) { $ validator -> validateBiogHist ( $ biogHist ) ; } foreach ( $ constellation -> getConventionDeclarations ( ) as $ cd ) { $ validator -> validateConventionDeclaration ( $ cd ) ; } foreach ( $ constellation -> getDateList ( ) as $ date ) { $ validator -> validateDate ( $ date ) ; } foreach ( $ constellation -> getActivities ( ) as $ activity ) { $ validator -> validateActivity ( $ activity ) ; } foreach ( $ constellation -> getGenders ( ) as $ gender ) { $ validator -> validateGender ( $ gender ) ; } foreach ( $ constellation -> getGeneralContexts ( ) as $ gc ) { $ validator -> validateGeneralContext ( $ gc ) ; } foreach ( $ constellation -> getLanguagesUsed ( ) as $ languageUsed ) { $ validator -> validateLanguage ( $ languageUsed ) ; } foreach ( $ constellation -> getLegalStatuses ( ) as $ legalStatus ) { $ validator -> validateLegalStatus ( $ legalStatus ) ; } foreach ( $ constellation -> getMaintenanceEvents ( ) as $ maintenanceEvent ) { $ validator -> validateMaintenanceEvent ( $ maintenanceEvent ) ; } foreach ( $ constellation -> getMandates ( ) as $ mandate ) { $ validator -> validateMandate ( $ mandate ) ; } foreach ( $ constellation -> getNameEntries ( ) as $ nameEntry ) { $ validator -> validateNameEntry ( $ nameEntry ) ; } foreach ( $ constellation -> getNationalities ( ) as $ nationality ) { $ validator -> validateNationality ( $ nationality ) ; } foreach ( $ constellation -> getOccupations ( ) as $ occupation ) { $ validator -> validateOccupation ( $ occupation ) ; } foreach ( $ constellation -> getOtherRecordIDs ( ) as $ other ) { $ validator -> validateOtherRecordID ( $ other ) ; } foreach ( $ constellation -> getEntityIDs ( ) as $ other ) { $ validator -> validateEntityID ( $ other ) ; } foreach ( $ constellation -> getPlaces ( ) as $ place ) { $ validator -> validatePlace ( $ place ) ; } foreach ( $ constellation -> getRelations ( ) as $ relation ) { $ validator -> validateRelation ( $ relation ) ; } foreach ( $ constellation -> getResourceRelations ( ) as $ relation ) { $ validator -> validateResourceRelation ( $ relation ) ; } foreach ( $ constellation -> getSNACControlMetadata ( ) as $ scm ) { $ validator -> validateSNACControlMetadata ( $ scm ) ; } foreach ( $ constellation -> getSources ( ) as $ source ) { $ validator -> validateSource ( $ source ) ; } foreach ( $ constellation -> getStructureOrGenealogies ( ) as $ sog ) { $ validator -> validateStructureOrGenealogy ( $ sog ) ; } foreach ( $ constellation -> getSubjects ( ) as $ subject ) { $ validator -> validateSubject ( $ subject ) ; } $ validator -> postValidation ( ) ; if ( $ validator -> errorOccurred ( ) ) { $ this -> errors [ $ validator -> getName ( ) ] = $ validator -> getErrorArray ( ) ; } } if ( count ( $ this -> errors ) < 1 ) { return true ; } else { throw new \ snac \ exceptions \ SNACValidationException ( json_encode ( $ this -> errors , JSON_PRETTY_PRINT ) ) ; return false ; } }
Validate a Constellation
 Validates the constellation passed in the parameter against the list of validators instantiated for this
 validation engine.
Validate a Constellation Validates the constellation passed in the parameter against the list of validators instantiated for this validation engine .
// For each validator, look over the constellation and validate it // Give the validator a chance to grab constellation-level data // Validate constellation root // Validate each piece of the constellation // Successful validation // just in case