hyrax 3.0.0.pre.rc4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.dassie/config/cable.yml +1 -1
  3. data/.dassie/config/environments/development.rb +2 -0
  4. data/.dassie/config/environments/production.rb +1 -1
  5. data/.dassie/config/redis.yml +1 -0
  6. data/.dassie/db/seeds.rb +8 -0
  7. data/.dockerignore +1 -0
  8. data/Dockerfile +7 -4
  9. data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +27 -1
  10. data/app/actors/hyrax/actors/file_actor.rb +4 -2
  11. data/app/actors/hyrax/actors/file_set_actor.rb +8 -6
  12. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +16 -5
  13. data/app/forms/hyrax/forms/resource_form.rb +15 -0
  14. data/app/helpers/hyrax/hyrax_helper_behavior.rb +8 -0
  15. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +116 -0
  16. data/app/indexers/hyrax/valkyrie_indexer.rb +6 -1
  17. data/app/indexers/hyrax/valkyrie_work_indexer.rb +2 -0
  18. data/app/jobs/embargo_expiry_job.rb +7 -5
  19. data/app/jobs/file_set_attached_event_job.rb +6 -1
  20. data/app/jobs/lease_expiry_job.rb +6 -4
  21. data/app/models/concerns/hyrax/ability.rb +11 -0
  22. data/app/models/concerns/hyrax/solr_document_behavior.rb +7 -1
  23. data/app/models/hyrax/file_set.rb +1 -0
  24. data/app/models/hyrax/work.rb +2 -0
  25. data/app/models/job_io_wrapper.rb +1 -1
  26. data/app/services/hyrax/access_control_list.rb +1 -1
  27. data/app/services/hyrax/adapters/nesting_index_adapter.rb +1 -1
  28. data/app/services/hyrax/embargo_manager.rb +1 -1
  29. data/app/services/hyrax/graph_exporter.rb +1 -1
  30. data/app/services/hyrax/listeners/metadata_index_listener.rb +18 -1
  31. data/app/services/hyrax/versioning_service.rb +1 -1
  32. data/app/services/hyrax/work_uploads_handler.rb +5 -2
  33. data/app/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb +1 -1
  34. data/app/views/hyrax/base/_form_share.html.erb +1 -5
  35. data/app/views/hyrax/base/_workflow_actions.html.erb +1 -1
  36. data/app/views/hyrax/batch_edits/edit.html.erb +2 -2
  37. data/app/views/hyrax/collections/_list_collections.html.erb +1 -1
  38. data/app/views/hyrax/collections/_search_form.html.erb +1 -1
  39. data/app/views/hyrax/stats/file.html.erb +1 -1
  40. data/app/views/hyrax/stats/work.html.erb +1 -1
  41. data/app/views/hyrax/uploads/_js_templates.html.erb +4 -4
  42. data/app/views/hyrax/uploads/_js_templates_versioning.html.erb +4 -4
  43. data/app/views/hyrax/users/_contributions.html.erb +1 -1
  44. data/app/views/hyrax/users/_profile_tabs.html.erb +2 -2
  45. data/app/views/hyrax/users/_search_form.html.erb +1 -1
  46. data/app/views/hyrax/users/_user.html.erb +1 -1
  47. data/app/views/hyrax/users/_user_info.html.erb +9 -9
  48. data/bin/db-migrate-seed.sh +3 -1
  49. data/bin/solrcloud-assign-configset.sh +27 -0
  50. data/bin/solrcloud-upload-configset.sh +31 -0
  51. data/chart/hyrax/Chart.yaml +8 -8
  52. data/chart/hyrax/README.md +42 -6
  53. data/chart/hyrax/templates/NOTES.txt +1 -1
  54. data/chart/hyrax/templates/_helpers.tpl +76 -0
  55. data/chart/hyrax/templates/configmap-env.yaml +10 -11
  56. data/chart/hyrax/templates/cron-embargo.yaml +24 -0
  57. data/chart/hyrax/templates/cron-lease.yaml +24 -0
  58. data/chart/hyrax/templates/deployment.yaml +36 -4
  59. data/chart/hyrax/templates/secrets.yaml +3 -2
  60. data/chart/hyrax/values.yaml +72 -1
  61. data/config/initializers/listeners.rb +2 -0
  62. data/documentation/developing-your-hyrax-based-app.md +3 -3
  63. data/lib/hyrax/transactions/container.rb +11 -1
  64. data/lib/hyrax/transactions/steps/delete_resource.rb +38 -0
  65. data/lib/hyrax/transactions/steps/destroy_work.rb +1 -0
  66. data/lib/hyrax/transactions/work_destroy.rb +20 -0
  67. data/lib/hyrax/version.rb +1 -1
  68. data/lib/tasks/embargo_lease.rake +27 -0
  69. data/lib/wings/active_fedora_converter/default_work.rb +4 -0
  70. data/lib/wings/attribute_transformer.rb +29 -19
  71. data/lib/wings/model_transformer.rb +4 -19
  72. data/lib/wings/orm_converter.rb +24 -21
  73. data/lib/wings/valkyrie/persister.rb +1 -0
  74. data/lib/wings/valkyrie/query_service.rb +36 -24
  75. data/template.rb +1 -1
  76. metadata +14 -20
  77. data/chart/fcrepo/.gitignore +0 -2
  78. data/chart/fcrepo/.helmignore +0 -23
  79. data/chart/fcrepo/Chart.yaml +0 -11
  80. data/chart/fcrepo/README.md +0 -50
  81. data/chart/fcrepo/templates/NOTES.txt +0 -21
  82. data/chart/fcrepo/templates/_helpers.tpl +0 -68
  83. data/chart/fcrepo/templates/configmap-env.yaml +0 -19
  84. data/chart/fcrepo/templates/deployment.yaml +0 -109
  85. data/chart/fcrepo/templates/ingress.yaml +0 -41
  86. data/chart/fcrepo/templates/pvc.yaml +0 -20
  87. data/chart/fcrepo/templates/secret.yaml +0 -12
  88. data/chart/fcrepo/templates/service.yaml +0 -15
  89. data/chart/fcrepo/templates/serviceaccount.yaml +0 -12
  90. data/chart/fcrepo/templates/tests/test-connection.yaml +0 -15
  91. data/chart/fcrepo/values.yaml +0 -79
  92. data/chart/hyrax/templates/fcrepo-secret.yaml +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 684ca77fe907962abffc140cd9b96081584650df75282c35e0ccd6fc041473ca
