curation_concerns-models 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/actors/curation_concerns/file_set_actor.rb +13 -19
- data/app/actors/curation_concerns/work_actor_behavior.rb +1 -1
- data/app/indexers/curation_concerns/collection_indexer.rb +3 -0
- data/app/indexers/curation_concerns/{file_set_indexing_service.rb → file_set_indexer.rb} +26 -4
- data/app/indexers/curation_concerns/{work_indexing_service.rb → work_indexer.rb} +2 -2
- data/app/jobs/audit_job.rb +3 -1
- data/app/jobs/import_url_job.rb +4 -0
- data/app/jobs/ingest_file_job.rb +18 -7
- data/app/jobs/ingest_local_file_job.rb +0 -7
- data/app/jobs/upload_set_update_job.rb +55 -46
- data/app/models/concerns/curation_concerns/ability.rb +5 -1
- data/app/models/concerns/curation_concerns/basic_metadata.rb +0 -7
- data/app/models/concerns/curation_concerns/belongs_to_upload_sets.rb +13 -0
- data/app/models/concerns/curation_concerns/collection_behavior.rb +34 -4
- data/app/models/concerns/curation_concerns/file_set/belongs_to_works.rb +3 -3
- data/app/models/concerns/curation_concerns/file_set/indexing.rb +1 -1
- data/app/models/concerns/curation_concerns/file_set/querying.rb +17 -0
- data/app/models/concerns/curation_concerns/file_set_behavior.rb +4 -5
- data/app/models/concerns/curation_concerns/naming.rb +17 -0
- data/app/models/concerns/curation_concerns/required_metadata.rb +14 -0
- data/app/models/concerns/curation_concerns/solr_document_behavior.rb +21 -7
- data/app/models/concerns/curation_concerns/upload_set_behavior.rb +1 -2
- data/app/models/concerns/curation_concerns/work_behavior.rb +7 -11
- data/app/models/curation_concerns/classify_concern.rb +2 -0
- data/app/models/curation_concerns/quick_classification_query.rb +21 -13
- data/app/services/curation_concerns/file_set_audit_service.rb +32 -11
- data/config/locales/curation_concerns.en.yml +17 -1
- data/curation_concerns-models.gemspec +1 -1
- data/lib/curation_concerns/configuration.rb +6 -11
- data/lib/curation_concerns/messages.rb +8 -6
- data/lib/curation_concerns/models.rb +2 -0
- data/lib/curation_concerns/models/version.rb +1 -1
- data/lib/curation_concerns/name.rb +20 -0
- data/lib/curation_concerns/null_logger.rb +10 -0
- data/lib/generators/curation_concerns/models/install_generator.rb +0 -1
- data/lib/generators/curation_concerns/models/templates/config/curation_concerns.rb +6 -22
- metadata +13 -9
- data/app/models/concerns/curation_concerns/file_set/belongs_to_upload_sets.rb +0 -15
- data/app/models/concerns/curation_concerns/generic_file.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3519b3ed462c460a07f19055e6c852cc5a062b33
|
4
|
+
data.tar.gz: 4e3956164fe04bc1209f6dbe683c1c8a0ab245c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d79cdcb836c3e8d6dc60da0074bcf763652311b774373bb7f3db77157868d3fb162df850e23f1a9b0376717176b636f444cb5ab4eb25d85402bddcec8258161a
|
7
|
+
data.tar.gz: c7262a624b1f4d52c52cc371480513fe1520b87091be157d8f180cb711cdf34da9c45846c56b28c390015110b70032f8f028f64683d9ebfa53c40c2a92d5fc80
|
@@ -19,28 +19,17 @@ module CurationConcerns
|
|
19
19
|
# create_content, which also performs a save. However, due to the relationship between Hydra::PCDM objects,
|
20
20
|
# we have to save both the parent work and the file_set in order to record the "metadata" relationship
|
21
21
|
# between them.
|
22
|
-
# @param [String] upload_set_id id of the batch of files that the file was uploaded with
|
23
22
|
# @param [ActiveFedora::Base] work the parent work that will contain the file_set.
|
24
23
|
# @param [Hash] file_set specifying the visibility, lease and/or embargo of the file set. If you don't provide at least one of visibility, embargo_release_date or lease_expiration_date, visibility will be copied from the parent.
|
25
24
|
|
26
|
-
def create_metadata(
|
25
|
+
def create_metadata(work, file_set_params = {})
|
27
26
|
file_set.apply_depositor_metadata(user)
|
28
27
|
now = CurationConcerns::TimeService.time_in_utc
|
29
28
|
file_set.date_uploaded = now
|
30
29
|
file_set.date_modified = now
|
31
30
|
file_set.creator = [user.user_key]
|
32
31
|
|
33
|
-
|
34
|
-
UploadSet.create(id: upload_set_id) unless UploadSet.exists?(upload_set_id)
|
35
|
-
file_set.upload_set_id = upload_set_id
|
36
|
-
else
|
37
|
-
ActiveFedora::Base.logger.warn 'unable to find UploadSet to attach to'
|
38
|
-
end
|
39
|
-
|
40
|
-
if assign_visibility?(file_set_params)
|
41
|
-
interpret_visibility file_set_params
|
42
|
-
end
|
43
|
-
# TODO: Why do we need to check if work is nil? Shoudn't that raise an error?
|
32
|
+
interpret_visibility file_set_params if assign_visibility?(file_set_params)
|
44
33
|
attach_file_to_work(work, file_set, file_set_params) if work
|
45
34
|
yield(file_set) if block_given?
|
46
35
|
end
|
@@ -50,14 +39,18 @@ module CurationConcerns
|
|
50
39
|
# Simultaneously moving a preservation copy to the repostiory.
|
51
40
|
# TODO: create a job to monitor this directory and prune old files that
|
52
41
|
# have made it to the repo
|
53
|
-
# @param [ActionDigest::HTTP::UploadedFile, Tempfile] file the file uploaded by the user.
|
42
|
+
# @param [File, ActionDigest::HTTP::UploadedFile, Tempfile] file the file uploaded by the user.
|
54
43
|
def create_content(file)
|
55
|
-
|
44
|
+
# Assign label and title of File Set is necessary.
|
45
|
+
file_set.label ||= file.respond_to?(:original_filename) ? file.original_filename : ::File.basename(file)
|
56
46
|
file_set.title = [file_set.label] if file_set.title.blank?
|
47
|
+
|
48
|
+
# Need to save the file_set in order to get an id
|
57
49
|
return false unless file_set.save
|
58
50
|
|
59
51
|
working_file = copy_file_to_working_directory(file, file_set.id)
|
60
|
-
|
52
|
+
mime_type = file.respond_to?(:content_type) ? file.content_type : nil
|
53
|
+
IngestFileJob.perform_later(file_set.id, working_file, mime_type, user.user_key)
|
61
54
|
make_derivative(file_set.id, working_file)
|
62
55
|
true
|
63
56
|
end
|
@@ -97,7 +90,6 @@ module CurationConcerns
|
|
97
90
|
|
98
91
|
def destroy
|
99
92
|
file_set.destroy
|
100
|
-
# TODO: need to mend the linked list of proxies (possibly wrap with a lock)
|
101
93
|
CurationConcerns.config.callback.run(:after_destroy, file_set.id, user)
|
102
94
|
end
|
103
95
|
|
@@ -107,11 +99,13 @@ module CurationConcerns
|
|
107
99
|
CharacterizeJob.perform_later(file_set_id, working_file)
|
108
100
|
end
|
109
101
|
|
110
|
-
# @param [ActionDispatch::Http::UploadedFile] file
|
102
|
+
# @param [File, ActionDispatch::Http::UploadedFile] file
|
111
103
|
# @param [String] id the identifer
|
112
104
|
# @return [String] path of the working file
|
113
105
|
def copy_file_to_working_directory(file, id)
|
114
|
-
|
106
|
+
# file_set.label not gaurunteed to be set at this point (e.g. if called from update_content)
|
107
|
+
file_set.label ||= file.respond_to?(:original_filename) ? file.original_filename : ::File.basename(file)
|
108
|
+
copy_stream_to_working_directory(id, file_set.label, file)
|
115
109
|
end
|
116
110
|
|
117
111
|
# @param [FileSet] file_set the resource
|
@@ -71,7 +71,7 @@ module CurationConcerns::WorkActorBehavior
|
|
71
71
|
def attach_file(file)
|
72
72
|
file_set = ::FileSet.new
|
73
73
|
file_set_actor = CurationConcerns::FileSetActor.new(file_set, user)
|
74
|
-
file_set_actor.create_metadata(curation_concern
|
74
|
+
file_set_actor.create_metadata(curation_concern, visibility_attributes)
|
75
75
|
file_set_actor.create_content(file)
|
76
76
|
@file_sets ||= []
|
77
77
|
@file_sets << file_set # This is so that other methods like assign_representative can access the file_sets without reloading them from fedora
|
@@ -1,9 +1,12 @@
|
|
1
1
|
module CurationConcerns
|
2
2
|
class CollectionIndexer < Hydra::PCDM::CollectionIndexer
|
3
|
+
STORED_INTEGER = Solrizer::Descriptor.new(:integer, :stored)
|
3
4
|
def generate_solr_document
|
4
5
|
super.tap do |solr_doc|
|
5
6
|
# Makes Collections show under the "Collections" tab
|
6
7
|
Solrizer.set_field(solr_doc, 'generic_type', 'Collection', :facetable)
|
8
|
+
# Index the size of the collection in bytes
|
9
|
+
solr_doc[Solrizer.solr_name(:bytes, STORED_INTEGER)] = object.bytes
|
7
10
|
end
|
8
11
|
end
|
9
12
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module CurationConcerns
|
2
|
-
class
|
2
|
+
class FileSetIndexer < ActiveFedora::IndexingService
|
3
3
|
include IndexesThumbnails
|
4
|
+
STORED_INTEGER = Solrizer::Descriptor.new(:integer, :stored)
|
4
5
|
|
5
6
|
def generate_solr_document
|
6
7
|
super.tap do |solr_doc|
|
@@ -9,16 +10,37 @@ module CurationConcerns
|
|
9
10
|
# Label is the actual file name. It's not editable by the user.
|
10
11
|
solr_doc[Solrizer.solr_name('label')] = object.label
|
11
12
|
solr_doc[Solrizer.solr_name('label', :stored_sortable)] = object.label
|
12
|
-
solr_doc[Solrizer.solr_name('file_format')] =
|
13
|
-
solr_doc[Solrizer.solr_name('file_format', :facetable)] =
|
14
|
-
solr_doc[Solrizer.solr_name(:file_size,
|
13
|
+
solr_doc[Solrizer.solr_name('file_format')] = file_format
|
14
|
+
solr_doc[Solrizer.solr_name('file_format', :facetable)] = file_format
|
15
|
+
solr_doc[Solrizer.solr_name(:file_size, STORED_INTEGER)] = object.file_size[0]
|
15
16
|
solr_doc['all_text_timv'] = object.full_text.content
|
16
17
|
solr_doc[Solrizer.solr_name('generic_work_ids', :symbol)] = object.generic_work_ids unless object.generic_work_ids.empty?
|
17
18
|
solr_doc['height_is'] = Integer(object.height.first) if object.height.present?
|
18
19
|
solr_doc['width_is'] = Integer(object.width.first) if object.width.present?
|
19
20
|
solr_doc[Solrizer.solr_name('mime_type', :stored_sortable)] = object.mime_type
|
20
21
|
solr_doc['thumbnail_path_ss'] = thumbnail_path
|
22
|
+
# Index the Fedora-generated SHA1 digest to create a linkage
|
23
|
+
# between files on disk (in fcrepo.binary-store-path) and objects
|
24
|
+
# in the repository.
|
25
|
+
solr_doc[Solrizer.solr_name('digest', :symbol)] = digest_from_content
|
21
26
|
end
|
22
27
|
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def digest_from_content
|
32
|
+
return unless object.original_file
|
33
|
+
object.original_file.digest.first.to_s
|
34
|
+
end
|
35
|
+
|
36
|
+
def file_format
|
37
|
+
if object.mime_type.present? && object.format_label.present?
|
38
|
+
"#{object.mime_type.split('/').last} (#{object.format_label.join(', ')})"
|
39
|
+
elsif object.mime_type.present?
|
40
|
+
object.mime_type.split('/').last
|
41
|
+
elsif object.format_label.present?
|
42
|
+
object.format_label
|
43
|
+
end
|
44
|
+
end
|
23
45
|
end
|
24
46
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module CurationConcerns
|
2
|
-
class
|
2
|
+
class WorkIndexer < ActiveFedora::IndexingService
|
3
3
|
include IndexesThumbnails
|
4
4
|
def generate_solr_document
|
5
5
|
super.tap do |solr_doc|
|
6
|
-
# We know that all the members of GenericWorks are
|
6
|
+
# We know that all the members of GenericWorks are FileSets so we can use
|
7
7
|
# member_ids which requires fewer Fedora API calls than file_set_ids.
|
8
8
|
# file_set_ids requires loading all the members from Fedora but member_ids
|
9
9
|
# looks just at solr
|
data/app/jobs/audit_job.rb
CHANGED
@@ -46,7 +46,9 @@ class AuditJob < ActiveFedoraIdBasedJob
|
|
46
46
|
ChecksumAuditLog.create!(pass: passing, file_set_id: id, version: uri, file_id: file_id)
|
47
47
|
end
|
48
48
|
|
49
|
+
private
|
50
|
+
|
49
51
|
def logger
|
50
|
-
ActiveFedora::Base.logger
|
52
|
+
ActiveFedora::Base.logger || CurationConcerns::NullLogger.new
|
51
53
|
end
|
52
54
|
end
|
data/app/jobs/import_url_job.rb
CHANGED
@@ -11,6 +11,10 @@ class ImportUrlJob < ActiveFedoraIdBasedJob
|
|
11
11
|
|
12
12
|
Tempfile.open(id.tr('/', '_')) do |f|
|
13
13
|
copy_remote_file(file_set.import_url, f)
|
14
|
+
|
15
|
+
# reload the generic file once the data is copied since this is a long running task
|
16
|
+
file_set.reload
|
17
|
+
|
14
18
|
# attach downloaded file to generic file stubbed out
|
15
19
|
if CurationConcerns::FileSetActor.new(file_set, user).create_content(f)
|
16
20
|
# send message to user on download success
|
data/app/jobs/ingest_file_job.rb
CHANGED
@@ -3,14 +3,25 @@ class IngestFileJob < ActiveJob::Base
|
|
3
3
|
|
4
4
|
def perform(file_set_id, filename, mime_type, user_key)
|
5
5
|
file_set = FileSet.find(file_set_id)
|
6
|
-
file = Hydra::Derivatives::IoDecorator.new(File.open(filename, "rb"))
|
7
|
-
file.mime_type = mime_type
|
8
|
-
file.original_name = File.basename(filename)
|
9
6
|
|
10
|
-
|
11
|
-
|
7
|
+
file = File.open(filename, "rb")
|
8
|
+
# If mime-type is known, wrap in an IO decorator
|
9
|
+
# Otherwise allow Hydra::Works service to determine mime_type
|
10
|
+
if mime_type
|
11
|
+
file = Hydra::Derivatives::IoDecorator.new(file)
|
12
|
+
file.mime_type = mime_type
|
13
|
+
file.original_name = File.basename(filename)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Tell AddFileToFileSet service to skip versioning because versions will be minted by VersionCommitter (called by save_characterize_and_record_committer) when necessary
|
17
|
+
Hydra::Works::AddFileToFileSet.call(file_set, file, :original_file, versioning: false)
|
18
|
+
|
19
|
+
# Persist changes to the file_set
|
12
20
|
file_set.save!
|
13
|
-
|
14
|
-
|
21
|
+
|
22
|
+
# Do post file ingest actions
|
23
|
+
user = User.find_by_user_key(user_key)
|
24
|
+
CurationConcerns::VersioningService.create(file_set.original_file, user)
|
25
|
+
CurationConcerns.config.callback.run(:after_create_content, file_set, user)
|
15
26
|
end
|
16
27
|
end
|
@@ -1,14 +1,7 @@
|
|
1
1
|
class IngestLocalFileJob < ActiveJob::Base
|
2
|
-
attr_accessor :directory, :filename, :user_key, :file_set_id
|
3
|
-
|
4
2
|
queue_as :ingest_local
|
5
3
|
|
6
4
|
def perform(file_set_id, directory, filename, user_key)
|
7
|
-
@file_set_id = file_set_id
|
8
|
-
@directory = directory
|
9
|
-
@filename = filename
|
10
|
-
@user_key = user_key
|
11
|
-
|
12
5
|
user = User.find_by_user_key(user_key)
|
13
6
|
fail "Unable to find user for #{user_key}" unless user
|
14
7
|
file_set = FileSet.find(file_set_id)
|
@@ -4,65 +4,74 @@ class UploadSetUpdateJob < ActiveJob::Base
|
|
4
4
|
|
5
5
|
queue_as :upload_set_update
|
6
6
|
|
7
|
-
attr_accessor :
|
7
|
+
attr_accessor :saved, :denied
|
8
8
|
|
9
|
-
|
9
|
+
# This copies metadata from the passed in attribute to all of the works that
|
10
|
+
# are members of the given upload set
|
11
|
+
def perform(login, upload_set_id, titles, attributes, visibility)
|
10
12
|
@login = login
|
11
|
-
@title = title || {}
|
12
|
-
@file_attributes = file_attributes
|
13
|
-
@visibility = visibility
|
14
|
-
@work_attributes = file_attributes.merge(visibility: visibility)
|
15
|
-
@upload_set_id = upload_set_id
|
16
13
|
@saved = []
|
17
14
|
@denied = []
|
15
|
+
@upload_set_id = upload_set_id
|
18
16
|
|
19
|
-
|
20
|
-
|
17
|
+
titles ||= {}
|
18
|
+
attributes = attributes.merge(visibility: visibility)
|
21
19
|
|
22
|
-
upload_set
|
23
|
-
|
24
|
-
|
20
|
+
update(upload_set, titles, attributes)
|
21
|
+
send_user_message
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
25
|
|
26
|
-
upload_set
|
26
|
+
def upload_set
|
27
|
+
@upload_set ||= UploadSet.find_or_create(@upload_set_id)
|
28
|
+
end
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
if
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
return true
|
30
|
+
def update(upload_set, titles, attributes)
|
31
|
+
upload_set.works.each do |work|
|
32
|
+
title = titles[work.id] if titles[work.id]
|
33
|
+
next unless update_work(work, title, attributes)
|
34
|
+
# TODO: stop assuming that files only belong to one work
|
35
|
+
saved << work
|
36
36
|
end
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
|
38
|
+
upload_set.update(status: ["Complete"])
|
39
|
+
end
|
40
|
+
|
41
|
+
def send_user_success_message
|
42
|
+
return unless CurationConcerns.config.callback.set?(:after_upload_set_update_success)
|
43
|
+
CurationConcerns.config.callback.run(:after_upload_set_update_success, user, upload_set)
|
44
|
+
end
|
45
|
+
|
46
|
+
def send_user_failure_message
|
47
|
+
return unless CurationConcerns.config.callback.set?(:after_upload_set_update_failure)
|
48
|
+
CurationConcerns.config.callback.run(:after_upload_set_update_failure, user, upload_set)
|
49
|
+
end
|
50
|
+
|
51
|
+
def send_user_message
|
52
|
+
if denied.empty?
|
53
|
+
send_user_success_message unless saved.empty?
|
54
|
+
else
|
55
|
+
send_user_failure_message
|
42
56
|
end
|
43
|
-
return false
|
44
57
|
end
|
45
|
-
end
|
46
58
|
|
47
|
-
|
48
|
-
|
49
|
-
ActiveFedora::Base.logger.error "User #{user.user_key} DENIED access to #{file.id}!"
|
50
|
-
denied << file
|
51
|
-
return
|
59
|
+
def user
|
60
|
+
@user ||= User.find_by_user_key(@login)
|
52
61
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
work
|
63
|
-
CurationConcerns::GenericWorkActor.new(work, user, work_attributes).update
|
62
|
+
|
63
|
+
def update_work(work, title, attributes)
|
64
|
+
unless user.can? :edit, work
|
65
|
+
ActiveFedora::Base.logger.error "User #{user.user_key} DENIED access to #{work.id}!"
|
66
|
+
denied << work
|
67
|
+
return
|
68
|
+
end
|
69
|
+
|
70
|
+
work.title = title if title
|
71
|
+
work_actor(work, attributes).update
|
64
72
|
end
|
65
73
|
|
66
|
-
|
67
|
-
|
74
|
+
def work_actor(work, attributes)
|
75
|
+
CurationConcerns::GenericWorkActor.new(work, user, attributes)
|
76
|
+
end
|
68
77
|
end
|
@@ -34,10 +34,14 @@ module CurationConcerns
|
|
34
34
|
can :collect, :all
|
35
35
|
end
|
36
36
|
|
37
|
+
def registered_user?
|
38
|
+
user_groups.include? 'registered'
|
39
|
+
end
|
40
|
+
|
37
41
|
# Add this to your ability_logic if you want all logged in users to be able
|
38
42
|
# to submit content
|
39
43
|
def everyone_can_create_curation_concerns
|
40
|
-
return
|
44
|
+
return unless registered_user?
|
41
45
|
can :create, [::FileSet, ::Collection]
|
42
46
|
can :create, [CurationConcerns.config.curation_concerns]
|
43
47
|
end
|
@@ -5,10 +5,6 @@ module CurationConcerns
|
|
5
5
|
included do
|
6
6
|
property :label, predicate: ActiveFedora::RDF::Fcrepo::Model.downloadFilename, multiple: false
|
7
7
|
|
8
|
-
property :depositor, predicate: ::RDF::URI.new('http://id.loc.gov/vocabulary/relators/dpt'), multiple: false do |index|
|
9
|
-
index.as :symbol, :stored_searchable
|
10
|
-
end
|
11
|
-
|
12
8
|
property :relative_path, predicate: ::RDF::URI.new('http://scholarsphere.psu.edu/ns#relativePath'), multiple: false
|
13
9
|
|
14
10
|
property :import_url, predicate: ::RDF::URI.new('http://scholarsphere.psu.edu/ns#importUrl'), multiple: false do |index|
|
@@ -19,9 +15,6 @@ module CurationConcerns
|
|
19
15
|
property :resource_type, predicate: ::RDF::Vocab::DC.type do |index|
|
20
16
|
index.as :stored_searchable, :facetable
|
21
17
|
end
|
22
|
-
property :title, predicate: ::RDF::Vocab::DC.title do |index|
|
23
|
-
index.as :stored_searchable, :facetable
|
24
|
-
end
|
25
18
|
property :creator, predicate: ::RDF::Vocab::DC.creator do |index|
|
26
19
|
index.as :stored_searchable, :facetable
|
27
20
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module BelongsToUploadSets
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
included do
|
5
|
+
belongs_to :upload_set, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf
|
6
|
+
end
|
7
|
+
|
8
|
+
# Is this file in the middle of being processed by an UploadSet?
|
9
|
+
def processing?
|
10
|
+
try(:upload_set).try(:status) == ['processing'.freeze]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -23,10 +23,6 @@ module CurationConcerns
|
|
23
23
|
title.present? ? title : 'No Title'
|
24
24
|
end
|
25
25
|
|
26
|
-
def bytes
|
27
|
-
members.reduce(0) { |sum, gf| sum + gf.content.size.to_i }
|
28
|
-
end
|
29
|
-
|
30
26
|
def can_be_member_of_collection?(collection)
|
31
27
|
collection != self
|
32
28
|
end
|
@@ -37,8 +33,42 @@ module CurationConcerns
|
|
37
33
|
end
|
38
34
|
end
|
39
35
|
|
36
|
+
# Compute the sum of each file in the collection using Solr to
|
37
|
+
# avoid having to access Fedora
|
38
|
+
#
|
39
|
+
# @return [Fixnum] size of collection in bytes
|
40
|
+
# @raise [RuntimeError] unsaved record does not exist in solr
|
41
|
+
def bytes
|
42
|
+
return 0 if member_ids.count == 0
|
43
|
+
|
44
|
+
raise "Collection must be saved to query for bytes" if new_record?
|
45
|
+
|
46
|
+
# One query per member_id because Solr is not a relational database
|
47
|
+
sizes = member_ids.collect do |work_id|
|
48
|
+
query = ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: ::FileSet.to_class_uri)
|
49
|
+
argz = { fl: "id, #{file_size_field}",
|
50
|
+
fq: "{!join from=#{member_ids_field} to=id}id:#{work_id}"
|
51
|
+
}
|
52
|
+
files = ActiveFedora::SolrService.query(query, argz)
|
53
|
+
files.reduce(0) { |sum, f| sum + f[file_size_field].to_i }
|
54
|
+
end
|
55
|
+
|
56
|
+
sizes.reduce(0, :+)
|
57
|
+
end
|
58
|
+
|
40
59
|
private
|
41
60
|
|
61
|
+
# Field name to look up when locating the size of each file in Solr.
|
62
|
+
# Override for your own installation if using something different
|
63
|
+
def file_size_field
|
64
|
+
Solrizer.solr_name(:file_size, FileSetIndexer::STORED_INTEGER)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Solr field name collections and works use to index member ids
|
68
|
+
def member_ids_field
|
69
|
+
Solrizer.solr_name('member_ids', :symbol)
|
70
|
+
end
|
71
|
+
|
42
72
|
def can_add_to_members?(collectible)
|
43
73
|
collectible.try(:can_be_member_of_collection?, self)
|
44
74
|
end
|
@@ -17,17 +17,17 @@ module CurationConcerns
|
|
17
17
|
end
|
18
18
|
|
19
19
|
# Returns the first parent object
|
20
|
-
# This is a hack to handle things like
|
20
|
+
# This is a hack to handle things like FileSets inheriting access controls from their parent. (see CurationConcerns::ParentContainer in app/controllers/concerns/curation_concers/parent_container.rb)
|
21
21
|
def parent
|
22
22
|
in_objects.first
|
23
23
|
end
|
24
24
|
|
25
25
|
# Returns the id of first parent object
|
26
|
-
# This is a hack to handle things like
|
26
|
+
# This is a hack to handle things like FileSets inheriting access controls from their parent. (see CurationConcerns::ParentContainer in app/controllers/concerns/curation_concers/parent_container.rb)
|
27
27
|
delegate :id, to: :parent, prefix: true
|
28
28
|
|
29
29
|
# Files with sibling relationships
|
30
|
-
# Returns all
|
30
|
+
# Returns all FileSets aggregated by any of the GenericWorks that aggregate the current object
|
31
31
|
def related_files
|
32
32
|
generic_works = self.generic_works
|
33
33
|
return [] if generic_works.empty?
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module FileSet
|
3
|
+
module Querying
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
module ClassMethods
|
7
|
+
def where_digest_is(digest_string)
|
8
|
+
where Solrizer.solr_name('digest', :symbol) => urnify(digest_string)
|
9
|
+
end
|
10
|
+
|
11
|
+
def urnify(digest_string)
|
12
|
+
"urn:sha1:#{digest_string}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -13,16 +13,15 @@ module CurationConcerns
|
|
13
13
|
include CurationConcerns::FileSet::FullTextIndexing
|
14
14
|
include CurationConcerns::FileSet::Indexing
|
15
15
|
include CurationConcerns::FileSet::BelongsToWorks
|
16
|
-
include CurationConcerns::FileSet::
|
16
|
+
include CurationConcerns::FileSet::Querying
|
17
17
|
include CurationConcerns::HumanReadableType
|
18
|
+
include CurationConcerns::RequiredMetadata
|
19
|
+
include CurationConcerns::Naming
|
18
20
|
include Hydra::AccessControls::Embargoable
|
19
21
|
|
20
22
|
included do
|
21
23
|
attr_accessor :file
|
22
|
-
|
23
|
-
|
24
|
-
def human_readable_type
|
25
|
-
self.class.to_s.demodulize.titleize
|
24
|
+
self.human_readable_type = 'File'
|
26
25
|
end
|
27
26
|
|
28
27
|
def representative_id
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module Naming
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
# Override of ActiveModel::Model name that allows us to use our custom name class
|
7
|
+
def model_name
|
8
|
+
@_model_name ||= begin
|
9
|
+
namespace = parents.detect do |n|
|
10
|
+
n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming?
|
11
|
+
end
|
12
|
+
CurationConcerns::Name.new(self, namespace)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module RequiredMetadata
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
property :depositor, predicate: ::RDF::URI.new('http://id.loc.gov/vocabulary/relators/dpt'), multiple: false do |index|
|
7
|
+
index.as :symbol, :stored_searchable
|
8
|
+
end
|
9
|
+
property :title, predicate: ::RDF::Vocab::DC.title do |index|
|
10
|
+
index.as :stored_searchable, :facetable
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -44,14 +44,16 @@ module CurationConcerns
|
|
44
44
|
fetch(Solrizer.solr_name('hasRelatedMediaFragment', :symbol), []).first
|
45
45
|
end
|
46
46
|
|
47
|
+
def date_created
|
48
|
+
date_field('date_created')
|
49
|
+
end
|
50
|
+
|
51
|
+
def date_modified
|
52
|
+
date_field('date_modified')
|
53
|
+
end
|
54
|
+
|
47
55
|
def date_uploaded
|
48
|
-
|
49
|
-
return unless field.present?
|
50
|
-
begin
|
51
|
-
Date.parse(field).to_formatted_s(:standard)
|
52
|
-
rescue
|
53
|
-
Rails.logger.info "Unable to parse date: #{field.first.inspect} for #{self['id']}"
|
54
|
-
end
|
56
|
+
date_field('date_uploaded')
|
55
57
|
end
|
56
58
|
|
57
59
|
def depositor(default = '')
|
@@ -128,5 +130,17 @@ module CurationConcerns
|
|
128
130
|
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
129
131
|
end
|
130
132
|
end
|
133
|
+
|
134
|
+
private
|
135
|
+
|
136
|
+
def date_field(field_name)
|
137
|
+
field = self[Solrizer.solr_name(field_name, :stored_sortable, type: :date)]
|
138
|
+
return unless field.present?
|
139
|
+
begin
|
140
|
+
Date.parse(field).to_formatted_s(:standard)
|
141
|
+
rescue
|
142
|
+
Rails.logger.info "Unable to parse date: #{field.first.inspect} for #{self['id']}"
|
143
|
+
end
|
144
|
+
end
|
131
145
|
end
|
132
146
|
end
|
@@ -5,9 +5,8 @@ module CurationConcerns
|
|
5
5
|
include CurationConcerns::Noid
|
6
6
|
|
7
7
|
included do
|
8
|
-
has_many :
|
8
|
+
has_many :works, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf, class_name: 'ActiveFedora::Base'
|
9
9
|
|
10
|
-
property :creator, predicate: ::RDF::DC.creator
|
11
10
|
property :title, predicate: ::RDF::DC.title
|
12
11
|
property :status, predicate: ::RDF::DC.type
|
13
12
|
end
|
@@ -2,14 +2,17 @@ module CurationConcerns::WorkBehavior
|
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
4
|
include Hydra::Works::WorkBehavior
|
5
|
-
include
|
5
|
+
include CurationConcerns::HumanReadableType
|
6
6
|
include CurationConcerns::Noid
|
7
7
|
include CurationConcerns::Permissions
|
8
8
|
include CurationConcerns::Serializers
|
9
9
|
include Hydra::WithDepositor
|
10
10
|
include Solrizer::Common
|
11
|
-
include
|
12
|
-
include
|
11
|
+
include CurationConcerns::HasRepresentative
|
12
|
+
include CurationConcerns::WithFileSets
|
13
|
+
include CurationConcerns::Naming
|
14
|
+
include CurationConcerns::RequiredMetadata
|
15
|
+
include CurationConcerns::BelongsToUploadSets
|
13
16
|
include Hydra::AccessControls::Embargoable
|
14
17
|
|
15
18
|
included do
|
@@ -19,25 +22,18 @@ module CurationConcerns::WorkBehavior
|
|
19
22
|
|
20
23
|
module ClassMethods
|
21
24
|
def indexer
|
22
|
-
CurationConcerns::
|
25
|
+
CurationConcerns::WorkIndexer
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
26
29
|
def to_s
|
27
30
|
if title.present?
|
28
31
|
Array(title).join(' | ')
|
29
|
-
elsif label.present?
|
30
|
-
Array(label).join(' | ')
|
31
32
|
else
|
32
33
|
'No Title'
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
|
-
# Returns a string identifying the path associated with the object. ActionPack uses this to find a suitable partial to represent the object.
|
37
|
-
def to_partial_path
|
38
|
-
"curation_concerns/#{super}"
|
39
|
-
end
|
40
|
-
|
41
37
|
def can_be_member_of_collection?(_collection)
|
42
38
|
true
|
43
39
|
end
|
@@ -1,30 +1,38 @@
|
|
1
1
|
module CurationConcerns
|
2
2
|
class QuickClassificationQuery
|
3
|
-
def self.each_for_context(*args, &block)
|
4
|
-
new(*args).all.each(&block)
|
5
|
-
end
|
6
|
-
|
7
3
|
attr_reader :user
|
8
4
|
|
5
|
+
# @param [User] user the current user
|
6
|
+
# @param [Hash] options
|
7
|
+
# @option options [#call] :concern_name_normalizer (ClassifyConcern.to_class) a proc that translates names to classes
|
8
|
+
# @option options [Array<String>] :models the options to display, defaults to everything.
|
9
9
|
def initialize(user, options = {})
|
10
10
|
@user = user
|
11
11
|
@concern_name_normalizer = options.fetch(:concern_name_normalizer, ClassifyConcern.method(:to_class))
|
12
|
-
@
|
12
|
+
@models = options.fetch(:models, CurationConcerns.config.registered_curation_concern_types)
|
13
|
+
end
|
14
|
+
|
15
|
+
def each(&block)
|
16
|
+
authorized_models.each(&block)
|
17
|
+
end
|
18
|
+
|
19
|
+
# @return true if the requested concerns is same as all avaliable concerns
|
20
|
+
def all?
|
21
|
+
models == CurationConcerns.config.registered_curation_concern_types
|
13
22
|
end
|
14
23
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
ActiveFedora::Base.logger.debug "can is #{user.can?(:create, normalized_curation_concern_names.first)}"
|
19
|
-
normalized_curation_concern_names.select { |klass| user.can?(:create, klass) }
|
24
|
+
# @return [Array] a list of all the requested concerns that the user can create
|
25
|
+
def authorized_models
|
26
|
+
normalized_model_names.select { |klass| user.can?(:create, klass) }
|
20
27
|
end
|
21
28
|
|
22
29
|
private
|
23
30
|
|
24
|
-
attr_reader :concern_name_normalizer, :
|
31
|
+
attr_reader :concern_name_normalizer, :models
|
25
32
|
|
26
|
-
|
27
|
-
|
33
|
+
# Transform the list of requested model names into a list of class names
|
34
|
+
def normalized_model_names
|
35
|
+
models.map { |name| concern_name_normalizer.call(name) }
|
28
36
|
end
|
29
37
|
end
|
30
38
|
end
|
@@ -1,21 +1,30 @@
|
|
1
1
|
module CurationConcerns
|
2
2
|
class FileSetAuditService
|
3
3
|
attr_reader :file_set
|
4
|
-
def initialize(
|
5
|
-
@file_set =
|
4
|
+
def initialize(file_set)
|
5
|
+
@file_set = file_set
|
6
6
|
end
|
7
7
|
|
8
8
|
NO_RUNS = 999
|
9
9
|
|
10
10
|
# provides a human readable version of the audit status
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
# This may trigger audits to be run if required
|
12
|
+
# @param [Hydra::PCDM::File] file the file to get the audit status for, defaults to the original_file.
|
13
|
+
def human_readable_audit_status(file = file_set.original_file)
|
14
|
+
audit_stat(file)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Check the file by only what is in the audit log.
|
18
|
+
# Do not try to access the versions if we do not have access to them.
|
19
|
+
# Use this when a file_set is loaded from solr instead of fedora
|
20
|
+
def logged_audit_status
|
21
|
+
audit_results = ChecksumAuditLog.logs_for(file_set.id, "original_file")
|
22
|
+
.collect { |result| result["pass"] }
|
23
|
+
|
24
|
+
if audit_results.length > 0
|
25
|
+
stat_to_string(audit_results.reduce(true) { |sum, value| sum && value })
|
17
26
|
else
|
18
|
-
|
27
|
+
'Audits have not yet been run on this file.'
|
19
28
|
end
|
20
29
|
end
|
21
30
|
|
@@ -29,6 +38,17 @@ module CurationConcerns
|
|
29
38
|
|
30
39
|
private
|
31
40
|
|
41
|
+
def stat_to_string(stat)
|
42
|
+
case stat
|
43
|
+
when 0
|
44
|
+
'failing'
|
45
|
+
when 1
|
46
|
+
'passing'
|
47
|
+
else
|
48
|
+
fail ArgumentError, "Unknown status `#{stat}'"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
32
52
|
# Retrieve or generate the audit check for a file (all versions are checked for versioned files)
|
33
53
|
# @param [ActiveFedora::File] file to audit
|
34
54
|
# @param [Array] log container for messages
|
@@ -45,10 +65,11 @@ module CurationConcerns
|
|
45
65
|
# check how many non runs we had
|
46
66
|
non_runs = audit_results.reduce(0) { |sum, value| value == NO_RUNS ? sum + 1 : sum }
|
47
67
|
if non_runs == 0
|
48
|
-
audit_results.reduce(true) { |sum, value| sum && value }
|
68
|
+
result = audit_results.reduce(true) { |sum, value| sum && value }
|
69
|
+
stat_to_string(result)
|
49
70
|
elsif non_runs < audit_results.length
|
50
71
|
result = audit_results.reduce(true) { |sum, value| value == NO_RUNS ? sum : sum && value }
|
51
|
-
"Some audits have not been run, but the ones run were #{
|
72
|
+
"Some audits have not been run, but the ones run were #{stat_to_string(result)}."
|
52
73
|
else
|
53
74
|
'Audits have not yet been run on this file.'
|
54
75
|
end
|
@@ -2,5 +2,21 @@ en:
|
|
2
2
|
curation_concerns:
|
3
3
|
product_name: "CurationConcerns"
|
4
4
|
product_twitter_handle: "@HydraSphere"
|
5
|
-
institution_name:
|
5
|
+
institution_name: &INSTITUTION_NAME "Institution Name"
|
6
6
|
institution_name_full: "The Institution Name"
|
7
|
+
visibility:
|
8
|
+
open:
|
9
|
+
text: "Open Access"
|
10
|
+
class: "label-success"
|
11
|
+
authenticated:
|
12
|
+
text: *INSTITUTION_NAME
|
13
|
+
class: "label-info"
|
14
|
+
restricted:
|
15
|
+
text: "Private"
|
16
|
+
class: "label-danger"
|
17
|
+
embargo:
|
18
|
+
text: "Embargo"
|
19
|
+
class: "label-warning"
|
20
|
+
lease:
|
21
|
+
text: "Lease"
|
22
|
+
class: "label-warning"
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency 'active_attr'
|
23
23
|
spec.add_dependency 'hydra-collections', '~> 6.0.0.rc1'
|
24
24
|
spec.add_dependency 'hydra-head', '~> 9.3'
|
25
|
-
spec.add_dependency 'hydra-works', '~> 0.
|
25
|
+
spec.add_dependency 'hydra-works', '~> 0.6'
|
26
26
|
spec.add_dependency 'active_fedora-noid', '~> 1.0'
|
27
27
|
spec.add_dependency 'resque', '~> 1.23'
|
28
28
|
spec.add_dependency 'resque-pool', '~> 0.3'
|
@@ -11,13 +11,6 @@ module CurationConcerns
|
|
11
11
|
yield(config)
|
12
12
|
end
|
13
13
|
|
14
|
-
# Keep this deprecated class here so that anyone that references it in their config gets a deprecation rather than uninitialized constant.
|
15
|
-
# Remove when Configuration#queue= is removed
|
16
|
-
module Resque
|
17
|
-
class Queue
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
14
|
class Configuration
|
22
15
|
include Callbacks
|
23
16
|
|
@@ -62,7 +55,8 @@ module CurationConcerns
|
|
62
55
|
attr_accessor :temp_file_base, :enable_local_ingest, :analytic_start_date,
|
63
56
|
:fits_to_desc_mapping, :max_days_between_audits,
|
64
57
|
:resource_types, :resource_types_to_schema,
|
65
|
-
:permission_levels, :owner_permission_levels, :analytics
|
58
|
+
:permission_levels, :owner_permission_levels, :analytics,
|
59
|
+
:display_microdata, :microdata_default_type
|
66
60
|
|
67
61
|
attr_writer :enable_noids
|
68
62
|
def enable_noids
|
@@ -85,9 +79,6 @@ module CurationConcerns
|
|
85
79
|
@redis_namespace ||= 'curation_concerns'
|
86
80
|
end
|
87
81
|
|
88
|
-
attr_writer :queue
|
89
|
-
deprecation_deprecate :queue=
|
90
|
-
|
91
82
|
attr_writer :fits_path
|
92
83
|
def fits_path
|
93
84
|
@fits_path ||= 'fits.sh'
|
@@ -124,6 +115,8 @@ module CurationConcerns
|
|
124
115
|
:after_import_local_file_failure, :after_audit_failure,
|
125
116
|
:after_destroy, :after_import_url_success, :after_import_url_failure
|
126
117
|
|
118
|
+
# Registers the given curation concern model in the configuration
|
119
|
+
# @param [Array<Symbol>,Symbol] curation_concern_types
|
127
120
|
def register_curation_concern(*curation_concern_types)
|
128
121
|
Array(curation_concern_types).flatten.compact.each do |cc_type|
|
129
122
|
class_name = normalize_concern_name(cc_type)
|
@@ -145,6 +138,8 @@ module CurationConcerns
|
|
145
138
|
|
146
139
|
private
|
147
140
|
|
141
|
+
# @param [Symbol] the symbol representing the model
|
142
|
+
# @return [String] the class name for the model
|
148
143
|
def normalize_concern_name(c)
|
149
144
|
c.to_s.camelize
|
150
145
|
end
|
@@ -40,9 +40,9 @@ module CurationConcerns
|
|
40
40
|
end
|
41
41
|
|
42
42
|
# Double-quotes are replaced with single ones so this list can be included in a data block. Ex:
|
43
|
-
# <a href="#" data-content="<a href='#'>embedded link</a>"
|
43
|
+
# <a href="#" data-content="<a href='#'>embedded link</a>" data-toggle="popover">Click me</a>
|
44
44
|
def file_list(files)
|
45
|
-
files.map { |
|
45
|
+
files.map { |fs| link_to_file(fs) }.join(', ').tr("\"", "'")
|
46
46
|
end
|
47
47
|
|
48
48
|
def link_to_file(file)
|
@@ -53,14 +53,16 @@ module CurationConcerns
|
|
53
53
|
|
54
54
|
def success_link(files)
|
55
55
|
link_to I18n.t('curation_concerns.messages.success.multiple.link'), '#',
|
56
|
-
|
57
|
-
|
56
|
+
data: { toggle: 'popover',
|
57
|
+
content: file_list(files).html_safe,
|
58
|
+
title: I18n.t('curation_concerns.messages.success.title') }
|
58
59
|
end
|
59
60
|
|
60
61
|
def failure_link(files)
|
61
62
|
link_to I18n.t('curation_concerns.messages.failure.multiple.link'), '#',
|
62
|
-
|
63
|
-
|
63
|
+
data: { toggle: 'popover',
|
64
|
+
content: file_list(files).html_safe,
|
65
|
+
title: I18n.t('curation_concerns.messages.failure.title') }
|
64
66
|
end
|
65
67
|
end
|
66
68
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
# A model name that provides routes that are namespaced to CurationConcerns,
|
3
|
+
# without changing the param key.
|
4
|
+
#
|
5
|
+
# Example:
|
6
|
+
# name = CurationConcerns::Name.new(GenericWork)
|
7
|
+
# name.param_key
|
8
|
+
# # => 'generic_work'
|
9
|
+
# name.route_key
|
10
|
+
# # => 'curation_concerns_generic_works'
|
11
|
+
#
|
12
|
+
class Name < ActiveModel::Name
|
13
|
+
def initialize(klass, namespace = nil, name = nil)
|
14
|
+
super
|
15
|
+
@route_key = "curation_concerns_#{ActiveSupport::Inflector.pluralize(@param_key)}"
|
16
|
+
@singular_route_key = ActiveSupport::Inflector.singularize(@route_key)
|
17
|
+
@route_key << "_index" if @plural == @singular
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -8,7 +8,6 @@ This generator makes the following changes to your application:
|
|
8
8
|
1. Creates several database migrations if they do not exist in /db/migrate
|
9
9
|
2. Creates the curation_concerns.rb configuration file and several others
|
10
10
|
3. Creates the file_set.rb and collection.rb models
|
11
|
-
4. Runs full-text generator
|
12
11
|
"''
|
13
12
|
def banner
|
14
13
|
say_status('warning', 'GENERATING CURATION_CONCERNS MODELS', :yellow)
|
@@ -29,28 +29,12 @@ CurationConcerns.configure do |config|
|
|
29
29
|
'Other' => 'Other'
|
30
30
|
}
|
31
31
|
|
32
|
-
config.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
'Dataset' => 'http://schema.org/Dataset',
|
39
|
-
'Dissertation' => 'http://schema.org/ScholarlyArticle',
|
40
|
-
'Image' => 'http://schema.org/ImageObject',
|
41
|
-
'Journal' => 'http://schema.org/CreativeWork',
|
42
|
-
'Map or Cartographic Material' => 'http://schema.org/Map',
|
43
|
-
'Masters Thesis' => 'http://schema.org/ScholarlyArticle',
|
44
|
-
'Part of Book' => 'http://schema.org/Book',
|
45
|
-
'Poster' => 'http://schema.org/CreativeWork',
|
46
|
-
'Presentation' => 'http://schema.org/CreativeWork',
|
47
|
-
'Project' => 'http://schema.org/CreativeWork',
|
48
|
-
'Report' => 'http://schema.org/CreativeWork',
|
49
|
-
'Research Paper' => 'http://schema.org/ScholarlyArticle',
|
50
|
-
'Software or Program Code' => 'http://schema.org/Code',
|
51
|
-
'Video' => 'http://schema.org/VideoObject',
|
52
|
-
'Other' => 'http://schema.org/CreativeWork'
|
53
|
-
}
|
32
|
+
config.display_microdata = true
|
33
|
+
config.microdata_default_type = 'http://schema.org/CreativeWork'
|
34
|
+
|
35
|
+
config.resource_types_to_schema = config.resource_types.map do |k, v|
|
36
|
+
[k, I18n.t("curation_concerns.schema_org.resource_type.#{v}", default: config.microdata_default_type)]
|
37
|
+
end.to_h
|
54
38
|
|
55
39
|
config.permission_levels = {
|
56
40
|
'Choose Access' => 'none',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curation_concerns-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_attr
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.6'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.6'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: active_fedora-noid
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,8 +184,8 @@ files:
|
|
184
184
|
- app/actors/curation_concerns/lease_actor.rb
|
185
185
|
- app/actors/curation_concerns/work_actor_behavior.rb
|
186
186
|
- app/indexers/curation_concerns/collection_indexer.rb
|
187
|
-
- app/indexers/curation_concerns/
|
188
|
-
- app/indexers/curation_concerns/
|
187
|
+
- app/indexers/curation_concerns/file_set_indexer.rb
|
188
|
+
- app/indexers/curation_concerns/work_indexer.rb
|
189
189
|
- app/jobs/active_fedora_id_based_job.rb
|
190
190
|
- app/jobs/audit_job.rb
|
191
191
|
- app/jobs/characterize_job.rb
|
@@ -198,20 +198,22 @@ files:
|
|
198
198
|
- app/models/checksum_audit_log.rb
|
199
199
|
- app/models/concerns/curation_concerns/ability.rb
|
200
200
|
- app/models/concerns/curation_concerns/basic_metadata.rb
|
201
|
+
- app/models/concerns/curation_concerns/belongs_to_upload_sets.rb
|
201
202
|
- app/models/concerns/curation_concerns/collection_behavior.rb
|
202
|
-
- app/models/concerns/curation_concerns/file_set/belongs_to_upload_sets.rb
|
203
203
|
- app/models/concerns/curation_concerns/file_set/belongs_to_works.rb
|
204
204
|
- app/models/concerns/curation_concerns/file_set/derivatives.rb
|
205
205
|
- app/models/concerns/curation_concerns/file_set/full_text_indexing.rb
|
206
206
|
- app/models/concerns/curation_concerns/file_set/indexing.rb
|
207
|
+
- app/models/concerns/curation_concerns/file_set/querying.rb
|
207
208
|
- app/models/concerns/curation_concerns/file_set/versions.rb
|
208
209
|
- app/models/concerns/curation_concerns/file_set_behavior.rb
|
209
|
-
- app/models/concerns/curation_concerns/generic_file.rb
|
210
210
|
- app/models/concerns/curation_concerns/has_representative.rb
|
211
211
|
- app/models/concerns/curation_concerns/human_readable_type.rb
|
212
|
+
- app/models/concerns/curation_concerns/naming.rb
|
212
213
|
- app/models/concerns/curation_concerns/permissions.rb
|
213
214
|
- app/models/concerns/curation_concerns/permissions/readable.rb
|
214
215
|
- app/models/concerns/curation_concerns/permissions/writable.rb
|
216
|
+
- app/models/concerns/curation_concerns/required_metadata.rb
|
215
217
|
- app/models/concerns/curation_concerns/serializers.rb
|
216
218
|
- app/models/concerns/curation_concerns/solr_document_behavior.rb
|
217
219
|
- app/models/concerns/curation_concerns/upload_set_behavior.rb
|
@@ -243,6 +245,8 @@ files:
|
|
243
245
|
- lib/curation_concerns/models/engine.rb
|
244
246
|
- lib/curation_concerns/models/utils.rb
|
245
247
|
- lib/curation_concerns/models/version.rb
|
248
|
+
- lib/curation_concerns/name.rb
|
249
|
+
- lib/curation_concerns/null_logger.rb
|
246
250
|
- lib/generators/curation_concerns/models/abstract_migration_generator.rb
|
247
251
|
- lib/generators/curation_concerns/models/clamav_generator.rb
|
248
252
|
- lib/generators/curation_concerns/models/install_generator.rb
|
@@ -282,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
286
|
version: '0'
|
283
287
|
requirements: []
|
284
288
|
rubyforge_project:
|
285
|
-
rubygems_version: 2.
|
289
|
+
rubygems_version: 2.5.0
|
286
290
|
signing_key:
|
287
291
|
specification_version: 4
|
288
292
|
summary: Simple institutional repository models for Hydra
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module CurationConcerns
|
2
|
-
module FileSet
|
3
|
-
module BelongsToUploadSets
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
included do
|
6
|
-
belongs_to :upload_set, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf
|
7
|
-
end
|
8
|
-
|
9
|
-
# Is this file in the middle of being processed by an UploadSet?
|
10
|
-
def processing?
|
11
|
-
try(:upload_set).try(:status) == ['processing'.freeze]
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|