Skip to content

Commit

Permalink
Undo Active Fedora conversion of based_near
Browse files Browse the repository at this point in the history
This may still be needed, but this doesn't work correctly.
A ticket has been created for this bug if this is something that is
ever needed.

#6926
  • Loading branch information
LaRita Robinson committed Oct 16, 2024
1 parent 0635b70 commit cc7902c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
9 changes: 2 additions & 7 deletions lib/wings/active_fedora_converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,12 @@ def apply_attributes_to_model(af_object)
end
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength

# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def parse_attributes(af_object)
converted_attrs = normal_attributes
af_object.attributes = converted_attrs.except(:members, :files, :file_name)
af_object.original_filename = converted_attrs[:file_name] if converted_attrs[:file_name]
af_object.extracted_text = create_extrated_text(af_object) if resource.attributes[:extracted_text_id].present?
af_object.based_near = convert_based_near(converted_attrs[:based_near]) if converted_attrs[:based_near]
perform_lease_conversion(af_object: af_object, resource: resource)
perform_embargo_conversion(af_object: af_object, resource: resource)

Expand All @@ -163,11 +162,7 @@ def parse_attributes(af_object)
files = converted_attrs.delete(:files)
af_object.files.build_or_set(files) if files
end
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength

def convert_based_near(based_near_string)
based_near_string.map { |bn| Hyrax::ControlledVocabularies::Location.new(bn) }
end
# rubocop:enable Metrics/AbcSize

def create_extrated_text(af_object)
pcdm_et_file = af_object.extracted_text.presence || af_object.create_extracted_text
Expand Down
13 changes: 1 addition & 12 deletions spec/wings/active_fedora_converter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,7 @@
end

context 'when given a valkyrie native model' do
let(:based_near) { "https://sws.geonames.org/4920808/" }
let(:resource) do
klass.new(title: ['comet in moominland'],
distant_relation: ['Snufkin'],
based_near: [based_near])
end
let(:resource) { klass.new(title: ['comet in moominland'], distant_relation: ['Snufkin']) }
let(:klass) { Hyrax::Test::Converter::Resource }

before do
Expand All @@ -138,7 +133,6 @@ module Converter
class Resource < Hyrax::Resource
attribute :title, Valkyrie::Types::Array.of(Valkyrie::Types::String)
attribute :distant_relation, Valkyrie::Types::String
attribute :based_near, Valkyrie::Types::Array.of(Valkyrie::Types::String)
end
end
end
Expand All @@ -160,11 +154,6 @@ class Resource < Hyrax::Resource
.to have_attributes(title: ['comet in moominland'], distant_relation: ['Snufkin'])
end

it 'converts based_near to an RDF::URI' do
converted_work = converter.convert
expect(converted_work.based_near.first).to be_a(Hyrax::ControlledVocabularies::Location)
end

it 'supports indexing' do
expect(converter.convert.indexing_service).to be_a Hyrax::Indexers::ResourceIndexer
end
Expand Down

0 comments on commit cc7902c

Please sign in to comment.