4
- data.tar.gz: 661b6c451fa1fbd7f25d91ab56331e88827a4f3e88fddb85bbcb1623a7d9f068
3
+ metadata.gz: 92a018038d9094f92a85088a61ff697aba139a326cfa96a95a7d4cdbeca98a0a
4
+ data.tar.gz: 8ca7c54444ba58ba89f2fc977ddcb8597122b985c9d7a7dda21d64fdcc87e648
5
5
  SHA512:
6
- metadata.gz: 2f884204185783729a1d7a8d00dfa41c27e592097749f773418cdecf033aff2804e853ccefadf48d7d0c7c18da7576d3d1fa30aba05a58e687814f6d337b8c7c
7
- data.tar.gz: ae5b51cbb3949d03967a5d4aa1650aaf77c8776d799df5456db09ff4b615ed8665699277f092e50267277afb654ca09e75200863f02f91c92b0f8f08465c0a60
6
+ metadata.gz: d5a60ae3e20bead1941c72d241bfa4fbee221eb6bf4637ad1bf58a53edd07eaaa741108707d06ece69b096b83132512875555fc64c6128b3a0c1046b079cbf9a
7
+ data.tar.gz: 64b2ef5c948183fa190b4f20adfae67ef22a8abc83df98c4e4581cbe83d960b3dc8d67b0453c062da5940d76f915a496fcb16f3b3a29aa63ffdeb2f0b443dab3
@@ -6,5 +6,5 @@ test:
6
6
 
7
7
  production:
8
8
  adapter: redis
