sufia 6.0.0.rc4 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile +1 -1
  4. data/History.md +280 -0
  5. data/README.md +180 -98
  6. data/SUFIA_VERSION +1 -1
  7. data/app/assets/images/site_images/collection-icon.svg +168 -0
  8. data/app/assets/javascripts/sufia/uploader.js +7 -4
  9. data/app/assets/stylesheets/sufia.css.scss +1 -1
  10. data/app/assets/stylesheets/sufia/_collections.scss +33 -13
  11. data/app/assets/stylesheets/sufia/_file-show.scss +24 -0
  12. data/app/assets/stylesheets/sufia/_settings.scss +4 -0
  13. data/app/controllers/concerns/sufia/catalog.rb +1 -11
  14. data/app/controllers/concerns/sufia/collections_controller_behavior.rb +13 -15
  15. data/app/controllers/concerns/sufia/dashboard_controller_behavior.rb +3 -1
  16. data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +2 -1
  17. data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +1 -0
  18. data/app/controllers/concerns/sufia/files_controller_behavior.rb +4 -1
  19. data/app/controllers/concerns/sufia/homepage_controller.rb +4 -11
  20. data/app/controllers/concerns/sufia/my_controller_behavior.rb +3 -21
  21. data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +6 -6
  22. data/app/controllers/concerns/sufia/users_controller_behavior.rb +7 -7
  23. data/app/controllers/my/collections_controller.rb +1 -8
  24. data/app/controllers/my/files_controller.rb +1 -1
  25. data/app/controllers/my/highlights_controller.rb +1 -9
  26. data/app/controllers/my/shares_controller.rb +1 -8
  27. data/app/helpers/generic_file_helper.rb +4 -0
  28. data/app/helpers/sufia/sufia_helper_behavior.rb +3 -3
  29. data/app/helpers/sufia_url_helper.rb +9 -0
  30. data/app/jobs/content_depositor_change_event_job.rb +5 -5
  31. data/app/search_builders/sufia/search_builder.rb +50 -0
  32. data/app/views/_user_util_links.html.erb +6 -4
  33. data/app/views/batch_edits/_check_all.html.erb +1 -1
  34. data/app/views/catalog/index.html.erb +3 -30
  35. data/app/views/collections/_media_display.html.erb +1 -1
  36. data/app/views/collections/_show_descriptions.html.erb +1 -1
  37. data/app/views/collections/_show_document_list_row.html.erb +2 -2
  38. data/app/views/dashboard/_index_partials/_heading_actions.html.erb +16 -12
  39. data/app/views/generic_files/_browse_everything.html.erb +3 -1
  40. data/app/views/generic_files/_local_file_import.html.erb +0 -1
  41. data/app/views/generic_files/_multiple_upload.html.erb +0 -1
  42. data/app/views/generic_files/_show_descriptions.html.erb +6 -11
  43. data/app/views/generic_files/_show_details.html.erb +41 -65
  44. data/app/views/generic_files/new.html.erb +1 -0
  45. data/app/views/generic_files/show.html.erb +2 -1
  46. data/app/views/generic_files/upload/_alerts.html.erb +5 -13
  47. data/app/views/homepage/_home_header.html.erb +6 -7
  48. data/app/views/my/_index_partials/_list_collections.html.erb +1 -1
  49. data/app/views/my/index.html.erb +2 -2
  50. data/app/views/records/edit_fields/_resource_type.html.erb +1 -1
  51. data/config/initializers/sufia_events.rb +2 -3
  52. data/config/locales/sufia.en.yml +11 -2
  53. data/lib/generators/sufia/install_generator.rb +5 -1
  54. data/lib/generators/sufia/templates/catalog_controller.rb +3 -5
  55. data/lib/generators/sufia/upgrade600_generator.rb +26 -0
  56. data/lib/sufia/version.rb +1 -1
  57. data/spec/actors/generic_file/actor_spec.rb +14 -0
  58. data/spec/controllers/collections_controller_spec.rb +19 -2
  59. data/spec/controllers/dashboard_controller_spec.rb +43 -12
  60. data/spec/controllers/generic_files_controller_spec.rb +24 -1
  61. data/spec/controllers/transfers_controller_spec.rb +4 -4
  62. data/spec/controllers/users_controller_spec.rb +18 -4
  63. data/spec/fixtures/spoken-text.m4a +0 -0
  64. data/spec/helpers/dashboard_helper_spec.rb +1 -1
  65. data/spec/helpers/sufia_url_helper_spec.rb +15 -0
  66. data/spec/inputs/select_with_help_input_spec.rb +15 -0
  67. data/spec/jobs/{active_fedora_pid_based_job_spec.rb → active_fedora_id_based_job_spec.rb} +2 -2
  68. data/spec/jobs/audit_job_spec.rb +2 -2
  69. data/spec/lib/sufia/id_service_spec.rb +8 -8
  70. data/spec/lib/sufia/user_stat_importer_spec.rb +9 -1
  71. data/spec/models/ability_spec.rb +7 -4
  72. data/spec/models/checksum_audit_log_spec.rb +10 -10
  73. data/spec/models/collection_spec.rb +8 -13
  74. data/spec/models/fits_datastream_spec.rb +17 -0
  75. data/spec/models/generic_file_spec.rb +9 -1
  76. data/spec/models/proxy_deposit_request_spec.rb +15 -3
  77. data/spec/services/generic_file_audit_service_spec.rb +1 -1
  78. data/spec/support/features.rb +1 -0
  79. data/spec/support/rake_output.rb +20 -0
  80. data/spec/tasks/rake_spec.rb +58 -0
  81. data/spec/test_app_templates/Gemfile.extra +3 -1
  82. data/spec/views/batch/edit.html.erb_spec.rb +6 -2
  83. data/spec/views/catalog/index.html.erb_spec.rb +1 -1
  84. data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +6 -2
  85. data/spec/views/dashboard/index_spec.rb +49 -1
  86. data/spec/views/generic_file/_browse_everything.html.erb_spec.rb +9 -0
  87. data/spec/views/generic_file/show.html.erb_spec.rb +13 -8
  88. data/spec/views/homepage/_home_header.html.erb_spec.rb +26 -0
  89. data/spec/views/users/_user_util_links.html.erb_spec.rb +20 -0
  90. data/spec/views/users/show.html.erb_spec.rb +1 -1
  91. data/sufia-models/app/actors/sufia/generic_file/actor.rb +1 -1
  92. data/sufia-models/app/jobs/active_fedora_id_based_job.rb +22 -0
  93. data/sufia-models/app/jobs/active_fedora_pid_based_job.rb +5 -20
  94. data/sufia-models/app/jobs/audit_job.rb +5 -6
  95. data/sufia-models/app/jobs/characterize_job.rb +1 -1
  96. data/sufia-models/app/jobs/create_derivatives_job.rb +1 -1
  97. data/sufia-models/app/jobs/import_url_job.rb +2 -2
  98. data/sufia-models/app/models/batch.rb +18 -4
  99. data/sufia-models/app/models/checksum_audit_log.rb +2 -2
  100. data/sufia-models/app/models/concerns/sufia/ability.rb +7 -1
  101. data/sufia-models/app/models/concerns/sufia/collection_behavior.rb +1 -1
  102. data/sufia-models/app/models/concerns/sufia/generic_file/full_text_indexing.rb +23 -14
  103. data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +1 -1
  104. data/sufia-models/app/models/datastreams/fits_datastream.rb +1 -36
  105. data/sufia-models/app/models/proxy_deposit_request.rb +6 -6
  106. data/sufia-models/app/services/sufia/generic_file_audit_service.rb +1 -1
  107. data/sufia-models/app/services/sufia/generic_file_indexing_service.rb +0 -1
  108. data/sufia-models/app/services/sufia/id_service.rb +2 -3
  109. data/sufia-models/app/services/sufia/noid.rb +1 -1
  110. data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +1 -1
  111. data/sufia-models/lib/generators/sufia/models/templates/migrations/change_audit_log_pid_to_generic_file_id.rb +5 -0
  112. data/sufia-models/lib/generators/sufia/models/templates/migrations/change_proxy_deposit_request_pid_to_generic_file_id.rb +5 -0
  113. data/sufia-models/lib/generators/sufia/models/upgrade600_generator.rb +21 -0
  114. data/sufia-models/lib/sufia/models/stats/user_stat_importer.rb +20 -1
  115. data/sufia-models/lib/sufia/models/version.rb +1 -1
  116. data/sufia-models/lib/tasks/batch_cleanup.rake +19 -0
  117. data/sufia-models/lib/tasks/migrate.rake +21 -0
  118. data/sufia-models/lib/tasks/sufia-models_tasks.rake +55 -38
  119. data/sufia-models/sufia-models.gemspec +1 -1
  120. data/sufia.gemspec +2 -2
  121. metadata +44 -38
  122. data/app/assets/images/site_images/bg_body.png +0 -0
  123. data/app/assets/images/site_images/bg_breadcrumbs.png +0 -0
  124. data/app/assets/images/site_images/bg_button1.png +0 -0
  125. data/app/assets/images/site_images/bg_button2.png +0 -0
  126. data/app/assets/images/site_images/bg_button3.png +0 -0
  127. data/app/assets/images/site_images/bg_content.png +0 -0
  128. data/app/assets/images/site_images/bg_content2.png +0 -0
  129. data/app/assets/images/site_images/bg_footer.png +0 -0
  130. data/app/assets/images/site_images/bg_masthead.png +0 -0
  131. data/app/assets/images/site_images/bg_search_field.png +0 -0
  132. data/app/assets/images/site_images/bg_search_header.png +0 -0
  133. data/app/assets/images/site_images/bg_signin.png +0 -0
  134. data/app/assets/images/site_images/carrot_blue.png +0 -0
  135. data/app/assets/images/site_images/carrot_yellow.png +0 -0
  136. data/app/assets/images/site_images/icon_arrow2_up.png +0 -0
  137. data/app/assets/images/site_images/icon_arrow3_down.png +0 -0
  138. data/app/assets/images/site_images/icon_arrow3_right.png +0 -0
  139. data/app/assets/images/site_images/icon_arrow_down.png +0 -0
  140. data/app/assets/images/site_images/icons_sprite.png +0 -0
  141. data/app/assets/images/site_images/logo_psuss_footer.png +0 -0
  142. data/app/views/catalog/_edit_partials/_default.html.erb +0 -55
  143. data/spec/support/fedora_conf/fedora.fcfg +0 -953
