class Libis::Tools::MetsFile::File
Container class for creating a file in the METS.
Attributes
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
Public Instance Methods
This method creates the appropriate {DnxSection}s based on what attributes are filled in.
# File lib/libis/tools/mets_objects.rb, line 97 def amd dnx = {} tech_data = [] # General File charateristics data = { label: label, note: note, fileCreationDate: creation_date, fileModificationDate: modification_date, FileEntityType: entity_type, compositionLevel: composition_level, # fileLocationType: 'FILE', fileLocation: location, fileOriginalName: original || target_name, fileOriginalPath: target_path, # fileOriginalID: CGI.escape(location), # fileExtension: ::File.extname(orig_name), fileMIMEType: mimetype, fileSizeBytes: size, # formatLibraryId: puid }.cleanup tech_data << GeneralFileCharacteristics.new(data) unless data.empty? # Fixity %w'MD5 SHA1 SHA256 SHA384 SHA512'.each do |checksum_type| if (checksum = self.send("checksum_#{checksum_type}")) data = { fixityType: checksum_type, fixityValue: checksum, }.cleanup tech_data << FileFixity.new(data) unless data.empty? end end # Object characteristics data = { groupID: make_group_id }.cleanup tech_data << ObjectCharacteristics.new(data) unless data.empty? # Preservation level if preservation_levels data_list = [] preservation_levels.each do |preservation_level| data = { preservationLevelValue: preservation_level[:value], preservationLevelRole: preservation_level[:role], preservationLevelRationale: preservation_level[:rationale], preservationLevelDateAssigned: preservation_level[:date], }.cleanup data_list << OpenStruct.new(data) unless data.empty? end tech_data << PreservationLevel.new(array: data_list) unless data_list.empty? end # Inhibitor if inhibitors data_list = [] inhibitors.each do |inhibitor| data = { inhibitorType: inhibitor[:type], inhibitorTarget: inhibitor[:target], inhibitorKey: inhibitor[:key], }.cleanup data_list << OpenStruct.new(data) unless data.empty? end tech_data << Inhibitors.new(array: data_list) unless data_list.empty? end # Dependencies if env_dependencies data_list = [] env_dependencies.each do |dependency| data = { dependencyName: dependency[:name], dependencyIdentifierType1: dependency[:type1], dependencyIdentifierValue1: dependency[:value1], dependencyIdentifierType2: dependency[:type2], dependencyIdentifierValue2: dependency[:value2], dependencyIdentifierType3: dependency[:type3], dependencyIdentifierValue3: dependency[:value3], }.cleanup data_list << OpenStruct.new(data) unless data.empty? end tech_data << EnvironmentDependencies.new(array: data_list) unless data_list.empty? end # Hardware registry id if hardware_ids data_list = [] hardware_ids.each do |id| data = { registryId: id }.cleanup data_list << OpenStruct.new(data) unless data.empty? end tech_data << EnvHardwareRegistry.new(array: data_list) unless data_list.empty? end # Software registry id if software_ids data_list = [] software_ids.each do |id| data = { registryId: id }.cleanup data_list << OpenStruct.new(data) unless data.empty? end tech_data << EnvSoftwareRegistry.new(array: data_list) unless data_list.empty? end # Singatures if signatures data_list = [] signatures.each do |signature| data = { signatureInformationEncoding: signature[:encoding], signer: signature[:signer], signatureMethod: signature[:method], signatureValue: signature[:value], signatureValidationRules: signature[:rules], signatureProperties: signature[:properties], }.cleanup data_list << OpenStruct.new(data) unless data.empty? end tech_data << SignatureInformation.new(array: data_list) unless data_list.empty? end # Hardware if hardware_infos data_list = [] hardware_infos.each do |hardware| data = { hardwareName: hardware[:name], hardwareType: hardware[:type], hardwareOtherInformation: hardware[:info], }.cleanup data_list << OpenStruct.new(data) unless data.empty? end tech_data << EnvironmentHardware.new(array: data_list) unless data_list.empty? end # Software if software_infos data_list = [] software_infos.each do |software| data = { softwareName: software[:name], softwareVersion: software[:version], softwareType: software[:type], softwareOtherInformation: software[:info], softwareDependancy: software[:dependency], }.cleanup data_list << OpenStruct.new(data) unless data.empty? end tech_data << EnvironmentSoftware.new(array: data_list) unless data_list.empty? end # Relationship if relationship_infos data_list = [] relationship_infos.each do |relationship| data = { relationshipType: relationship[:type], relationshipSubType: relationship[:subtype], relatedObjectIdentifierType1: relationship[:type1], relatedObjectIdentifierValue1: relationship[:id1], relatedObjectSequence1: relationship[:seq1], relatedObjectIdentifierType2: relationship[:type2], relatedObjectIdentifierValue2: relationship[:id2], relatedObjectSequence2: relationship[:seq2], relatedObjectIdentifierType3: relationship[:type3], relatedObjectIdentifierValue3: relationship[:id3], relatedObjectSequence3: relationship[:seq3], }.cleanup data_list << OpenStruct.new(data) unless data.empty? end tech_data << RelationShip.new(array: data_list) unless data_list.empty? end # Environment if environments data_list = [] environments.each do |environment| data = { environmentCharacteristic: environment[:characteristic], environmentPurpose: environment[:purpose], environmentNote: environment[:note], }.cleanup data_list << OpenStruct.new(data) unless data.empty? end tech_data << Environment.new(array: data_list) unless data_list.empty? end # Application if applications data_list = [] applications.each do |application| data = { creatingApplicationName: application[:name], creatingApplicationVersion: application[:version], dateCreatedByApplication: application[:date], }.cleanup data_list << OpenStruct.new(data) unless data.empty? end tech_data << CreatingApplication.new(array: data_list) unless data_list.empty? end # Finally assemble technical section dnx[:tech] = tech_data unless tech_data.empty? dnx end
The id that will be used for the group in the XML file.
# File lib/libis/tools/mets_objects.rb, line 66 def make_group_id "grp#{group_id rescue @id}" end
The file’s name as it was originally.
# File lib/libis/tools/mets_objects.rb, line 71 def orig_name ::File.basename(location) end
The file’s original directory.
# File lib/libis/tools/mets_objects.rb, line 76 def orig_path ::File.dirname(location) end
The full path where the file is copied
# File lib/libis/tools/mets_objects.rb, line 81 def target if target_location.nil? return "#{xml_id}#{::File.extname(location)}" end target_location end
# File lib/libis/tools/mets_objects.rb, line 88 def target_name ::File.basename(target) end
# File lib/libis/tools/mets_objects.rb, line 92 def target_path ::File.dirname(target) end
The id that will be used in the XML file to reference this file.
# File lib/libis/tools/mets_objects.rb, line 61 def xml_id "fid#{@id}" end