9
- url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
9
+ url: <%= ENV.fetch("REDIS_URL") { sprintf "redis://%s%s:%s/1", (ENV['REDIS_PASSWORD'].present? ? ":#{ENV['REDIS_PASSWORD']}@" : ''), ENV.fetch('REDIS_HOST', 'localhost'), ENV.fetch('REDIS_PORT', '6379') } %>
10
10
  channel_prefix: _dassie_production
@@ -60,6 +60,8 @@ Rails.application.configure do
60
60
  # Suppress logger output for asset requests.
61
61
  config.assets.quiet = true
62
62
 
63
+ config.assets.prefix = '/dev-assets'
64
+
63
65
  # Raises error for missing translations
64
66
  config.action_view.raise_on_missing_translations = true
65
67
 
@@ -23,7 +23,7 @@ Rails.application.configure do
23
23
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
24
24
 
25
25
  # Compress JavaScripts and CSS.
26
- config.assets.js_compressor = :uglifier
26
+ config.assets.js_compressor = Uglifier.new(harmony: true)
27
27
  # config.assets.css_compressor = :sass
28
28
 
29
29
  # Do not fallback to assets pipeline if a precompiled asset is missed.
@@ -7,3 +7,4 @@ test:
7
7
  production:
8
8
  host: <%= ENV.fetch('REDIS_HOST', 'localhost') %>
9
9
  port: <%= ENV.fetch('REDIS_PORT', 6379) %>
10
+ password: <%= ENV['REDIS_PASSWORD'] %>
data/.dassie/db/seeds.rb CHANGED
@@ -12,3 +12,11 @@ puts "\n== Loading users"
12
12
  User.where(email: 'admin@example.com').first_or_create do |f|
13
13
  f.password = 'admin_password'
14
14
  end
15
+
16
+ User.where(email: 'basic_user@example.com').first_or_create do |f|
17
+ f.password = 'password'
18
+ end
19
+
20
+ User.where(email: 'another_user@example.com').first_or_create do |f|
21
+ f.password = 'password'
22
+ end
data/.dockerignore CHANGED
@@ -9,3 +9,4 @@ Dockerfile
9
9
 