@@ -31,7 +31,7 @@ describe 'users/show.html.erb', :type => :view do
31
31
 
32
32
  context "with trophy" do
33
33
 
34
- let(:generic_file) { GenericFile.new(title: ["Fake object"], id: "abc123") }
34
+ let(:generic_file) { stub_model(GenericFile, title: ["Fake object"], id: "abc123") }
35
35
  before do
36
36
  allow(view).to receive(:search_session).and_return({})
37
37
  allow(view).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
@@ -31,7 +31,7 @@ module Sufia::GenericFile
31
31
  def create_content(file, file_name, path, mime_type)
32
32
  generic_file.add_file(file, path: path, original_name: file_name, mime_type: mime_type)
33
33
  generic_file.label ||= file_name
34
- generic_file.title = [file_name] if generic_file.title.blank?
34
+ generic_file.title = [generic_file.label] if generic_file.title.blank?
35
35
  save_characterize_and_record_committer do
36
36
  if Sufia.config.respond_to?(:after_create_content)
37
37
  Sufia.config.after_create_content.call(generic_file, user)
@@ -0,0 +1,22 @@
1
+ class ActiveFedoraIdBasedJob
2
+ def queue_name
3
+ :id_based
4
+ end
5
+
6
+ attr_accessor :id
7
+
8
+ def initialize(id)
9
+ self.id = id
10
+ end
11
+
12
+ def object
13
+ @object ||= ActiveFedora::Base.find(id)
14
+ end
15
+
16
+ alias_method :generic_file, :object
17
+ alias_method :generic_file_id, :id
18
+
19
+ def run
20
+ raise RuntimeError, "Define #run in a subclass"
21
+ end
22
+ end
@@ -1,22 +1,7 @@
1
- class ActiveFedoraPidBasedJob
2
- def queue_name
3
- :pid_based
4
- end
5
-
6
- attr_accessor :pid
7
-
8
- def initialize(pid)
9
- self.pid = pid
10
- end
11
-
12
- def object
13
- @object ||= ActiveFedora::Base.find(pid)
14
- end
15
-
16
- alias_method :generic_file, :object
17
- alias_method :generic_file_id, :pid
18
-
19
- def run
20
- raise RuntimeError, "Define #run in a subclass"
1
+ class ActiveFedoraPidBasedJob < ActiveFedoraIdBasedJob
2
+ extend Deprecation
3
+ def self.extended(document)
4
+ Deprecation.warn ActiveFedoraPidBasedJob, "ActiveFedoraPidBasedJob is deprecated; use ActiveFedoraIdBasedJob instead."
21
5
  end
22
6
  end
7
+
@@ -1,4 +1,4 @@
1
- class AuditJob < ActiveFedoraPidBasedJob
1
+ class AuditJob < ActiveFedoraIdBasedJob
2
2
  def queue_name
3
3
  :audit
4
4
  end
@@ -6,7 +6,7 @@ class AuditJob < ActiveFedoraPidBasedJob
6
6
  PASS = 'Passing Audit Run'
7
7
  FAIL = 'Failing Audit Run'
8
8
 
9
- attr_accessor :uri, :pid, :path
9
+ attr_accessor :uri, :id, :path
10
10
 
11
11
  # URI of the resource to audit.
12
12
  # This URI could include the actual resource (e.g. content) and the version to audit:
@@ -14,8 +14,7 @@ class AuditJob < ActiveFedoraPidBasedJob
14
14
  # but it could also just be:
15
15
  # http://localhost:8983/fedora/rest/test/a/b/c/abcxyz/content
16
16
  def initialize(id, path, uri)
17
- super(uri)
18
- self.pid = id
17
+ super(id)
19
18
  self.path = path
20
19
  self.uri = uri
21
20
  end
@@ -49,12 +48,12 @@ class AuditJob < ActiveFedoraPidBasedJob
49
48
 
50
49
  if fixity_ok
51
50
  passing = 1
52
- ChecksumAuditLog.prune_history(pid, path)
51
+ ChecksumAuditLog.prune_history(id, path)
53
52
  else
54
53
  logger.warn "***AUDIT*** Audit failed for #{uri} #{error_msg}"
55
54
  passing = 0
56
55
  end
57
- ChecksumAuditLog.create!(pass: passing, pid: pid, version: uri, dsid: path)
56
+ ChecksumAuditLog.create!(pass: passing, generic_file_id: id, version: uri, dsid: path)
58
57
  end
59
58
 
60
59
  def logger
@@ -1,4 +1,4 @@
1
- class CharacterizeJob < ActiveFedoraPidBasedJob
1
+ class CharacterizeJob < ActiveFedoraIdBasedJob
2
2
  def queue_name
3
3
  :characterize
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateDerivativesJob < ActiveFedoraPidBasedJob
1
+ class CreateDerivativesJob < ActiveFedoraIdBasedJob
2
2
  def queue_name
3
3
  :derivatives
4
4
  end
@@ -2,7 +2,7 @@ require 'net/https'
2
2
  require 'uri'
3
3
  require 'tempfile'
4
4
 
5
- class ImportUrlJob < ActiveFedoraPidBasedJob
5
+ class ImportUrlJob < ActiveFedoraIdBasedJob
6
6
 
