hyrax 3.0.1 → 3.3.0
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 +49 -19
- data/.dassie/.env +1 -2
- data/.dassie/Gemfile +18 -9
- data/.dassie/app/controllers/catalog_controller.rb +6 -0
- data/.dassie/app/models/user.rb +0 -2
- data/.dassie/config/analytics.yml +12 -5
- data/.dassie/config/environments/development.rb +2 -0
- data/.dassie/config/initializers/hyrax.rb +7 -0
- data/.dassie/config/role_map.yml +2 -0
- data/.dassie/db/migrate/20210921150120_enable_uuid_extension.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150121_create_orm_resources.valkyrie_engine.rb +19 -0
- data/.dassie/db/migrate/20210921150122_add_model_type_to_orm_resources.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150123_change_model_type_to_internal_model.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150124_create_path_gin_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150125_create_internal_resource_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150126_create_updated_at_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150127_add_optimistic_locking_to_orm_resources.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20211130181150_create_default_administrative_set.rb +8 -0
- data/.dassie/db/schema.rb +20 -1
- data/.dassie/db/seeds.rb +1 -1
- data/.dockerignore +3 -0
- data/.env +8 -6
- data/.github/workflows/main.yml +17 -0
- data/.github/workflows/release.yml +17 -0
- data/.gitignore +1 -0
- data/.regen +1 -1
- data/.rubocop.yml +4 -0
- data/CONTAINERS.md +33 -10
- data/Dockerfile +14 -9
- data/Gemfile +21 -27
- data/README.md +37 -0
- data/app/actors/hyrax/actors/base_actor.rb +2 -2
- data/app/actors/hyrax/actors/collections_membership_actor.rb +3 -3
- 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/actors/hyrax/actors/file_set_actor.rb +12 -5
- data/app/assets/javascripts/hyrax/admin/graphs.es6 +34 -37
- data/app/assets/javascripts/hyrax/analytics_events.js +69 -0
- data/app/assets/javascripts/hyrax/collapse.js +24 -0
- data/app/assets/javascripts/hyrax/collections.js +1 -2
- data/app/assets/javascripts/hyrax/ga_events.js +2 -8
- data/app/assets/javascripts/hyrax/reports-buttons.js +33 -0
- data/app/assets/javascripts/hyrax.js +2 -1
- data/app/assets/stylesheets/_bootstrap-default-overrides.scss +9 -0
- data/app/assets/stylesheets/hyrax/_styles.scss +5 -0
- data/app/authorities/qa/authorities/collections.rb +4 -5
- data/app/authorities/qa/authorities/find_works.rb +1 -1
- data/app/controllers/concerns/hyrax/breadcrumbs_for_collection_analytics.rb +26 -0
- data/app/controllers/concerns/hyrax/breadcrumbs_for_works_analytics.rb +26 -0
- data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +30 -10
- data/app/controllers/concerns/hyrax/controller.rb +35 -2
- 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/admin_sets_controller.rb +2 -19
- data/app/controllers/hyrax/admin/analytics/analytics_controller.rb +40 -0
- data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +61 -0
- data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +122 -0
- data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +5 -6
- data/app/controllers/hyrax/admin/workflows_controller.rb +8 -2
- data/app/controllers/hyrax/collections_controller.rb +6 -1
- data/app/controllers/hyrax/dashboard/collection_members_controller.rb +24 -17
- data/app/controllers/hyrax/dashboard/collections_controller.rb +112 -37
- data/app/controllers/hyrax/dashboard/nest_collections_controller.rb +75 -39
- data/app/controllers/hyrax/dashboard_controller.rb +8 -0
- data/app/controllers/hyrax/file_sets_controller.rb +49 -13
- data/app/controllers/hyrax/my_controller.rb +4 -4
- data/app/controllers/hyrax/permissions_controller.rb +3 -4
- data/app/controllers/hyrax/stats_controller.rb +3 -1
- data/app/controllers/hyrax/workflow_actions_controller.rb +11 -6
- data/app/forms/hyrax/forms/administrative_set_form.rb +62 -0
- data/app/forms/hyrax/forms/collection_form.rb +9 -5
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +38 -6
- data/app/forms/hyrax/forms/file_set_form.rb +46 -0
- data/app/forms/hyrax/forms/pcdm_collection_form.rb +67 -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 +34 -26
- data/app/forms/hyrax/forms/work_form.rb +5 -2
- data/app/forms/hyrax/forms/workflow_action_form.rb +4 -0
- 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 +16 -5
- data/app/helpers/hyrax/embargo_helper.rb +4 -0
- data/app/helpers/hyrax/file_set_helper.rb +25 -6
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +9 -0
- data/app/helpers/hyrax/lease_helper.rb +4 -0
- data/app/helpers/hyrax/url_helper.rb +4 -1
- data/app/helpers/hyrax/work_form_helper.rb +53 -0
- data/app/indexers/hyrax/administrative_set_indexer.rb +18 -0
- data/app/indexers/hyrax/pcdm_collection_indexer.rb +2 -0
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +3 -1
- data/app/indexers/hyrax/valkyrie_indexer.rb +3 -3
- data/app/indexers/hyrax/valkyrie_work_indexer.rb +1 -1
- 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/characterize_job.rb +28 -1
- data/app/jobs/ingest_local_file_job.rb +18 -2
- data/app/jobs/inherit_permissions_job.rb +9 -5
- data/app/jobs/valkyrie_ingest_job.rb +56 -0
- data/app/models/admin_set.rb +22 -30
- data/app/models/collection_branding_info.rb +25 -9
- data/app/models/concerns/hyrax/ability/admin_set_ability.rb +31 -7
- data/app/models/concerns/hyrax/ability/collection_ability.rb +35 -20
- data/app/models/concerns/hyrax/ability/collection_type_ability.rb +1 -1
- data/app/models/concerns/hyrax/ability.rb +31 -8
- data/app/models/concerns/hyrax/collection_behavior.rb +17 -44
- data/app/models/concerns/hyrax/embargoable.rb +24 -0
- data/app/models/concerns/hyrax/file_set/characterization.rb +18 -12
- data/app/models/concerns/hyrax/solr_document/metadata.rb +1 -0
- data/app/models/concerns/hyrax/solr_document_behavior.rb +11 -54
- data/app/models/concerns/hyrax/suppressible.rb +5 -0
- data/app/models/concerns/hyrax/user.rb +9 -3
- data/app/models/concerns/hyrax/work_behavior.rb +1 -1
- data/app/models/file_download_stat.rb +4 -4
- data/app/models/hyrax/administrative_set.rb +7 -1
- data/app/models/hyrax/default_administrative_set.rb +42 -0
- data/app/models/hyrax/file_set.rb +6 -0
- data/app/models/hyrax/pcdm_collection.rb +1 -0
- data/app/models/hyrax/permission.rb +1 -1
- data/app/models/hyrax/permission_template.rb +112 -12
- data/app/models/hyrax/statistic.rb +31 -4
- data/app/models/hyrax/virus_scanner.rb +27 -18
- data/app/models/hyrax/work.rb +1 -0
- data/app/models/hyrax/workflow_action_info.rb +16 -0
- data/app/models/sipity/agent.rb +1 -0
- data/app/models/sipity/comment.rb +17 -0
- data/app/models/sipity/entity.rb +30 -8
- data/app/models/sipity/workflow.rb +1 -0
- data/app/models/sipity.rb +53 -2
- data/app/presenters/hyrax/admin/dashboard_presenter.rb +8 -6
- data/app/presenters/hyrax/admin/repository_growth_presenter.rb +10 -5
- data/app/presenters/hyrax/admin/user_activity_presenter.rb +8 -12
- data/app/presenters/hyrax/admin_set_options_presenter.rb +12 -8
- data/app/presenters/hyrax/admin_set_presenter.rb +13 -4
- data/app/presenters/hyrax/admin_set_selection_presenter.rb +116 -0
- data/app/presenters/hyrax/collection_presenter.rb +34 -9
- data/app/presenters/hyrax/file_set_presenter.rb +8 -1
- data/app/presenters/hyrax/file_usage.rb +3 -2
- data/app/presenters/hyrax/menu_presenter.rb +4 -0
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +119 -0
- 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 +37 -8
- data/app/presenters/hyrax/work_usage.rb +6 -3
- data/app/renderers/hyrax/renderers/attribute_renderer.rb +10 -2
- data/app/search_builders/hyrax/README.md +1 -1
- data/app/search_builders/hyrax/abstract_type_relation.rb +4 -2
- data/app/search_builders/hyrax/admin_set_search_builder.rb +1 -1
- data/app/search_builders/hyrax/collection_member_search_builder.rb +6 -1
- data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +1 -1
- data/app/search_builders/hyrax/exposed_models_relation.rb +1 -1
- data/app/search_builders/hyrax/filter_by_type.rb +1 -2
- data/app/search_builders/hyrax/my/collections_search_builder.rb +2 -2
- data/app/search_builders/hyrax/nested_collections_parent_search_builder.rb +1 -1
- data/app/search_builders/hyrax/single_collection_search_builder.rb +1 -1
- data/app/services/hyrax/admin_set_create_service.rb +199 -53
- data/app/services/hyrax/analytics/google/events.rb +37 -0
- data/app/services/hyrax/analytics/google/events_daily.rb +72 -0
- data/app/services/hyrax/analytics/google/visits.rb +44 -0
- data/app/services/hyrax/analytics/google/visits_daily.rb +49 -0
- data/app/services/hyrax/analytics/google.rb +204 -0
- data/app/services/hyrax/analytics/matomo.rb +193 -0
- data/app/services/hyrax/analytics/results.rb +79 -0
- data/app/services/hyrax/analytics.rb +12 -82
- data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +134 -0
- data/app/services/hyrax/collection_types/permissions_service.rb +1 -1
- data/app/services/hyrax/collections/collection_member_search_service.rb +72 -0
- data/app/services/hyrax/collections/collection_member_service.rb +122 -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 +10 -3
- data/app/services/hyrax/collections/permissions_create_service.rb +82 -78
- data/app/services/hyrax/collections/permissions_service.rb +1 -1
- data/app/services/hyrax/contextual_path.rb +24 -1
- data/app/services/hyrax/curation_concern.rb +24 -2
- 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/default_middleware_stack.rb +11 -0
- data/app/services/hyrax/edit_permissions_service.rb +74 -41
- data/app/services/hyrax/ensure_well_formed_admin_set_service.rb +3 -3
- data/app/services/hyrax/find_objects_via_solr_service.rb +31 -0
- data/app/services/hyrax/listeners/acl_index_listener.rb +3 -1
- data/app/services/hyrax/listeners/active_fedora_acl_index_listener.rb +4 -1
- data/app/services/hyrax/listeners/batch_notification_listener.rb +3 -1
- data/app/services/hyrax/listeners/file_metadata_listener.rb +19 -0
- data/app/services/hyrax/listeners/file_set_lifecycle_listener.rb +6 -2
- data/app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb +6 -2
- data/app/services/hyrax/listeners/member_cleanup_listener.rb +3 -0
- data/app/services/hyrax/listeners/metadata_index_listener.rb +33 -11
- data/app/services/hyrax/listeners/object_lifecycle_listener.rb +9 -3
- data/app/services/hyrax/listeners/proxy_deposit_listener.rb +3 -1
- data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +3 -0
- data/app/services/hyrax/listeners/workflow_listener.rb +3 -1
- data/app/services/hyrax/listeners.rb +8 -0
- data/app/services/hyrax/multiple_membership_checker.rb +53 -29
- data/app/services/hyrax/permission_manager.rb +4 -4
- data/app/services/hyrax/resource_status.rb +7 -0
- data/app/services/hyrax/restriction_service.rb +4 -0
- data/app/services/hyrax/search_service.rb +4 -2
- data/app/services/hyrax/solr_query_builder_service.rb +45 -8
- data/app/services/hyrax/solr_query_service.rb +224 -0
- data/app/services/hyrax/solr_service.rb +9 -2
- data/app/services/hyrax/statistics/collections/over_time.rb +2 -1
- data/app/services/hyrax/statistics/depositors/summary.rb +2 -1
- data/app/services/hyrax/statistics/users/over_time.rb +8 -5
- data/app/services/hyrax/statistics/works/over_time.rb +10 -0
- data/app/services/hyrax/visibility_intention.rb +20 -2
- data/app/services/hyrax/work_uploads_handler.rb +21 -3
- data/app/services/hyrax/workflow/abstract_notification.rb +2 -2
- data/app/services/hyrax/workflow/action_taken_service.rb +16 -4
- data/app/services/hyrax/workflow/actionable_objects.rb +70 -0
- data/app/services/hyrax/workflow/activate_object.rb +5 -4
- data/app/services/hyrax/workflow/changes_required_notification.rb +5 -4
- data/app/services/hyrax/workflow/deactivate_object.rb +7 -5
- data/app/services/hyrax/workflow/deposited_notification.rb +8 -4
- data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +7 -3
- data/app/services/hyrax/workflow/grant_read_to_depositor.rb +10 -3
- data/app/services/hyrax/workflow/object_in_workflow_decorator.rb +31 -0
- data/app/services/hyrax/workflow/revoke_edit_from_depositor.rb +8 -2
- data/app/services/hyrax/workflow/status_list_service.rb +43 -13
- data/app/services/hyrax/workflow/workflow_action_service.rb +4 -1
- data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
- data/app/views/hyrax/admin/analytics/_date_range_form.html.erb +11 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_custom_range.html.erb +39 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_monthly_summary.html.erb +48 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_summary.html.erb +55 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +55 -0
- data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +70 -0
- data/app/views/hyrax/admin/analytics/collection_reports/show.html.erb +94 -0
- data/app/views/hyrax/admin/analytics/work_reports/_custom_range.html.erb +43 -0
- data/app/views/hyrax/admin/analytics/work_reports/_monthly_summary.html.erb +35 -0
- data/app/views/hyrax/admin/analytics/work_reports/_summary.html.erb +60 -0
- data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +33 -0
- data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +40 -0
- data/app/views/hyrax/admin/analytics/work_reports/_work_counts.html.erb +18 -0
- data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +41 -0
- data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +77 -0
- data/app/views/hyrax/admin/analytics/work_reports/show.html.erb +90 -0
- data/app/views/hyrax/admin/stats/show.html.erb +1 -1
- data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
- 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/_form_visibility_error.html.erb +2 -0
- data/app/views/hyrax/base/_guts4form.html.erb +3 -3
- data/app/views/hyrax/base/_relationships_parent_row.html.erb +0 -1
- data/app/views/hyrax/base/_representative_media.html.erb +1 -1
- data/app/views/hyrax/base/_show_actions.html.erb +2 -2
- data/app/views/hyrax/base/_work_button_row.html.erb +1 -1
- data/app/views/hyrax/base/show.html.erb +6 -0
- data/app/views/hyrax/batch_uploads/_form.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +4 -0
- data/app/views/hyrax/dashboard/_repository_growth.html.erb +5 -5
- data/app/views/hyrax/dashboard/_resource_type_graph.html.erb +41 -0
- data/app/views/hyrax/dashboard/_sidebar.html.erb +4 -1
- data/app/views/hyrax/dashboard/_tabs.html.erb +11 -0
- data/app/views/hyrax/dashboard/_user_activity.html.erb +17 -23
- data/app/views/hyrax/dashboard/_user_activity_graph.html.erb +55 -0
- data/app/views/hyrax/dashboard/_visibility_graph.html.erb +31 -0
- data/app/views/hyrax/dashboard/_work_type_graph.html.erb +41 -0
- data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form.html.erb +6 -5
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_sort_and_per_page.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/dashboard/show_admin.html.erb +24 -45
- data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +22 -0
- data/app/views/hyrax/file_sets/_actions.html.erb +4 -3
- 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 +7 -1
- data/app/views/hyrax/homepage/index.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/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +1 -1
- data/app/views/hyrax/my/collections/index.html.erb +1 -1
- data/app/views/hyrax/stats/_downloads.html.erb +18 -0
- data/app/views/hyrax/stats/_pageviews.html.erb +18 -0
- data/app/views/hyrax/stats/work.html.erb +17 -9
- data/app/views/layouts/_head_tag_content.html.erb +7 -2
- data/app/views/layouts/hyrax/dashboard.html.erb +1 -0
- data/app/views/layouts/hyrax.html.erb +1 -0
- data/app/views/{_ga.html.erb → shared/_ga.html.erb} +3 -7
- data/app/views/shared/_matomo.html.erb +15 -0
- data/app/views/shared/_read_only.html.erb +5 -0
- data/bin/db-migrate-seed.sh +3 -1
- data/bin/hyrax-entrypoint.sh +0 -14
- data/bin/solrcloud-assign-configset.sh +11 -3
- data/bin/solrcloud-upload-configset.sh +17 -6
- data/chart/hyrax/Chart.yaml +9 -5
- data/chart/hyrax/README.md +52 -5
- data/chart/hyrax/templates/_helpers.tpl +15 -1
- data/chart/hyrax/templates/branding-pvc.yaml +2 -2
- data/chart/hyrax/templates/configmap-env.yaml +6 -2
- data/chart/hyrax/templates/deployment-worker.yaml +42 -5
- data/chart/hyrax/templates/deployment.yaml +53 -0
- data/chart/hyrax/templates/derivatives-pvc.yaml +2 -2
- data/chart/hyrax/templates/ingress.yaml +13 -4
- data/chart/hyrax/templates/secrets.yaml +8 -0
- data/chart/hyrax/templates/uploads-pvc.yaml +2 -2
- data/chart/hyrax/values.yaml +84 -2
- data/config/brakeman.ignore +2 -2
- data/config/features.rb +3 -0
- data/config/i18n-tasks.yml +2 -2
- data/config/initializers/1_healthz.rb +1 -0
- data/config/initializers/listeners.rb +5 -4
- data/config/initializers/valkryrie_storage.rb +7 -0
- data/config/locales/hyrax.de.yml +195 -1
- data/config/locales/hyrax.en.yml +192 -13
- data/config/locales/hyrax.es.yml +195 -1
- data/config/locales/hyrax.fr.yml +195 -1
- data/config/locales/hyrax.it.yml +195 -1
- data/config/locales/hyrax.pt-BR.yml +195 -1
- data/config/locales/hyrax.zh.yml +195 -1
- data/config/routes.rb +4 -0
- data/db/seeds.rb +1 -1
- data/docker-compose.yml +42 -9
- data/documentation/developing-your-hyrax-based-app.md +4 -4
- data/documentation/legacyREADME.md +4 -4
- data/hyrax.gemspec +4 -2
- data/lib/generators/hyrax/templates/catalog_controller.rb +3 -1
- data/lib/generators/hyrax/templates/config/analytics.yml +13 -7
- data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +15 -13
- data/lib/generators/hyrax/templates/db/migrate/20211130181150_create_default_administrative_set.rb.erb +8 -0
- data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +4 -2
- data/lib/generators/hyrax/work_resource/templates/indexer_spec.rb.erb +1 -0
- data/lib/hyrax/active_fedora_dummy_model.rb +62 -0
- data/lib/hyrax/collection_name.rb +6 -2
- data/lib/hyrax/configuration.rb +114 -4
- data/lib/hyrax/engine.rb +9 -6
- data/lib/hyrax/errors.rb +2 -0
- data/lib/hyrax/form_fields.rb +1 -0
- data/lib/hyrax/publisher.rb +16 -0
- data/lib/hyrax/resource_name.rb +1 -0
- data/lib/hyrax/resource_sync/change_list_writer.rb +2 -2
- data/lib/hyrax/resource_sync/resource_list_writer.rb +2 -2
- data/lib/hyrax/specs/capybara.rb +5 -3
- data/lib/hyrax/specs/shared_specs/hydra_works.rb +2 -0
- data/lib/hyrax/specs/shared_specs/indexers.rb +6 -0
- data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +9 -0
- data/lib/hyrax/transactions/admin_set_create.rb +22 -0
- data/lib/hyrax/transactions/collection_create.rb +25 -0
- data/lib/hyrax/transactions/collection_update.rb +20 -0
- data/lib/hyrax/transactions/container.rb +58 -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_collections.rb +13 -1
- data/lib/hyrax/transactions/steps/add_to_parent.rb +36 -0
- data/lib/hyrax/transactions/steps/apply_collection_type_permissions.rb +29 -0
- data/lib/hyrax/transactions/steps/remove_file_set_from_work.rb +47 -0
- data/lib/hyrax/transactions/steps/save.rb +18 -6
- data/lib/hyrax/transactions/steps/set_collection_type_gid.rb +35 -0
- data/lib/hyrax/transactions/work_create.rb +2 -1
- data/lib/hyrax/valkyrie_can_can_adapter.rb +1 -0
- data/lib/hyrax/valkyrie_simple_path_generator.rb +20 -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/default_admin_set.rake +12 -11
- data/lib/tasks/regenerate_derivatives.rake +12 -0
- data/lib/wings/active_fedora_converter/default_work.rb +15 -0
- data/lib/wings/model_transformer.rb +17 -1
- data/lib/wings/orm_converter.rb +18 -2
- data/lib/wings/setup.rb +17 -0
- data/lib/wings/valkyrie/persister.rb +16 -0
- data/lib/wings/valkyrie/storage.rb +56 -1
- data/lib/wings.rb +0 -21
- data/template.rb +1 -1
- data/vendor/assets/javascripts/morris/morris.min.js +1 -7
- data/vendor/assets/stylesheets/morris.js/0.5.1/morris.css +1 -1
- metadata +120 -17
- data/app/views/hyrax/dashboard/_repository_objects.html.erb +0 -28
@@ -6,13 +6,17 @@ module Hyrax
|
|
6
6
|
# Listens for events related to Hydra Works FileSets
|
7
7
|
class FileSetLifecycleListener
|
8
8
|
##
|
9
|
-
#
|
9
|
+
# Called when 'file.set.attached' event is published
|
10
|
+
# @param [Dry::Events::Event] event
|
11
|
+
# @return [void]
|
10
12
|
def on_file_set_attached(event)
|
11
13
|
FileSetAttachedEventJob.perform_later(event[:file_set], event[:user])
|
12
14
|
end
|
13
15
|
|
14
16
|
##
|
15
|
-
#
|
17
|
+
# Called when 'file.set.restored' event is published
|
18
|
+
# @param [Dry::Events::Event] event
|
19
|
+
# @return [void]
|
16
20
|
def on_file_set_restored(event)
|
17
21
|
ContentRestoredVersionEventJob
|
18
22
|
.perform_later(event[:file_set], event[:user], event[:revision])
|
@@ -9,7 +9,9 @@ module Hyrax
|
|
9
9
|
##
|
10
10
|
# Send a notification to the depositor for failed checksum audits.
|
11
11
|
#
|
12
|
-
#
|
12
|
+
# Called when 'file.set.audited' event is published
|
13
|
+
# @param [Dry::Events::Event] event
|
14
|
+
# @return [void]
|
13
15
|
def on_file_set_audited(event)
|
14
16
|
return unless event[:result] == :failure # do nothing on success
|
15
17
|
|
@@ -24,7 +26,9 @@ module Hyrax
|
|
24
26
|
# Send a notification to the depositing user for FileSet url import
|
25
27
|
# failures.
|
26
28
|
#
|
27
|
-
#
|
29
|
+
# Called when 'file.set.url.imported' event is published
|
30
|
+
# @param [Dry::Events::Event] event
|
31
|
+
# @return [void]
|
28
32
|
def on_file_set_url_imported(event)
|
29
33
|
Hyrax::ImportUrlFailureService.new(event[:file_set], event[:user]).call if
|
30
34
|
event[:result] == :failure
|
@@ -5,6 +5,9 @@ module Hyrax
|
|
5
5
|
##
|
6
6
|
# Listens for object deleted events and cleans up associated members
|
7
7
|
class MemberCleanupListener
|
8
|
+
# Called when 'object.deleted' event is published
|
9
|
+
# @param [Dry::Events::Event] event
|
10
|
+
# @return [void]
|
8
11
|
def on_object_deleted(event)
|
9
12
|
return unless event.payload.key?(:object) # legacy callback
|
10
13
|
return if event[:object].is_a?(ActiveFedora::Base) # handled by legacy code
|
@@ -14,30 +14,52 @@ module Hyrax
|
|
14
14
|
##
|
15
15
|
# Re-index the resource.
|
16
16
|
#
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
# Called when 'collection.metadata.updated' event is published
|
18
|
+
# @param [Dry::Events::Event] event
|
19
|
+
# @return [void]
|
20
|
+
def on_collection_metadata_updated(event)
|
21
|
+
return unless resource? event[:collection]
|
22
|
+
Hyrax.index_adapter.save(resource: event[:collection])
|
23
|
+
end
|
21
24
|
|
25
|
+
##
|
26
|
+
# Re-index the resource.
|
27
|
+
#
|
28
|
+
# Called when 'object.metadata.updated' event is published
|
29
|
+
# @param [Dry::Events::Event] event
|
30
|
+
# @return [void]
|
31
|
+
def on_object_metadata_updated(event)
|
32
|
+
return unless resource? event[:object]
|
22
33
|
Hyrax.index_adapter.save(resource: event[:object])
|
23
34
|
end
|
24
35
|
|
25
36
|
##
|
26
37
|
# Remove the resource from the index.
|
27
38
|
#
|
28
|
-
#
|
39
|
+
# Called when 'object.deleted' event is published
|
40
|
+
# @param [Dry::Events::Event] event
|
41
|
+
# @return [void]
|
29
42
|
def on_object_deleted(event)
|
30
|
-
|
31
|
-
event.payload[:object].is_a?(Valkyrie::Resource)
|
32
|
-
|
43
|
+
return unless resource?(event.payload[:object])
|
33
44
|
Hyrax.index_adapter.delete(resource: event[:object])
|
34
45
|
end
|
35
46
|
|
36
47
|
private
|
37
48
|
|
38
|
-
def
|
39
|
-
|
40
|
-
|
49
|
+
def resource?(resource)
|
50
|
+
return true if resource.is_a? Valkyrie::Resource
|
51
|
+
log_non_resource(resource)
|
52
|
+
false
|
53
|
+
end
|
54
|
+
|
55
|
+
def log_non_resource(resource)
|
56
|
+
generic_type = resource_generic_type(resource)
|
57
|
+
Hyrax.logger.info("Skipping #{generic_type} reindex because the " \
|
58
|
+
"#{generic_type} #{resource} was not a Valkyrie::Resource.")
|
59
|
+
end
|
60
|
+
|
61
|
+
def resource_generic_type(resource)
|
62
|
+
resource.try(:collection?) ? 'collection' : 'object'
|
41
63
|
end
|
42
64
|
end
|
43
65
|
end
|
@@ -6,19 +6,25 @@ module Hyrax
|
|
6
6
|
# Listens for events related to the PCDM Object lifecycles.
|
7
7
|
class ObjectLifecycleListener
|
8
8
|
##
|
9
|
-
#
|
9
|
+
# Called when 'object.deleted' event is published
|
10
|
+
# @param [Dry::Events::Event] event
|
11
|
+
# @return [void]
|
10
12
|
def on_object_deleted(event)
|
11
13
|
ContentDeleteEventJob.perform_later(event[:id].to_s, event[:user])
|
12
14
|
end
|
13
15
|
|
14
16
|
##
|
15
|
-
#
|
17
|
+
# Called when 'object.deposited' event is published
|
18
|
+
# @param [Dry::Events::Event] event
|
19
|
+
# @return [void]
|
16
20
|
def on_object_deposited(event)
|
17
21
|
ContentDepositEventJob.perform_later(event[:object], event[:user])
|
18
22
|
end
|
19
23
|
|
20
24
|
##
|
21
|
-
#
|
25
|
+
# Called when 'object.metadata.updated' event is published
|
26
|
+
# @param [Dry::Events::Event] event
|
27
|
+
# @return [void]
|
22
28
|
def on_object_metadata_updated(event)
|
23
29
|
ContentUpdateEventJob.perform_later(event[:object], event[:user])
|
24
30
|
end
|
@@ -7,7 +7,9 @@ module Hyrax
|
|
7
7
|
# deposits an item `on_behalf_of` another, ensures transfer is handled.
|
8
8
|
class ProxyDepositListener
|
9
9
|
##
|
10
|
-
#
|
10
|
+
# Called when 'object.deposited' event is published
|
11
|
+
# @param [Dry::Events::Event] event
|
12
|
+
# @return [void]
|
11
13
|
def on_object_deposited(event)
|
12
14
|
return if event[:object].try(:on_behalf_of).blank? ||
|
13
15
|
(event[:object].on_behalf_of == event[:object].depositor)
|
@@ -5,6 +5,9 @@ module Hyrax
|
|
5
5
|
##
|
6
6
|
# Listens for object deleted events and cleans up associated members
|
7
7
|
class TrophyCleanupListener
|
8
|
+
# Called when 'object.deleted' event is published
|
9
|
+
# @param [Dry::Events::Event] event
|
10
|
+
# @return [void]
|
8
11
|
def on_object_deleted(event)
|
9
12
|
Trophy.where(work_id: event[:id]).destroy_all
|
10
13
|
rescue StandardError => err
|
@@ -21,7 +21,9 @@ module Hyrax
|
|
21
21
|
end
|
22
22
|
|
23
23
|
##
|
24
|
-
#
|
24
|
+
# Called when 'object.deposited' event is published
|
25
|
+
# @param [Dry::Events::Event] event
|
26
|
+
# @return [void]
|
25
27
|
def on_object_deposited(event)
|
26
28
|
return Rails.logger.warn("Skipping workflow initialization for #{event[:object]}; no user is given\n\t#{event}") if
|
27
29
|
event[:user].blank?
|
@@ -7,11 +7,19 @@ module Hyrax
|
|
7
7
|
#
|
8
8
|
# You may need to register a listener as autoload. See
|
9
9
|
# ./app/services/hyrax/listeners.rb
|
10
|
+
#
|
11
|
+
# When an instance of a listener class is registered with
|
12
|
+
# Dry::Events::Publisher#subscribe, its method(s) will be called when a event
|
13
|
+
# is published that maps to the method name using the pattern:
|
14
|
+
# on_event_fired => 'event.fired'
|
15
|
+
#
|
16
|
+
# @see https://dry-rb.org/gems/dry-events/0.2/#event-listeners
|
10
17
|
module Listeners
|
11
18
|
extend ActiveSupport::Autoload
|
12
19
|
|
13
20
|
autoload :AclIndexListener
|
14
21
|
autoload :BatchNotificationListener
|
22
|
+
autoload :FileMetadataListener
|
15
23
|
autoload :FileSetLifecycleListener
|
16
24
|
autoload :FileSetLifecycleNotificationListener
|
17
25
|
autoload :MemberCleanupListener
|
@@ -6,8 +6,7 @@ module Hyrax
|
|
6
6
|
class MultipleMembershipChecker
|
7
7
|
attr_reader :item
|
8
8
|
|
9
|
-
# @param [#member_of_collection_ids] item an object that belongs to
|
10
|
-
# collections
|
9
|
+
# @param [#member_of_collection_ids] item an object that belongs to collections
|
11
10
|
def initialize(item:)
|
12
11
|
@item = item
|
13
12
|
end
|
@@ -20,53 +19,78 @@ module Hyrax
|
|
20
19
|
# `allow_multiple_membership` as `false` require that its members do not
|
21
20
|
# also belong to other collections of the same type.
|
22
21
|
#
|
23
|
-
# There are two contexts in which memberships are checked: when doing a
|
24
|
-
# wholesale replacement and when making an incremental change, such as
|
25
|
-
# adding a single collection membership to an object. In the former case,
|
26
|
-
# `#check` only scans the passed-in collection identifiers. In the latter,
|
27
|
-
# `#check` must also scan the collections to which an object currently
|
28
|
-
# belongs for potential conflicts.
|
29
|
-
#
|
30
22
|
# @param collection_ids [Array<String>] a list of collection identifiers
|
31
|
-
# @param include_current_members [Boolean]
|
32
|
-
#
|
23
|
+
# @param include_current_members [Boolean] if true, include item's existing
|
24
|
+
# collections in check; else if false, check passed in collections only
|
25
|
+
# * use `false` when collection_ids includes proposed new collections and existing
|
26
|
+
# collections (@see Hyrax::Actors::CollectionsMembershipActor #valid_membership?)
|
27
|
+
# * use `true` when collection_ids includes proposed new collections only
|
28
|
+
# (@see Hyrax::Collections::CollectionMemberService #add_member)
|
33
29
|
#
|
34
30
|
# @return [nil, String] nil if no conflicts; an error message string if so
|
35
31
|
def check(collection_ids:, include_current_members: false)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
collections_to_check =
|
42
|
-
|
43
|
-
|
44
|
-
problematic_collections = collections_to_check.uniq(&:id)
|
45
|
-
.group_by(&:collection_type_gid)
|
46
|
-
.select { |_gid, list| list.count > 1 }
|
47
|
-
return if problematic_collections.blank?
|
32
|
+
return unless single_membership_collection_types_exist?
|
33
|
+
|
34
|
+
proposed_single_membership_collections = filter_to_single_membership_collections(collection_ids)
|
35
|
+
return if proposed_single_membership_collections.blank?
|
36
|
+
|
37
|
+
collections_to_check = collections_to_check(proposed_single_membership_collections,
|
38
|
+
include_current_members)
|
39
|
+
problematic_collections = check_collections(collections_to_check)
|
48
40
|
build_error_message(problematic_collections)
|
49
41
|
end
|
50
42
|
|
51
43
|
private
|
52
44
|
|
53
|
-
def
|
45
|
+
def single_membership_collection_types_exist?
|
46
|
+
single_membership_collection_types_gids.present?
|
47
|
+
end
|
48
|
+
|
49
|
+
def single_membership_collection_types_gids
|
50
|
+
@single_membership_collection_types_gids ||=
|
51
|
+
Hyrax::CollectionType.gids_that_do_not_allow_multiple_membership&.map(&:to_s)
|
52
|
+
end
|
53
|
+
|
54
|
+
def filter_to_single_membership_collections(collection_ids)
|
54
55
|
return [] if collection_ids.blank?
|
56
|
+
field_pairs = {
|
57
|
+
Hyrax.config.collection_type_index_field.to_sym => single_membership_collection_types_gids
|
58
|
+
}
|
59
|
+
Hyrax::SolrQueryService.new
|
60
|
+
.with_generic_type(generic_type: "Collection")
|
61
|
+
.with_ids(ids: Array[collection_ids])
|
62
|
+
.with_field_pairs(field_pairs: field_pairs, join_with: ' OR ')
|
63
|
+
.get_objects(use_valkyrie: true).to_a
|
64
|
+
end
|
55
65
|
|
56
|
-
|
66
|
+
def collections_to_check(proposed, include_current_members)
|
67
|
+
# ActorStack does a wholesale collection membership replacement, such that
|
68
|
+
# proposed collections include existing and new collections. Parameter
|
69
|
+
# `include_current_members` will be false when coming from the actor stack
|
70
|
+
# to prevent member items being passed in and then added here as well.
|
71
|
+
return proposed unless include_current_members
|
72
|
+
proposed | filter_to_single_membership_collections(item.member_of_collection_ids)
|
57
73
|
end
|
58
74
|
|
59
|
-
def
|
60
|
-
|
75
|
+
def check_collections(collections_to_check)
|
76
|
+
# uniq insures we include a collection only once when it is in the list multiple
|
77
|
+
# group_by groups collections of the same collection type together
|
78
|
+
# select keeps only collection type groups that have more than one collection
|
79
|
+
# of the single collection type
|
80
|
+
collections_to_check.uniq(&:id)
|
81
|
+
.group_by(&:collection_type_gid)
|
82
|
+
.select { |_gid, list| list.count > 1 }
|
61
83
|
end
|
62
84
|
|
63
85
|
def build_error_message(problematic_collections)
|
86
|
+
return if problematic_collections.blank?
|
64
87
|
error_message_clauses = problematic_collections.map do |gid, list|
|
65
88
|
I18n.t('hyrax.admin.collection_types.multiple_membership_checker.error_type_and_collections',
|
66
89
|
type: collection_type_title_from_gid(gid),
|
67
90
|
collections: collection_titles_from_list(list))
|
68
91
|
end
|
69
|
-
"#{I18n.t('hyrax.admin.collection_types.multiple_membership_checker.error_preamble')}
|
92
|
+
"#{I18n.t('hyrax.admin.collection_types.multiple_membership_checker.error_preamble')}" \
|
93
|
+
"#{error_message_clauses.join('; ')}"
|
70
94
|
end
|
71
95
|
|
72
96
|
def collection_type_title_from_gid(gid)
|
@@ -74,7 +98,7 @@ module Hyrax
|
|
74
98
|
end
|
75
99
|
|
76
100
|
def collection_titles_from_list(collection_list)
|
77
|
-
collection_list.
|
101
|
+
collection_list.map do |collection|
|
78
102
|
collection.title.first
|
79
103
|
end.to_sentence
|
80
104
|
end
|
@@ -143,7 +143,7 @@ module Hyrax
|
|
143
143
|
def groups_for(mode:)
|
144
144
|
Enumerator.new do |yielder|
|
145
145
|
acl.permissions.each do |permission|
|
146
|
-
next unless permission.mode == mode
|
146
|
+
next unless permission.mode.to_sym == mode
|
147
147
|
next unless permission.agent.starts_with?(Hyrax::Group.name_prefix)
|
148
148
|
yielder << permission.agent.gsub(Hyrax::Group.name_prefix, '')
|
149
149
|
end
|
@@ -154,7 +154,7 @@ module Hyrax
|
|
154
154
|
groups = groups.map(&:to_s)
|
155
155
|
|
156
156
|
acl.permissions.each do |permission|
|
157
|
-
next unless permission.mode == mode
|
157
|
+
next unless permission.mode.to_sym == mode
|
158
158
|
next unless permission.agent.starts_with?(Hyrax::Group.name_prefix)
|
159
159
|
|
160
160
|
group_name = permission.agent.gsub(Hyrax::Group.name_prefix, '')
|
@@ -175,7 +175,7 @@ module Hyrax
|
|
175
175
|
end
|
176
176
|
|
177
177
|
acl.permissions.each do |permission|
|
178
|
-
next unless permission.mode == mode
|
178
|
+
next unless permission.mode.to_sym == mode
|
179
179
|
next if permission.agent.starts_with?(Hyrax::Group.name_prefix)
|
180
180
|
next if users.include? permission.agent
|
181
181
|
|
@@ -189,7 +189,7 @@ module Hyrax
|
|
189
189
|
def users_for(mode:)
|
190
190
|
Enumerator.new do |yielder|
|
191
191
|
acl.permissions.each do |permission|
|
192
|
-
next unless permission.mode == mode
|
192
|
+
next unless permission.mode.to_sym == mode
|
193
193
|
next if permission.agent.starts_with?(Hyrax::Group.name_prefix)
|
194
194
|
yielder << permission.agent
|
195
195
|
end
|
@@ -36,6 +36,13 @@ module Hyrax
|
|
36
36
|
self.resource = resource
|
37
37
|
end
|
38
38
|
|
39
|
+
##
|
40
|
+
# @param [#state] resource
|
41
|
+
# @return [Boolean]
|
42
|
+
def self.inactive?(resource:)
|
43
|
+
new(resource: resource).inactive?
|
44
|
+
end
|
45
|
+
|
39
46
|
##
|
40
47
|
# @return [Boolean]
|
41
48
|
# @raise [NoMethodError] if the resource doesn't have a state attribute
|
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# SearchService returns search results from the repository
|
4
3
|
module Hyrax
|
5
|
-
|
4
|
+
##
|
5
|
+
# Returns search results from the repository.
|
6
|
+
#
|
7
|
+
# @note Adapted from Blacklight 7
|
6
8
|
class SearchService
|
7
9
|
def initialize(config:, user_params: nil, search_builder_class: config.search_builder_class, **context)
|
8
10
|
@blacklight_config = config
|
@@ -1,37 +1,74 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Hyrax
|
3
|
+
##
|
4
|
+
# @deprecated
|
5
|
+
# This class is being replaced by Hyrax::SolrQueryService.
|
6
|
+
#
|
3
7
|
# Methods in this class are from/based on ActiveFedora::SolrQueryBuilder
|
8
|
+
#
|
9
|
+
# @see Hyrax::SolrQueryService
|
4
10
|
class SolrQueryBuilderService
|
5
11
|
class << self
|
6
12
|
# Construct a solr query for a list of ids
|
7
13
|
# This is used to get a solr response based on the list of ids in an object's RELS-EXT relationhsips
|
8
14
|
# If the id_array is empty, defaults to a query of "id:NEVER_USE_THIS_ID", which will return an empty solr response
|
9
15
|
# @param [Array] id_array the ids that you want included in the query
|
16
|
+
# @return [String] a solr query
|
17
|
+
# @example
|
18
|
+
# construct_query_for_ids(['a1', 'b2'])
|
19
|
+
# # => "{!terms f=id}a1,b2"
|
20
|
+
# @deprecated
|
10
21
|
def construct_query_for_ids(id_array)
|
22
|
+
Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
|
23
|
+
"Instead, use 'Hyrax::SolrQueryService.new.with_ids'.")
|
11
24
|
ids = id_array.reject(&:blank?)
|
12
25
|
return "id:NEVER_USE_THIS_ID" if ids.empty?
|
13
|
-
|
26
|
+
Hyrax::SolrQueryService.new.with_ids(ids: id_array).build
|
14
27
|
end
|
15
28
|
|
16
29
|
# Construct a solr query from a list of pairs (e.g. [field name, values])
|
17
|
-
# @param [
|
18
|
-
# @param [String] join_with
|
19
|
-
# @param [String] type
|
30
|
+
# @param [Hash] field_pairs a list of pairs of property name and values
|
31
|
+
# @param [String] join_with the value we're joining the clauses with (default: ' AND ')
|
32
|
+
# @param [String] type of query to run. Either 'raw' or 'field' (default: 'field')
|
20
33
|
# @return [String] a solr query
|
21
34
|
# @example
|
22
35
|
# construct_query([['library_id_ssim', '123'], ['owner_ssim', 'Fred']])
|
23
36
|
# # => "_query_:\"{!field f=library_id_ssim}123\" AND _query_:\"{!field f=owner_ssim}Fred\""
|
37
|
+
# @deprecated
|
24
38
|
def construct_query(field_pairs, join_with = default_join_with, type = 'field')
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
39
|
+
Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
|
40
|
+
"Instead, use 'Hyrax::SolrQueryService.new.with_field_pairs'.")
|
41
|
+
Hyrax::SolrQueryService.new.with_field_pairs(field_pairs: field_pairs,
|
42
|
+
join_with: join_with,
|
43
|
+
type: type).build
|
29
44
|
end
|
30
45
|
|
46
|
+
# @deprecated
|
31
47
|
def default_join_with
|
48
|
+
Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
|
49
|
+
"There will not be a replacement for this method. See Hyrax::SolrQueryService which is replacing this class.")
|
32
50
|
' AND '
|
33
51
|
end
|
34
52
|
|
53
|
+
# Construct a solr query from a list of pairs (e.g. [field name, values]) including the model (e.g. Collection, Monograph)
|
54
|
+
# @param [Class] model class
|
55
|
+
# @param [Hash] field_pairs a list of pairs of property name and values
|
56
|
+
# @param [String] join_with the value we're joining the clauses with (default: ' AND ')
|
57
|
+
# @param [String] type of query to run. Either 'raw' or 'field' (default: 'field')
|
58
|
+
# @return [String] a solr query
|
59
|
+
# @example
|
60
|
+
# construct_query(Collection, [['library_id_ssim', '123'], ['owner_ssim', 'Fred']])
|
61
|
+
# # => "_query_:\"{!field f=has_model_ssim}Collection\" AND _query_:\"{!field f=library_id_ssim}123\" AND _query_:\"{!field f=owner_ssim}Fred\""
|
62
|
+
# @deprecated
|
63
|
+
def construct_query_for_model(model, field_pairs, join_with = default_join_with, type = 'field')
|
64
|
+
Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
|
65
|
+
"Instead, use 'Hyrax::SolrQueryService.new.with_model'.")
|
66
|
+
field_pairs["has_model_ssim"] = model.to_s
|
67
|
+
Hyrax::SolrQueryService.new.with_field_pairs(field_pairs: field_pairs,
|
68
|
+
join_with: join_with,
|
69
|
+
type: type).build
|
70
|
+
end
|
71
|
+
|
35
72
|
private
|
36
73
|
|
37
74
|
# @param [Array<Array>] pairs a list of (key, value) pairs. The value itself may
|