ddr-models 2.6.2 → 2.7.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +2 -3
- data/app/models/collection.rb +11 -3
- data/app/models/component.rb +54 -4
- data/app/models/item.rb +1 -2
- data/config/initializers/active_fedora_base.rb +8 -5
- data/config/initializers/rubydora_monkey_patch.rb +11 -0
- data/config/initializers/subscriptions.rb +16 -9
- data/config/locales/ddr-models.en.yml +3 -0
- data/ddr-models.gemspec +3 -2
- data/lib/ddr/actions/virus_check.rb +10 -16
- data/lib/ddr/auth.rb +0 -8
- data/lib/ddr/datastreams.rb +13 -2
- data/lib/ddr/datastreams/administrative_metadata_datastream.rb +9 -0
- data/lib/ddr/datastreams/content_datastream.rb +5 -0
- data/lib/ddr/datastreams/datastream_behavior.rb +60 -15
- data/lib/ddr/datastreams/delete_external_files.rb +29 -0
- data/lib/ddr/datastreams/descriptive_metadata_datastream.rb +33 -33
- data/lib/ddr/datastreams/external_file_datastream.rb +69 -0
- data/lib/ddr/datastreams/fits_datastream.rb +15 -5
- data/lib/ddr/datastreams/intermediate_file_datastream.rb +5 -0
- data/lib/ddr/datastreams/metadata_datastream.rb +15 -17
- data/lib/ddr/datastreams/multires_image_datastream.rb +5 -0
- data/lib/ddr/derivatives.rb +1 -0
- data/lib/ddr/derivatives/ptif_generator.rb +5 -1
- data/lib/ddr/derivatives/update_derivatives.rb +23 -0
- data/lib/ddr/events/deletion_event.rb +5 -9
- data/lib/ddr/events/event.rb +7 -9
- data/lib/ddr/events/ingestion_event.rb +5 -9
- data/lib/ddr/events/update_event.rb +12 -5
- data/lib/ddr/index.rb +0 -1
- data/lib/ddr/index/csv_query_result.rb +10 -2
- data/lib/ddr/index/fields.rb +10 -9
- data/lib/ddr/index/filter.rb +1 -0
- data/lib/ddr/managers/derivatives_manager.rb +84 -98
- data/lib/ddr/managers/technical_metadata_manager.rb +20 -5
- data/lib/ddr/models.rb +24 -24
- data/lib/ddr/models/base.rb +98 -74
- data/lib/ddr/models/cache.rb +20 -0
- data/lib/ddr/models/engine.rb +4 -6
- data/lib/ddr/models/file_management.rb +57 -152
- data/lib/ddr/models/fixity_checkable.rb +0 -5
- data/lib/ddr/models/has_admin_metadata.rb +4 -2
- data/lib/ddr/models/has_children.rb +35 -1
- data/lib/ddr/models/has_content.rb +3 -33
- data/lib/ddr/models/has_intermediate_file.rb +18 -0
- data/lib/ddr/models/has_multires_image.rb +12 -15
- data/lib/ddr/models/has_struct_metadata.rb +2 -38
- data/lib/ddr/models/indexing.rb +160 -163
- data/lib/ddr/models/permanent_id.rb +26 -49
- data/lib/ddr/models/solr_document.rb +21 -19
- data/lib/ddr/models/structure.rb +168 -41
- data/lib/ddr/models/structures/agent.rb +49 -0
- data/lib/ddr/models/structures/div.rb +64 -0
- data/lib/ddr/models/structures/f_locat.rb +54 -0
- data/lib/ddr/models/structures/file.rb +52 -0
- data/lib/ddr/models/structures/file_grp.rb +35 -0
- data/lib/ddr/models/structures/file_sec.rb +22 -0
- data/lib/ddr/models/structures/fptr.rb +31 -0
- data/lib/ddr/models/structures/mets_hdr.rb +37 -0
- data/lib/ddr/models/structures/mptr.rb +49 -0
- data/lib/ddr/models/structures/struct_map.rb +40 -0
- data/lib/ddr/models/version.rb +1 -1
- data/lib/ddr/notifications.rb +10 -12
- data/lib/ddr/utils.rb +29 -16
- data/lib/ddr/vocab.rb +15 -17
- data/lib/ddr/vocab/asset.rb +29 -19
- data/lib/ddr/vocab/contact.rb +5 -7
- data/lib/ddr/vocab/display.rb +6 -8
- data/lib/ddr/vocab/duke_terms.rb +8 -10
- data/lib/ddr/vocab/rdf_vocabulary_parser.rb +37 -39
- data/lib/ddr/vocab/roles.rb +17 -19
- data/lib/ddr/vocab/vocabulary.rb +26 -26
- data/spec/datastreams/external_file_datastream_spec.rb +37 -0
- data/spec/derivatives/png_generator_spec.rb +21 -25
- data/spec/derivatives/ptif_generator_spec.rb +22 -26
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/db/schema.rb +23 -23
- data/spec/factories/structure_factories.rb +8 -2
- data/spec/fixtures/imageA.jpg +0 -0
- data/spec/fixtures/imageB.jpg +0 -0
- data/spec/index/csv_query_result_spec.rb +3 -3
- data/spec/index/fields_spec.rb +7 -6
- data/spec/managers/derivatives_manager_spec.rb +105 -112
- data/spec/managers/technical_metadata_manager_spec.rb +22 -18
- data/spec/models/active_fedora_base_spec.rb +0 -106
- data/spec/models/active_fedora_datastream_spec.rb +33 -2
- data/spec/models/attachment_spec.rb +0 -2
- data/spec/models/cache_spec.rb +32 -0
- data/spec/models/collection_spec.rb +43 -19
- data/spec/models/component_spec.rb +41 -51
- data/spec/models/descriptive_metadata_datastream_spec.rb +99 -87
- data/spec/models/events_spec.rb +50 -69
- data/spec/models/file_management_spec.rb +79 -187
- data/spec/models/has_children_spec.rb +54 -3
- data/spec/models/has_struct_metadata_spec.rb +32 -38
- data/spec/models/indexing_spec.rb +11 -6
- data/spec/models/item_spec.rb +21 -7
- data/spec/models/permanent_id_spec.rb +1 -5
- data/spec/models/solr_document_spec.rb +13 -41
- data/spec/models/structure_spec.rb +85 -16
- data/spec/models/structures/agent_spec.rb +30 -0
- data/spec/models/structures/div_spec.rb +26 -0
- data/spec/models/structures/f_locat_spec.rb +78 -0
- data/spec/models/structures/file_grp_spec.rb +23 -0
- data/spec/models/structures/file_sec_spec.rb +22 -0
- data/spec/models/structures/file_spec.rb +60 -0
- data/spec/models/structures/fptr_spec.rb +23 -0
- data/spec/models/structures/mets_hdr_spec.rb +26 -0
- data/spec/models/structures/mptr_spec.rb +25 -0
- data/spec/models/structures/struct_map_spec.rb +24 -0
- data/spec/models/target_spec.rb +0 -2
- data/spec/spec_helper.rb +4 -9
- data/spec/support/shared_examples_for_ddr_models.rb +96 -156
- data/spec/support/shared_examples_for_has_content.rb +56 -30
- data/spec/support/shared_examples_for_has_intermediate_spec.rb +28 -0
- data/spec/support/shared_examples_for_non_collection_models.rb +5 -0
- data/spec/support/structural_metadata_helper.rb +230 -59
- data/spec/utils_spec.rb +0 -2
- metadata +86 -44
- data/app/helpers/models_helper.rb +0 -10
- data/lib/ddr/auth/legacy/abstract_legacy_permissions.rb +0 -17
- data/lib/ddr/auth/legacy/legacy_authorization.rb +0 -44
- data/lib/ddr/auth/legacy/legacy_default_permissions.rb +0 -33
- data/lib/ddr/auth/legacy/legacy_permissions.rb +0 -33
- data/lib/ddr/auth/legacy/legacy_roles.rb +0 -25
- data/lib/ddr/index/legacy_license_fields.rb +0 -12
- data/lib/ddr/jobs.rb +0 -12
- data/lib/ddr/jobs/fits_file_characterization.rb +0 -13
- data/lib/ddr/jobs/fixity_check.rb +0 -13
- data/lib/ddr/jobs/job.rb +0 -36
- data/lib/ddr/jobs/queue.rb +0 -27
- data/lib/ddr/jobs/update_index.rb +0 -13
- data/lib/ddr/models/access_controllable.rb +0 -24
- data/lib/ddr/models/struct_div.rb +0 -63
- data/spec/auth/legacy_default_permissions_spec.rb +0 -37
- data/spec/auth/legacy_permissions_spec.rb +0 -37
- data/spec/helpers/models_helper_spec.rb +0 -11
- data/spec/jobs/fits_file_characterization_spec.rb +0 -16
- data/spec/jobs/fixity_check_spec.rb +0 -22
- data/spec/jobs/job_spec.rb +0 -40
- data/spec/jobs/update_index_spec.rb +0 -22
- data/spec/models/struct_div_spec.rb +0 -70
- data/spec/support/shared_examples_for_access_controllables.rb +0 -6
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Ddr::Datastreams
|
4
|
+
class DeleteExternalFiles
|
5
|
+
|
6
|
+
def self.call(*args)
|
7
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
8
|
+
case event.name
|
9
|
+
when Ddr::Datastreams::DELETE
|
10
|
+
delete_files(event.payload[:version_history])
|
11
|
+
when Ddr::Models::Base::DELETE, Ddr::Models::Base::DEACCESSION
|
12
|
+
delete_files(event.payload[:datastream_history].values.flatten)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.get_files_to_delete(profiles)
|
17
|
+
return [] if profiles.empty?
|
18
|
+
profiles
|
19
|
+
.select { |prof| (prof["dsControlGroup"] == "E") && prof["dsLocation"].start_with?("file:") }
|
20
|
+
.map { |prof| Ddr::Utils.path_from_uri(prof["dsLocation"]) }
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.delete_files(profiles)
|
24
|
+
paths = get_files_to_delete(profiles)
|
25
|
+
FileUtils.rm_f(paths) unless paths.empty?
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -1,46 +1,46 @@
|
|
1
|
-
|
2
|
-
module Datastreams
|
3
|
-
class DescriptiveMetadataDatastream < MetadataDatastream
|
1
|
+
require "rdf/vocab"
|
4
2
|
|
5
|
-
|
6
|
-
|
3
|
+
module Ddr::Datastreams
|
4
|
+
class DescriptiveMetadataDatastream < MetadataDatastream
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
end
|
6
|
+
class_attribute :vocabularies
|
7
|
+
self.vocabularies = [RDF::Vocab::DC, Ddr::Vocab::DukeTerms].freeze
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
9
|
+
def self.default_attributes
|
10
|
+
super.merge(:mimeType => 'application/n-triples')
|
11
|
+
end
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
def self.indexers
|
14
|
+
# Add term_name => [indexers] mapping to customize indexing
|
15
|
+
{}
|
16
|
+
end
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
def self.default_indexers
|
19
|
+
[:stored_searchable]
|
20
|
+
end
|
24
21
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
22
|
+
def self.indexers_for(term_name)
|
23
|
+
indexers.fetch(term_name, default_indexers)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Add terms from the vocabularies as properties
|
27
|
+
vocabularies.each do |vocab|
|
28
|
+
Ddr::Vocab::Vocabulary.property_terms(vocab).each do |term|
|
29
|
+
term_name = Ddr::Vocab::Vocabulary.term_name(vocab, term)
|
30
|
+
# Do not include :license as a descriptive metadata property
|
31
|
+
unless term_name == :license
|
32
|
+
property term_name, predicate: term do |index|
|
33
|
+
index.as *indexers_for(term_name)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
+
end
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
|
39
|
+
# Override ActiveFedora::Rdf::Indexing#apply_prefix(name) to not
|
40
|
+
# prepend the index field name with a string based on the datastream id.
|
41
|
+
def apply_prefix(name)
|
42
|
+
name
|
44
43
|
end
|
44
|
+
|
45
45
|
end
|
46
46
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Ddr::Datastreams
|
2
|
+
class ExternalFileDatastream < ActiveFedora::Datastream
|
3
|
+
|
4
|
+
FILE_PERMISSIONS = 0644
|
5
|
+
|
6
|
+
class_attribute :file_store
|
7
|
+
|
8
|
+
after_destroy do
|
9
|
+
self.dsLocation = nil # Rubydora does not reset dsLocation
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.default_attributes
|
13
|
+
super.merge(controlGroup: "E")
|
14
|
+
end
|
15
|
+
|
16
|
+
def file_size
|
17
|
+
if path = file_path
|
18
|
+
File.size(path)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_file(source_path, mime_type: nil)
|
23
|
+
set_mime_type(source_path, mime_type)
|
24
|
+
store(source_path)
|
25
|
+
end
|
26
|
+
|
27
|
+
def file_path
|
28
|
+
Ddr::Utils.path_from_uri(dsLocation) if dsLocation
|
29
|
+
end
|
30
|
+
|
31
|
+
def file_path=(path)
|
32
|
+
self.dsLocation = Ddr::Utils.path_to_uri(path)
|
33
|
+
end
|
34
|
+
|
35
|
+
def generate_file_name
|
36
|
+
SecureRandom.uuid
|
37
|
+
end
|
38
|
+
|
39
|
+
def generate_stored_path
|
40
|
+
file_name = generate_file_name
|
41
|
+
subpath = File.join([0, 2, 4, 6].map { |i| file_name[i, 2] })
|
42
|
+
File.join(file_store, subpath, file_name)
|
43
|
+
end
|
44
|
+
|
45
|
+
def file_paths
|
46
|
+
new? ? Array(file_path) : versions.map(&:file_path)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def store(source_path)
|
52
|
+
stored_path = generate_stored_path
|
53
|
+
FileUtils.mkdir_p File.dirname(stored_path)
|
54
|
+
FileUtils.cp source_path, stored_path
|
55
|
+
File.chmod(FILE_PERMISSIONS, stored_path)
|
56
|
+
self.file_path = stored_path
|
57
|
+
end
|
58
|
+
|
59
|
+
def set_mime_type(source_path, mime_type = nil)
|
60
|
+
self.mimeType = mime_type || get_mime_type(source_path)
|
61
|
+
end
|
62
|
+
|
63
|
+
def get_mime_type(source_path)
|
64
|
+
mime_types = MIME::Types.of(source_path)
|
65
|
+
mime_types.empty? ? Ddr::Models.default_mime_type : mime_types.first.content_type
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
@@ -22,10 +22,15 @@ module Ddr::Datastreams
|
|
22
22
|
}
|
23
23
|
}
|
24
24
|
t.fileinfo {
|
25
|
-
t.size
|
26
|
-
t.creatingApplicationName
|
27
25
|
t.created
|
26
|
+
t.creatingApplicationName
|
27
|
+
t.creatingos
|
28
|
+
t.filename
|
29
|
+
t.filepath
|
30
|
+
t.fslastmodified
|
28
31
|
t.lastmodified
|
32
|
+
t.md5checksum
|
33
|
+
t.size
|
29
34
|
}
|
30
35
|
t.filestatus {
|
31
36
|
t.valid
|
@@ -49,24 +54,29 @@ module Ddr::Datastreams
|
|
49
54
|
}
|
50
55
|
|
51
56
|
## proxy terms
|
57
|
+
|
52
58
|
# identification / identity
|
53
|
-
t.media_type proxy: [:identification, :identity, :mimetype]
|
54
59
|
t.format_label proxy: [:identification, :identity, :format_label]
|
55
60
|
t.format_version proxy: [:identification, :identity, :version]
|
61
|
+
t.media_type proxy: [:identification, :identity, :mimetype]
|
56
62
|
t.pronom_identifier proxy: [:identification, :identity, :pronom_identifier]
|
63
|
+
|
57
64
|
# filestatus
|
58
65
|
t.valid proxy: [:filestatus, :valid]
|
59
66
|
t.well_formed proxy: [:filestatus, :well_formed]
|
67
|
+
|
60
68
|
# fileinfo
|
61
69
|
t.created proxy: [:fileinfo, :created]
|
62
70
|
t.creating_application proxy: [:fileinfo, :creatingApplicationName]
|
63
71
|
t.extent proxy: [:fileinfo, :size]
|
72
|
+
t.md5 proxy: [:fileinfo, :md5checksum]
|
73
|
+
|
64
74
|
# image metadata
|
65
|
-
t.image_width proxy: [:metadata, :image, :imageWidth]
|
66
|
-
t.image_height proxy: [:metadata, :image, :imageHeight]
|
67
75
|
t.color_space proxy: [:metadata, :image, :colorSpace]
|
68
76
|
t.icc_profile_name proxy: [:metadata, :image, :iccProfileName]
|
69
77
|
t.icc_profile_version proxy: [:metadata, :image, :iccProfileVersion]
|
78
|
+
t.image_height proxy: [:metadata, :image, :imageHeight]
|
79
|
+
t.image_width proxy: [:metadata, :image, :imageWidth]
|
70
80
|
end
|
71
81
|
|
72
82
|
def self.xml_template
|
@@ -7,20 +7,18 @@ module Ddr
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# Returns ActiveTriplesTerm now that this is an RDF datastream
|
10
|
-
def values
|
10
|
+
def values(term)
|
11
11
|
term == :format ? self.format : self.send(term)
|
12
12
|
end
|
13
13
|
|
14
14
|
# Update term with values
|
15
15
|
# Note that empty values (nil or "") are rejected from values array
|
16
|
-
def set_values
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
values = nil if values.blank?
|
21
|
-
end
|
16
|
+
def set_values(term, values)
|
17
|
+
vals = Array(values)
|
18
|
+
.map { |v| v.to_s.strip }
|
19
|
+
.reject { |v| v.blank? }
|
22
20
|
begin
|
23
|
-
self.send("#{term}=",
|
21
|
+
self.send("#{term}=", vals)
|
24
22
|
rescue NoMethodError
|
25
23
|
raise ArgumentError, "No such term: #{term}"
|
26
24
|
end
|
@@ -28,15 +26,15 @@ module Ddr
|
|
28
26
|
|
29
27
|
# Add value to term
|
30
28
|
# Note that empty value (nil or "") is not added
|
31
|
-
def add_value
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
29
|
+
def add_value(term, value)
|
30
|
+
vals = values(term).to_a << value
|
31
|
+
set_values(term, vals)
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_changed?
|
35
|
+
# Patches a bug in AF RDF datastreams where
|
36
|
+
# Content appears to change from nil to empty string
|
37
|
+
super && !empty?
|
40
38
|
end
|
41
39
|
|
42
40
|
end
|
data/lib/ddr/derivatives.rb
CHANGED
@@ -24,7 +24,7 @@ module Ddr
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def run_generator(source_to_use)
|
27
|
-
command = "
|
27
|
+
command = "#{vips_command} im_vips2tiff #{Ddr::Utils.file_path(source_to_use)} #{Ddr::Utils.file_path(output)}:#{options}"
|
28
28
|
`#{command}`
|
29
29
|
$?.exitstatus
|
30
30
|
end
|
@@ -46,6 +46,10 @@ module Ddr
|
|
46
46
|
`identify -quiet -format '%[depth]' #{Ddr::Utils.file_path(source)}[0]`
|
47
47
|
end
|
48
48
|
|
49
|
+
def vips_command
|
50
|
+
Ddr::Models.vips_path ? File.join(Ddr::Models.vips_path, 'vips') : 'vips'
|
51
|
+
end
|
52
|
+
|
49
53
|
end
|
50
54
|
end
|
51
55
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Ddr::Derivatives
|
2
|
+
class UpdateDerivatives
|
3
|
+
|
4
|
+
def self.call(*args)
|
5
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
6
|
+
if event.name == "delete.repo_file" &&
|
7
|
+
!file_ids.include?(event.payload[:file_id])
|
8
|
+
return false
|
9
|
+
end
|
10
|
+
if event.name =~ /\.repo_object\z/ &&
|
11
|
+
(file_ids & event.payload[:datastreams_changed]).empty?
|
12
|
+
return false
|
13
|
+
end
|
14
|
+
obj = ActiveFedora::Base.find(event.payload[:pid])
|
15
|
+
obj.derivatives.update_derivatives(:later)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.file_ids
|
19
|
+
Ddr::Datastreams.update_derivatives_on_changed
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -1,12 +1,8 @@
|
|
1
|
-
module Ddr
|
2
|
-
|
3
|
-
|
1
|
+
module Ddr::Events
|
2
|
+
class DeletionEvent < Event
|
3
|
+
include PreservationEventBehavior
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
self.description = "Object deleted"
|
8
|
-
self.preservation_event_type = :del
|
9
|
-
|
10
|
-
end
|
5
|
+
self.description = "Object deleted"
|
6
|
+
self.preservation_event_type = :del
|
11
7
|
end
|
12
8
|
end
|
data/lib/ddr/events/event.rb
CHANGED
@@ -39,7 +39,12 @@ module Ddr
|
|
39
39
|
# Receive message sent by ActiveSupport::Notifications
|
40
40
|
def self.call(*args)
|
41
41
|
notification = ActiveSupport::Notifications::Event.new(*args)
|
42
|
-
|
42
|
+
payload = notification.payload.dup
|
43
|
+
payload[:event_date_time] ||= notification.time
|
44
|
+
create do |event|
|
45
|
+
event.attributes = payload.select { |k, v| event.has_attribute?(k) }
|
46
|
+
yield [event, notification] if block_given?
|
47
|
+
end
|
43
48
|
end
|
44
49
|
|
45
50
|
# Repository software version -- e.g., "Fedora Repository 3.7.0"
|
@@ -49,8 +54,6 @@ module Ddr
|
|
49
54
|
.join(" ")
|
50
55
|
end
|
51
56
|
|
52
|
-
# Scopes
|
53
|
-
|
54
57
|
def self.for_object(obj)
|
55
58
|
for_pid(obj.pid)
|
56
59
|
end
|
@@ -59,8 +62,6 @@ module Ddr
|
|
59
62
|
where(pid: pid)
|
60
63
|
end
|
61
64
|
|
62
|
-
# Rendering methods
|
63
|
-
|
64
65
|
def display_type
|
65
66
|
# Ddr::Events::UpdateEvent => "Update"
|
66
67
|
@display_type ||= self.class.to_s.split("::").last.sub("Event", "").titleize
|
@@ -74,8 +75,6 @@ module Ddr
|
|
74
75
|
comment.present? ? comment : summary
|
75
76
|
end
|
76
77
|
|
77
|
-
# Outcome methods
|
78
|
-
|
79
78
|
def success!
|
80
79
|
self.outcome = SUCCESS
|
81
80
|
end
|
@@ -92,7 +91,6 @@ module Ddr
|
|
92
91
|
outcome == FAILURE
|
93
92
|
end
|
94
93
|
|
95
|
-
# Object getter and setter
|
96
94
|
def object
|
97
95
|
@object ||= ActiveFedora::Base.find(pid) if pid
|
98
96
|
end
|
@@ -123,7 +121,7 @@ module Ddr
|
|
123
121
|
protected
|
124
122
|
|
125
123
|
def set_defaults
|
126
|
-
self.attributes = defaults.reject { |attr, val| attribute_present?
|
124
|
+
self.attributes = defaults.reject { |attr, val| attribute_present?(attr) }
|
127
125
|
end
|
128
126
|
|
129
127
|
def defaults
|
@@ -1,12 +1,8 @@
|
|
1
|
-
module Ddr
|
2
|
-
|
3
|
-
|
1
|
+
module Ddr::Events
|
2
|
+
class IngestionEvent < Event
|
3
|
+
include PreservationEventBehavior
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
self.preservation_event_type = :ing
|
8
|
-
self.description = "Object ingested into the repository"
|
9
|
-
|
10
|
-
end
|
5
|
+
self.preservation_event_type = :ing
|
6
|
+
self.description = "Object ingested into the repository"
|
11
7
|
end
|
12
8
|
end
|