7
7
  def queue_name
8
8
  :import_url
@@ -11,7 +11,7 @@ class ImportUrlJob < ActiveFedoraPidBasedJob
11
11
  def run
12
12
  user = User.find_by_user_key(generic_file.depositor)
13
13
 
14
- Tempfile.open(pid.gsub('/', '_')) do |f|
14
+ Tempfile.open(id.gsub('/', '_')) do |f|
15
15
  path, mime_type = copy_remote_file(generic_file.import_url, f)
16
16
  # attach downloaded file to generic file stubbed out
17
17
  if Sufia::GenericFile::Actor.new(generic_file, user).create_content(f, path, 'content', mime_type)
@@ -10,13 +10,27 @@ class Batch < ActiveFedora::Base
10
10
  property :status, predicate: ::RDF::DC.type
11
11
 
12
12
  def self.find_or_create(id)
13
- # FIXME potential race condition in this method. Consider that `find' may raise
14
- # ObjectNotFound in multiple processes. However, Fedora should raise an error
15
- # if we try to create two objects with the same id.
16
13
  begin
17
14
  Batch.find(id)
18
15
  rescue ActiveFedora::ObjectNotFoundError
19
- Batch.create(id: id)
16
+ safe_create(id)
20
17
  end
21
18
  end
19
+
20
+ private
21
+
22
+ # This method handles most race conditions gracefully.
23
+ # If a batch with the same ID is created by another thread
24
+ # we fetch the batch that was created (rather than throwing
25
+ # an error) and continute.
26
+ def self.safe_create(id)
27
+ begin
28
+ Batch.create(id: id)
29
+ rescue ActiveFedora::IllegalOperation => ex
30
+ # This is the exception thrown by LDP when we attempt to
31
+ # create a duplicate object. If we can find the object
32
+ # then we are good to go.
33
+ Batch.find(id)
34
+ end
35
+ end
22
36
  end
@@ -1,7 +1,7 @@
1
1
  class ChecksumAuditLog < ActiveRecord::Base
2
2
 
3
3
  def self.get_audit_log(id, path, version_uri)
4
- ChecksumAuditLog.find_or_create_by(pid: id, dsid: path, version: version_uri)
4
+ ChecksumAuditLog.find_or_create_by(generic_file_id: id, dsid: path, version: version_uri)
5
5
  end
6
6
 
7
7
  # Check to see if there are previous passing logs that we can delete
@@ -16,6 +16,6 @@ class ChecksumAuditLog < ActiveRecord::Base
16
16
  end
17
17
 
18
18
  def self.logs_for(id, path)
19
- ChecksumAuditLog.where(pid: id, dsid: path).order('created_at desc, id desc')
19
+ ChecksumAuditLog.where(generic_file_id: id, dsid: path).order('created_at desc, id desc')
20
20
  end
21
21
  end
@@ -8,6 +8,7 @@ module Sufia
8
8
 
9
9
  def sufia_abilities
10
10
  generic_file_abilities
11
+ user_abilities
11
12
  featured_work_abilities
12
13
  editor_abilities
13
14
  stats_abilities
@@ -23,7 +24,10 @@ module Sufia
23
24
  can :reject, ProxyDepositRequest, receiving_user_id: current_user.id, status: 'pending'
24
25
  # a user who sent a proxy deposit request can cancel it if it's pending.
25
26
  can :destroy, ProxyDepositRequest, sending_user_id: current_user.id, status: 'pending'
26
- can :edit, ::User, id: current_user.id
27
+ end
28
+
29
+ def user_abilities
30
+ can [:edit, :update, :toggle_trophy], ::User, id: current_user.id
27
31
  end
28
32
 
29
33
  def featured_work_abilities
@@ -31,6 +35,7 @@ module Sufia
31
35
  end
32
36
 
33
37
  def generic_file_abilities
