-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit will fix the OAI importer by adjusting the `FileSetActor` and `ImportUrlJob`. The reason why it wasn't working is because it was based on Hyrax 2.9.6 method signatures which has changed in Hyrax 3.5.0. Ref: - https://github.com/scientist-softserv/adventist-dl/issues/624
- Loading branch information
Showing
3 changed files
with
53 additions
and
198 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# frozen_string_literal: true | ||
|
||
# OVERRIDE Hyrax 3.5.0 to override default_thumbnail | ||
|
||
module Hyrax | ||
module Actors | ||
module FileSetActorDecorator | ||
def attach_to_valkyrie_work(work, file_set_params) | ||
work = Hyrax.query_service.find_by(id: work.id) unless work.new_record | ||
file_set.visibility = work.visibility unless assign_visibility?(file_set_params) | ||
fs = Hyrax.persister.save(resource: file_set) | ||
Hyrax.publisher.publish('object.metadata.updated', object: fs, user: user) | ||
work.member_ids << fs.id | ||
work.representative_id = fs.id if work.representative_id.blank? | ||
# OVERRIDE Hyrax 3.5.0 to override default_thumbnail | ||
work.thumbnail = file_set if file_set.override_default_thumbnail == 'true' || work.thumbnail_id.blank? | ||
|
||
# Save the work so the association between the work and the file_set is persisted (head_id) | ||
# NOTE: the work may not be valid, in which case this save doesn't do anything. | ||
Hyrax.persister.save(resource: work) | ||
Hyrax.publisher.publish('object.metadata.updated', object: work, user: user) | ||
end | ||
|
||
# Adds a FileSet to the work using ore:Aggregations. | ||
def attach_to_af_work(work, file_set_params) | ||
work.reload unless work.new_record? | ||
file_set.visibility = work.visibility unless assign_visibility?(file_set_params) | ||
work.ordered_members << file_set | ||
work.representative = file_set if work.representative_id.blank? | ||
# OVERRIDE Hyrax 3.5.0 to override default_thumbnail | ||
work.thumbnail = file_set if file_set.override_default_thumbnail == 'true' || work.thumbnail_id.blank? | ||
|
||
# Save the work so the association between the work and the file_set is persisted (head_id) | ||
# NOTE: the work may not be valid, in which case this save doesn't do anything. | ||
work.save | ||
end | ||
end | ||
end | ||
end | ||
|
||
Hyrax::Actors::FileSetActor.prepend Hyrax::Actors::FileSetActorDecorator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters