class Stanford::StorageObjectValidator

druids are Stanford specific entities

Constants

DRUID_MISMATCH

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

Public Class Methods

error_code_to_messages() click to toggle source

the Stanford validator expects keys to be in ascending numerical order

# File lib/stanford/storage_object_validator.rb, line 22
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

Public Instance Methods

identify_druid() click to toggle source
# File lib/stanford/storage_object_validator.rb, line 17
def identify_druid
  druid_from_filepath == object_id_from_manifest_inventory ? [] : [result_hash(DRUID_MISMATCH)]
end
validation_errors(allow_content_subdirs = true) click to toggle source
# File lib/stanford/storage_object_validator.rb, line 10
def validation_errors(allow_content_subdirs = true)
  errors = []
  errors.concat super(allow_content_subdirs)
  errors.concat(identify_druid) if errors.empty?
  errors
end

Private Instance Methods

druid_from_filepath() click to toggle source
# File lib/stanford/storage_object_validator.rb, line 31
def druid_from_filepath
  "druid:#{File.basename(storage_obj_path)}"
end