38
+ can :view_share_work, [GenericFile]
34
39
  can :create, [GenericFile, Collection] if user_groups.include? 'registered'
35
40
  end
36
41
 
@@ -51,5 +56,6 @@ module Sufia
51
56
  def depositor_for_document(document_id)
52
57
  ::GenericFile.load_instance_from_solr(document_id).depositor
53
58
  end
59
+
54
60
  end
55
61
  end
@@ -18,7 +18,7 @@ module Sufia
18
18
  # Compute the sum of each file in the collection
19
19
  # Return an integer of the result
20
20
  def bytes
21
- members.reduce(0) { |sum, gf| sum + gf.file_size.first.to_i }
21
+ members.reduce(0) { |sum, gf| sum + gf.content.size.to_i }
22
22
  end
23
23
  end
24
24
  end
@@ -14,21 +14,30 @@ module Sufia
14
14
 
15
15
  private
16
16
 
17
- def extract_content
18
- url = Blacklight.solr_config[:url] ? Blacklight.solr_config[:url] : Blacklight.solr_config["url"] ? Blacklight.solr_config["url"] : Blacklight.solr_config[:fulltext] ? Blacklight.solr_config[:fulltext]["url"] : Blacklight.solr_config[:default]["url"]
19
- uri = URI("#{url}/update/extract?extractOnly=true&wt=json&extractFormat=text")
20
- req = Net::HTTP.new(uri.host, uri.port)
21
- resp = req.post(uri.to_s, self.content.content, {
22
- 'Content-type' => "#{self.mime_type};charset=utf-8",
23
- 'Content-Length' => self.content.content.size.to_s
24
- })
25
- raise "URL '#{uri}' returned code #{resp.code}" unless resp.code == "200"
26
- self.content.content.rewind if self.content.content.respond_to?(:rewind)
27
- extracted_text = JSON.parse(resp.body)[''].rstrip
28
- full_text.content = extracted_text if extracted_text.present?
29
- rescue => e
30
- logger.error("Error extracting content from #{self.id}: #{e.inspect}")
17
+ def extract_content
18
+ uri = URI("#{connection_url}/update/extract?extractOnly=true&wt=json&extractFormat=text")
19
+ req = Net::HTTP.new(uri.host, uri.port)
20
+ resp = req.post(uri.to_s, self.content.content, {
21
+ 'Content-type' => "#{self.mime_type};charset=utf-8",
22
+ 'Content-Length' => self.content.content.size.to_s
23
+ })
24
+ raise "URL '#{uri}' returned code #{resp.code}" unless resp.code == "200"
25
+ self.content.content.rewind if self.content.content.respond_to?(:rewind)
26
+ extracted_text = JSON.parse(resp.body)[''].rstrip
27
+ full_text.content = extracted_text if extracted_text.present?
28
+ rescue => e
29
+ logger.error("Error extracting content from #{self.id}: #{e.inspect}")
30
+ end
31
+
32
+ def connection_url
33
+ case
34
+ when Blacklight.connection_config[:url] then Blacklight.connection_config[:url]
35
+ when Blacklight.connection_config["url"] then Blacklight.connection_config["url"]
36
+ when Blacklight.connection_config[:fulltext] then Blacklight.connection_config[:fulltext]["url"]
37
+ else Blacklight.connection_config[:default]["url"]
31
38
  end
39
+ end
40
+
32
41
  end
33
42
  end
34
43
  end
@@ -24,7 +24,7 @@ module Sufia
24
24
  def request_transfer_to(target)
25
25
  raise ArgumentError, "Must provide a target" unless target
26
26
  deposit_user = ::User.find_by_user_key(depositor)
27
- ProxyDepositRequest.create!(pid: id, receiving_user: target, sending_user: deposit_user)
27
+ ProxyDepositRequest.create!(generic_file_id: id, receiving_user: target, sending_user: deposit_user)
28
28
  end
29
29
  end
30
30
  end
@@ -144,42 +144,7 @@ class FitsDatastream < ActiveFedora::OmDatastream
144
144
  http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd",
145
145
  version: "0.6.0",
146
146
  timestamp: "1/25/12 11:04 AM") {
147
- xml.identification {
148
- xml.identity(format: '', mimetype: '',
149
- toolname: 'FITS', toolversion: '') {
150
- xml.tool(toolname: '', toolversion: '')
151
- xml.version(toolname: '', toolversion: '')
152
- xml.externalIdentifier(toolname: '', toolversion: '')
153
- }
154
- }
155
- xml.fileinfo {
156
- xml.size(toolname: '', toolversion: '')
157
- xml.creatingApplicatioName(toolname: '', toolversion: '',
158
- status: '')
159
- xml.lastmodified(toolname: '', toolversion: '', status: '')
160
- xml.filepath(toolname: '', toolversion: '', status: '')
161
- xml.filename(toolname: '', toolversion: '', status: '')
162
- xml.md5checksum(toolname: '', toolversion: '', status: '')
163
- xml.fslastmodified(toolname: '', toolversion: '', status: '')
164
- }
165
- xml.filestatus {
166
- xml.tag! "well-formed", toolname: '', toolversion: '', status: ''
167
- xml.valid(toolname: '', toolversion: '', status: '')
168
- }
169
- xml.metadata {
170
- xml.document {
171
- xml.title(toolname: '', toolversion: '', status: '')
172
- xml.author(toolname: '', toolversion: '', status: '')
173
- xml.pageCount(toolname: '', toolversion: '')
174
- xml.isTagged(toolname: '', toolversion: '')
175
- xml.hasOutline(toolname: '', toolversion: '')
176
- xml.hasAnnotations(toolname: '', toolversion: '')
177
- xml.isRightsManaged(toolname: '', toolversion: '',
178
- status: '')
179
- xml.isProtected(toolname: '', toolversion: '')
180
- xml.hasForms(toolname: '', toolversion: '', status: '')
181
- }
182
- }
147
+ xml.identification { xml.identity(toolname: 'FITS') }
183
148
  }
184
149
  end
185
150
  builder.doc
@@ -1,11 +1,11 @@
1
1
  class ProxyDepositRequest < ActiveRecord::Base
2
- include Blacklight::SolrHelper
2
+ include Blacklight::SearchHelper
3
3
  include ActionView::Helpers::UrlHelper
4
4
 
5
5
  belongs_to :receiving_user, class_name: 'User'
6
6
  belongs_to :sending_user, class_name: 'User'
7
7
 
8
- validates :sending_user, :pid, presence: true
8
+ validates :sending_user, :generic_file_id, presence: true
9
9
  validate :transfer_to_should_be_a_valid_username
10
10
  validate :sending_user_should_not_be_receiving_user
11
11
  validate :should_not_be_already_part_of_a_transfer
@@ -28,7 +28,7 @@ class ProxyDepositRequest < ActiveRecord::Base
28
28
  end
29
29
 
30
30
  def should_not_be_already_part_of_a_transfer
31
- transfers = ProxyDepositRequest.where(pid: pid)
31
+ transfers = ProxyDepositRequest.where(generic_file_id: generic_file_id, status: 'pending')
32
32
  errors.add(:open_transfer, 'must close open transfer on the file before creating a new one') unless transfers.blank? || ( transfers.count == 1 && transfers[0].id == self.id)
33
33
  end
34
34
 
@@ -53,7 +53,7 @@ class ProxyDepositRequest < ActiveRecord::Base
53
53
 
54
54
  # @param [Boolean] reset (false) should the access controls be reset. This means revoking edit access from the depositor
55
55
  def transfer!(reset = false)
56
- Sufia.queue.push(ContentDepositorChangeEventJob.new(pid, receiving_user.user_key, reset))
56
+ Sufia.queue.push(ContentDepositorChangeEventJob.new(generic_file_id, receiving_user.user_key, reset))
57
57
  self.status = 'accepted'
58
58
  self.fulfillment_date = Time.now
59
59
  save!
@@ -73,12 +73,12 @@ class ProxyDepositRequest < ActiveRecord::Base
73
73
  end
74
74
 
75
75
  def deleted_file?
76
- !GenericFile.exists?(pid)
76
+ !GenericFile.exists?(generic_file_id)
77
77
  end
78
78
 
79
79
  def title
80
80
  return 'file not found' if deleted_file?
81
- query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids([pid])
81
+ query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids([generic_file_id])
82
82
  solr_response = ActiveFedora::SolrService.query(query, raw: true)
83
83
  SolrDocument.new(solr_response['response']['docs'].first, solr_response).title
84
84
  end
@@ -63,7 +63,7 @@ module Sufia
63
63
  latest_audit = ChecksumAuditLog.logs_for(generic_file.id, file).first
64
64
  return latest_audit unless needs_audit?(latest_audit)
65
65
  Sufia.queue.push(AuditJob.new(generic_file.id, file, uri))
66
- latest_audit || ChecksumAuditLog.new(pass: NO_RUNS, pid: generic_file.id, dsid: file, version: label)
66
+ latest_audit || ChecksumAuditLog.new(pass: NO_RUNS, generic_file_id: generic_file.id, dsid: file, version: label)
67
67
  end
68
68
 
69
69
  def needs_audit?(latest_audit)
@@ -6,7 +6,6 @@ module Sufia
6
6
  solr_doc[Solrizer.solr_name('file_format')] = object.file_format
7
7
  solr_doc[Solrizer.solr_name('file_format', :facetable)] = object.file_format
8
8
  solr_doc['all_text_timv'] = object.full_text.content
9
- solr_doc = object.index_collection_ids(solr_doc)
10
9
  end
11
10
  end
12
11
  end
@@ -8,7 +8,6 @@ module Sufia
8
8
  end
9
9
 
10
10
  @minter = ::Noid::Minter.new(template: noid_template)
11
- @pid = $$
12
11
  @semaphore = Mutex.new
13
12
  def self.valid?(identifier)
14
13
  # remove the fedora namespace since it's not part of the noid
@@ -18,8 +17,8 @@ module Sufia
18
17
  def self.mint
19
18
  @semaphore.synchronize do
20
19
  while true
21
- pid = self.next_id
22
- return pid unless ActiveFedora::Base.exists?(pid)
20
+ id = self.next_id
21
+ return id unless ActiveFedora::Base.exists?(id)
23
22
  end
24
23
  end
25
24
  end
@@ -2,7 +2,7 @@ module Sufia
2
2
  module Noid
3
3
  extend ActiveSupport::Concern
4
4
 
5
- ## This overrides the default behavior, which is to ask Fedora for a pid
5
+ ## This overrides the default behavior, which is to ask Fedora for an id
6
6
  # @see ActiveFedora::Persistence.assign_id
7
7
  def assign_id
8
8
  Sufia::IdService.mint if Sufia.config.enable_noids
@@ -123,7 +123,7 @@ Sufia.config do |config|
123
123
  # NOTE: if you have always sent analytics to GA for downloads and page views leave this commented out
124
124
  # config.analytic_start_date = DateTime.new(2014,9,10)
125
125
  #
126
- # Method of converting pids into URIs for storage in Fedora
126
+ # Method of converting ids into URIs for storage in Fedora
127
127
  # config.translate_uri_to_id = lambda { |uri| uri.to_s.split('/')[-1] }
128
128
  # config.translate_id_to_uri = lambda { |id|
129
129
  # "#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}/#{Sufia::Noid.treeify(id)}" }
@@ -0,0 +1,5 @@
1
+ class ChangeAuditLogPidToGenericFileId < ActiveRecord::Migration
2
+ def change
3
+ rename_column :checksum_audit_logs, :pid, :generic_file_id
4
+ end
5
+ end