10
10
  artifacts/*
11
11
  coverage/*
12
+ chart/*
data/Dockerfile CHANGED
@@ -7,10 +7,12 @@ ARG EXTRA_APK_PACKAGES="git"
7
7
 
8
8
  RUN apk --no-cache upgrade && \
9
9
  apk --no-cache add build-base \
10
+ curl \
10
11
  imagemagick \
11
12
  tzdata \
12
13
  nodejs \
13
14
  yarn \
15
+ zip \
14
16
  $DATABASE_APK_PACKAGE \
15
17
  $EXTRA_APK_PACKAGES
16
18
 
@@ -39,7 +41,7 @@ ARG BUNDLE_WITHOUT="development test"
39
41
 
40
42
  ONBUILD COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
41
43
  ONBUILD RUN bundle install --jobs "$(nproc)"
42
- ONBUILD RUN DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile
44
+ ONBUILD RUN RAILS_ENV=production SECRET_KEY_BASE=`bin/rake secret` DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile
43
45
 
44
46
  FROM hyrax-base as hyrax-engine-dev
45
47
 
@@ -52,7 +54,7 @@ COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
52
54
  COPY --chown=1001:101 . /app/samvera/hyrax-engine
53
55
 
54
56
  RUN cd /app/samvera/hyrax-engine && bundle install --jobs "$(nproc)"
55
- RUN DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake yarn:install
57
+ RUN RAILS_ENV=production SECRET_KEY_BASE='fakesecret1234' DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile
56
58
 
57
59
 
58
60
  FROM hyrax-engine-dev as hyrax-engine-dev-worker
@@ -61,9 +63,10 @@ ENV MALLOC_ARENA_MAX=2
61
63
 
62
64
  USER root
63
65
  RUN apk --no-cache add bash \
66
+ ffmpeg \
67
+ mediainfo \
64
68
  openjdk11-jre \
65
- perl \
66
- mediainfo
69
+ perl
67
70
  USER app
68
71
 
69
72
  RUN mkdir -p /app/fits && \
@@ -61,9 +61,18 @@ module Hyrax
61
61
  true
62
62
  end
63
63
 
64
+ def create_file_from_url(env, uri, file_name, auth_header)
65
+ case env.curation_concern
66
+ when Valkyrie::Resource
67
+ create_file_from_url_through_valkyrie(env, uri, file_name, auth_header)
68
+ else
69
+ create_file_from_url_through_active_fedora(env, uri, file_name, auth_header)
70
+ end
71
+ end
72
+
64
73
  # Generic utility for creating FileSet from a URL
65
74
  # Used in to import files using URLs from a file picker like browse_everything
66
- def create_file_from_url(env, uri, file_name, auth_header = {})
75
+ def create_file_from_url_through_active_fedora(env, uri, file_name, auth_header)
67
76
  import_url = URI.decode_www_form_component(uri.to_s)
68
77
  ::FileSet.new(import_url: import_url, label: file_name) do |fs|
69
78
  actor = Hyrax::Actors::FileSetActor.new(fs, env.user)
@@ -80,6 +89,23 @@ module Hyrax
80
89
  end
81
90
  end
82
91
 
92
+ # Generic utility for creating Hyrax::FileSet from a URL
93
+ # Used in to import files using URLs from a file picker like browse_everything
94
+ def create_file_from_url_through_valkyrie(env, uri, file_name, auth_header)
95
+ import_url = URI.decode_www_form_component(uri.to_s)
96
+ fs = Hyrax.persister.save(resource: Hyrax::FileSet.new(import_url: import_url, label: file_name))
97
+ actor = Hyrax::Actors::FileSetActor.new(fs, env.user, use_valkyrie: true)
98
+ actor.create_metadata(visibility: env.curation_concern.visibility)
99
+ actor.attach_to_work(env.curation_concern)
100
+ if uri.scheme == 'file'
101
+ # Turn any %20 into spaces.
102
+ file_path = CGI.unescape(uri.path)
103
+ IngestLocalFileJob.perform_later(fs, file_path, env.user)
104
+ else
105
+ ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)
106
+ end
107
+ end
108
+
83
109
  def operation_for(user:)
84
110
  Hyrax::Operation.create!(user: user,
85
111
  operation_type: "Attach Remote File")
@@ -11,7 +11,7 @@ module Hyrax
11
11
  # @param [FileSet] file_set the parent FileSet
12
12
  # @param [Symbol, #to_sym] relation the type/use for the file
13
13
  # @param [User] user the user to record as the Agent acting upon the file
14
- def initialize(file_set, relation, user, use_valkyrie: false)
14
+ def initialize(file_set, relation, user, use_valkyrie: Hyrax.config.query_index_from_valkyrie)
15
15
  @use_valkyrie = use_valkyrie
16
16
  @file_set = file_set
17
17
  @relation = normalize_relation(relation)
@@ -75,7 +75,7 @@ module Hyrax
75
75
  CharacterizeJob.perform_later(file_set, repository_file.id, pathhint(io))
76
76
  end
77
77
 
78
- def perform_ingest_file_through_valkyrie(io)
78
+ def perform_ingest_file_through_valkyrie(io) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
79
79
  file =
80
80
  begin
81
81
  Hyrax.storage_adapter.upload(resource: file_set, file: io, original_filename: io.original_name, use: relation)
@@ -87,7 +87,9 @@ module Hyrax
87
87
  create_version(file_metadata, user)
88
88
  id = file_metadata.file_identifier
89
89
  file_set.file_ids << id
90
+ file_set.original_file_id = id
90
91
  Hyrax.persister.save(resource: file_set)
92
+ Hyrax.publisher.publish('object.metadata.updated', object: file_set, user: user)
91
93
  CharacterizeJob.perform_later(file_set, id.to_s, pathhint(io))
92
94
  file_metadata
93
95
  end
@@ -6,7 +6,7 @@ module Hyrax
6
6
  include Lockable
7
7
  attr_reader :file_set, :user, :attributes, :use_valkyrie
8
8
 
9
- def initialize(file_set, user, use_valkyrie: false)
9
+ def initialize(file_set, user, use_valkyrie: Hyrax.config.query_index_from_valkyrie)
10
10
  @use_valkyrie = use_valkyrie
11
11
  @file_set = file_set
12
12
  @user = user
@@ -68,7 +68,6 @@ module Hyrax
68
68
  yield(file_set) if block_given?
69
69
  end
70
70
 
71
- # Adds a FileSet to the work using ore:Aggregations.
72
71
  # Locks to ensure that only one process is operating on the list at a time.
73
72
  def attach_to_work(work, file_set_params = {})
74
73
  acquire_lock_for(work.id) do
@@ -87,15 +86,18 @@ module Hyrax
87
86
  def attach_to_valkyrie_work(work, file_set_params)
88
87
  work = Hyrax.query_service.find_by(id: work.id) unless work.new_record
89
88
  file_set.visibility = work.visibility unless assign_visibility?(file_set_params)
90
- Hyrax.persister.save(resource: file_set)
91
- work.member_ids << file_set.id
92
- work.representative_id = file_set.id if work.representative_id.blank?
93
- work.thumbnail_id = file_set.id if work.thumbnail_id.blank?
89
+ fs = Hyrax.persister.save(resource: file_set)
90
+ Hyrax.publisher.publish('object.metadata.updated', object: fs, user: user)
91
+ work.member_ids << fs.id
92
+ work.representative_id = fs.id if work.representative_id.blank?
93
+ work.thumbnail_id = fs.id if work.thumbnail_id.blank?
94
94
  # Save the work so the association between the work and the file_set is persisted (head_id)
95
95
  # NOTE: the work may not be valid, in which case this save doesn't do anything.
96
96
  Hyrax.persister.save(resource: work)
97
+ Hyrax.publisher.publish('object.metadata.updated', object: work, user: user)
97
98
  end
98
99
 
100
+ # Adds a FileSet to the work using ore:Aggregations.
99
101
  def attach_to_af_work(work, file_set_params)
100
102
  work.reload unless work.new_record?
101
103
  file_set.visibility = work.visibility unless assign_visibility?(file_set_params)
@@ -113,10 +113,21 @@ module Hyrax
113
113
  end
114
114
 
115
115
  def destroy
116
- title = curation_concern.to_s
117
- env = Actors::Environment.new(curation_concern, current_ability, {})
118
- return unless actor.destroy(env)
119
- Hyrax.config.callback.run(:after_destroy, curation_concern.id, current_user, warn: false)
116
+ case curation_concern
117
+ when ActiveFedora::Base
118
+ title = curation_concern.to_s
119
+ env = Actors::Environment.new(curation_concern, current_ability, {})
120
+ return unless actor.destroy(env)
121
+ Hyrax.config.callback.run(:after_destroy, curation_concern.id, current_user, warn: false)
122
+ else
123
+ transactions['work_resource.destroy']
124
+ .with_step_args('work_resource.delete' => { user: current_user })
125
+ .call(curation_concern)
126
+ .value!
127
+
128
+ title = Array(curation_concern.title).first
129
+ end
130
+
120
131
  after_destroy_response(title)
121
132
  end
122
133
 
@@ -380,7 +391,7 @@ module Hyrax
380
391
 
381
392
  def after_destroy_response(title)
382
393
  respond_to do |wants|
383
- wants.html { redirect_to my_works_path, notice: "Deleted #{title}" }
394
+ wants.html { redirect_to hyrax.my_works_path, notice: "Deleted #{title}" }
384
395
  wants.json { render_json_response(response_type: :deleted, message: "Deleted #{curation_concern.id}") }
385
396
  end
386
397
  end
@@ -43,6 +43,20 @@ module Hyrax
43
43
  property :access, virtual: true, prepopulator: ->(_opts) { self.access = model.mode }
44
44
  end
45
45
 
46
+ ##
47
+ # @api private
48
+ InWorksPopulator = lambda do |_options|
49
+ self.in_works_ids =
50
+ if persisted?
51
+ Hyrax.query_service
52
+ .find_inverse_references_by(resource: model, property: :member_ids)
53
+ .select(&:work?)
54
+ .map(&:id)
55
+ else
56
+ []
57
+ end
58
+ end
59
+
46
60
  ##
47
61
  # @api private
48
62
  #
@@ -90,6 +104,7 @@ module Hyrax
90
104
 
91
105
  # pcdm relationships
92
106
  property :admin_set_id, prepopulator: ->(_opts) { self.admin_set_id = AdminSet::DEFAULT_ID }
107
+ property :in_works_ids, virtual: true, prepopulator: InWorksPopulator
93
108
  property :member_ids, default: [], type: Valkyrie::Types::Array
94
109
  property :member_of_collection_ids, default: [], type: Valkyrie::Types::Array
95
110
 
@@ -20,6 +20,14 @@ module Hyrax
20
20
  include Hyrax::WorkFormHelper
21
21
  include Hyrax::WorkflowsHelper
22
22
 
23
+ ##
24
+ # @return [Array<String>] the list of all user groups
25
+ def available_user_groups(ability:)
26
+ return ::User.group_service.role_names if ability.admin?
27
+
28
+ ability.user_groups
29
+ end
30
+
23
31
  # Which translations are available for the user to select
24
32
  # @return [Hash{String => String}] locale abbreviations as keys and flags as values
25
33
  def available_translations
@@ -0,0 +1,116 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hyrax
4
+ ##
5
+ # Indexes Hyrax::FileSet objects
6
+ class ValkyrieFileSetIndexer < Hyrax::ValkyrieIndexer
7
+ include Hyrax::ResourceIndexer
8
+ include Hyrax::PermissionIndexer
9
+ include Hyrax::VisibilityIndexer
10
+ include Hyrax::Indexer(:core_metadata)
11
+ include Hyrax::Indexer(:basic_metadata)
12
+
13
+ # include Hyrax::IndexesThumbnails # TODO: Is there a Valkyrie version of a thumbnail indexer?
14
+
15
+ def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
16
+ super.tap do |solr_doc| # rubocop:disable Metrics/BlockLength
17
+ # Metadata from the FileSet
18
+ solr_doc['file_ids_ssim'] = resource.file_ids&.map(&:to_s)
19
+ solr_doc['original_file_id_ssi'] = resource.original_file_id.to_s
20
+ solr_doc['thumbnail_id_ssi'] = resource.thumbnail_id.to_s
21
+ solr_doc['extracted_text_id_ssi'] = resource.extracted_text_id.to_s
22
+
23
+ # Add in metadata from the original file.
24
+ file_metadata = original_file
25
+ return solr_doc unless file_metadata
26
+
27
+ # Label is the actual file name. It's not editable by the user.
28
+ solr_doc['original_file_alternate_ids_tesim'] = file_metadata.alternate_ids&.map(&:to_s) if file_metadata.alternate_ids.present?
29
+
30
+ solr_doc['original_filename_tesi'] = file_metadata.original_filename if file_metadata.original_filename.present?
31
+ solr_doc['original_filename_ssi'] = file_metadata.original_filename if file_metadata.original_filename.present?
32
+ solr_doc['mime_type_tesi'] = file_metadata.mime_type if file_metadata.mime_type.present?
33
+ solr_doc['mime_type_ssi'] = file_metadata.mime_type if file_metadata.mime_type.present?
34
+
35
+ solr_doc['file_format_tesim'] = file_format(file_metadata)
36
+ solr_doc['file_format_sim'] = file_format(file_metadata)
37
+ solr_doc['file_size_lts'] = file_metadata.size[0]
38
+ solr_doc['type_tesim'] = file_metadata.type if file_metadata.type.present?
39
+
40
+ # attributes set by fits
41
+ solr_doc['format_label_tesim'] = file_metadata.format_label if file_metadata.format_label.present?
42
+ solr_doc['size_tesim'] = file_metadata.size if file_metadata.size.present?
43
+ solr_doc['well_formed_tesim'] = file_metadata.well_formed if file_metadata.well_formed.present?
44
+ solr_doc['valid_tesim'] = file_metadata.valid if file_metadata.valid.present?
45
+ solr_doc['fits_version_tesim'] = file_metadata.fits_version if file_metadata.fits_version.present?
46
+ solr_doc['exif_version_tesim'] = file_metadata.exif_version if file_metadata.exif_version.present?
47
+ solr_doc['checksum_tesim'] = file_metadata.checksum if file_metadata.checksum.present?
48
+
49
+ # shared attributes across multiple file types
50
+ solr_doc['frame_rate_tesim'] = file_metadata.frame_rate if file_metadata.frame_rate.present? # audio, video
51
+ solr_doc['bit_rate_tesim'] = file_metadata.bit_rate if file_metadata.bit_rate.present? # audio, video
52
+ solr_doc['duration_tesim'] = file_metadata.duration if file_metadata.duration.present? # audio, video
53
+ solr_doc['sample_rate_tesim'] = file_metadata.sample_rate if file_metadata.sample_rate.present? # audio, video
54
+
55
+ solr_doc['height_tesim'] = file_metadata.height if file_metadata.height.present? # image, video
56
+ solr_doc['width_tesim'] = file_metadata.width if file_metadata.width.present? # image, video
57
+
58
+ # attributes set by fits for audio files
59
+ solr_doc['bit_depth_tesim'] = file_metadata.bit_depth if file_metadata.bit_depth.present?
60
+ solr_doc['channels_tesim'] = file_metadata.channels if file_metadata.channels.present?
61
+ solr_doc['data_format_tesim'] = file_metadata.data_format if file_metadata.data_format.present?
62
+ solr_doc['offset_tesim'] = file_metadata.offset if file_metadata.offset.present?
63
+
64
+ # attributes set by fits for documents
65
+ solr_doc['file_title_tesim'] = file_metadata.file_title if file_metadata.file_title.present?
66
+ solr_doc['page_count_tesim'] = file_metadata.page_count if file_metadata.page_count.present?
67
+ solr_doc['language_tesim'] = file_metadata.language if file_metadata.language.present?
68
+ solr_doc['word_count_tesim'] = file_metadata.word_count if file_metadata.word_count.present?
69
+ solr_doc['character_count_tesim'] = file_metadata.character_count if file_metadata.character_count.present?
70
+ solr_doc['line_count_tesim'] = file_metadata.line_count if file_metadata.line_count.present?
71
+ solr_doc['character_set_tesim'] = file_metadata.character_set if file_metadata.character_set.present?
72
+ solr_doc['markup_basis_tesim'] = file_metadata.markup_basis if file_metadata.markup_basis.present?
73
+ solr_doc['paragraph_count_tesim'] = file_metadata.paragraph_count if file_metadata.paragraph_count.present?
74
+ solr_doc['markup_language_tesim'] = file_metadata.markup_language if file_metadata.markup_language.present?
75
+ solr_doc['table_count_tesim'] = file_metadata.table_count if file_metadata.table_count.present?
76
+ solr_doc['graphics_count_tesim'] = file_metadata.graphics_count if file_metadata.graphics_count.present?
77
+
78
+ # attributes set by fits for images
79
+ solr_doc['byte_order_tesim'] = file_metadata.byte_order if file_metadata.byte_order.present?
80
+ solr_doc['compression_tesim'] = file_metadata.compression if file_metadata.compression.present?
81
+ solr_doc['color_space_tesim'] = file_metadata.color_space if file_metadata.color_space.present?
82
+ solr_doc['profile_name_tesim'] = file_metadata.profile_name if file_metadata.profile_name.present?
83
+ solr_doc['profile_version_tesim'] = file_metadata.profile_version if file_metadata.profile_version.present?
84
+ solr_doc['orientation_tesim'] = file_metadata.orientation if file_metadata.orientation.present?
85
+ solr_doc['color_map_tesim'] = file_metadata.color_map if file_metadata.color_map.present?
86
+ solr_doc['image_producer_tesim'] = file_metadata.image_producer if file_metadata.image_producer.present?
87
+ solr_doc['capture_device_tesim'] = file_metadata.capture_device if file_metadata.capture_device.present?
88
+ solr_doc['scanning_software_tesim'] = file_metadata.scanning_software if file_metadata.scanning_software.present?
89
+ solr_doc['gps_timestamp_tesim'] = file_metadata.gps_timestamp if file_metadata.gps_timestamp.present?
90
+ solr_doc['latitude_tesim'] = file_metadata.latitude if file_metadata.latitude.present?
91
+ solr_doc['longitude_tesim'] = file_metadata.longitude if file_metadata.longitude.present?
92
+
93
+ # attributes set by fits for video
94
+ solr_doc['aspect_ratio_tesim'] = file_metadata.aspect_ratio if file_metadata.aspect_ratio.present?
95
+ end
96
+ end
97
+
98
+ private
99
+
100
+ def original_file
101
+ Hyrax.custom_queries.find_original_file(file_set: resource)
102
+ rescue Valkyrie::Persistence::ObjectNotFoundError
103
+ Hyrax.custom_queries.find_files(file_set: resource).first
104
+ end
105
+
106
+ def file_format(file)
107
+ if file.mime_type.present? && file.format_label.present?
108
+ "#{file.mime_type.split('/').last} (#{file.format_label.join(', ')})"
109
+ elsif file.mime_type.present?
110
+ file.mime_type.split('/').last
111
+ elsif file.format_label.present?
112
+ file.format_label
113
+ end
114
+ end
115
+ end
116
+ end
@@ -95,7 +95,12 @@ module Hyrax
95
95
  # @example
96
96
  # ValkyrieIndexer.for(resource: Book.new) # => #<BookIndexer ...>
97
97
  def for(resource:)
98
- indexer_class_for(resource).new(resource: resource)
98
+ case resource
99
+ when Hyrax::FileSet
100
+ Hyrax::ValkyrieFileSetIndexer.new(resource: resource)
101
+ else
102
+ indexer_class_for(resource).new(resource: resource)
103
+ end
99
104
  end
100
105
 
101
106
  private
@@ -16,6 +16,8 @@ module Hyrax
16
16
  solr_doc['admin_set_id_ssim'] = [resource.admin_set_id.to_s]
17
17
  solr_doc['member_of_collection_ids_ssim'] = resource.member_of_collection_ids.map(&:to_s)
18
18
  solr_doc['member_ids_ssim'] = resource.member_ids.map(&:to_s)
19
+ solr_doc['depositor_ssim'] = [resource.depositor]
20
+ solr_doc['depositor_tesim'] = [resource.depositor]
19
21
  end
20
22
  end
21
23
 
@@ -1,15 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  class EmbargoExpiryJob < Hyrax::ApplicationJob
3
3
  def perform
4
- records_with_expired_embargos.each do |id|
5
- work = ActiveFedora::Base.find(id)
6
- Hyrax::Actors::EmbargoActor.new(work).destroy
4
+ records_with_expired_embargos.each do |resource|
5
+ Hyrax::EmbargoManager.release_embargo_for(resource: resource) &&
6
+ Hyrax::AccessControlList(resource).save
7
7
  end
8
8
  end
9
9
 
10
10
  ##
11
- # @return [Enumerator<String>] ids for all the objects that have expired active embargoes
11
+ # @return [Enumerator<Valkyrie::Resource>] ids for all the objects that have expired active embargoes
12
12
  def records_with_expired_embargos
13
- Hyrax::EmbargoService.assets_with_expired_embargoes.map(&:id)
13
+ ids = Hyrax::EmbargoService.assets_with_expired_embargoes.map(&:id)
14
+
15
+ Hyrax.query_service.find_many_by_ids(ids: ids)
14
16
  end
15
17
  end