hyrax 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +22 -0
- data/.dassie/Gemfile +10 -5
- data/.dassie/config/initializers/hyrax.rb +5 -0
- data/.dockerignore +3 -0
- data/.env +0 -1
- data/.rubocop.yml +4 -0
- data/CONTAINERS.md +1 -1
- data/Dockerfile +12 -6
- data/Gemfile +21 -27
- data/app/actors/hyrax/actors/base_actor.rb +1 -1
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +85 -63
- data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +7 -42
- data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +20 -8
- data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +21 -9
- data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +14 -5
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +22 -3
- data/app/controllers/hyrax/admin/workflows_controller.rb +8 -2
- data/app/controllers/hyrax/dashboard/collection_members_controller.rb +13 -9
- data/app/controllers/hyrax/dashboard/collections_controller.rb +12 -10
- data/app/controllers/hyrax/file_sets_controller.rb +49 -13
- data/app/controllers/hyrax/permissions_controller.rb +3 -4
- data/app/controllers/hyrax/workflow_actions_controller.rb +3 -1
- data/app/forms/hyrax/forms/collection_form.rb +7 -3
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +24 -2
- data/app/forms/hyrax/forms/file_set_form.rb +46 -0
- data/app/forms/hyrax/forms/permission.rb +23 -0
- data/app/forms/hyrax/forms/permission_template_form.rb +8 -2
- data/app/forms/hyrax/forms/resource_form.rb +10 -17
- data/app/forms/hyrax/forms/work_form.rb +5 -2
- data/app/helpers/hyrax/batch_edits_helper.rb +3 -1
- data/app/helpers/hyrax/collections_helper.rb +88 -2
- data/app/helpers/hyrax/dashboard_helper_behavior.rb +3 -7
- data/app/helpers/hyrax/file_set_helper.rb +25 -6
- data/app/helpers/hyrax/work_form_helper.rb +53 -0
- data/app/indexers/hyrax/administrative_set_indexer.rb +18 -0
- data/app/indexers/hyrax/valkyrie_indexer.rb +3 -3
- data/app/inputs/controlled_vocabulary_input.rb +2 -5
- data/app/jobs/attach_files_to_work_job.rb +19 -10
- data/app/jobs/attach_files_to_work_with_ordered_members_job.rb +6 -5
- data/app/jobs/inherit_permissions_job.rb +9 -5
- data/app/models/admin_set.rb +6 -25
- data/app/models/concerns/hyrax/ability.rb +3 -1
- data/app/models/concerns/hyrax/collection_behavior.rb +17 -44
- data/app/models/concerns/hyrax/file_set/characterization.rb +18 -12
- data/app/models/concerns/hyrax/solr_document_behavior.rb +9 -52
- data/app/models/concerns/hyrax/suppressible.rb +5 -0
- data/app/models/concerns/hyrax/user.rb +9 -3
- data/app/models/hyrax/file_set.rb +6 -0
- data/app/models/hyrax/pcdm_collection.rb +1 -0
- data/app/models/hyrax/permission_template.rb +98 -12
- data/app/models/hyrax/virus_scanner.rb +27 -18
- data/app/models/sipity/agent.rb +1 -0
- data/app/models/sipity/entity.rb +30 -8
- data/app/models/sipity/workflow.rb +1 -0
- data/app/models/sipity.rb +42 -0
- data/app/presenters/hyrax/admin_set_options_presenter.rb +2 -10
- data/app/presenters/hyrax/admin_set_presenter.rb +5 -1
- data/app/presenters/hyrax/admin_set_selection_presenter.rb +116 -0
- data/app/presenters/hyrax/collection_presenter.rb +31 -6
- data/app/presenters/hyrax/file_set_presenter.rb +6 -1
- data/app/presenters/hyrax/file_usage.rb +3 -2
- data/app/presenters/hyrax/stats_usage_presenter.rb +2 -1
- data/app/presenters/hyrax/trophy_presenter.rb +33 -4
- data/app/presenters/hyrax/user_profile_presenter.rb +11 -1
- data/app/presenters/hyrax/version_list_presenter.rb +19 -0
- data/app/presenters/hyrax/version_presenter.rb +3 -2
- data/app/presenters/hyrax/work_show_presenter.rb +25 -4
- data/app/presenters/hyrax/work_usage.rb +5 -3
- data/app/renderers/hyrax/renderers/attribute_renderer.rb +10 -2
- data/app/search_builders/hyrax/admin_set_search_builder.rb +1 -1
- data/app/search_builders/hyrax/my/collections_search_builder.rb +1 -1
- data/app/services/hyrax/admin_set_create_service.rb +3 -1
- data/app/services/hyrax/collections/collection_member_search_service.rb +72 -0
- data/app/services/hyrax/collections/collection_member_service.rb +112 -27
- data/app/services/hyrax/collections/migration_service.rb +4 -2
- data/app/services/hyrax/collections/nested_collection_persistence_service.rb +12 -13
- data/app/services/hyrax/collections/nested_collection_query_service.rb +2 -0
- data/app/services/hyrax/collections/permissions_create_service.rb +6 -4
- data/app/services/hyrax/contextual_path.rb +23 -0
- data/app/services/hyrax/custom_queries/find_file_metadata.rb +7 -5
- data/app/services/hyrax/custom_queries/navigators/parent_collections_navigator.rb +46 -0
- data/app/services/hyrax/edit_permissions_service.rb +27 -20
- data/app/services/hyrax/find_objects_via_solr_service.rb +11 -7
- data/app/services/hyrax/multiple_membership_checker.rb +51 -31
- data/app/services/hyrax/resource_status.rb +7 -0
- data/app/services/hyrax/search_service.rb +4 -2
- data/app/services/hyrax/solr_query_builder_service.rb +29 -6
- data/app/services/hyrax/solr_query_service.rb +224 -0
- data/app/services/hyrax/solr_service.rb +8 -1
- data/app/services/hyrax/statistics/depositors/summary.rb +2 -1
- data/app/services/hyrax/work_uploads_handler.rb +17 -2
- data/app/services/hyrax/workflow/actionable_objects.rb +70 -0
- data/app/services/hyrax/workflow/object_in_workflow_decorator.rb +31 -0
- data/app/services/hyrax/workflow/status_list_service.rb +43 -13
- data/app/views/hyrax/base/_form_relationships.html.erb +1 -2
- data/app/views/hyrax/base/_form_rendering.html.erb +1 -1
- data/app/views/hyrax/base/_form_representative.html.erb +1 -1
- data/app/views/hyrax/base/_form_thumbnail.html.erb +1 -1
- data/app/views/hyrax/base/_guts4form.html.erb +2 -2
- data/app/views/hyrax/base/_representative_media.html.erb +1 -1
- data/app/views/hyrax/base/_show_actions.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form.html.erb +3 -3
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/edit.html.erb +4 -2
- data/app/views/hyrax/dashboard/collections/new.html.erb +4 -2
- data/app/views/hyrax/dashboard/collections/show.html.erb +1 -1
- data/app/views/hyrax/file_sets/edit.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_image.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_office_document.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_pdf.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +1 -1
- data/app/views/hyrax/file_sets/show.html.erb +1 -1
- data/app/views/hyrax/my/_admin_set_action_menu.html.erb +0 -11
- data/app/views/hyrax/my/_collection_action_menu.html.erb +1 -2
- data/app/views/hyrax/my/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +3 -5
- data/bin/solrcloud-assign-configset.sh +8 -5
- data/bin/solrcloud-upload-configset.sh +4 -2
- data/chart/hyrax/Chart.yaml +3 -3
- data/chart/hyrax/README.md +47 -1
- data/chart/hyrax/templates/_helpers.tpl +1 -1
- data/chart/hyrax/templates/configmap-env.yaml +1 -3
- data/chart/hyrax/templates/deployment-worker.yaml +6 -3
- data/chart/hyrax/templates/deployment.yaml +8 -3
- data/chart/hyrax/values.yaml +12 -0
- data/config/brakeman.ignore +2 -2
- data/config/locales/hyrax.de.yml +1 -1
- data/config/locales/hyrax.en.yml +1 -1
- data/config/locales/hyrax.es.yml +1 -1
- data/config/locales/hyrax.fr.yml +1 -1
- data/config/locales/hyrax.it.yml +1 -1
- data/config/locales/hyrax.pt-BR.yml +1 -1
- data/config/locales/hyrax.zh.yml +1 -1
- data/docker-compose.yml +1 -0
- data/documentation/developing-your-hyrax-based-app.md +1 -1
- data/documentation/legacyREADME.md +1 -1
- data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +5 -0
- data/lib/hyrax/active_fedora_dummy_model.rb +62 -0
- data/lib/hyrax/configuration.rb +8 -0
- data/lib/hyrax/engine.rb +1 -0
- data/lib/hyrax/errors.rb +2 -0
- data/lib/hyrax/specs/capybara.rb +3 -1
- data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +9 -0
- data/lib/hyrax/transactions/container.rb +21 -0
- data/lib/hyrax/transactions/file_set_destroy.rb +21 -0
- data/lib/hyrax/transactions/steps/add_file_sets.rb +3 -2
- data/lib/hyrax/transactions/steps/add_to_parent.rb +36 -0
- data/lib/hyrax/transactions/steps/remove_file_set_from_work.rb +47 -0
- data/lib/hyrax/transactions/work_create.rb +2 -1
- data/lib/hyrax/valkyrie_can_can_adapter.rb +1 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/hyrax.rb +9 -0
- data/lib/tasks/collection_type_global_id.rake +1 -1
- data/lib/tasks/regenerate_derivatives.rake +12 -0
- data/lib/wings/orm_converter.rb +18 -2
- data/lib/wings/setup.rb +1 -0
- data/lib/wings/valkyrie/storage.rb +56 -1
- data/template.rb +1 -1
- metadata +17 -2
|
@@ -1215,7 +1215,7 @@ pt-BR:
|
|
|
1215
1215
|
subject: Carga em lote completo
|
|
1216
1216
|
title: Arquivos carregados com sucesso
|
|
1217
1217
|
models:
|
|
1218
|
-
|
|
1218
|
+
file_set: Conjunto de arquivos
|
|
1219
1219
|
hyrax/pcdm_collection: Coleção
|
|
1220
1220
|
hyrax/work: Trabalhar
|
|
1221
1221
|
my:
|
data/config/locales/hyrax.zh.yml
CHANGED
data/docker-compose.yml
CHANGED
|
@@ -125,7 +125,7 @@ NOTE: The steps need to be done in order to create a new Hyrax based app.
|
|
|
125
125
|
Generate a new Rails application using the template.
|
|
126
126
|
|
|
127
127
|
```
|
|
128
|
-
rails _5.2.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v3.0
|
|
128
|
+
rails _5.2.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v3.1.0/template.rb
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
|
|
@@ -50,7 +50,7 @@ The Samvera community is here to help. Please see our [support guide](./.github/
|
|
|
50
50
|
# Getting started
|
|
51
51
|
|
|
52
52
|
This document contains instructions specific to setting up an app with __Hyrax
|
|
53
|
-
v3.
|
|
53
|
+
v3.1.0__. If you are looking for instructions on installing a different
|
|
54
54
|
version, be sure to select the appropriate branch or tag from the drop-down
|
|
55
55
|
menu above.
|
|
56
56
|
|
|
@@ -159,6 +159,11 @@ Hyrax.config do |config|
|
|
|
159
159
|
# Should a button with "Share my work" show on the front page to all users (even those not logged in)?
|
|
160
160
|
# config.display_share_button_when_not_logged_in = true
|
|
161
161
|
|
|
162
|
+
# This user is logged as the acting user for jobs and other processes that
|
|
163
|
+
# run without being attributed to a specific user (e.g. creation of the
|
|
164
|
+
# default admin set).
|
|
165
|
+
# config.system_user_key = 'systemuser@example.com'
|
|
166
|
+
|
|
162
167
|
# The user who runs batch jobs. Update this if you aren't using emails
|
|
163
168
|
# config.batch_user_key = 'batchuser@example.com'
|
|
164
169
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Hyrax
|
|
3
|
+
##
|
|
4
|
+
# @api public
|
|
5
|
+
#
|
|
6
|
+
# Given a model class and an +id+, provides +ActiveModel+ style methods. This
|
|
7
|
+
# is a tool for providing route resolution and other +ActiveModel+ behavior
|
|
8
|
+
# for +ActiveFedora+ without loading the object from the fedora backend.
|
|
9
|
+
#
|
|
10
|
+
# @note this was originally implemented for +SolrDocument+ as
|
|
11
|
+
# +Hyrax::SolrDocumentBehavior::ModelWrapper+, but is useful in the more
|
|
12
|
+
# general case that we know the model class and id, but don't have a full
|
|
13
|
+
# model object.
|
|
14
|
+
#
|
|
15
|
+
class ActiveFedoraDummyModel
|
|
16
|
+
##
|
|
17
|
+
# @api public
|
|
18
|
+
#
|
|
19
|
+
# @param [Class] model
|
|
20
|
+
# @param [String, nil] id
|
|
21
|
+
def initialize(model, id)
|
|
22
|
+
@model = model
|
|
23
|
+
@id = id
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
##
|
|
27
|
+
# @api public
|
|
28
|
+
def persisted?
|
|
29
|
+
true
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
##
|
|
33
|
+
# @api public
|
|
34
|
+
def to_param
|
|
35
|
+
@id
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
##
|
|
39
|
+
# @api public
|
|
40
|
+
def model_name
|
|
41
|
+
@model.model_name
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
##
|
|
45
|
+
# @api public
|
|
46
|
+
#
|
|
47
|
+
# @note uses the @model's `._to_partial_path` if implemented, otherwise
|
|
48
|
+
# constructs a default
|
|
49
|
+
def to_partial_path
|
|
50
|
+
return @model._to_partial_path if
|
|
51
|
+
@model.respond_to?(:_to_partial_path)
|
|
52
|
+
|
|
53
|
+
"hyrax/#{model_name.collection}/#{model_name.element}"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
##
|
|
57
|
+
# @api public
|
|
58
|
+
def to_global_id
|
|
59
|
+
URI::GID.build app: GlobalID.app, model_name: model_name.name, model_id: @id
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
data/lib/hyrax/configuration.rb
CHANGED
|
@@ -643,6 +643,14 @@ module Hyrax
|
|
|
643
643
|
@show_work_item_rows ||= 10 # rows on show view
|
|
644
644
|
end
|
|
645
645
|
|
|
646
|
+
# This user is logged as the acting user for jobs and other processes that
|
|
647
|
+
# run without being attributed to a specific user (e.g. creation of the
|
|
648
|
+
# default admin set).
|
|
649
|
+
attr_writer :system_user_key
|
|
650
|
+
def system_user_key
|
|
651
|
+
@system_user_key ||= 'systemuser@example.com'
|
|
652
|
+
end
|
|
653
|
+
|
|
646
654
|
attr_writer :batch_user_key
|
|
647
655
|
def batch_user_key
|
|
648
656
|
@batch_user_key ||= 'batchuser@example.com'
|
data/lib/hyrax/engine.rb
CHANGED
data/lib/hyrax/errors.rb
CHANGED
data/lib/hyrax/specs/capybara.rb
CHANGED
|
@@ -40,7 +40,9 @@ if ENV['IN_DOCKER'].present? || ENV['HUB_URL'].present?
|
|
|
40
40
|
|
|
41
41
|
Capybara.server_host = '0.0.0.0'
|
|
42
42
|
Capybara.server_port = 3010
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
ip = IPSocket.getaddress(Socket.gethostname)
|
|
45
|
+
Capybara.app_host = "http://#{ip}:#{Capybara.server_port}"
|
|
44
46
|
else
|
|
45
47
|
TEST_HOST = 'localhost:3000'.freeze
|
|
46
48
|
# @note In January 2018, TravisCI disabled Chrome sandboxing in its Linux
|
|
@@ -21,11 +21,13 @@ module Hyrax
|
|
|
21
21
|
require 'hyrax/transactions/apply_change_set'
|
|
22
22
|
require 'hyrax/transactions/create_work'
|
|
23
23
|
require 'hyrax/transactions/destroy_work'
|
|
24
|
+
require 'hyrax/transactions/file_set_destroy'
|
|
24
25
|
require 'hyrax/transactions/work_create'
|
|
25
26
|
require 'hyrax/transactions/work_destroy'
|
|
26
27
|
require 'hyrax/transactions/update_work'
|
|
27
28
|
require 'hyrax/transactions/steps/add_file_sets'
|
|
28
29
|
require 'hyrax/transactions/steps/add_to_collections'
|
|
30
|
+
require 'hyrax/transactions/steps/add_to_parent'
|
|
29
31
|
require 'hyrax/transactions/steps/apply_collection_permission_template'
|
|
30
32
|
require 'hyrax/transactions/steps/apply_permission_template'
|
|
31
33
|
require 'hyrax/transactions/steps/apply_visibility'
|
|
@@ -33,6 +35,7 @@ module Hyrax
|
|
|
33
35
|
require 'hyrax/transactions/steps/destroy_work'
|
|
34
36
|
require 'hyrax/transactions/steps/ensure_admin_set'
|
|
35
37
|
require 'hyrax/transactions/steps/ensure_permission_template'
|
|
38
|
+
require 'hyrax/transactions/steps/remove_file_set_from_work'
|
|
36
39
|
require 'hyrax/transactions/steps/save'
|
|
37
40
|
require 'hyrax/transactions/steps/save_work'
|
|
38
41
|
require 'hyrax/transactions/steps/save_access_control'
|
|
@@ -92,11 +95,29 @@ module Hyrax
|
|
|
92
95
|
end
|
|
93
96
|
end
|
|
94
97
|
|
|
98
|
+
namespace 'file_set' do |ops| # Hyrax::FileSet
|
|
99
|
+
ops.register 'delete' do
|
|
100
|
+
Steps::DeleteResource.new
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
ops.register 'destroy' do
|
|
104
|
+
FileSetDestroy.new
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
ops.register 'remove_from_work' do
|
|
108
|
+
Steps::RemoveFileSetFromWork.new
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
95
112
|
namespace 'work_resource' do |ops| # valkyrie works
|
|
96
113
|
ops.register 'add_file_sets' do
|
|
97
114
|
Steps::AddFileSets.new
|
|
98
115
|
end
|
|
99
116
|
|
|
117
|
+
ops.register 'add_to_parent' do
|
|
118
|
+
Steps::AddToParent.new
|
|
119
|
+
end
|
|
120
|
+
|
|
100
121
|
ops.register 'delete' do
|
|
101
122
|
Steps::DeleteResource.new
|
|
102
123
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'hyrax/transactions/transaction'
|
|
3
|
+
|
|
4
|
+
module Hyrax
|
|
5
|
+
module Transactions
|
|
6
|
+
##
|
|
7
|
+
# destroys a FileSet resource.
|
|
8
|
+
#
|
|
9
|
+
# @since 3.1.0
|
|
10
|
+
class FileSetDestroy < Transaction
|
|
11
|
+
DEFAULT_STEPS = ['file_set.remove_from_work',
|
|
12
|
+
'file_set.delete'].freeze
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# @see Hyrax::Transactions::Transaction
|
|
16
|
+
def initialize(container: Container, steps: DEFAULT_STEPS)
|
|
17
|
+
super
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -20,10 +20,11 @@ module Hyrax
|
|
|
20
20
|
##
|
|
21
21
|
# @param [Hyrax::Work] obj
|
|
22
22
|
# @param [Enumerable<UploadedFile>] uploaded_files
|
|
23
|
+
# @param [Enumerable<Hash>] file_set_params
|
|
23
24
|
#
|
|
24
25
|
# @return [Dry::Monads::Result]
|
|
25
|
-
def call(obj, uploaded_files: [])
|
|
26
|
-
if @handler.new(work: obj).add(files: uploaded_files).attach
|
|
26
|
+
def call(obj, uploaded_files: [], file_set_params: [])
|
|
27
|
+
if @handler.new(work: obj).add(files: uploaded_files, file_set_params: file_set_params).attach
|
|
27
28
|
Success(obj)
|
|
28
29
|
else
|
|
29
30
|
Failure[:failed_to_attach_file_sets, uploaded_files]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'dry/monads'
|
|
3
|
+
|
|
4
|
+
module Hyrax
|
|
5
|
+
module Transactions
|
|
6
|
+
module Steps
|
|
7
|
+
##
|
|
8
|
+
# Adds a work to a parent work
|
|
9
|
+
#
|
|
10
|
+
# @see https://wiki.lyrasis.org/display/samvera/Hydra::Works+Shared+Modeling
|
|
11
|
+
class AddToParent
|
|
12
|
+
include Dry::Monads[:result]
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# @param [Hyrax::Work] obj
|
|
16
|
+
# @param [#to_s] parent_id
|
|
17
|
+
#
|
|
18
|
+
# @return [Dry::Monads::Result]
|
|
19
|
+
def call(obj, parent_id: nil, user: nil)
|
|
20
|
+
return Success(obj) if parent_id.blank?
|
|
21
|
+
|
|
22
|
+
parent = Hyrax.query_service.find_by(id: parent_id)
|
|
23
|
+
parent.member_ids << obj.id
|
|
24
|
+
Hyrax.persister.save(resource: parent)
|
|
25
|
+
|
|
26
|
+
user ||= ::User.find_by_user_key(obj.depositor)
|
|
27
|
+
Hyrax.publisher.publish('object.metadata.updated', object: parent, user: user)
|
|
28
|
+
|
|
29
|
+
Success(obj)
|
|
30
|
+
rescue Valkyrie::Persistence::ObjectNotFoundError => _err
|
|
31
|
+
Failure[:parent_object_not_found, parent_id]
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'dry/monads'
|
|
3
|
+
|
|
4
|
+
module Hyrax
|
|
5
|
+
module Transactions
|
|
6
|
+
module Steps
|
|
7
|
+
##
|
|
8
|
+
# removes the file set from all its parents, returning a
|
|
9
|
+
# `Dry::Monads::Result` (`Success`|`Failure`).
|
|
10
|
+
#
|
|
11
|
+
# there should normally be only one parent for a FileSet, but in the case
|
|
12
|
+
# that there are multiple, this step will remove the file set from all
|
|
13
|
+
# parents.
|
|
14
|
+
#
|
|
15
|
+
# if no user is provided to attribute the removal to, the step fails
|
|
16
|
+
# immediately.
|
|
17
|
+
#
|
|
18
|
+
# @see https://dry-rb.org/gems/dry-monads/1.0/result/
|
|
19
|
+
class RemoveFileSetFromWork
|
|
20
|
+
include Dry::Monads[:result]
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# @param [Valkyrie::QueryService] query_service
|
|
24
|
+
def initialize(query_service: Hyrax.query_service, persister: Hyrax.persister)
|
|
25
|
+
@persister = persister
|
|
26
|
+
@query_service = query_service
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
##
|
|
30
|
+
# @param [Hyrax::FileSet] file_set
|
|
31
|
+
#
|
|
32
|
+
# @return [Dry::Monads::Result]
|
|
33
|
+
def call(file_set, user: nil)
|
|
34
|
+
return Failure('No user provided.') if user.nil?
|
|
35
|
+
|
|
36
|
+
@query_service.find_parents(resource: file_set).each do |parent|
|
|
37
|
+
parent.member_ids -= [file_set.id]
|
|
38
|
+
saved = @persister.save(resource: parent)
|
|
39
|
+
Hyrax.publisher.publish('object.metadata.updated', object: saved, user: user)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
Success(file_set)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -14,7 +14,8 @@ module Hyrax
|
|
|
14
14
|
'change_set.add_to_collections',
|
|
15
15
|
'change_set.apply',
|
|
16
16
|
'work_resource.save_acl',
|
|
17
|
-
'work_resource.add_file_sets'
|
|
17
|
+
'work_resource.add_file_sets',
|
|
18
|
+
'work_resource.add_to_parent'].freeze
|
|
18
19
|
|
|
19
20
|
##
|
|
20
21
|
# @see Hyrax::Transactions::Transaction
|
|
@@ -19,6 +19,7 @@ module Hyrax
|
|
|
19
19
|
#
|
|
20
20
|
# @raise Hyrax::ObjectNotFoundError
|
|
21
21
|
def self.find(_model_class, id)
|
|
22
|
+
return Hyrax.query_service.find_by(id: id) unless Hyrax.config.enable_noids?
|
|
22
23
|
Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: id)
|
|
23
24
|
rescue Valkyrie::Persistence::ObjectNotFoundError => err
|
|
24
25
|
raise Hyrax::ObjectNotFoundError, err.message
|
data/lib/hyrax/version.rb
CHANGED
data/lib/hyrax.rb
CHANGED
|
@@ -25,6 +25,13 @@ require 'valkyrie/indexing_adapter'
|
|
|
25
25
|
require 'valkyrie/indexing/solr/indexing_adapter'
|
|
26
26
|
require 'valkyrie/indexing/null_indexing_adapter'
|
|
27
27
|
|
|
28
|
+
##
|
|
29
|
+
# Hyrax is a Ruby on Rails Engine built by the Samvera community. The engine
|
|
30
|
+
# provides a foundation for creating many different digital repository
|
|
31
|
+
# applications.
|
|
32
|
+
#
|
|
33
|
+
# @see https://samvera.org Samvera Community
|
|
34
|
+
# @see https://guides.rubyonrails.org/engines.html Rails Guides: Getting Started with Engines
|
|
28
35
|
module Hyrax
|
|
29
36
|
extend ActiveSupport::Autoload
|
|
30
37
|
|
|
@@ -46,6 +53,8 @@ module Hyrax
|
|
|
46
53
|
def self.GlobalID(input) # rubocop:disable Naming/MethodName
|
|
47
54
|
case input
|
|
48
55
|
when Valkyrie::Resource
|
|
56
|
+
return input.to_global_id if input.respond_to?(:to_global_id)
|
|
57
|
+
|
|
49
58
|
ValkyrieGlobalIdProxy.new(resource: input).to_global_id
|
|
50
59
|
else
|
|
51
60
|
input.to_global_id if input.respond_to?(:to_global_id)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
namespace :hyrax do
|
|
3
3
|
namespace :collections do
|
|
4
4
|
desc 'Update CollectionType global id references for Hyrax 3.0.0'
|
|
5
|
-
task :
|
|
5
|
+
task update_collection_type_global_ids: :environment do
|
|
6
6
|
puts 'Updating collection -> collection type GlobalId references.'
|
|
7
7
|
|
|
8
8
|
count = 0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
namespace :hyrax do
|
|
4
|
+
namespace :file_sets do
|
|
5
|
+
desc 'Regenerate derivatives for all FileSets in the repository'
|
|
6
|
+
task regenerate_derivatives: :environment do
|
|
7
|
+
FileSet.all.each do |fs|
|
|
8
|
+
fs.files.each { |fi| CreateDerivativesJob.perform_later(fs, fi) }
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
data/lib/wings/orm_converter.rb
CHANGED
|
@@ -40,6 +40,12 @@ module Wings
|
|
|
40
40
|
_canonical_valkyrie_model&.name
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
##
|
|
44
|
+
# @return [String]
|
|
45
|
+
def to_s
|
|
46
|
+
internal_resource
|
|
47
|
+
end
|
|
48
|
+
|
|
43
49
|
##
|
|
44
50
|
# @api private
|
|
45
51
|
def _canonical_valkyrie_model
|
|
@@ -47,8 +53,18 @@ module Wings
|
|
|
47
53
|
end
|
|
48
54
|
end
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
##
|
|
57
|
+
# @return [URI::GID]
|
|
58
|
+
def to_global_id
|
|
59
|
+
URI::GID.build([GlobalID.app, internal_resource, id, {}])
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
##
|
|
63
|
+
# @return [ActiveModel::Base]
|
|
64
|
+
def to_model
|
|
65
|
+
model_class = internal_resource.safe_constantize || self
|
|
66
|
+
|
|
67
|
+
Hyrax::ActiveFedoraDummyModel.new(model_class, id)
|
|
52
68
|
end
|
|
53
69
|
|
|
54
70
|
klass.properties.each_key do |property_name|
|