Top Level Namespace

Defined Under Namespace

Modules: AgentsHelper, EnjuBiblio, ManifestationsHelper, OwnsHelper, PictureFilesHelper, SeriesStatementsHelper Classes: AdapterError, Agent, AgentImportFile, AgentImportFileQueue, AgentImportFileStateMachine, AgentImportFileTransition, AgentImportFilesController, AgentImportResult, AgentImportResultsController, AgentMerge, AgentMergeList, AgentMergeListsController, AgentMergesController, AgentRelationship, AgentRelationshipType, AgentRelationshipTypesController, AgentRelationshipsController, AgentType, AgentTypesController, AgentsController, CarrierType, CarrierTypesController, Clause, ContentType, ContentTypesController, CountriesController, Country, Cql, Create, CreateType, CreateTypesController, CreatesController, Donate, DonatesController, FormOfWork, FormOfWorksController, FrequenciesController, Frequency, Identifier, IdentifierType, IdentifierTypesController, ImportRequest, ImportRequestStateMachine, ImportRequestTransition, ImportRequestsController, Item, ItemsController, Language, LanguagesController, License, LicensesController, Manifestation, ManifestationRelationship, ManifestationRelationshipType, ManifestationRelationshipTypesController, ManifestationRelationshipsController, ManifestationsController, MediumOfPerformance, MediumOfPerformancesController, Openurl, OpenurlQuerySyntaxError, Own, OwnsController, PictureFile, PictureFilesController, Produce, ProduceType, ProduceTypesController, ProducesController, QueryArgumentError, QueryError, QuerySyntaxError, Realize, RealizeType, RealizeTypesController, RealizesController, ResourceExportFile, ResourceExportFileQueue, ResourceExportFileStateMachine, ResourceExportFileTransition, ResourceExportFilesController, ResourceImportFile, ResourceImportFileQueue, ResourceImportFileStateMachine, ResourceImportFileTransition, ResourceImportFilesController, ResourceImportResult, ResourceImportResultsController, ScannerError, SeriesStatement, SeriesStatementMerge, SeriesStatementMergeList, SeriesStatementMergeListsController, SeriesStatementMergesController, SeriesStatementsController, Sru

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_attributes!(l) if agent_type
    when "corporate_body"
      agent_type = AgentType.where(name: 'CorporateBody').first
      agent_type.update_attributes!(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
# File 'lib/tasks/carrier_type.rb', line 1

def update_carrier_type
  cd = CarrierType.where(name: 'CD').first
  cd.update_column(:name, 'cd') if cd
  dvd = CarrierType.where(name: 'DVD').first
  dvd.update_column(:name, 'dvd') if cd

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

    case line[1]["name"]
    when "volume"
    carrier_type = CarrierType.where(name: 'print').first
    carrier_type.update_attributes!(line[1]) if carrier_type
    when "audio_disc"
    carrier_type = CarrierType.where(name: 'cd').first
    carrier_type.update_attributes!(line[1]) if carrier_type
    when "videodisc"
    carrier_type = CarrierType.where(name: 'dvd').first
    carrier_type.update_attributes!(line[1]) if carrier_type
    when "online_resource"
    carrier_type = CarrierType.where(name: 'file').first
    carrier_type.update_attributes!(line[1]) if carrier_type
    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_attributes!(l) if content_type
    when "two_dimensional_moving_image"
      content_type = ContentType.where(name: 'video').first
      content_type.update_attributes!(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.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_attributes!(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