curation_concerns-models 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/Rakefile +1 -1
- data/app/actors/concerns/curation_concerns/manages_embargoes_actor.rb +11 -19
- data/app/actors/curation_concerns/base_actor.rb +41 -45
- data/app/actors/curation_concerns/embargo_actor.rb +19 -0
- data/app/actors/curation_concerns/file_set_actor.rb +200 -0
- data/app/actors/curation_concerns/lease_actor.rb +19 -0
- data/app/actors/curation_concerns/work_actor_behavior.rb +55 -58
- data/app/indexers/curation_concerns/collection_indexer.rb +10 -0
- data/app/indexers/curation_concerns/file_set_indexing_service.rb +24 -0
- data/app/{services/curation_concerns/generic_work_indexing_service.rb → indexers/curation_concerns/work_indexing_service.rb} +6 -6
- data/app/jobs/active_fedora_id_based_job.rb +5 -12
- data/app/jobs/audit_job.rb +11 -17
- data/app/jobs/characterize_job.rb +8 -7
- data/app/jobs/create_derivatives_job.rb +8 -11
- data/app/jobs/import_url_job.rb +12 -25
- data/app/jobs/ingest_file_job.rb +16 -0
- data/app/jobs/ingest_local_file_job.rb +14 -35
- data/app/jobs/resolrize_job.rb +3 -5
- data/app/jobs/upload_set_update_job.rb +68 -0
- data/app/models/checksum_audit_log.rb +2 -3
- data/app/models/concerns/curation_concerns/ability.rb +18 -10
- data/app/models/concerns/curation_concerns/basic_metadata.rb +1 -3
- data/app/models/concerns/curation_concerns/collection_behavior.rb +13 -14
- data/app/models/concerns/curation_concerns/file_set/belongs_to_upload_sets.rb +15 -0
- data/app/models/concerns/curation_concerns/{generic_file → file_set}/belongs_to_works.rb +8 -14
- data/app/models/concerns/curation_concerns/file_set/derivatives.rb +54 -0
- data/app/models/concerns/curation_concerns/{generic_file → file_set}/full_text_indexing.rb +1 -2
- data/app/models/concerns/curation_concerns/{generic_file → file_set}/indexing.rb +2 -2
- data/app/models/concerns/curation_concerns/{generic_file → file_set}/versions.rb +2 -3
- data/app/models/concerns/curation_concerns/file_set_behavior.rb +36 -0
- data/app/models/concerns/curation_concerns/generic_file.rb +1 -1
- data/app/models/concerns/curation_concerns/has_representative.rb +6 -7
- data/app/models/concerns/curation_concerns/human_readable_type.rb +5 -7
- data/app/models/concerns/curation_concerns/permissions.rb +2 -2
- data/app/models/concerns/curation_concerns/permissions/readable.rb +0 -1
- data/app/models/concerns/curation_concerns/permissions/writable.rb +10 -51
- data/app/models/concerns/curation_concerns/serializers.rb +3 -5
- data/app/models/concerns/curation_concerns/solr_document_behavior.rb +37 -40
- data/app/models/concerns/curation_concerns/upload_set_behavior.rb +38 -0
- data/app/models/concerns/curation_concerns/user.rb +4 -51
- data/app/models/concerns/curation_concerns/with_file_sets.rb +28 -0
- data/app/models/concerns/curation_concerns/{generic_work_behavior.rb → work_behavior.rb} +12 -6
- data/app/models/curation_concerns/classify_concern.rb +7 -7
- data/app/models/curation_concerns/quick_classification_query.rb +6 -7
- data/app/models/single_use_link.rb +34 -0
- data/app/models/upload_set.rb +3 -0
- data/app/services/curation_concerns/derivative_path.rb +32 -0
- data/app/services/curation_concerns/{generic_file_audit_service.rb → file_set_audit_service.rb} +17 -18
- data/app/services/curation_concerns/indexes_thumbnails.rb +14 -0
- data/app/services/curation_concerns/local_file_service.rb +10 -0
- data/app/services/curation_concerns/lock_manager.rb +40 -0
- data/app/services/curation_concerns/noid.rb +1 -1
- data/app/services/curation_concerns/persist_derivatives.rb +33 -0
- data/app/services/curation_concerns/persist_directly_contained_output_file_service.rb +26 -0
- data/app/services/curation_concerns/repository_audit_service.rb +1 -3
- data/app/services/curation_concerns/thumbnail_path_service.rb +46 -0
- data/app/services/curation_concerns/time_service.rb +7 -0
- data/app/services/curation_concerns/versioning_service.rb +11 -12
- data/curation_concerns-models.gemspec +6 -6
- data/lib/curation_concerns/configuration.rb +154 -0
- data/lib/curation_concerns/messages.rb +26 -26
- data/lib/curation_concerns/models.rb +5 -14
- data/lib/curation_concerns/models/engine.rb +0 -30
- data/lib/curation_concerns/models/utils.rb +4 -4
- data/lib/curation_concerns/models/version.rb +1 -1
- data/lib/generators/curation_concerns/models/abstract_migration_generator.rb +8 -7
- data/lib/generators/curation_concerns/models/clamav_generator.rb +3 -3
- data/lib/generators/curation_concerns/models/install_generator.rb +13 -20
- data/lib/generators/curation_concerns/models/templates/app/models/file_set.rb +4 -0
- data/lib/generators/curation_concerns/models/templates/config/clamav.rb +1 -1
- data/lib/generators/curation_concerns/models/templates/config/curation_concerns.rb +52 -65
- data/lib/generators/curation_concerns/models/templates/config/redis_config.rb +13 -17
- data/lib/generators/curation_concerns/models/templates/config/resque_config.rb +2 -1
- data/lib/generators/curation_concerns/models/templates/migrations/create_checksum_audit_logs.rb +3 -3
- data/lib/generators/curation_concerns/models/templates/migrations/create_single_use_links.rb +12 -0
- data/lib/tasks/curation_concerns-models_tasks.rake +4 -62
- data/lib/tasks/migrate.rake +1 -1
- data/lib/tasks/resque.rake +1 -0
- data/lib/tasks/solr_reindex.rake +1 -1
- metadata +59 -52
- data/app/actors/curation_concerns/generic_file_actor.rb +0 -150
- data/app/jobs/active_fedora_pid_based_job.rb +0 -6
- data/app/jobs/copy_permissions_job.rb +0 -24
- data/app/models/concerns/curation_concerns/generic_file/characterization.rb +0 -89
- data/app/models/concerns/curation_concerns/generic_file/content.rb +0 -8
- data/app/models/concerns/curation_concerns/generic_file/export.rb +0 -343
- data/app/models/concerns/curation_concerns/generic_file_behavior.rb +0 -44
- data/app/models/concerns/curation_concerns/with_basic_metadata.rb +0 -98
- data/app/models/concerns/curation_concerns/with_generic_files.rb +0 -29
- data/app/models/datastreams/fits_datastream.rb +0 -148
- data/app/services/curation_concerns/characterization_service.rb +0 -71
- data/app/services/curation_concerns/full_text_extraction_service.rb +0 -38
- data/app/services/curation_concerns/generic_file_indexing_service.rb +0 -14
- data/lib/curation_concerns/models/resque.rb +0 -36
- data/lib/generators/curation_concerns/models/fulltext_generator.rb +0 -28
- data/lib/generators/curation_concerns/models/templates/app/models/generic_file.rb +0 -4
- data/lib/generators/curation_concerns/models/templates/config/resque_admin.rb +0 -10
@@ -2,13 +2,12 @@ module CurationConcerns::HasRepresentative
|
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
4
|
included do
|
5
|
-
|
6
|
-
|
5
|
+
belongs_to :representative,
|
6
|
+
predicate: ::RDF::Vocab::EBUCore.hasRelatedMediaFragment,
|
7
|
+
class_name: 'ActiveFedora::Base'
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
9
|
+
belongs_to :thumbnail,
|
10
|
+
predicate: ::RDF::Vocab::EBUCore.hasRelatedImage,
|
11
|
+
class_name: 'ActiveFedora::Base'
|
12
12
|
end
|
13
|
-
|
14
13
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module CurationConcerns
|
2
|
-
|
2
|
+
module HumanReadableType
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
@@ -11,13 +11,11 @@ module CurationConcerns
|
|
11
11
|
self.class.human_readable_type
|
12
12
|
end
|
13
13
|
|
14
|
-
def to_solr(solr_doc={})
|
15
|
-
super(solr_doc).tap do |
|
16
|
-
|
17
|
-
|
14
|
+
def to_solr(solr_doc = {})
|
15
|
+
super(solr_doc).tap do |doc|
|
16
|
+
doc[Solrizer.solr_name('human_readable_type', :facetable)] = human_readable_type
|
17
|
+
doc[Solrizer.solr_name('human_readable_type', :stored_searchable)] = human_readable_type
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
21
20
|
end
|
22
21
|
end
|
23
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module CurationConcerns
|
2
2
|
module Permissions
|
3
3
|
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
|
4
|
+
include CurationConcerns::Permissions::Writable
|
5
|
+
include CurationConcerns::Permissions::Readable
|
6
6
|
end
|
7
7
|
end
|
@@ -3,7 +3,7 @@ module CurationConcerns
|
|
3
3
|
module Writable
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
#we're overriding the permissions= method which is in Hydra::AccessControls::Permissions
|
6
|
+
# we're overriding the permissions= method which is in Hydra::AccessControls::Permissions
|
7
7
|
include Hydra::AccessControls::Permissions
|
8
8
|
include Hydra::AccessControls::Visibility
|
9
9
|
|
@@ -14,62 +14,21 @@ module CurationConcerns
|
|
14
14
|
def paranoid_permissions
|
15
15
|
valid = true
|
16
16
|
paranoid_edit_permissions.each do |validation|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
17
|
+
next unless validation[:condition].call(self)
|
18
|
+
errors[validation[:key]] ||= []
|
19
|
+
errors[validation[:key]] << validation[:message]
|
20
|
+
valid = false
|
22
21
|
end
|
23
|
-
|
22
|
+
valid
|
24
23
|
end
|
25
24
|
|
26
25
|
def paranoid_edit_permissions
|
27
26
|
[
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
{ key: :edit_users, message: 'Depositor must have edit access', condition: ->(obj) { !obj.edit_users.include?(obj.depositor) } },
|
28
|
+
{ key: :edit_groups, message: 'Public cannot have edit access', condition: ->(obj) { obj.edit_groups.include?('public') } },
|
29
|
+
{ key: :edit_groups, message: 'Registered cannot have edit access', condition: ->(obj) { obj.edit_groups.include?('registered') } }
|
31
30
|
]
|
32
31
|
end
|
33
|
-
|
34
|
-
def clear_permissions!
|
35
|
-
self.permissions = []
|
36
|
-
end
|
37
|
-
|
38
|
-
## Updates those permissions that are provided to it. Does not replace any permissions unless they are provided
|
39
|
-
# def permissions=(params)
|
40
|
-
# raise "Fixme #{params}"
|
41
|
-
# perm_hash = permission_hash
|
42
|
-
# params[:new_user_name].each { |name, access| perm_hash['person'][name] = access } if params[:new_user_name].present?
|
43
|
-
# params[:new_group_name].each { |name, access| perm_hash['group'][name] = access } if params[:new_group_name].present?
|
44
|
-
|
45
|
-
# params[:user].each { |name, access| perm_hash['person'][name] = access} if params[:user]
|
46
|
-
# params[:group].each { |name, access| perm_hash['group'][name] = access if ['read', 'edit'].include?(access)} if params[:group]
|
47
|
-
|
48
|
-
# # rightsMetadata.update_permissions(perm_hash)
|
49
|
-
# end
|
50
|
-
|
51
|
-
# def permissions
|
52
|
-
# raise "Fixme "
|
53
|
-
# perms = super
|
54
|
-
# perms.map {|p| { name: p.name, access: p.access, type:p.type } }
|
55
|
-
# end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
def permission_hash
|
60
|
-
old_perms = self.permissions
|
61
|
-
user_perms = {}
|
62
|
-
old_perms.select{|r| r[:type] == 'user'}.each do |r|
|
63
|
-
user_perms[r[:name]] = r[:access]
|
64
|
-
end
|
65
|
-
user_perms
|
66
|
-
group_perms = {}
|
67
|
-
old_perms.select{|r| r[:type] == 'group'}.each do |r|
|
68
|
-
group_perms[r[:name]] = r[:access]
|
69
|
-
end
|
70
|
-
{'person'=>user_perms, 'group'=>group_perms}
|
71
|
-
end
|
72
|
-
|
73
32
|
end
|
74
33
|
end
|
75
|
-
end
|
34
|
+
end
|
@@ -1,15 +1,13 @@
|
|
1
1
|
module CurationConcerns
|
2
2
|
module Serializers
|
3
|
-
|
4
3
|
def to_s
|
5
4
|
if title.present?
|
6
|
-
Array(title).join(
|
5
|
+
Array(title).join(' | ')
|
7
6
|
elsif label.present?
|
8
|
-
Array(label).join(
|
7
|
+
Array(label).join(' | ')
|
9
8
|
else
|
10
|
-
|
9
|
+
'No Title'
|
11
10
|
end
|
12
11
|
end
|
13
|
-
|
14
12
|
end
|
15
13
|
end
|
@@ -1,15 +1,12 @@
|
|
1
1
|
module CurationConcerns
|
2
2
|
module SolrDocumentBehavior
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
include Hydra::Works::MimeTypes
|
5
|
+
|
3
6
|
def title_or_label
|
4
7
|
title || label
|
5
8
|
end
|
6
9
|
|
7
|
-
##
|
8
|
-
# Give our SolrDocument an ActiveModel::Naming appropriate route_key
|
9
|
-
def route_key
|
10
|
-
get(Solrizer.solr_name('has_model', :symbol)).split(':').last.downcase
|
11
|
-
end
|
12
|
-
|
13
10
|
def to_param
|
14
11
|
id
|
15
12
|
end
|
@@ -43,12 +40,12 @@ module CurationConcerns
|
|
43
40
|
Array(self[Solrizer.solr_name('human_readable_type', :stored_searchable)]).first
|
44
41
|
end
|
45
42
|
|
46
|
-
def
|
47
|
-
|
43
|
+
def representative_id
|
44
|
+
fetch(Solrizer.solr_name('hasRelatedMediaFragment', :symbol), []).first
|
48
45
|
end
|
49
46
|
|
50
47
|
def date_uploaded
|
51
|
-
field = self[Solrizer.solr_name(
|
48
|
+
field = self[Solrizer.solr_name('date_uploaded', :stored_sortable, type: :date)]
|
52
49
|
return unless field.present?
|
53
50
|
begin
|
54
51
|
Date.parse(field).to_formatted_s(:standard)
|
@@ -58,7 +55,7 @@ module CurationConcerns
|
|
58
55
|
end
|
59
56
|
|
60
57
|
def depositor(default = '')
|
61
|
-
val = Array(self[Solrizer.solr_name(
|
58
|
+
val = Array(self[Solrizer.solr_name('depositor')]).first
|
62
59
|
val.present? ? val : default
|
63
60
|
end
|
64
61
|
|
@@ -75,61 +72,61 @@ module CurationConcerns
|
|
75
72
|
end
|
76
73
|
|
77
74
|
def file_format
|
78
|
-
|
75
|
+
Array(self[Solrizer.solr_name('file_format')]).first
|
79
76
|
end
|
80
77
|
|
81
78
|
def creator
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
def tags
|
86
|
-
Array(self[Solrizer.solr_name("tag")])
|
79
|
+
fetch(Solrizer.solr_name('creator'), [])
|
87
80
|
end
|
88
81
|
|
89
|
-
def
|
90
|
-
|
82
|
+
def contributor
|
83
|
+
fetch(Solrizer.solr_name('contributor'), [])
|
91
84
|
end
|
92
85
|
|
93
|
-
def
|
94
|
-
|
86
|
+
def subject
|
87
|
+
fetch(Solrizer.solr_name('subject'), [])
|
95
88
|
end
|
96
89
|
|
97
|
-
def
|
98
|
-
|
90
|
+
def publisher
|
91
|
+
fetch(Solrizer.solr_name('publisher'), [])
|
99
92
|
end
|
100
93
|
|
101
|
-
def
|
102
|
-
|
94
|
+
def language
|
95
|
+
fetch(Solrizer.solr_name('language'), [])
|
103
96
|
end
|
104
97
|
|
105
|
-
def
|
106
|
-
|
98
|
+
def tags
|
99
|
+
fetch(Solrizer.solr_name('tag'), [])
|
107
100
|
end
|
108
101
|
|
109
|
-
def
|
110
|
-
|
102
|
+
def embargo_release_date
|
103
|
+
self[Hydra.config.permissions.embargo.release_date]
|
111
104
|
end
|
112
105
|
|
113
|
-
def
|
114
|
-
|
106
|
+
def lease_expiration_date
|
107
|
+
self[Hydra.config.permissions.lease.expiration_date]
|
115
108
|
end
|
116
109
|
|
117
|
-
def
|
118
|
-
['
|
110
|
+
def rights
|
111
|
+
self[Solrizer.solr_name('rights')]
|
119
112
|
end
|
120
113
|
|
121
|
-
def
|
122
|
-
['
|
114
|
+
def mime_type
|
115
|
+
self[Solrizer.solr_name('mime_type', :stored_sortable)]
|
123
116
|
end
|
124
117
|
|
125
|
-
def
|
126
|
-
|
118
|
+
def read_groups
|
119
|
+
fetch(Hydra.config.permissions.read.group, [])
|
127
120
|
end
|
128
121
|
|
129
|
-
def
|
130
|
-
|
131
|
-
|
132
|
-
|
122
|
+
def visibility
|
123
|
+
@visibility ||= if read_groups.include? Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC
|
124
|
+
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
125
|
+
elsif read_groups.include? Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED
|
126
|
+
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
127
|
+
else
|
128
|
+
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
129
|
+
end
|
133
130
|
end
|
134
131
|
end
|
135
132
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module UploadSetBehavior
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
include Hydra::AccessControls::Permissions
|
5
|
+
include CurationConcerns::Noid
|
6
|
+
|
7
|
+
included do
|
8
|
+
has_many :file_sets, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf
|
9
|
+
|
10
|
+
property :creator, predicate: ::RDF::DC.creator
|
11
|
+
property :title, predicate: ::RDF::DC.title
|
12
|
+
property :status, predicate: ::RDF::DC.type
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
def find_or_create(id)
|
17
|
+
UploadSet.find(id)
|
18
|
+
rescue ActiveFedora::ObjectNotFoundError
|
19
|
+
safe_create(id)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
# This method handles most race conditions gracefully.
|
25
|
+
# If an upload_set with the same ID is created by another thread
|
26
|
+
# we fetch the upload_set that was created (rather than throwing
|
27
|
+
# an error) and continute.
|
28
|
+
def safe_create(id)
|
29
|
+
UploadSet.create(id: id)
|
30
|
+
rescue ActiveFedora::IllegalOperation
|
31
|
+
# This is the exception thrown by LDP when we attempt to
|
32
|
+
# create a duplicate object. If we can find the object
|
33
|
+
# then we are good to go.
|
34
|
+
UploadSet.find(id)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,65 +1,18 @@
|
|
1
1
|
module CurationConcerns::User
|
2
2
|
extend ActiveSupport::Concern
|
3
|
-
|
4
|
-
# Copied piecemeal from the pcdm branch of sufia-models. More may yet be necessary.
|
5
|
-
|
6
3
|
included do
|
7
|
-
# Connects this user object to Blacklight's Bookmarks and Folders.
|
8
|
-
include Blacklight::User
|
9
|
-
include Hydra::User
|
10
|
-
|
11
4
|
delegate :can?, :cannot?, to: :ability
|
12
|
-
|
13
|
-
attr_accessor :update_directory
|
14
|
-
end
|
15
|
-
|
16
|
-
# Format the json for select2 which requires just an id and a field called text.
|
17
|
-
# If we need an alternate format we should probably look at a json template gem
|
18
|
-
def as_json(opts = nil)
|
19
|
-
{ id: user_key, text: display_name ? "#{display_name} (#{user_key})" : user_key }
|
20
|
-
end
|
21
|
-
|
22
|
-
# Populate user instance with attributes from remote system (e.g., LDAP)
|
23
|
-
# There is no default implementation -- override this in your application
|
24
|
-
# def populate_attributes
|
25
|
-
# end
|
26
|
-
|
27
|
-
def email_address
|
28
|
-
self.email
|
29
|
-
end
|
30
|
-
|
31
|
-
def name
|
32
|
-
self.display_name.titleize || raise
|
33
|
-
rescue
|
34
|
-
self.user_key
|
35
5
|
end
|
36
6
|
|
37
7
|
# Redefine this for more intuitive keys in Redis
|
38
8
|
def to_param
|
39
|
-
#
|
9
|
+
# HACK: because rails doesn't like periods in urls.
|
40
10
|
user_key.gsub(/\./, '-dot-')
|
41
11
|
end
|
42
12
|
|
43
|
-
|
44
|
-
# def groups
|
45
|
-
# @groups ||= self.group_list ? self.group_list.split(";?;") : []
|
46
|
-
# end
|
47
|
-
|
48
|
-
def ability
|
49
|
-
@ability ||= ::Ability.new(self)
|
50
|
-
end
|
51
|
-
|
52
|
-
module ClassMethods
|
53
|
-
def current
|
54
|
-
Thread.current[:user]
|
55
|
-
end
|
13
|
+
private
|
56
14
|
|
57
|
-
def
|
58
|
-
|
15
|
+
def ability
|
16
|
+
@ability ||= ::Ability.new(self)
|
59
17
|
end
|
60
|
-
|
61
|
-
# def from_url_component(component)
|
62
|
-
# User.find_by_user_key(component.gsub(/-dot-/, '.'))
|
63
|
-
# end
|
64
|
-
end
|
65
18
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copied from Curate
|
2
|
+
module CurationConcerns
|
3
|
+
module WithFileSets
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
# The file_sets association and its accessor methods comes from Hydra::Works::AggregatesFileSets
|
8
|
+
before_destroy :before_destroy_cleanup_file_sets
|
9
|
+
end
|
10
|
+
|
11
|
+
# Stopgap unil ActiveFedora ContainerAssociation includes an *_ids accessor.
|
12
|
+
# At the moment, this is no more efficient than calling file_sets, but hopefully that will change in the future.
|
13
|
+
def file_set_ids
|
14
|
+
file_sets.map(&:id)
|
15
|
+
end
|
16
|
+
|
17
|
+
def before_destroy_cleanup_file_sets
|
18
|
+
file_sets.each(&:destroy)
|
19
|
+
end
|
20
|
+
|
21
|
+
def copy_visibility_to_files
|
22
|
+
file_sets.each do |fs|
|
23
|
+
fs.visibility = visibility
|
24
|
+
fs.save!
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
module CurationConcerns::
|
1
|
+
module CurationConcerns::WorkBehavior
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
|
-
include Hydra::Works::
|
4
|
+
include Hydra::Works::WorkBehavior
|
5
5
|
include ::CurationConcerns::HumanReadableType
|
6
6
|
include CurationConcerns::Noid
|
7
7
|
include CurationConcerns::Permissions
|
@@ -9,7 +9,7 @@ module CurationConcerns::GenericWorkBehavior
|
|
9
9
|
include Hydra::WithDepositor
|
10
10
|
include Solrizer::Common
|
11
11
|
include ::CurationConcerns::HasRepresentative
|
12
|
-
include ::CurationConcerns::
|
12
|
+
include ::CurationConcerns::WithFileSets
|
13
13
|
include Hydra::AccessControls::Embargoable
|
14
14
|
|
15
15
|
included do
|
@@ -19,12 +19,18 @@ module CurationConcerns::GenericWorkBehavior
|
|
19
19
|
|
20
20
|
module ClassMethods
|
21
21
|
def indexer
|
22
|
-
CurationConcerns::
|
22
|
+
CurationConcerns::WorkIndexingService
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
def to_s
|
27
|
-
title.
|
27
|
+
if title.present?
|
28
|
+
Array(title).join(' | ')
|
29
|
+
elsif label.present?
|
30
|
+
Array(label).join(' | ')
|
31
|
+
else
|
32
|
+
'No Title'
|
33
|
+
end
|
28
34
|
end
|
29
35
|
|
30
36
|
# Returns a string identifying the path associated with the object. ActionPack uses this to find a suitable partial to represent the object.
|
@@ -32,7 +38,7 @@ module CurationConcerns::GenericWorkBehavior
|
|
32
38
|
"curation_concerns/#{super}"
|
33
39
|
end
|
34
40
|
|
35
|
-
def can_be_member_of_collection?(
|
41
|
+
def can_be_member_of_collection?(_collection)
|
36
42
|
true
|
37
43
|
end
|
38
44
|
end
|