hyrax 4.0.0 → 5.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +124 -232
- data/.dassie/.env +8 -2
- data/.dassie/Gemfile +27 -42
- data/.dassie/Gemfile.dassie +2 -0
- data/.dassie/app/assets/config/manifest.js +2 -0
- data/.dassie/app/assets/stylesheets/hyrax.scss +1 -0
- data/.dassie/config/environments/test.rb +1 -0
- data/.dassie/config/initializers/hyrax.rb +3 -1
- data/.dassie/config/initializers/riiif.rb +11 -7
- data/.dassie/config/metadata/collection_resource.yaml +3 -0
- data/.dassie/config/metadata/monograph.yaml +8 -0
- data/.dassie/config/metadata/sample_metadata.yaml +1 -0
- data/.dassie/config/redis.yml +2 -0
- data/.dassie/db/migrate/20230725222727_create_hyrax_counter_metrics.hyrax.rb +14 -0
- data/.dassie/db/migrate/20230803165135_change_work_id_to_string.rb +5 -0
- data/.dassie/db/migrate/20230808102105_add_indices_to_hyrax_counter_metrics.hyrax.rb +8 -0
- data/.dassie/db/migrate/20230821153635_add_fields_to_counter_metric.rb +8 -0
- data/.dassie/db/schema.rb +22 -3
- data/.dockerignore +7 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +10 -7
- data/.github/release.yml +5 -2
- data/.gitignore +1 -1
- data/.koppie/.env +13 -4
- data/.koppie/Gemfile +10 -12
- data/.koppie/Gemfile.koppie +2 -0
- data/.koppie/Rakefile +0 -2
- data/.koppie/app/models/ability.rb +1 -5
- data/.koppie/app/models/user.rb +0 -2
- data/.koppie/config/application.rb +2 -1
- data/.koppie/config/arkivo.yml +6 -0
- data/.koppie/config/blacklight.yml +2 -2
- data/.koppie/config/environments/test.rb +1 -0
- data/.koppie/config/features.yml +2 -0
- data/.koppie/config/initializers/1_valkyrie.rb +29 -6
- data/.koppie/config/initializers/arkivo_constraint.rb +12 -0
- data/.koppie/config/initializers/hyrax.rb +10 -4
- data/.koppie/config/initializers/riiif.rb +11 -7
- data/.koppie/config/metadata/collection_resource.yaml +49 -0
- data/.koppie/config/metadata/generic_work.yaml +2 -0
- data/.koppie/config/metadata/monograph.yaml +10 -0
- data/.koppie/config/role_map.yml +3 -25
- data/.koppie/config/routes.rb +1 -2
- data/.koppie/config/solr.yml +1 -1
- data/.koppie/config/valkyrie_index.yml +4 -10
- data/.koppie/config/zotero.yml +6 -0
- data/.koppie/db/migrate/20230725222727_create_hyrax_counter_metrics.hyrax.rb +14 -0
- data/.koppie/db/migrate/20230803165135_change_work_id_to_string.rb +5 -0
- data/.koppie/db/schema.rb +12 -1
- data/.koppie/yarn.lock +23 -23
- data/.regen +1 -1
- data/CONTAINERS.md +1 -3
- data/Dockerfile +17 -13
- data/Gemfile +4 -21
- data/Gemfile.dassie +2 -0
- data/Gemfile.koppie +2 -0
- data/README.md +0 -1
- data/Rakefile +0 -11
- data/app/actors/hyrax/actors/base_actor.rb +4 -3
- data/app/actors/hyrax/actors/embargo_actor.rb +3 -3
- data/app/actors/hyrax/actors/lease_actor.rb +5 -2
- data/app/assets/javascripts/hyrax/batch_select_all.js +1 -1
- data/app/assets/javascripts/hyrax/file_manager/member.es6 +1 -1
- data/app/assets/javascripts/hyrax/file_manager/sorting.es6 +3 -2
- data/app/assets/stylesheets/hyrax/_file-listing.scss +0 -2
- data/app/assets/stylesheets/hyrax/_work-show.scss +19 -3
- data/app/assets/stylesheets/hyrax/sidebar.scss +23 -0
- data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +8 -2
- data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +7 -1
- data/app/controllers/concerns/hyrax/valkyrie_downloads_controller_behavior.rb +79 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +64 -14
- data/app/controllers/hyrax/admin/workflows_controller.rb +48 -3
- data/app/controllers/hyrax/api/items_controller.rb +2 -3
- data/app/controllers/hyrax/batch_edits_controller.rb +39 -10
- data/app/controllers/hyrax/batch_uploads_controller.rb +5 -1
- data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -1
- data/app/controllers/hyrax/downloads_controller.rb +8 -1
- data/app/controllers/hyrax/file_sets_controller.rb +50 -6
- data/app/controllers/hyrax/my/collections_controller.rb +2 -0
- data/app/controllers/hyrax/single_use_links_viewer_controller.rb +16 -2
- data/app/forms/concerns/hyrax/basic_metadata_form_fields_behavior.rb +38 -0
- data/app/forms/hyrax/forms/collection_form.rb +0 -15
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +0 -34
- data/app/forms/hyrax/forms/file_set_edit_form.rb +1 -1
- data/app/forms/hyrax/forms/file_set_form.rb +2 -2
- data/app/forms/hyrax/forms/pcdm_object_form.rb +21 -0
- data/app/forms/hyrax/forms/permission_template_form.rb +2 -7
- data/app/forms/hyrax/forms/resource_batch_edit_form.rb +118 -0
- data/app/forms/hyrax/forms/resource_form.rb +21 -34
- data/app/forms/hyrax/forms/work_embargo_form.rb +1 -0
- data/app/forms/hyrax/forms/work_form.rb +1 -1
- data/app/forms/hyrax/forms/work_lease_form.rb +1 -0
- data/app/helpers/hyrax/dashboard_helper_behavior.rb +30 -9
- data/app/helpers/hyrax/membership_helper.rb +13 -1
- data/app/helpers/hyrax/work_form_helper.rb +0 -107
- data/app/indexers/hyrax/file_set_indexer.rb +6 -0
- data/app/indexers/hyrax/location_indexer.rb +29 -0
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +36 -5
- data/app/indexers/hyrax/valkyrie_work_indexer.rb +9 -2
- data/app/inputs/controlled_vocabulary_input.rb +1 -1
- data/app/jobs/characterize_job.rb +1 -1
- data/app/jobs/create_work_job.rb +36 -4
- data/app/jobs/valkyrie_characterization_job.rb +9 -0
- data/app/jobs/valkyrie_create_derivatives_job.rb +8 -7
- data/app/jobs/valkyrie_ingest_job.rb +1 -4
- data/app/models/admin_set.rb +1 -31
- data/app/models/collection_branding_info.rb +2 -9
- data/app/models/concerns/hyrax/ability.rb +2 -1
- data/app/models/concerns/hyrax/collection_behavior.rb +4 -12
- data/app/models/concerns/hyrax/file_set/derivatives.rb +3 -2
- data/app/models/concerns/hyrax/riiif_file.rb +30 -0
- data/app/models/concerns/hyrax/solr_document_behavior.rb +20 -3
- data/app/models/hyrax/collection_type.rb +5 -14
- data/app/models/hyrax/counter_metric.rb +7 -0
- data/app/models/hyrax/file_metadata.rb +9 -9
- data/app/models/hyrax/file_set.rb +76 -15
- data/app/models/hyrax/orcid_validator.rb +0 -6
- data/app/models/hyrax/resource.rb +30 -2
- data/app/models/hyrax/work.rb +2 -5
- data/app/presenters/hyrax/collection_presenter.rb +0 -17
- data/app/presenters/hyrax/embargo_presenter.rb +4 -0
- data/app/presenters/hyrax/file_set_presenter.rb +6 -0
- data/app/presenters/hyrax/iiif_manifest_presenter.rb +3 -7
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +6 -4
- data/app/presenters/hyrax/presenter_renderer.rb +0 -7
- data/app/presenters/hyrax/version_list_presenter.rb +19 -10
- data/app/presenters/hyrax/version_presenter.rb +19 -4
- data/app/presenters/hyrax/work_show_presenter.rb +6 -11
- data/app/search_builders/hyrax/file_set_search_builder.rb +1 -1
- data/app/search_builders/hyrax/valkyrie_abstract_type_relation.rb +37 -0
- data/app/search_builders/hyrax/valkyrie_work_relation.rb +9 -0
- data/app/services/hyrax/admin_set_create_service.rb +0 -17
- data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +16 -9
- data/app/services/hyrax/collections/collection_member_service.rb +1 -1
- data/app/services/hyrax/custom_queries/find_by_date_range.rb +55 -0
- data/app/services/hyrax/custom_queries/find_count_by.rb +62 -0
- data/app/services/hyrax/custom_queries/find_file_metadata.rb +1 -1
- data/app/services/hyrax/custom_queries/find_models_by_access.rb +59 -0
- data/app/services/hyrax/derivative_bucketed_storage.rb +25 -0
- data/app/services/hyrax/derivative_path.rb +14 -4
- data/app/services/hyrax/embargo_manager.rb +106 -13
- data/app/services/hyrax/embargo_service.rb +12 -10
- data/app/services/hyrax/file_set_derivatives_service.rb +14 -13
- data/app/services/hyrax/fixity_check_failure_service.rb +1 -1
- data/app/services/hyrax/identifier/dispatcher.rb +9 -2
- data/app/services/hyrax/lease_manager.rb +88 -8
- data/app/services/hyrax/listeners/file_metadata_listener.rb +16 -8
- data/app/services/hyrax/listeners/member_cleanup_listener.rb +2 -28
- data/app/services/hyrax/listeners/metadata_index_listener.rb +11 -0
- data/app/services/hyrax/listeners/workflow_listener.rb +8 -11
- data/app/services/hyrax/lock_manager.rb +1 -2
- data/app/services/hyrax/persist_directly_contained_output_file_service.rb +24 -2
- data/app/services/hyrax/riiif_file_resolver.rb +50 -0
- data/app/services/hyrax/simple_schema_loader.rb +31 -0
- data/app/services/hyrax/solr_query_service.rb +7 -6
- data/app/services/hyrax/statistics/depositors/summary.rb +1 -1
- data/app/services/hyrax/statistics/over_time.rb +1 -1
- data/app/services/hyrax/statistics/users/over_time.rb +3 -1
- data/app/services/hyrax/statistics/valkyrie_query_service.rb +49 -0
- data/app/services/hyrax/statistics/works/count.rb +1 -1
- data/app/services/hyrax/thumbnail_path_service.rb +5 -0
- data/app/services/hyrax/valkyrie_persist_derivatives.rb +16 -11
- data/app/services/hyrax/valkyrie_upload.rb +16 -28
- data/app/services/hyrax/versioning_service.rb +30 -15
- data/app/services/hyrax/visibility_intention.rb +1 -4
- data/app/services/hyrax/visibility_propagator.rb +1 -1
- data/app/services/hyrax/work_uploads_handler.rb +1 -1
- data/app/services/hyrax/workflow/actionable_objects.rb +28 -3
- data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +1 -1
- data/app/services/hyrax/workflow/grant_read_to_depositor.rb +1 -1
- data/app/services/hyrax/workflow/permission_query.rb +23 -2
- data/app/validators/hyrax/collection_membership_validator.rb +1 -1
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/admin/workflows/_tabs.html.erb +9 -0
- data/app/views/hyrax/admin/workflows/index.html.erb +53 -76
- data/app/views/hyrax/base/_file_manager_members.html.erb +2 -2
- data/app/views/hyrax/base/_file_manager_resource_form.html.erb +1 -1
- data/app/views/hyrax/base/_form.html.erb +0 -10
- data/app/views/hyrax/base/_form_permission_embargo.html.erb +1 -1
- data/app/views/hyrax/base/_form_permission_lease.html.erb +1 -1
- data/app/views/hyrax/base/_form_visibility_component.html.erb +4 -4
- data/app/views/hyrax/base/_items.html.erb +1 -1
- data/app/views/hyrax/base/_show_actions.html.erb +1 -1
- data/app/views/hyrax/base/_workflow_actions.html.erb +25 -23
- data/app/views/hyrax/base/file_manager.html.erb +1 -1
- data/app/views/hyrax/base/show.json.jbuilder +4 -3
- data/app/views/hyrax/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +3 -3
- data/app/views/hyrax/file_sets/_versioning.html.erb +5 -5
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +4 -4
- data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +2 -2
- data/app/views/hyrax/file_sets/show.html.erb +5 -3
- data/app/views/hyrax/homepage/_explore_collections.html.erb +1 -1
- data/app/views/hyrax/my/_search_form.html.erb +1 -1
- data/app/views/hyrax/notifications/_notifications.html.erb +1 -1
- data/app/views/hyrax/users/_vitals.html.erb +1 -1
- data/bin/dev-entrypoint.sh +13 -0
- data/chart/hyrax/Chart.yaml +18 -14
- data/chart/hyrax/README.md +34 -21
- data/chart/hyrax/templates/_helpers.tpl +34 -1
- data/chart/hyrax/templates/configmap-env.yaml +12 -2
- data/chart/hyrax/templates/secrets.yaml +1 -1
- data/chart/hyrax/values.yaml +39 -14
- data/config/initializers/file_length_patch.rb +10 -0
- data/config/initializers/listeners.rb +4 -10
- data/config/initializers/storage_adapter_initializer.rb +1 -1
- data/config/locales/hyrax.en.yml +8 -0
- data/config/metadata/basic_metadata.yaml +52 -0
- data/config/metadata/core_metadata.yaml +4 -0
- data/config/metadata/file_set_metadata.yaml +20 -1
- data/config/metadata/hyrax_internal_metadata.yaml +57 -0
- data/docker-compose-koppie.yml +36 -22
- data/docker-compose-sirenia.yml +202 -0
- data/docker-compose.yml +42 -26
- data/documentation/developing-your-hyrax-based-app.md +6 -14
- data/documentation/legacyREADME.md +3 -1
- data/hyrax.gemspec +12 -13
- data/karma.conf.js +9 -10
- data/lib/generators/hyrax/collection_resource/templates/collection_metadata.yaml +2 -0
- data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +1 -1
- data/lib/generators/hyrax/templates/config/initializers/riiif.rb +11 -7
- data/lib/generators/hyrax/templates/db/migrate/20230725222727_create_hyrax_counter_metrics.rb.erb +14 -0
- data/lib/generators/hyrax/templates/db/migrate/20230803165135_change_work_id_to_string.rb.erb +5 -0
- data/lib/generators/hyrax/templates/db/migrate/20230808102105_add_indices_to_hyrax_counter_metrics.rb.erb +8 -0
- data/lib/generators/hyrax/templates/db/migrate/20230821153635_add_fields_to_counter_metric.rb.erb +8 -0
- data/lib/generators/hyrax/templates/db/seeds.rb +1 -1
- data/lib/generators/hyrax/work_resource/templates/form.rb.erb +1 -1
- data/lib/generators/hyrax/work_resource/templates/metadata.yaml +2 -0
- data/lib/hyrax/active_fedora_dummy_model.rb +6 -1
- data/lib/hyrax/configuration.rb +147 -43
- data/lib/hyrax/controlled_vocabularies/location.rb +7 -1
- data/lib/hyrax/engine.rb +2 -1
- data/lib/hyrax/form_fields.rb +6 -0
- data/lib/hyrax/publisher.rb +23 -3
- data/lib/hyrax/redis_event_store.rb +7 -8
- data/lib/hyrax/resource_name.rb +4 -0
- data/lib/hyrax/specs/capybara.rb +25 -37
- data/lib/hyrax/specs/shared_specs/hydra_works.rb +34 -7
- data/lib/hyrax/specs/shared_specs/indexers.rb +24 -6
- data/lib/hyrax/transactions/collection_destroy.rb +3 -2
- data/lib/hyrax/transactions/container.rb +47 -0
- data/lib/hyrax/transactions/file_metadata_destroy.rb +20 -0
- data/lib/hyrax/transactions/file_set_destroy.rb +3 -1
- data/lib/hyrax/transactions/file_set_update.rb +21 -0
- data/lib/hyrax/transactions/steps/add_file_sets.rb +6 -0
- data/lib/hyrax/transactions/steps/add_to_parent.rb +1 -1
- data/lib/hyrax/transactions/steps/apply_permission_template.rb +40 -0
- data/lib/hyrax/transactions/steps/delete_all_file_metadata.rb +46 -0
- data/lib/hyrax/transactions/steps/delete_all_file_sets.rb +46 -0
- data/lib/hyrax/transactions/steps/file_metadata_delete.rb +40 -0
- data/lib/hyrax/transactions/steps/remove_from_membership.rb +45 -0
- data/lib/hyrax/transactions/steps/save.rb +21 -0
- data/lib/hyrax/transactions/work_create.rb +1 -0
- data/lib/hyrax/transactions/work_destroy.rb +3 -2
- data/lib/hyrax/version.rb +1 -1
- data/lib/hyrax.rb +1 -0
- data/lib/tasks/collection_type_global_id.rake +9 -4
- data/lib/tasks/embargo_lease.rake +1 -0
- data/lib/valkyrie/indexing/solr/indexing_adapter.rb +2 -0
- data/lib/wings/active_fedora_converter/default_work.rb +7 -2
- data/lib/wings/active_fedora_converter/file_metadata_node.rb +1 -1
- data/lib/wings/active_fedora_converter.rb +53 -11
- data/lib/wings/attribute_transformer.rb +24 -17
- data/lib/wings/model_transformer.rb +23 -12
- data/lib/wings/orm_converter.rb +23 -18
- data/lib/wings/setup.rb +23 -3
- data/lib/wings/valkyrie/persister.rb +4 -2
- data/lib/wings/valkyrie/storage.rb +8 -90
- data/lib/wings.rb +5 -0
- data/package.json +3 -1
- data/tasks/hyrax_dev.rake +2 -33
- data/template.rb +1 -1
- metadata +104 -81
- data/.engine_cart.yml +0 -3
- data/app/forms/hyrax/forms/file_manager_form.rb +0 -35
- data/app/services/hyrax/collections/migration_service.rb +0 -113
- data/app/views/hyrax/base/_form_collections_error.html.erb +0 -1
- data/app/views/hyrax/base/_form_in_works_error.html.erb +0 -3
- data/app/views/hyrax/base/_form_ordered_members_error.html.erb +0 -3
- data/app/views/hyrax/base/_form_visibility_error.html.erb +0 -19
- data/app/views/hyrax/users/_user_util_links_extra.html.erb +0 -0
- data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +0 -9
@@ -97,112 +97,5 @@ module Hyrax
|
|
97
97
|
hash[presenter.title_or_label] = presenter.id
|
98
98
|
end
|
99
99
|
end
|
100
|
-
|
101
|
-
##
|
102
|
-
# This helper retrieves errors based on form type.
|
103
|
-
#
|
104
|
-
# @param form [Hyrax::Forms::WorkForm] or Hyrax::ChangeSet
|
105
|
-
# @return [String] specific error message
|
106
|
-
def in_works_ids_errors_for(form:)
|
107
|
-
case form
|
108
|
-
when Hyrax::ChangeSet
|
109
|
-
form.errors[:in_works_ids]
|
110
|
-
else
|
111
|
-
form.model.errors[:in_works_ids]
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
##
|
116
|
-
# This helper retrieves errors based on form type.
|
117
|
-
#
|
118
|
-
# @param form [Hyrax::Forms::WorkForm] or Hyrax::ChangeSet
|
119
|
-
# @return [String] specific error message
|
120
|
-
def ordered_member_ids_errors_for(form:)
|
121
|
-
case form
|
122
|
-
when Hyrax::ChangeSet
|
123
|
-
form.errors[:ordered_member_ids]
|
124
|
-
else
|
125
|
-
form.model.errors[:ordered_member_ids]
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
##
|
130
|
-
# This helper retrieves errors based on form type.
|
131
|
-
#
|
132
|
-
# @param form [Hyrax::Forms::WorkForm] or Hyrax::ChangeSet
|
133
|
-
# @return [String] specific error message
|
134
|
-
def visibility_errors_for(form:)
|
135
|
-
case form
|
136
|
-
when Hyrax::ChangeSet
|
137
|
-
form.errors[:visibility]
|
138
|
-
else
|
139
|
-
form.model.errors[:visibility]
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
##
|
144
|
-
# This helper retrieves errors based on form type.
|
145
|
-
#
|
146
|
-
# @param form [Hyrax::Forms::WorkForm] or Hyrax::ChangeSet
|
147
|
-
# @return [String] specific error message
|
148
|
-
def embargo_release_date_errors_for(form:)
|
149
|
-
case form
|
150
|
-
when Hyrax::ChangeSet
|
151
|
-
form.errors[:embargo_release_date]
|
152
|
-
else
|
153
|
-
form.model.errors[:embargo_release_date]
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
##
|
158
|
-
# This helper retrieves errors based on form type.
|
159
|
-
#
|
160
|
-
# @param form [Hyrax::Forms::WorkForm] or Hyrax::ChangeSet
|
161
|
-
# @return [String] specific error message
|
162
|
-
def visibility_after_embargo_errors_for(form:)
|
163
|
-
case form
|
164
|
-
when Hyrax::ChangeSet
|
165
|
-
form.errors[:visibility_after_embargo]
|
166
|
-
else
|
167
|
-
form.model.errors[:visibility_after_embargo]
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
##
|
172
|
-
# This helper retrieves errors based on form type.
|
173
|
-
#
|
174
|
-
# @param form [Hyrax::Forms::WorkForm] or Hyrax::ChangeSet
|
175
|
-
# @return [String] specific error message
|
176
|
-
def lease_expiration_date_errors_for(form:)
|
177
|
-
case form
|
178
|
-
when Hyrax::ChangeSet
|
179
|
-
form.errors[:lease_expiration_date_errors]
|
180
|
-
else
|
181
|
-
form.model.errors[:lease_expiration_date_errors]
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
##
|
186
|
-
# This helper retrieves errors based on form type.
|
187
|
-
#
|
188
|
-
# @param form [Hyrax::Forms::WorkForm] or Hyrax::ChangeSet
|
189
|
-
# @return [String] specific error message
|
190
|
-
def visibility_after_lease_errors_for(form:)
|
191
|
-
case form
|
192
|
-
when Hyrax::ChangeSet
|
193
|
-
form.errors[:visibility_after_lease]
|
194
|
-
else
|
195
|
-
form.model.errors[:visibility_after_lease]
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
##
|
200
|
-
# This helper retrieves errors based on form type.
|
201
|
-
#
|
202
|
-
# @param form [Hyrax::Forms::WorkForm] or Hyrax::ChangeSet
|
203
|
-
# @return [String] specific error message
|
204
|
-
def full_collections_errors(form:)
|
205
|
-
form.full_error(:collections) || form.full_error(:member_of_collection_ids)
|
206
|
-
end
|
207
100
|
end
|
208
101
|
end
|
@@ -30,6 +30,7 @@ module Hyrax
|
|
30
30
|
solr_doc['original_checksum_tesim'] = object.original_checksum
|
31
31
|
solr_doc['alpha_channels_ssi'] = object.alpha_channels
|
32
32
|
solr_doc['original_file_id_ssi'] = original_file_id
|
33
|
+
solr_doc['extracted_text_id_ssi'] = extracted_text_id
|
33
34
|
solr_doc['generic_type_si'] = 'FileSet'
|
34
35
|
end
|
35
36
|
end
|
@@ -46,6 +47,11 @@ module Hyrax
|
|
46
47
|
Hyrax::VersioningService.versioned_file_id object.original_file
|
47
48
|
end
|
48
49
|
|
50
|
+
def extracted_text_id
|
51
|
+
return unless object.extracted_text
|
52
|
+
Hyrax::VersioningService.versioned_file_id object.extracted_text
|
53
|
+
end
|
54
|
+
|
49
55
|
def file_format
|
50
56
|
if object.mime_type.present? && object.format_label.present?
|
51
57
|
"#{object.mime_type.split('/').last} (#{object.format_label.join(', ')})"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hyrax
|
4
|
+
##
|
5
|
+
# Indexes properties common to Hyrax::Resource types
|
6
|
+
module LocationIndexer
|
7
|
+
def to_solr
|
8
|
+
super.tap do |index_document|
|
9
|
+
index_document[:based_near_label_tesim] = based_near_label_lookup(resource.based_near) if resource.respond_to? :based_near
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def based_near_label_lookup(locations)
|
16
|
+
locations.map do |loc|
|
17
|
+
if URI.parse(loc)
|
18
|
+
location_service.full_label(loc)
|
19
|
+
else
|
20
|
+
loc
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def location_service
|
26
|
+
Hyrax.config.location_service
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Hyrax
|
4
4
|
##
|
5
5
|
# Indexes Hyrax::FileSet objects
|
6
|
-
class ValkyrieFileSetIndexer < Hyrax::ValkyrieIndexer
|
6
|
+
class ValkyrieFileSetIndexer < Hyrax::ValkyrieIndexer # rubocop:disable Metrics/ClassLength
|
7
7
|
include Hyrax::ResourceIndexer
|
8
8
|
include Hyrax::PermissionIndexer
|
9
9
|
include Hyrax::VisibilityIndexer
|
@@ -17,11 +17,14 @@ module Hyrax
|
|
17
17
|
|
18
18
|
# Metadata from the FileSet
|
19
19
|
solr_doc['file_ids_ssim'] = resource.file_ids&.map(&:to_s)
|
20
|
-
solr_doc['original_file_id_ssi'] = resource.
|
20
|
+
solr_doc['original_file_id_ssi'] = resource.iiif_id
|
21
21
|
solr_doc['extracted_text_id_ssi'] = resource.extracted_text_id.to_s
|
22
22
|
solr_doc['hasRelatedMediaFragment_ssim'] = resource.representative_id.to_s
|
23
23
|
solr_doc['hasRelatedImage_ssim'] = resource.thumbnail_id.to_s
|
24
24
|
|
25
|
+
index_lease(solr_doc)
|
26
|
+
index_embargo(solr_doc)
|
27
|
+
|
25
28
|
# Add in metadata from the original file.
|
26
29
|
file_metadata = Hyrax::FileSetFileService.new(file_set: resource).original_file
|
27
30
|
return solr_doc unless file_metadata
|
@@ -36,12 +39,13 @@ module Hyrax
|
|
36
39
|
|
37
40
|
solr_doc['file_format_tesim'] = file_format(file_metadata)
|
38
41
|
solr_doc['file_format_sim'] = file_format(file_metadata)
|
39
|
-
solr_doc['file_size_lts'] = file_metadata.
|
40
|
-
solr_doc['type_tesim'] = file_metadata.
|
42
|
+
solr_doc['file_size_lts'] = file_metadata.recorded_size[0]
|
43
|
+
solr_doc['type_tesim'] = file_metadata.pcdm_use.map(&:to_s) if file_metadata.pcdm_use.present?
|
44
|
+
solr_doc['pcdm_use_tesim'] = file_metadata.pcdm_use.map(&:to_s) if file_metadata.pcdm_use.present?
|
41
45
|
|
42
46
|
# attributes set by fits
|
43
47
|
solr_doc['format_label_tesim'] = file_metadata.format_label if file_metadata.format_label.present?
|
44
|
-
solr_doc['size_tesim'] = file_metadata.
|
48
|
+
solr_doc['size_tesim'] = file_metadata.recorded_size if file_metadata.recorded_size.present?
|
45
49
|
solr_doc['well_formed_tesim'] = file_metadata.well_formed if file_metadata.well_formed.present?
|
46
50
|
solr_doc['valid_tesim'] = file_metadata.valid if file_metadata.valid.present?
|
47
51
|
solr_doc['fits_version_tesim'] = file_metadata.fits_version if file_metadata.fits_version.present?
|
@@ -56,10 +60,13 @@ module Hyrax
|
|
56
60
|
|
57
61
|
solr_doc['height_tesim'] = file_metadata.height if file_metadata.height.present? # image, video
|
58
62
|
solr_doc['width_tesim'] = file_metadata.width if file_metadata.width.present? # image, video
|
63
|
+
solr_doc['height_is'] = Integer(file_metadata.height.first) if file_metadata.height.present?
|
64
|
+
solr_doc['width_is'] = Integer(file_metadata.width.first) if file_metadata.width.present?
|
59
65
|
|
60
66
|
# attributes set by fits for audio files
|
61
67
|
solr_doc['bit_depth_tesim'] = file_metadata.bit_depth if file_metadata.bit_depth.present?
|
62
68
|
solr_doc['channels_tesim'] = file_metadata.channels if file_metadata.channels.present?
|
69
|
+
solr_doc['alpha_channels_ssi'] = file_metadata.channels.first if file_metadata.channels.present?
|
63
70
|
solr_doc['data_format_tesim'] = file_metadata.data_format if file_metadata.data_format.present?
|
64
71
|
solr_doc['offset_tesim'] = file_metadata.offset if file_metadata.offset.present?
|
65
72
|
|
@@ -108,5 +115,29 @@ module Hyrax
|
|
108
115
|
file.format_label
|
109
116
|
end
|
110
117
|
end
|
118
|
+
|
119
|
+
def index_lease(doc)
|
120
|
+
if resource.lease&.active?
|
121
|
+
doc['lease_expiration_date_dtsi'] = resource.lease.lease_expiration_date&.to_datetime
|
122
|
+
doc['visibility_after_lease_ssim'] = resource.lease.visibility_after_lease
|
123
|
+
doc['visibility_during_lease_ssim'] = resource.lease.visibility_during_lease
|
124
|
+
else
|
125
|
+
doc['lease_history_ssim'] = resource&.lease&.lease_history
|
126
|
+
end
|
127
|
+
|
128
|
+
doc
|
129
|
+
end
|
130
|
+
|
131
|
+
def index_embargo(doc)
|
132
|
+
if resource.embargo&.active?
|
133
|
+
doc['embargo_release_date_dtsi'] = resource.embargo.embargo_release_date&.to_datetime
|
134
|
+
doc['visibility_after_embargo_ssim'] = resource.embargo.visibility_after_embargo
|
135
|
+
doc['visibility_during_embargo_ssim'] = resource.embargo.visibility_during_embargo
|
136
|
+
else
|
137
|
+
doc['embargo_history_ssim'] = resource&.embargo&.embargo_history
|
138
|
+
end
|
139
|
+
|
140
|
+
doc
|
141
|
+
end
|
111
142
|
end
|
112
143
|
end
|
@@ -7,6 +7,7 @@ module Hyrax
|
|
7
7
|
include Hyrax::ResourceIndexer
|
8
8
|
include Hyrax::PermissionIndexer
|
9
9
|
include Hyrax::VisibilityIndexer
|
10
|
+
include Hyrax::LocationIndexer
|
10
11
|
include Hyrax::ThumbnailIndexer
|
11
12
|
include Hyrax::Indexer(:core_metadata)
|
12
13
|
|
@@ -25,6 +26,7 @@ module Hyrax
|
|
25
26
|
solr_doc['depositor_tesim'] = [resource.depositor]
|
26
27
|
solr_doc['hasRelatedMediaFragment_ssim'] = [resource.representative_id.to_s]
|
27
28
|
solr_doc['hasRelatedImage_ssim'] = [resource.thumbnail_id.to_s]
|
29
|
+
solr_doc['hasFormat_ssim'] = resource.rendering_ids.map(&:to_s) if resource.rendering_ids.present?
|
28
30
|
index_embargo(solr_doc)
|
29
31
|
index_lease(solr_doc)
|
30
32
|
end
|
@@ -43,19 +45,24 @@ module Hyrax
|
|
43
45
|
end
|
44
46
|
|
45
47
|
def index_embargo(doc)
|
46
|
-
if
|
48
|
+
if resource.embargo&.active?
|
47
49
|
doc['embargo_release_date_dtsi'] = resource.embargo.embargo_release_date&.to_datetime
|
48
50
|
doc['visibility_after_embargo_ssim'] = resource.embargo.visibility_after_embargo
|
49
51
|
doc['visibility_during_embargo_ssim'] = resource.embargo.visibility_during_embargo
|
52
|
+
else
|
53
|
+
doc['embargo_history_ssim'] = resource&.embargo&.embargo_history
|
50
54
|
end
|
55
|
+
|
51
56
|
doc
|
52
57
|
end
|
53
58
|
|
54
59
|
def index_lease(doc)
|
55
|
-
if
|
60
|
+
if resource.lease&.active?
|
56
61
|
doc['lease_expiration_date_dtsi'] = resource.lease.lease_expiration_date&.to_datetime
|
57
62
|
doc['visibility_after_lease_ssim'] = resource.lease.visibility_after_lease
|
58
63
|
doc['visibility_during_lease_ssim'] = resource.lease.visibility_during_lease
|
64
|
+
else
|
65
|
+
doc['lease_history_ssim'] = resource&.lease&.lease_history
|
59
66
|
end
|
60
67
|
|
61
68
|
doc
|
@@ -44,7 +44,7 @@ class ControlledVocabularyInput < MultiValueInput
|
|
44
44
|
def hidden_id_field(value, index)
|
45
45
|
name = name_for(attribute_name, index, 'id')
|
46
46
|
id = id_for(attribute_name, index, 'id')
|
47
|
-
hidden_value = value.node? ? '' : value.rdf_subject
|
47
|
+
hidden_value = value.try(:node?) ? '' : value.rdf_subject
|
48
48
|
@builder.hidden_field(attribute_name, name: name, id: id, value: hidden_value, data: { id: 'remote' })
|
49
49
|
end
|
50
50
|
|
@@ -51,7 +51,7 @@ class CharacterizeJob < Hyrax::ApplicationJob
|
|
51
51
|
# value. So later we'll ensure it's set to the new file's filename.
|
52
52
|
reset_title = file_set.title.first == file_set.label
|
53
53
|
|
54
|
-
characterization_service.run(file_set.characterization_proxy, filepath)
|
54
|
+
characterization_service.run(file_set.characterization_proxy, filepath, **Hyrax.config.characterization_options)
|
55
55
|
Hyrax.logger.debug "Ran characterization on #{file_set.characterization_proxy.id} (#{file_set.characterization_proxy.mime_type})"
|
56
56
|
file_set.characterization_proxy.alpha_channels = channels(filepath) if file_set.image? && Hyrax.config.iiif_image_server?
|
57
57
|
file_set.characterization_proxy.save!
|
data/app/jobs/create_work_job.rb
CHANGED
@@ -17,15 +17,47 @@ class CreateWorkJob < Hyrax::ApplicationJob
|
|
17
17
|
def perform(user, model, attributes, operation)
|
18
18
|
operation.performing!
|
19
19
|
work = model.constantize.new
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
if model.constantize < ActiveFedora::Base
|
21
|
+
status = batch_create_af_work(work, attributes, user)
|
22
|
+
errors = work.errors
|
23
|
+
else
|
24
|
+
result = batch_create_valkyrie_work(work, attributes, user)
|
25
|
+
status = result.success?
|
26
|
+
errors = result.failure&.last
|
27
|
+
end
|
28
|
+
|
23
29
|
return operation.success! if status
|
24
|
-
operation.fail!(
|
30
|
+
operation.fail!(errors.full_messages.join(' '))
|
25
31
|
end
|
26
32
|
|
27
33
|
private
|
28
34
|
|
35
|
+
def batch_create_af_work(work, attributes, user)
|
36
|
+
current_ability = Ability.new(user)
|
37
|
+
env = Hyrax::Actors::Environment.new(work, current_ability, attributes)
|
38
|
+
work_actor.create(env)
|
39
|
+
end
|
40
|
+
|
41
|
+
def batch_create_valkyrie_work(work, attributes, user)
|
42
|
+
uploaded_file_ids = attributes.delete(:uploaded_files)
|
43
|
+
files = Hyrax::UploadedFile.find(uploaded_file_ids)
|
44
|
+
permissions_params = attributes.delete(:permissions_attributes)
|
45
|
+
form = Hyrax::FormFactory.new.build(work, nil, nil)
|
46
|
+
form.validate(attributes)
|
47
|
+
|
48
|
+
transactions['change_set.create_work']
|
49
|
+
.with_step_args(
|
50
|
+
'work_resource.add_file_sets' => { uploaded_files: files },
|
51
|
+
'change_set.set_user_as_depositor' => { user: user },
|
52
|
+
'work_resource.save_acl' => { permissions_params: permissions_params }
|
53
|
+
)
|
54
|
+
.call(form)
|
55
|
+
end
|
56
|
+
|
57
|
+
def transactions
|
58
|
+
Hyrax::Transactions::Container
|
59
|
+
end
|
60
|
+
|
29
61
|
def work_actor
|
30
62
|
Hyrax::CurationConcern.actor
|
31
63
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
class ValkyrieCharacterizationJob < Hyrax::ApplicationJob
|
3
|
+
queue_as Hyrax.config.ingest_queue_name
|
4
|
+
def perform(file_metadata_id)
|
5
|
+
file_metadata = Hyrax.custom_queries.find_file_metadata_by(id: file_metadata_id)
|
6
|
+
Hyrax.config.characterization_service
|
7
|
+
.run(metadata: file_metadata, file: file_metadata.file, **Hyrax.config.characterization_options)
|
8
|
+
end
|
9
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
class ValkyrieCreateDerivativesJob < Hyrax::ApplicationJob
|
3
3
|
queue_as Hyrax.config.ingest_queue_name
|
4
|
-
def perform(
|
4
|
+
def perform(file_set_id, file_id, _filepath = nil)
|
5
5
|
file_metadata = Hyrax.custom_queries.find_file_metadata_by(id: file_id)
|
6
6
|
return if file_metadata.video? && !Hyrax.config.enable_ffmpeg
|
7
7
|
# Get file into a local path.
|
@@ -9,15 +9,16 @@ class ValkyrieCreateDerivativesJob < Hyrax::ApplicationJob
|
|
9
9
|
# Call derivatives with the file_set.
|
10
10
|
derivative_service = Hyrax::DerivativeService.for(file_metadata)
|
11
11
|
derivative_service.create_derivatives(file.disk_path)
|
12
|
+
reindex_parent(file_set_id)
|
12
13
|
end
|
13
14
|
|
14
15
|
private
|
15
16
|
|
16
|
-
def
|
17
|
-
Hyrax.query_service
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
Hyrax.
|
17
|
+
def reindex_parent(file_set_id)
|
18
|
+
file_set = Hyrax.query_service.find_by(id: file_set_id)
|
19
|
+
parent = Hyrax.custom_queries.find_parent_work(resource: file_set)
|
20
|
+
return unless parent.thumbnail_id == file_set.id
|
21
|
+
Hyrax.logger.debug { "Reindexing #{parent.id} due to creation of thumbnail derivatives." }
|
22
|
+
Hyrax.index_adapter.save(resource: parent)
|
22
23
|
end
|
23
24
|
end
|
@@ -25,15 +25,12 @@ class ValkyrieIngestJob < Hyrax::ApplicationJob
|
|
25
25
|
def ingest(file:, pcdm_use:)
|
26
26
|
file_set_uri = Valkyrie::ID.new(file.file_set_uri)
|
27
27
|
file_set = Hyrax.query_service.find_by(id: file_set_uri)
|
28
|
-
|
29
|
-
updated_metadata = upload_file(
|
28
|
+
upload_file(
|
30
29
|
file: file,
|
31
30
|
file_set: file_set,
|
32
31
|
pcdm_use: pcdm_use,
|
33
32
|
user: file.user
|
34
33
|
)
|
35
|
-
|
36
|
-
ValkyrieCreateDerivativesJob.perform_later(file_set.id.to_s, updated_metadata.id.to_s)
|
37
34
|
end
|
38
35
|
|
39
36
|
##
|
data/app/models/admin_set.rb
CHANGED
@@ -42,25 +42,6 @@ class AdminSet < ActiveFedora::Base
|
|
42
42
|
before_destroy :check_if_not_default_set, :check_if_empty
|
43
43
|
after_destroy :destroy_permission_template
|
44
44
|
|
45
|
-
def self.default_set?(id)
|
46
|
-
Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
|
47
|
-
"Instead, use 'Hyrax::AdminSetCreateService.default_admin_set?(id:)'.")
|
48
|
-
Hyrax::AdminSetCreateService.default_admin_set?(id: id)
|
49
|
-
end
|
50
|
-
|
51
|
-
def default_set?
|
52
|
-
Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
|
53
|
-
"Instead, use 'Hyrax::AdminSetCreateService.default_admin_set?(id:)'.")
|
54
|
-
self.class.default_set?(id)
|
55
|
-
end
|
56
|
-
|
57
|
-
# Creates the default AdminSet and an associated PermissionTemplate with workflow
|
58
|
-
def self.find_or_create_default_admin_set_id
|
59
|
-
Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
|
60
|
-
"Instead, use 'Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id'.")
|
61
|
-
Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s
|
62
|
-
end
|
63
|
-
|
64
45
|
def collection_type_gid
|
65
46
|
# allow AdminSet to behave more like a regular Collection
|
66
47
|
Hyrax::CollectionType.find_or_create_admin_set_type.to_global_id
|
@@ -86,17 +67,6 @@ class AdminSet < ActiveFedora::Base
|
|
86
67
|
Sipity::Workflow.find_active_workflow_for(admin_set_id: id)
|
87
68
|
end
|
88
69
|
|
89
|
-
##
|
90
|
-
# @deprecated use PermissionTemplate#reset_access_controls_for instead
|
91
|
-
#
|
92
|
-
# Calculate and update who should have edit access based on who
|
93
|
-
# has "manage" access in the PermissionTemplateAccess
|
94
|
-
def reset_access_controls!
|
95
|
-
Deprecation.warn("reset_access_controls! is deprecated; use PermissionTemplate#reset_access_controls_for instead.")
|
96
|
-
|
97
|
-
permission_template.reset_access_controls_for(collection: self)
|
98
|
-
end
|
99
|
-
|
100
70
|
# @api public
|
101
71
|
#
|
102
72
|
# return an id for the AdminSet.
|
@@ -120,7 +90,7 @@ class AdminSet < ActiveFedora::Base
|
|
120
90
|
end
|
121
91
|
|
122
92
|
def check_if_not_default_set
|
123
|
-
return true unless
|
93
|
+
return true unless Hyrax::AdminSetCreateService.default_admin_set?(id: id)
|
124
94
|
errors[:base] << I18n.t('hyrax.admin.admin_sets.delete.error_default_set')
|
125
95
|
throw :abort
|
126
96
|
end
|
@@ -19,15 +19,8 @@ class CollectionBrandingInfo < ApplicationRecord
|
|
19
19
|
super()
|
20
20
|
end
|
21
21
|
|
22
|
-
def delete(
|
23
|
-
id
|
24
|
-
Deprecation.warn('Passing an explict location path is ' \
|
25
|
-
'deprecated. Call without arguments instead.')
|
26
|
-
location_path
|
27
|
-
else
|
28
|
-
local_path
|
29
|
-
end
|
30
|
-
storage.delete(id: id)
|
22
|
+
def delete(_location_path = nil)
|
23
|
+
storage.delete(id: local_path)
|
31
24
|
end
|
32
25
|
|
33
26
|
def find_local_filename(collection_id, role, filename)
|
@@ -370,6 +370,7 @@ module Hyrax
|
|
370
370
|
can :manage, curation_concerns_models
|
371
371
|
can :manage, Sipity::WorkflowResponsibility
|
372
372
|
can :manage, :collection_types
|
373
|
+
can :manage, ::FileSet
|
373
374
|
end
|
374
375
|
|
375
376
|
##
|
@@ -418,7 +419,7 @@ module Hyrax
|
|
418
419
|
end
|
419
420
|
|
420
421
|
def curation_concerns_models
|
421
|
-
[::FileSet, Hyrax.config.collection_class] + Hyrax.config.curation_concerns
|
422
|
+
[::FileSet, ::Hyrax::FileSet, Hyrax.config.collection_class] + Hyrax.config.curation_concerns
|
422
423
|
end
|
423
424
|
|
424
425
|
def can_review_submissions?
|
@@ -28,9 +28,11 @@ module Hyrax
|
|
28
28
|
validates :collection_type_gid, presence: true
|
29
29
|
|
30
30
|
# Need to define here in order to override setter defined by ActiveTriples
|
31
|
-
def collection_type_gid=(new_collection_type_gid
|
31
|
+
def collection_type_gid=(new_collection_type_gid)
|
32
32
|
new_collection_type_gid = new_collection_type_gid&.to_s
|
33
|
-
raise "Can't modify collection type of this collection" if
|
33
|
+
raise "Can't modify collection type of this collection" if
|
34
|
+
!Thread.current[:force_collection_type_gid] && # Used by update_collection_type_global_ids rake task
|
35
|
+
persisted? && !collection_type_gid_was.nil? && collection_type_gid_was != new_collection_type_gid
|
34
36
|
new_collection_type = Hyrax::CollectionType.find_by_gid!(new_collection_type_gid)
|
35
37
|
super(new_collection_type_gid)
|
36
38
|
@collection_type = new_collection_type
|
@@ -38,16 +40,6 @@ module Hyrax
|
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
41
|
-
delegate(*Hyrax::CollectionType.settings_attributes, to: :collection_type)
|
42
|
-
ActiveSupport::Deprecation.deprecate_methods(self, *Hyrax::CollectionType.settings_attributes)
|
43
|
-
|
44
|
-
# Get the collection_type when accessed
|
45
|
-
def collection_type
|
46
|
-
Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
|
47
|
-
"Instead, use Hyrax::CollectionType.for(collection: collection).")
|
48
|
-
@collection_type ||= Hyrax::CollectionType.find_by_gid!(collection_type_gid)
|
49
|
-
end
|
50
|
-
|
51
43
|
def collection_type=(new_collection_type)
|
52
44
|
self.collection_type_gid = new_collection_type.to_global_id
|
53
45
|
end
|
@@ -43,8 +43,9 @@ module Hyrax
|
|
43
43
|
# # ./spec/jobs/create_derivatives_job_spec.rb:7:in `block (2 levels) in <top (required)>'
|
44
44
|
#
|
45
45
|
Hydra::Derivatives.source_file_service = Hyrax::LocalFileService
|
46
|
-
Hydra::Derivatives.output_file_service = Hyrax::
|
47
|
-
Hydra::Derivatives::FullTextExtract.output_file_service = Hyrax::PersistDirectlyContainedOutputFileService
|
46
|
+
Hydra::Derivatives.output_file_service = Hyrax::ValkyriePersistDerivatives
|
47
|
+
# Hydra::Derivatives::FullTextExtract.output_file_service = Hyrax::PersistDirectlyContainedOutputFileService
|
48
|
+
Hydra::Derivatives::FullTextExtract.output_file_service = Hyrax::ValkyriePersistDerivatives
|
48
49
|
before_destroy :cleanup_derivatives
|
49
50
|
# This completely overrides the version in Hydra::Works so that we
|
50
51
|
# read and write to a local file. It's important that characterization runs
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Hyrax
|
3
|
+
# Adds file locking to Riiif::File
|
4
|
+
# @see RiiifFileResolver
|
5
|
+
class RiiifFile < Riiif::File
|
6
|
+
include ActiveSupport::Benchmarkable
|
7
|
+
|
8
|
+
attr_reader :id
|
9
|
+
def initialize(input_path, tempfile = nil, id:)
|
10
|
+
super(input_path, tempfile)
|
11
|
+
raise(ArgumentError, "must specify id") if id.blank?
|
12
|
+
@id = id
|
13
|
+
end
|
14
|
+
|
15
|
+
# Wrap extract in a read lock and benchmark it
|
16
|
+
def extract(transformation, image_info = nil)
|
17
|
+
Riiif::Image.file_resolver.file_locks[id].with_read_lock do
|
18
|
+
benchmark "RiiifFile extracted #{path} with #{transformation.to_params}", level: :debug do
|
19
|
+
super
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def logger
|
27
|
+
Hyrax.logger
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -59,7 +59,7 @@ module Hyrax
|
|
59
59
|
##
|
60
60
|
# @return [Boolean]
|
61
61
|
def file_set?
|
62
|
-
hydra_model == ::FileSet
|
62
|
+
hydra_model == ::FileSet || hydra_model == Hyrax::FileSet
|
63
63
|
end
|
64
64
|
|
65
65
|
##
|
@@ -91,9 +91,9 @@ module Hyrax
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def visibility
|
94
|
-
@visibility ||= if
|
94
|
+
@visibility ||= if embargo_enforced?
|
95
95
|
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO
|
96
|
-
elsif
|
96
|
+
elsif lease_enforced?
|
97
97
|
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_LEASE
|
98
98
|
elsif public?
|
99
99
|
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
@@ -108,6 +108,23 @@ module Hyrax
|
|
108
108
|
first(Hyrax.config.collection_type_index_field)
|
109
109
|
end
|
110
110
|
|
111
|
+
def embargo_enforced?
|
112
|
+
return false if embargo_release_date.blank?
|
113
|
+
|
114
|
+
indexed_embargo_visibility = first('visibility_during_embargo_ssim')
|
115
|
+
# if we didn't index an embargo visibility, assume the release date means
|
116
|
+
# it's enforced
|
117
|
+
return true if indexed_embargo_visibility.blank?
|
118
|
+
|
119
|
+
# if the visibility and the visibility during embargo are the same, we're
|
120
|
+
# enforcing the embargo
|
121
|
+
self['visibility_ssi'] == indexed_embargo_visibility
|
122
|
+
end
|
123
|
+
|
124
|
+
def lease_enforced?
|
125
|
+
lease_expiration_date.present?
|
126
|
+
end
|
127
|
+
|
111
128
|
private
|
112
129
|
|
113
130
|
def model_classifier(classifier)
|
@@ -49,7 +49,10 @@ module Hyrax
|
|
49
49
|
# @return [Hyrax::PcdmCollection | ::Collection] an instance of Hyrax::CollectionType with id = the model_id portion of the gid (e.g. 3)
|
50
50
|
# @raise [ActiveRecord::RecordNotFound] if record matching gid is not found
|
51
51
|
def self.for(collection:)
|
52
|
-
|
52
|
+
gid = collection.collection_type_gid
|
53
|
+
gid = gid.first if gid.is_a?(Enumerable)
|
54
|
+
|
55
|
+
find_by_gid!(gid)
|
53
56
|
end
|
54
57
|
|
55
58
|
# Find the collection type associated with the Global Identifier (gid)
|
@@ -67,7 +70,7 @@ module Hyrax
|
|
67
70
|
# @see #gid
|
68
71
|
# @see Hyrax::MultipleMembershipChecker
|
69
72
|
def self.gids_that_do_not_allow_multiple_membership
|
70
|
-
where(allow_multiple_membership: false).map
|
73
|
+
where(allow_multiple_membership: false).map { |c| c.to_global_id.to_s }
|
71
74
|
end
|
72
75
|
|
73
76
|
# Find the collection type associated with the Global Identifier (gid)
|
@@ -95,18 +98,6 @@ module Hyrax
|
|
95
98
|
SETTINGS_ATTRIBUTES
|
96
99
|
end
|
97
100
|
|
98
|
-
##
|
99
|
-
# @deprecation use #to_global_id
|
100
|
-
#
|
101
|
-
# Return the Global Identifier for this collection type.
|
102
|
-
# @return [String, nil] Global Identifier (gid) for this collection_type (e.g. gid://internal/hyrax-collectiontype/3)
|
103
|
-
#
|
104
|
-
# @see https://github.com/rails/globalid#usage
|
105
|
-
def gid
|
106
|
-
Deprecation.warn('use #to_global_id.')
|
107
|
-
to_global_id.to_s if id
|
108
|
-
end
|
109
|
-
|
110
101
|
##
|
111
102
|
# @return [Enumerable<Collection, PcdmCollection>]
|
112
103
|
def collections(use_valkyrie: Hyrax.config.use_valkyrie?)
|