Top Level Namespace

Defined Under Namespace

Modules: AgentsHelper, EnjuBiblio, ManifestationsHelper, OwnsHelper, PictureFilesHelper, SeriesStatementsHelper Classes: Agent, AgentImportFile, AgentImportFileJob, AgentImportFilePolicy, AgentImportFileStateMachine, AgentImportFileTransition, AgentImportFilesController, AgentImportMailer, AgentImportResult, AgentImportResultPolicy, AgentImportResultsController, AgentMerge, AgentMergeList, AgentMergeListPolicy, AgentMergeListsController, AgentMergePolicy, AgentMergesController, AgentPolicy, AgentRelationship, AgentRelationshipPolicy, AgentRelationshipType, AgentRelationshipTypePolicy, AgentRelationshipTypesController, AgentRelationshipsController, AgentType, AgentTypePolicy, AgentTypesController, AgentsController, CarrierType, CarrierTypePolicy, CarrierTypesController, ContentType, ContentTypePolicy, ContentTypesController, CountriesController, Country, CountryPolicy, Create, CreatePolicy, CreateType, CreateTypePolicy, CreateTypesController, CreatesController, DoiRecord, Donate, DonatePolicy, DonatesController, FormOfWork, FormOfWorkPolicy, FormOfWorksController, FrequenciesController, Frequency, FrequencyPolicy, Identifier, IdentifierType, IdentifierTypePolicy, IdentifierTypesController, ImportRequest, ImportRequestPolicy, ImportRequestStateMachine, ImportRequestTransition, ImportRequestsController, IsbnRecord, IsbnRecordAndManifestation, IssnRecord, IssnRecordAndManifestation, Item, ItemCustomPropertiesController, ItemCustomProperty, ItemCustomPropertyPolicy, ItemCustomValue, ItemPolicy, ItemsController, Language, LanguagePolicy, LanguagesController, License, LicensePolicy, LicensesController, Manifestation, ManifestationCustomPropertiesController, ManifestationCustomProperty, ManifestationCustomPropertyPolicy, ManifestationCustomValue, ManifestationPolicy, ManifestationRelationship, ManifestationRelationshipPolicy, ManifestationRelationshipType, ManifestationRelationshipTypePolicy, ManifestationRelationshipTypesController, ManifestationRelationshipsController, ManifestationsController, MediumOfPerformance, MediumOfPerformancePolicy, MediumOfPerformancesController, Openurl, OpenurlQuerySyntaxError, Own, OwnPolicy, OwnsController, Periodical, PeriodicalAndManifestation, PictureFile, PictureFilePolicy, PictureFilesController, Produce, ProducePolicy, ProduceType, ProduceTypePolicy, ProduceTypesController, ProducesController, Realize, RealizePolicy, RealizeType, RealizeTypePolicy, RealizeTypesController, RealizesController, ResourceExportFile, ResourceExportFileJob, ResourceExportFilePolicy, ResourceExportFileStateMachine, ResourceExportFileTransition, ResourceExportFilesController, ResourceExportMailer, ResourceImportFile, ResourceImportFileJob, ResourceImportFilePolicy, ResourceImportFileStateMachine, ResourceImportFileTransition, ResourceImportFilesController, ResourceImportMailer, ResourceImportResult, ResourceImportResultPolicy, ResourceImportResultsController, SeriesStatement, SeriesStatementMerge, SeriesStatementMergeList, SeriesStatementMergeListPolicy, SeriesStatementMergeListsController, SeriesStatementMergePolicy, SeriesStatementMergesController, SeriesStatementPolicy, SeriesStatementsController

Instance Method Summary collapse

Instance Method Details

#update_agent_typeObject



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/tasks/agent_type.rb', line 1

def update_agent_type
  agent_types = YAML.load(open('db/fixtures/enju_biblio/agent_types.yml').read)
  agent_types.each do |line|
    l = line[1].select!{|k, v| %w(name display_name note).include?(k)}

    case l["name"]
    when "person"
      agent_type = AgentType.where(name: 'Person').first
      agent_type.update!(l) if agent_type
    when "corporate_body"
      agent_type = AgentType.where(name: 'CorporateBody').first
      agent_type.update!(l) if agent_type
    end
  end
end

#update_carrier_typeObject



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/tasks/carrier_type.rb', line 1

def update_carrier_type
  CarrierType.find_each do |carrier_type|
    case carrier_type.name
    when "volume"
      carrier_type = CarrierType.find_by(name: 'volume')
      if carrier_type
        unless carrier_type.attachment_file_name
          carrier_type.attachment = File.open("#{File.dirname(__FILE__)}/../../app/assets/images/icons/book.png")
          carrier_type.save!
        end
      end
    when "audio_disc"
      carrier_type = CarrierType.find_by(name: 'audio_disc')
      if carrier_type
        unless carrier_type.attachment_file_name
          carrier_type.attachment = File.open("#{File.dirname(__FILE__)}/../../app/assets/images/icons/cd.png")
          carrier_type.save!
        end
      end
    when "videodisc"
      carrier_type = CarrierType.find_by(name: 'videodisc')
      if carrier_type
        unless carrier_type.attachment_file_name
          carrier_type.attachment = File.open("#{File.dirname(__FILE__)}/../../app/assets/images/icons/dvd.png")
          carrier_type.save!
        end
      end
    when "online_resource"
      carrier_type = CarrierType.find_by(name: 'online_resource')
      if carrier_type
        unless carrier_type.attachment_file_name
          carrier_type.attachment = File.open("#{File.dirname(__FILE__)}/../../app/assets/images/icons/monitor.png")
          carrier_type.save!
        end
      end
    end
  end
end

#update_content_typeObject



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/tasks/content_type.rb', line 1

def update_content_type
  content_types = YAML.load(open('db/fixtures/enju_biblio/content_types.yml').read)
  content_types.each do |line|
    l = line[1].select!{|k, v| %w(name display_name note).include?(k)}

    case l["name"]
    when "text"
    when "performed_music"
      content_type = ContentType.where(name: 'audio').first
      content_type.update!(l) if content_type
    when "two_dimensional_moving_image"
      content_type = ContentType.where(name: 'video').first
      content_type.update!(l) if content_type
    end

    content_type = ContentType.where(name: l["name"]).first
    ContentType.create!(l) unless content_type
  end
end

#update_identifier_typeObject



1
2
3
4
5
6
7
8
9
10
11
12
# File 'lib/tasks/identifier_type.rb', line 1

def update_identifier_type
  identifier_types = YAML.safe_load(open('db/fixtures/enju_biblio/identifier_types.yml').read)
  identifier_types.each do |line|
    l = line[1].select!{|k, v| %w(name display_name note).include?(k)}
    identifier_type = IdentifierType.where(name: l["name"]).first
    if identifier_type
      identifier_type.update!(l)
    else
      IdentifierType.create!(l)
    end
  end
end

#update_itemObject



1
2
3
4
5
6
7
8
9
# File 'lib/tasks/item.rb', line 1

def update_item
  if defined?(Exemplify)
    Exemplify.find_each do |exemplify|
      if exemplify.item
        exemplify.item.update_column(:manifestation_id, exemplify.manifestation_id) unless exemplify.item.manifestation_id
      end
    end
  end
end