Class: Stanford::StorageObjectValidator

Inherits:
Moab::StorageObjectValidator show all
Defined in:
lib/stanford/storage_object_validator.rb

Overview

druids are Stanford specific entities

Constant Summary collapse

DRUID_MISMATCH =

TODO: test to make sure constants don’t collide on underlying int vals? keep from stepping on previously defined error code constants.

superclass.error_code_to_messages.keys.max + 1

Constants inherited from Moab::StorageObjectValidator

Moab::StorageObjectValidator::BAD_SUB_DIR_IN_CONTENT_DIR, Moab::StorageObjectValidator::CONTENT_DIR, Moab::StorageObjectValidator::CONTENT_SUB_DIRS_DETECTED, Moab::StorageObjectValidator::DATA_DIR, Moab::StorageObjectValidator::EXPECTED_DATA_SUB_DIRS, Moab::StorageObjectValidator::EXPECTED_VERSION_SUB_DIRS, Moab::StorageObjectValidator::EXTRA_CHILD_DETECTED, Moab::StorageObjectValidator::FILES_IN_VERSION_DIR, Moab::StorageObjectValidator::FORBIDDEN_CONTENT_SUB_DIRS, Moab::StorageObjectValidator::IMPLICIT_DIRS, Moab::StorageObjectValidator::INCORRECT_DIR_CONTENTS, Moab::StorageObjectValidator::MANIFESTS_DIR, Moab::StorageObjectValidator::MANIFEST_INVENTORY_PATH, Moab::StorageObjectValidator::METADATA_DIR, Moab::StorageObjectValidator::METADATA_SUB_DIRS_DETECTED, Moab::StorageObjectValidator::MISSING_DIR, Moab::StorageObjectValidator::NO_FILES_IN_CONTENT_DIR, Moab::StorageObjectValidator::NO_FILES_IN_MANIFEST_DIR, Moab::StorageObjectValidator::NO_FILES_IN_METADATA_DIR, Moab::StorageObjectValidator::NO_MANIFEST_INVENTORY, Moab::StorageObjectValidator::NO_SIGNATURE_CATALOG, Moab::StorageObjectValidator::SIGNATURE_CATALOG_PATH, Moab::StorageObjectValidator::VERSIONS_NOT_IN_ORDER, Moab::StorageObjectValidator::VERSION_DIR_BAD_FORMAT

Instance Attribute Summary

Attributes inherited from Moab::StorageObjectValidator

#storage_obj_path

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Moab::StorageObjectValidator

#initialize

Constructor Details

This class inherits a constructor from Moab::StorageObjectValidator

Class Method Details

.error_code_to_messagesObject

the Stanford validator expects keys to be in ascending numerical order



20
21
22
23
24
25
# File 'lib/stanford/storage_object_validator.rb', line 20

def self.error_code_to_messages
  @error_code_to_messages ||=
    {
      DRUID_MISMATCH => 'manifestInventory object_id does not match druid'
    }.merge!(superclass.error_code_to_messages).freeze
end

Instance Method Details

#identify_druidObject



15
16
17
# File 'lib/stanford/storage_object_validator.rb', line 15

def identify_druid
  druid_from_filepath == object_id_from_manifest_inventory ? [] : [result_hash(DRUID_MISMATCH)]
end

#validation_errors(allow_content_subdirs = true) ⇒ Object



8
9
10
11
12
13
# File 'lib/stanford/storage_object_validator.rb', line 8

def validation_errors(allow_content_subdirs = true)
  errors = []
  errors.concat super(allow_content_subdirs)
  errors.concat(identify_druid) if errors.empty?
  errors
end