ddr-models 3.0.0.beta.4 → 3.0.0.beta.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/collection.rb +1 -1
  3. data/lib/ddr/events.rb +1 -0
  4. data/lib/ddr/events/migration_event.rb +9 -0
  5. data/lib/ddr/index.rb +0 -1
  6. data/lib/ddr/index/fields.rb +1 -0
  7. data/lib/ddr/index/query.rb +9 -0
  8. data/lib/ddr/jobs/fits_file_characterization.rb +2 -2
  9. data/lib/ddr/managers/derivatives_manager.rb +2 -2
  10. data/lib/ddr/managers/permanent_id_manager.rb +2 -2
  11. data/lib/ddr/models/attached_files_profile.rb +5 -1
  12. data/lib/ddr/models/base.rb +4 -8
  13. data/lib/ddr/models/event_loggable.rb +1 -1
  14. data/lib/ddr/models/file_management.rb +1 -1
  15. data/lib/ddr/models/has_admin_metadata.rb +1 -1
  16. data/lib/ddr/models/has_content.rb +5 -4
  17. data/lib/ddr/models/has_struct_metadata.rb +2 -2
  18. data/lib/ddr/models/indexing.rb +17 -14
  19. data/lib/ddr/models/metadata/metadata_vocabularies.rb +2 -2
  20. data/lib/ddr/models/search/search_builder.rb +2 -2
  21. data/lib/ddr/models/version.rb +1 -1
  22. data/lib/ddr/models/year_facet.rb +1 -1
  23. data/lib/ddr/notifications.rb +1 -0
  24. data/spec/auth/effective_permissions_spec.rb +1 -1
  25. data/spec/auth/effective_roles_spec.rb +1 -1
  26. data/spec/auth/roles/role_set_query_spec.rb +5 -5
  27. data/spec/factories/role_factories.rb +1 -1
  28. data/spec/index/query_spec.rb +22 -0
  29. data/spec/models/active_fedora_datastream_spec.rb +3 -2
  30. data/spec/models/collection_spec.rb +1 -1
  31. data/spec/models/effective_license_spec.rb +3 -3
  32. data/spec/models/events_spec.rb +57 -54
  33. data/spec/models/has_admin_metadata_spec.rb +1 -1
  34. data/spec/models/indexing_spec.rb +40 -27
  35. data/spec/models/solr_document_spec.rb +2 -2
  36. data/spec/spec_helper.rb +0 -4
  37. data/spec/support/shared_examples_for_describables.rb +7 -17
  38. data/spec/support/shared_examples_for_governables.rb +2 -2
  39. data/spec/support/shared_examples_for_has_content.rb +22 -29
  40. data/spec/support/shared_examples_for_indexing.rb +9 -9
  41. data/spec/support/shared_examples_for_non_collection_models.rb +1 -1
  42. metadata +3 -3
  43. data/lib/ddr/index/filters.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec966b30c1ee1106c893b7bcf914015a74d6a872
4
- data.tar.gz: 4780ab2e5ec085392cf788e79cf920fed807ad0a
3
+ metadata.gz: 459b647ededb659adc26f3d0a4ac39fcec9d7bdb
4
+ data.tar.gz: 750255ea83e547d666bc18e35c90bff4a9785659
5
5
  SHA512:
6
- metadata.gz: 78bfd911fbcaebc909ad6ab26bef1efdc6447eb4c99f9733abc36b75f6ba1a6ea6acbe6856d379bbadcbf46476d8d9cdbf5d61bb9f23400ab9f62aff6bf75a79
7
- data.tar.gz: d32e38fec5818a9887061e9a84bcee2cb471b080d9353ff85c04ce535c76525781e9b56eb42cdd6c41813f0ca1e52cbe12ae3b312d24def4639a60acc0103e86
6
+ metadata.gz: 1245520f4f5221511c40edd77182a008c2ca0d21ba0c3e8424795e93fedccf2cf008087151ec7c577c3f334d2d9fd91574ea48b171133cbf3166ddff3026fbf7
7
+ data.tar.gz: 4d0b4daed25e1a942fe46805c8c52e771a92128d5c2d9721fc492d852d2485c077a71aaac28a6dded20c05361a2a3e89e7deb80a5f0ed1275bf55ae425459bb2
@@ -24,7 +24,7 @@ class Collection < Ddr::Models::Base
24
24
  # @return A lazy enumerator of SolrDocuments.
25
25
  def components_from_solr
26
26
  query = "#{Ddr::Index::Fields::COLLECTION_URI}:#{RSolr.solr_escape(id)}"
27
- filter = ActiveFedora::SolrService.construct_query_for_rel(:has_model => Component.to_class_uri)
27
+ filter = ActiveFedora::SolrQueryBuilder.construct_query_for_rel(:has_model => Component.to_class_uri)
28
28
  results = ActiveFedora::SolrService.query(query, fq: filter, rows: 100000)
29
29
  results.lazy.map {|doc| SolrDocument.new(doc)}
30
30
  end
@@ -7,6 +7,7 @@ module Ddr
7
7
  autoload :DeletionEvent
8
8
  autoload :FixityCheckEvent
9
9
  autoload :IngestionEvent
10
+ autoload :MigrationEvent
10
11
  autoload :UpdateEvent
11
12
  autoload :ValidationEvent
12
13
  autoload :VirusCheckEvent
@@ -0,0 +1,9 @@
1
+ module Ddr::Events
2
+ class MigrationEvent < Event
3
+ include PreservationEventBehavior
4
+
5
+ self.description = "Object migrated"
6
+ self.preservation_event_type = :mig
7
+
8
+ end
9
+ end
@@ -11,7 +11,6 @@ module Ddr
11
11
  autoload :FieldAttribute
12
12
  autoload :Fields
13
13
  autoload :Filter
14
- autoload :Filters
15
14
  autoload :LegacyLicenseFields
16
15
  autoload :Query
17
16
  autoload :QueryBuilder
@@ -13,6 +13,7 @@ module Ddr::Index
13
13
  BOX_NUMBER_FACET = Field.new :box_number_facet, :facetable
14
14
  COLLECTION_FACET = Field.new :collection_facet, :facetable
15
15
  COLLECTION_URI = Field.new :collection_uri, :symbol
16
+ CONTENT_CREATE_DATE = Field.new :content_create_date, :stored_sortable, type: :date
16
17
  CONTENT_SIZE = Field.new :content_size, solr_name: "content_size_lsi"
17
18
  CONTENT_SIZE_HUMAN = Field.new :content_size_human, :symbol
18
19
  CONTRIBUTOR_FACET = Field.new :contributor_facet, :facetable
@@ -52,5 +52,14 @@ module Ddr::Index
52
52
  self
53
53
  end
54
54
 
55
+ def ==(other)
56
+ other.instance_of?(self.class) &&
57
+ other.q == self.q &&
58
+ other.fields == self.fields &&
59
+ other.filters == self.filters &&
60
+ other.rows == self.rows &&
61
+ other.sort == self.sort
62
+ end
63
+
55
64
  end
56
65
  end
@@ -4,8 +4,8 @@ module Ddr::Jobs
4
4
 
5
5
  @queue = :file_characterization
6
6
 
7
- def self.perform(pid)
8
- obj = ActiveFedora::Base.find(pid)
7
+ def self.perform(id)
8
+ obj = ActiveFedora::Base.find(id)
9
9
  Ddr::Models::FileCharacterization.call(obj)
10
10
  end
11
11
 
@@ -63,8 +63,8 @@ module Ddr
63
63
 
64
64
  class DerivativeJob
65
65
  @queue = :derivatives
66
- def self.perform(pid, derivative_name)
67
- object = ActiveFedora::Base.find(pid)
66
+ def self.perform(id, derivative_name)
67
+ object = ActiveFedora::Base.find(id)
68
68
  derivative = Ddr::Derivatives::DERIVATIVES[derivative_name.to_sym]
69
69
  object.derivatives.update_derivative(derivative)
70
70
  end
@@ -46,8 +46,8 @@ EZID Metadata:
46
46
  class AssignmentJob
47
47
  @queue = :permanent_id
48
48
 
49
- def self.perform(pid)
50
- object = ActiveFedora::Base.find(pid)
49
+ def self.perform(id)
50
+ object = ActiveFedora::Base.find(id)
51
51
  object.permanent_id_manager.assign
52
52
  end
53
53
  end
@@ -10,7 +10,11 @@ module Ddr::Models
10
10
  end
11
11
 
12
12
  def attributes
13
- files_hash.keys.each_with_object({}) { |k, memo| memo[k.to_s] = nil }
13
+ files_hash.keys.each_with_object({}) do |key, memo|
14
+ unless files_hash[key].destroyed?
15
+ memo[key.to_s] = nil
16
+ end
17
+ end
14
18
  end
15
19
 
16
20
  def read_attribute_for_serialization(key)
@@ -22,10 +22,6 @@ module Ddr::Models
22
22
  end
23
23
  end
24
24
 
25
- def self.find_by_identifier(identifier)
26
- find(Ddr::Index::Fields::IDENTIFIER_ALL => identifier)
27
- end
28
-
29
25
  def inspect
30
26
  "#<#{model_and_id}, uri: \"#{uri}\">"
31
27
  end
@@ -57,9 +53,9 @@ module Ddr::Models
57
53
  arg = args.pop
58
54
  terms = case arg.to_sym
59
55
  when :empty
60
- desc_metadata_terms.select { |t| desc_metadata_values(t).empty? }
56
+ desc_metadata_terms.select { |t| desc_metadata.values(t).empty? }
61
57
  when :present
62
- desc_metadata_terms.select { |t| desc_metadata_values(t).present? }
58
+ desc_metadata_terms.select { |t| desc_metadata.values(t).present? }
63
59
  when :defined_attributes
64
60
  desc_metadata_terms & desc_metadata_attributes
65
61
  when :required
@@ -97,10 +93,10 @@ module Ddr::Models
97
93
  desc_metadata.set_values(term, values)
98
94
  end
99
95
 
100
- # Update all descMetadata terms with values in hash
96
+ # Update all desc_metadata terms with values in hash
101
97
  # Note that term not having key in hash will be set to nil!
102
98
  def set_desc_metadata(term_values_hash)
103
- desc_metadata_terms.each { |t| set_desc_metadata_values(t, term_values_hash[t]) }
99
+ desc_metadata_terms.each { |t| desc_metadata.set_values(t, term_values_hash[t]) }
104
100
  end
105
101
 
106
102
  def attached_files_profile
@@ -13,7 +13,7 @@ module Ddr
13
13
 
14
14
  # TESTME
15
15
  def notify_event(type, args={})
16
- Ddr::Notifications.notify_event(type, args.merge(pid: pid))
16
+ Ddr::Notifications.notify_event(type, args.merge(pid: id))
17
17
  end
18
18
 
19
19
  def has_events?
@@ -55,7 +55,7 @@ module Ddr::Models
55
55
 
56
56
  def notify_virus_scan_results
57
57
  while result = virus_scan_results.shift
58
- result.merge! pid: pid
58
+ result.merge! pid: id
59
59
  ActiveSupport::Notifications.instrument(Ddr::Notifications::VIRUS_CHECK, result)
60
60
  end
61
61
  end
@@ -38,7 +38,7 @@ module Ddr::Models
38
38
  multiple: false
39
39
 
40
40
  property :license,
41
- predicate: RDF::DC.license,
41
+ predicate: RDF::Vocab::DC.license,
42
42
  multiple: false
43
43
 
44
44
  property :local_id,
@@ -17,7 +17,9 @@ module Ddr
17
17
 
18
18
  around_save :update_derivatives, if: :content_changed?
19
19
 
20
- around_save :characterize_file, if: [ :content_changed?, "Ddr::Models.characterize_files?" ]
20
+ before_save if: :re_characterize? do
21
+ fits.delete(eradicate: true)
22
+ end
21
23
 
22
24
  delegate :validate_checksum!, to: :content
23
25
  end
@@ -116,9 +118,8 @@ module Ddr
116
118
  derivatives.update_derivatives(:later)
117
119
  end
118
120
 
119
- def characterize_file
120
- yield
121
- Resque.enqueue(Ddr::Jobs::FitsFileCharacterization, pid)
121
+ def re_characterize?
122
+ content_changed? && !fits.new_record?
122
123
  end
123
124
 
124
125
  def default_content_type
@@ -26,13 +26,13 @@ module Ddr
26
26
  end
27
27
 
28
28
  def multires_image_file_paths(type='default')
29
- ::SolrDocument.find(pid).multires_image_file_paths(type)
29
+ ::SolrDocument.find(id).multires_image_file_paths(type)
30
30
  end
31
31
 
32
32
  private
33
33
 
34
34
  def find_children
35
- query = ActiveFedora::SolrService.construct_query_for_rel([[ self.class.reflect_on_association(:children), self.id ]])
35
+ query = ActiveFedora::SolrQueryBuilder.construct_query_for_rel([[ self.class.reflect_on_association(:children), self.id ]])
36
36
  sort = "#{Ddr::Index::Fields::LOCAL_ID} ASC, #{Ddr::Index::Fields::OBJECT_CREATE_DATE} ASC"
37
37
  ActiveFedora::SolrService.query(query, sort: sort, rows: 999999)
38
38
  end
@@ -1,3 +1,5 @@
1
+ require 'time'
2
+
1
3
  module Ddr
2
4
  module Models
3
5
  module Indexing
@@ -19,10 +21,10 @@ module Ddr
19
21
  ADMIN_SET => admin_set,
20
22
  ASPACE_ID => aspace_id,
21
23
  ATTACHED_FILES => attached_files_profile.to_json,
22
- BOX_NUMBER_FACET => desc_metadata_values('box_number'),
23
- CONTRIBUTOR_FACET => desc_metadata_values('contributor'),
24
- CREATOR_FACET => descMetadata.creator,
25
- DATE_FACET => descMetadata.date,
24
+ BOX_NUMBER_FACET => desc_metadata.values('box_number'),
25
+ CONTRIBUTOR_FACET => desc_metadata.values('contributor'),
26
+ CREATOR_FACET => desc_metadata.creator,
27
+ DATE_FACET => desc_metadata.date,
26
28
  DATE_SORT => date_sort,
27
29
  DEPOSITOR => depositor,
28
30
  DISPLAY_FORMAT => display_format,
@@ -35,14 +37,14 @@ module Ddr
35
37
  PERMANENT_ID => permanent_id,
36
38
  PERMANENT_URL => permanent_url,
37
39
  POLICY_ROLE => roles.in_policy_scope.agents,
38
- PUBLISHER_FACET => descMetadata.publisher,
40
+ PUBLISHER_FACET => desc_metadata.publisher,
39
41
  RESEARCH_HELP_CONTACT => research_help_contact,
40
42
  RESOURCE_ROLE => roles.in_resource_scope.agents,
41
- SERIES_FACET => desc_metadata_values('series'),
42
- SPATIAL_FACET => desc_metadata_values('spatial'),
43
- SUBJECT_FACET => desc_metadata_values('subject'),
43
+ SERIES_FACET => desc_metadata.values('series'),
44
+ SPATIAL_FACET => desc_metadata.values('spatial'),
45
+ SUBJECT_FACET => desc_metadata.values('subject'),
44
46
  TITLE => title_display,
45
- TYPE_FACET => descMetadata.type,
47
+ TYPE_FACET => desc_metadata.type,
46
48
  WORKFLOW_STATE => workflow_state,
47
49
  YEAR_FACET => year_facet,
48
50
  }
@@ -56,6 +58,7 @@ module Ddr
56
58
  end
57
59
  if has_content?
58
60
  fields[ORIGINAL_FILENAME] = original_filename
61
+ fields[CONTENT_CREATE_DATE] = Ddr::Utils.solr_date(content.create_date)
59
62
  fields[CONTENT_SIZE] = content_size
60
63
  fields[CONTENT_SIZE_HUMAN] = content_human_size
61
64
  fields[MEDIA_TYPE] = content_type
@@ -87,14 +90,14 @@ module Ddr
87
90
  end
88
91
 
89
92
  def title_display
90
- return descMetadata.title.first if descMetadata.title.present?
91
- return descMetadata.identifier.first if descMetadata.identifier.present?
93
+ return desc_metadata.title.first if desc_metadata.title.present?
94
+ return desc_metadata.identifier.first if desc_metadata.identifier.present?
92
95
  return original_filename if respond_to?(:original_filename) && original_filename.present?
93
- "[#{pid}]"
96
+ "[#{id}]"
94
97
  end
95
98
 
96
99
  def all_identifiers
97
- descMetadata.identifier + [local_id, permanent_id, pid].compact
100
+ desc_metadata.identifier + [local_id, permanent_id, id].compact
98
101
  end
99
102
 
100
103
  def associated_collection
@@ -114,7 +117,7 @@ module Ddr
114
117
  end
115
118
 
116
119
  def date_sort
117
- descMetadata.date.first
120
+ desc_metadata.date.first
118
121
  end
119
122
 
120
123
  def year_facet
@@ -3,11 +3,11 @@ module Ddr::Models
3
3
  module MetadataVocabularies
4
4
 
5
5
  def dc11
6
- MetadataVocabulary.new(RDF::DC11)
6
+ MetadataVocabulary.new(RDF::Vocab::DC11)
7
7
  end
8
8
 
9
9
  def dcterms
10
- MetadataVocabulary.new(RDF::DC, except: RDF::DC.license)
10
+ MetadataVocabulary.new(RDF::Vocab::DC, except: RDF::Vocab::DC.license)
11
11
  end
12
12
 
13
13
  def duketerms
@@ -40,13 +40,13 @@ module Ddr::Models
40
40
  def policy_role_filters
41
41
  if policy_role_policies.present?
42
42
  rels = policy_role_policies.map { |pid| [:isGovernedBy, pid] }
43
- ActiveFedora::SolrService.construct_query_for_rel(rels, " OR ")
43
+ ActiveFedora::SolrQueryBuilder.construct_query_for_rel(rels, " OR ")
44
44
  end
45
45
  end
46
46
 
47
47
  def resource_role_filters
48
48
  current_ability.agents.map do |agent|
49
- ActiveFedora::SolrService.raw_query(Ddr::Index::Fields::RESOURCE_ROLE, agent)
49
+ ActiveFedora::SolrQueryBuilder.raw_query(Ddr::Index::Fields::RESOURCE_ROLE, agent)
50
50
  end.join(" OR ")
51
51
  end
52
52
 
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Models
3
- VERSION = "3.0.0.beta.4"
3
+ VERSION = "3.0.0.beta.6"
4
4
  end
5
5
  end
@@ -55,7 +55,7 @@ module Ddr::Models
55
55
  end
56
56
 
57
57
  def facet_values
58
- obj.descMetadata.date.each do |date|
58
+ obj.desc_metadata.date.each do |date|
59
59
  date.split(/;/).each do |value|
60
60
  clean! value
61
61
  years = extract_years(value)
@@ -6,6 +6,7 @@ module Ddr
6
6
  CREATION = "creation.events.ddr"
7
7
  UPDATE = "update.events.ddr"
8
8
  DELETION = "deletion.events.ddr"
9
+ MIGRATION = "migration.events.ddr"
9
10
 
10
11
  def self.notify_event(type, args={})
11
12
  name = "#{type}.events.ddr"
@@ -2,7 +2,7 @@ module Ddr::Auth
2
2
  RSpec.describe EffectivePermissions do
3
3
 
4
4
  let(:resource) { FactoryGirl.build(:item) }
5
- let(:policy) { Collection.new(pid: "coll-1") }
5
+ let(:policy) { Collection.new(id: "coll-1") }
6
6
  let(:agents) { [ "Editors", "bob@example.com" ] }
7
7
 
8
8
  before do
@@ -4,7 +4,7 @@ module Ddr::Auth
4
4
  let(:resource) { FactoryGirl.build(:item) }
5
5
  let(:policy) { Collection.new(id: "coll-1") }
6
6
  let(:agents) { [ "Editors", "bob@example.com", "public" ] }
7
- let(:editor) { Roles::Role.build role_type: "Editor", agent: "Editors", scope: "policy" }
7
+ let(:editor) { Roles::Role.new role_type: "Editor", agent: "Editors", scope: "policy" }
8
8
  let(:downloader) { FactoryGirl.build(:role, :downloader, :public) }
9
9
 
10
10
  before do
@@ -12,11 +12,11 @@ module Ddr::Auth
12
12
  let(:contributor_group) { "Contributors" }
13
13
  let(:downloader_group) { "Downloaders" }
14
14
  let(:viewer_group) { "Viewers" }
15
- let(:contributor_role) { Role.build(role_type: "Contributor", agent: contributor_group, scope: "resource") }
16
- let(:downloader_role) { Role.build(role_type: "Downloader", agent: downloader_group, scope: "resource") }
17
- let(:editor_role) { Role.build(role_type: "Editor", agent: editor, scope: "resource") }
18
- let(:curator_role) { Role.build(role_type: "Curator", agent: curator, scope: "policy") }
19
- let(:viewer_role) { Role.build(role_type: "Viewer", agent: viewer_group, scope: "policy") }
15
+ let(:contributor_role) { Role.new(role_type: "Contributor", agent: contributor_group, scope: "resource") }
16
+ let(:downloader_role) { Role.new(role_type: "Downloader", agent: downloader_group, scope: "resource") }
17
+ let(:editor_role) { Role.new(role_type: "Editor", agent: editor, scope: "resource") }
18
+ let(:curator_role) { Role.new(role_type: "Curator", agent: curator, scope: "policy") }
19
+ let(:viewer_role) { Role.new(role_type: "Viewer", agent: viewer_group, scope: "policy") }
20
20
  let(:policy_roles) { [curator_role, viewer_role] }
21
21
  let(:resource_roles) { [contributor_role, downloader_role, editor_role] }
22
22
 
@@ -2,7 +2,7 @@ FactoryGirl.define do
2
2
 
3
3
  factory :role, class: Ddr::Auth::Roles::Role do
4
4
 
5
- initialize_with { Ddr::Auth::Roles::Role.build(attributes) }
5
+ initialize_with { Ddr::Auth::Roles::Role.new(attributes) }
6
6
 
7
7
  Ddr::Auth::Roles.role_types.each do |rt|
8
8
  trait rt.to_s.downcase.to_sym do
@@ -44,5 +44,27 @@ module Ddr::Index
44
44
  }
45
45
  end
46
46
 
47
+ describe "equality" do
48
+ subject {
49
+ described_class.new do
50
+ q "foo:bar"
51
+ where "spam"=>"eggs"
52
+ fields :id, "foo", "spam"
53
+ asc "foo"
54
+ limit 50
55
+ end
56
+ }
57
+ let(:other) do
58
+ described_class.new do
59
+ q "foo:bar"
60
+ where "spam"=>"eggs"
61
+ fields :id, "foo", "spam"
62
+ asc "foo"
63
+ limit 50
64
+ end
65
+ end
66
+ it { is_expected.to eq other }
67
+ end
68
+
47
69
  end
48
70
  end
@@ -14,7 +14,7 @@ module ActiveFedora
14
14
  before do
15
15
  subject.content = file.read
16
16
  subject.mime_type = file.content_type
17
- allow(subject).to receive(:pid) { "test:1" }
17
+ allow(subject).to receive(:id) { "test-1" }
18
18
  end
19
19
  describe "the yielded file" do
20
20
  it "should by default have an extension for the datastream media type" do
@@ -43,6 +43,7 @@ module ActiveFedora
43
43
  end
44
44
  describe "when the file has no id" do
45
45
  it "should be NEW" do
46
+ allow(subject).to receive(:id) { nil }
46
47
  subject.tempfile do |f|
47
48
  expect(::File.basename(f.path).start_with?("NEW--")).to be true
48
49
  end
@@ -78,7 +79,7 @@ module ActiveFedora
78
79
  context "with persisted content" do
79
80
  before do
80
81
  allow(subject).to receive(:new_record?) { false }
81
- allow(subject).to receive(:pid) { "foobar-1" }
82
+ allow(subject).to receive(:id) { "foobar-1" }
82
83
  allow(subject).to receive(:checksum) { checksum }
83
84
  end
84
85
  context "and the repository internal checksum in invalid" do
@@ -35,7 +35,7 @@ RSpec.describe Collection, type: :model do
35
35
  let(:user) { FactoryGirl.build(:user) }
36
36
  before { subject.grant_roles_to_creator(user) }
37
37
  it "should include Curator roles in both resource abd policy scopes" do
38
- expect(subject.roles.to_a).to eq([Ddr::Auth::Roles::Role.build(role_type: "Curator", agent: user.agent, scope: "resource"), Ddr::Auth::Roles::Role.build(role_type: "Curator", agent: user.agent, scope: "policy")])
38
+ expect(subject.roles.to_a).to eq([Ddr::Auth::Roles::Role.new(role_type: "Curator", agent: user.agent, scope: "resource"), Ddr::Auth::Roles::Role.new(role_type: "Curator", agent: user.agent, scope: "policy")])
39
39
  end
40
40
  end
41
41
 
@@ -7,9 +7,9 @@ module Ddr::Models
7
7
 
8
8
  let(:license) { License.new(url: url) }
9
9
 
10
- let(:obj) { Component.new(pid: "test:1") }
11
- let(:parent) { Item.new(pid: "test:2") }
12
- let(:admin_policy) { Collection.new(pid: "test:3") }
10
+ let(:obj) { Component.new(id: "test-1") }
11
+ let(:parent) { Item.new(id: "test-2") }
12
+ let(:admin_policy) { Collection.new(id: "test-3") }
13
13
 
14
14
  describe "when the object has a license" do
15
15
  before do
@@ -1,73 +1,76 @@
1
- require 'spec_helper'
2
1
  require 'support/shared_examples_for_events'
3
2
 
4
- module Ddr
5
- module Events
6
- RSpec.describe Event, type: :model, events: true do
7
- it_behaves_like "an event"
8
- end
3
+ module Ddr::Events
4
+ RSpec.describe Event, type: :model, events: true do
5
+ it_behaves_like "an event"
6
+ end
9
7
 
10
- RSpec.describe UpdateEvent, type: :model, events: true do
11
- it_behaves_like "an event"
12
- it "should have a display type" do
13
- expect(subject.display_type).to eq "Update"
14
- end
8
+ RSpec.describe UpdateEvent, type: :model, events: true do
9
+ it_behaves_like "an event"
10
+ it "should have a display type" do
11
+ expect(subject.display_type).to eq "Update"
15
12
  end
13
+ end
16
14
 
17
- RSpec.describe CreationEvent, type: :model, events: true do
18
- it_behaves_like "an event"
19
- it_behaves_like "a preservation-related event"
20
- it "should have a display type" do
21
- expect(subject.display_type).to eq "Creation"
22
- end
15
+ RSpec.describe CreationEvent, type: :model, events: true do
16
+ it_behaves_like "an event"
17
+ it_behaves_like "a preservation-related event"
18
+ it "should have a display type" do
19
+ expect(subject.display_type).to eq "Creation"
23
20
  end
21
+ end
24
22
 
25
- RSpec.describe FixityCheckEvent, type: :model, events: true do
26
- it_behaves_like "an event"
27
- it_behaves_like "a preservation-related event"
28
- it_behaves_like "an event that reindexes its object after save"
29
- it "should have a display type" do
30
- expect(subject.display_type).to eq "Fixity Check"
31
- end
32
- describe "defaults" do
33
- it "should set software to the Fedora repository version" do
34
- pending "Fedora 4 API for getting repository version"
35
- expect(subject.software).to match /^Fedora Repository \d\.\d\.\d$/
36
- end
23
+ RSpec.describe FixityCheckEvent, type: :model, events: true do
24
+ it_behaves_like "an event"
25
+ it_behaves_like "a preservation-related event"
26
+ it_behaves_like "an event that reindexes its object after save"
27
+ it "should have a display type" do
28
+ expect(subject.display_type).to eq "Fixity Check"
29
+ end
30
+ describe "defaults" do
31
+ it "should set software to the Fedora repository version" do
32
+ pending "Fedora 4 API for getting repository version"
33
+ expect(subject.software).to match /^Fedora Repository \d\.\d\.\d$/
37
34
  end
38
35
  end
36
+ end
39
37
 
40
- RSpec.describe VirusCheckEvent, type: :model, events: true do
41
- it_behaves_like "an event"
42
- it_behaves_like "a preservation-related event"
43
- it_behaves_like "an event that reindexes its object after save"
44
- it "should have a display type" do
45
- expect(subject.display_type).to eq "Virus Check"
46
- end
38
+ RSpec.describe VirusCheckEvent, type: :model, events: true do
39
+ it_behaves_like "an event"
40
+ it_behaves_like "a preservation-related event"
41
+ it_behaves_like "an event that reindexes its object after save"
42
+ it "should have a display type" do
43
+ expect(subject.display_type).to eq "Virus Check"
47
44
  end
45
+ end
48
46
 
49
- RSpec.describe IngestionEvent, type: :model, events: true do
50
- it_behaves_like "an event"
51
- it_behaves_like "a preservation-related event"
52
- it "should have a display type" do
53
- expect(subject.display_type).to eq "Ingestion"
54
- end
47
+ RSpec.describe IngestionEvent, type: :model, events: true do
48
+ it_behaves_like "an event"
49
+ it_behaves_like "a preservation-related event"
50
+ it "should have a display type" do
51
+ expect(subject.display_type).to eq "Ingestion"
55
52
  end
53
+ end
56
54
 
57
- RSpec.describe ValidationEvent, type: :model, events: true do
58
- it_behaves_like "an event"
59
- it_behaves_like "a preservation-related event"
60
- it "should have a display type" do
61
- expect(subject.display_type).to eq "Validation"
62
- end
55
+ RSpec.describe ValidationEvent, type: :model, events: true do
56
+ it_behaves_like "an event"
57
+ it_behaves_like "a preservation-related event"
58
+ it "should have a display type" do
59
+ expect(subject.display_type).to eq "Validation"
63
60
  end
61
+ end
64
62
 
65
- RSpec.describe DeletionEvent, type: :model, events: true do
66
- it_behaves_like "an event"
67
- it_behaves_like "a preservation-related event"
68
- it "should have a display type" do
69
- expect(subject.display_type).to eq "Deletion"
70
- end
63
+ RSpec.describe DeletionEvent, type: :model, events: true do
64
+ it_behaves_like "an event"
65
+ it_behaves_like "a preservation-related event"
66
+ it "should have a display type" do
67
+ expect(subject.display_type).to eq "Deletion"
71
68
  end
72
69
  end
70
+
71
+ RSpec.describe MigrationEvent, type: :model, events: true do
72
+ it_behaves_like "an event"
73
+ it_behaves_like "a preservation-related event"
74
+ its(:display_type) { is_expected.to eq "Migration" }
75
+ end
73
76
  end
@@ -163,7 +163,7 @@ module Ddr::Models
163
163
  describe "#grant_roles_to_creator" do
164
164
  let(:user) { FactoryGirl.build(:user) }
165
165
  before { subject.grant_roles_to_creator(user) }
166
- its(:roles) { should include(Ddr::Auth::Roles::Role.build(role_type: "Editor", agent: user.agent, scope: "resource")) }
166
+ its(:roles) { should include(Ddr::Auth::Roles::Role.new(role_type: "Editor", agent: user.agent, scope: "resource")) }
167
167
  end
168
168
 
169
169
  describe "persistence" do
@@ -1,37 +1,50 @@
1
1
  module Ddr::Models
2
2
  RSpec.describe Indexing do
3
3
 
4
- let(:obj) { FactoryGirl.create(:item) }
4
+ subject { obj.index_fields }
5
5
 
6
- let(:role1) { FactoryGirl.build(:role, :curator, :person, :resource) }
7
- let(:role2) { FactoryGirl.build(:role, :curator, :person, :policy) }
8
- let(:role3) { FactoryGirl.build(:role, :editor, :group, :policy) }
9
- let(:role4) { FactoryGirl.build(:role, :editor, :person, :policy) }
6
+ describe "general indexing" do
7
+ let(:obj) { FactoryGirl.build(:item) }
10
8
 
11
- subject { obj.index_fields }
9
+ let(:role1) { FactoryGirl.build(:role, :curator, :person, :resource) }
10
+ let(:role2) { FactoryGirl.build(:role, :curator, :person, :policy) }
11
+ let(:role3) { FactoryGirl.build(:role, :editor, :group, :policy) }
12
+ let(:role4) { FactoryGirl.build(:role, :editor, :person, :policy) }
13
+
14
+ before do
15
+ obj.license = "cc-by-nc-nd-40"
16
+ obj.local_id = "foo"
17
+ obj.doi << "http://doi.org/10.1000/182"
18
+ obj.permanent_id = "ark:/99999/fk4zzz"
19
+ obj.permanent_url = "http://id.library.duke.edu/ark:/99999/fk4zzz"
20
+ obj.display_format = "Image"
21
+ obj.roles.grant role1, role2, role3, role4
22
+ obj.aspace_id = "aspace_dccea43034e1b8261e14cf999e86449d"
23
+ obj.fcrepo3_pid = "duke:1"
24
+ end
25
+
26
+ its([Indexing::LICENSE]) { is_expected.to eq("cc-by-nc-nd-40") }
27
+ its([Indexing::LOCAL_ID]) { is_expected.to eq("foo") }
28
+ its([Indexing::DOI]) { is_expected.to eq(["http://doi.org/10.1000/182"]) }
29
+ its([Indexing::PERMANENT_ID]) { is_expected.to eq("ark:/99999/fk4zzz") }
30
+ its([Indexing::PERMANENT_URL]) { is_expected.to eq("http://id.library.duke.edu/ark:/99999/fk4zzz") }
31
+ its([Indexing::DISPLAY_FORMAT]) { is_expected.to eq("Image") }
32
+ its([Indexing::ACCESS_ROLE]) { is_expected.to eq(obj.roles.to_json) }
33
+ its([Indexing::ASPACE_ID]) { is_expected.to eq("aspace_dccea43034e1b8261e14cf999e86449d") }
34
+ its([Indexing::POLICY_ROLE]) { is_expected.to contain_exactly(role2.agent, role3.agent, role4.agent) }
35
+ its([Indexing::RESOURCE_ROLE]) { is_expected.to contain_exactly(role1.agent) }
36
+ its([Indexing::FCREPO3_PID]) { is_expected.to eq("duke:1") }
37
+ end
38
+
39
+ describe "content-bearing object indexing" do
40
+ let(:obj) { FactoryGirl.create(:component) }
41
+ let!(:create_date) { DateTime.parse("2016-01-22T21:50:33Z") }
42
+ before {
43
+ allow(obj.content).to receive(:create_date) { create_date }
44
+ }
12
45
 
13
- before do
14
- obj.license = "cc-by-nc-nd-40"
15
- obj.local_id = "foo"
16
- obj.doi << "http://doi.org/10.1000/182"
17
- obj.permanent_id = "ark:/99999/fk4zzz"
18
- obj.permanent_url = "http://id.library.duke.edu/ark:/99999/fk4zzz"
19
- obj.display_format = "Image"
20
- obj.roles.grant role1, role2, role3, role4
21
- obj.aspace_id = "aspace_dccea43034e1b8261e14cf999e86449d"
22
- obj.fcrepo3_pid = "duke:1"
46
+ its([Indexing::CONTENT_CREATE_DATE]) { is_expected.to eq "2016-01-22T21:50:33Z" }
23
47
  end
24
48
 
25
- its([Indexing::LICENSE]) { is_expected.to eq("cc-by-nc-nd-40") }
26
- its([Indexing::LOCAL_ID]) { is_expected.to eq("foo") }
27
- its([Indexing::DOI]) { is_expected.to eq(["http://doi.org/10.1000/182"]) }
28
- its([Indexing::PERMANENT_ID]) { is_expected.to eq("ark:/99999/fk4zzz") }
29
- its([Indexing::PERMANENT_URL]) { is_expected.to eq("http://id.library.duke.edu/ark:/99999/fk4zzz") }
30
- its([Indexing::DISPLAY_FORMAT]) { is_expected.to eq("Image") }
31
- its([Indexing::ACCESS_ROLE]) { is_expected.to eq(obj.roles.to_json) }
32
- its([Indexing::ASPACE_ID]) { is_expected.to eq("aspace_dccea43034e1b8261e14cf999e86449d") }
33
- its([Indexing::POLICY_ROLE]) { is_expected.to contain_exactly(role2.agent, role3.agent, role4.agent) }
34
- its([Indexing::RESOURCE_ROLE]) { is_expected.to contain_exactly(role1.agent) }
35
- its([Indexing::FCREPO3_PID]) { is_expected.to eq("duke:1") }
36
49
  end
37
50
  end
@@ -86,8 +86,8 @@ RSpec.describe SolrDocument, type: :model, contacts: true do
86
86
  before { subject[Ddr::Index::Fields::ACCESS_ROLE] = json }
87
87
  it "should deserialize the roles from JSON" do
88
88
  expect(subject.roles.to_a)
89
- .to eq([Ddr::Auth::Roles::Role.build(role_type: "Editor", agent: "Editors", scope: "policy"),
90
- Ddr::Auth::Roles::Role.build(role_type: "Contributor", agent: "bob@example.com", scope: "resource")])
89
+ .to eq([Ddr::Auth::Roles::Role.new(role_type: "Editor", agent: "Editors", scope: "policy"),
90
+ Ddr::Auth::Roles::Role.new(role_type: "Contributor", agent: "bob@example.com", scope: "resource")])
91
91
  end
92
92
  end
93
93
 
@@ -26,10 +26,6 @@ Dir[File.join(File.dirname(__FILE__), "support", "*.rb")].each { |f| require f }
26
26
  require "database_cleaner"
27
27
  DatabaseCleaner.strategy = :truncation
28
28
 
29
- # Silence deprecation warnings
30
- warn "WARNING: Default deprecation behavior set to :silence!"
31
- Deprecation.default_deprecation_behavior = :silence
32
-
33
29
  RSpec.configure do |config|
34
30
 
35
31
  config.include ActionDispatch::TestProcess
@@ -2,16 +2,6 @@ RSpec.shared_examples "a describable object" do
2
2
 
3
3
  let(:object) { described_class.new }
4
4
 
5
- describe "having an identifier" do
6
- before do
7
- object.descMetadata.identifier = ["id001"]
8
- object.save(validate: false)
9
- end
10
- it "should be findable by identifier" do
11
- expect(described_class.find_by_identifier('id001')).to include object
12
- end
13
- end
14
-
15
5
  describe "#desc_metadata_terms" do
16
6
  it "should have a default value" do
17
7
  expect(object.desc_metadata_terms).to match_array(Ddr::Models::DescriptiveMetadata.unqualified_names)
@@ -28,9 +18,9 @@ RSpec.shared_examples "a describable object" do
28
18
  end
29
19
  context "with variable results" do
30
20
  before do
31
- object.descMetadata.title = ["Object Title"]
32
- object.descMetadata.creator = ["Duke University Libraries"]
33
- object.descMetadata.identifier = ["id001"]
21
+ object.desc_metadata.title = ["Object Title"]
22
+ object.desc_metadata.creator = ["Duke University Libraries"]
23
+ object.desc_metadata.identifier = ["id001"]
34
24
  object.save
35
25
  end
36
26
  it "should accept an :empty argument" do
@@ -44,9 +34,9 @@ RSpec.shared_examples "a describable object" do
44
34
  end
45
35
  describe "#set_desc_metadata" do
46
36
  let(:term_values_hash) { object.desc_metadata_terms.each_with_object({}) {|t, memo| memo[t] = ["Value"]} }
47
- it "should set the descMetadata terms to the values of the matching keys in the hash" do
37
+ it "should set the desc_metadata terms to the values of the matching keys in the hash" do
48
38
  object.desc_metadata_terms.each do |t|
49
- expect(object).to receive(:set_desc_metadata_values).with(t, ["Value"])
39
+ expect(object.desc_metadata).to receive(:set_values).with(t, ["Value"])
50
40
  end
51
41
  object.set_desc_metadata(term_values_hash)
52
42
  end
@@ -55,13 +45,13 @@ RSpec.shared_examples "a describable object" do
55
45
  context "when values == nil" do
56
46
  it "should set the term to an empty value" do
57
47
  object.set_desc_metadata_values(:title, nil)
58
- expect(object.descMetadata.title).to be_empty
48
+ expect(object.desc_metadata.title).to be_empty
59
49
  end
60
50
  end
61
51
  context "when values is an array" do
62
52
  it "should reject empty values from the array" do
63
53
  object.set_desc_metadata_values(:title, ["Object Title", nil, "Alternative Title", ""])
64
- expect(object.descMetadata.title).to eq ["Object Title", "Alternative Title"]
54
+ expect(object.desc_metadata.title).to eq ["Object Title", "Alternative Title"]
65
55
  end
66
56
  end
67
57
  end
@@ -1,8 +1,8 @@
1
1
  RSpec.shared_examples "a governable object" do
2
2
  let(:object) do
3
3
  described_class.new.tap do |obj|
4
- obj.descMetadata.title = [ 'Describable' ]
5
- obj.descMetadata.identifier = [ 'id001' ]
4
+ obj.desc_metadata.title = [ 'Describable' ]
5
+ obj.desc_metadata.identifier = [ 'id001' ]
6
6
  obj.save(validate: false)
7
7
  end
8
8
  end
@@ -56,22 +56,6 @@ RSpec.shared_examples "an object that can have content" do
56
56
  expect(subject.derivatives).to receive(:update_derivatives)
57
57
  subject.save
58
58
  end
59
- describe "file characterization" do
60
- context "characterize files is false" do
61
- before { allow(Ddr::Models).to receive(:characterize_files?) { false } }
62
- it "should not enqueue a FITS file characterization job" do
63
- expect(Resque).to_not receive(:enqueue).with(Ddr::Jobs::FitsFileCharacterization, instance_of(String))
64
- subject.save
65
- end
66
- end
67
- context "characterize files is true" do
68
- before { allow(Ddr::Models).to receive(:characterize_files?) { true } }
69
- it "should enqueue a FITS file characterization job" do
70
- expect(Resque).to receive(:enqueue).with(Ddr::Jobs::FitsFileCharacterization, instance_of(String))
71
- subject.save
72
- end
73
- end
74
- end
75
59
  end
76
60
 
77
61
  context "and it's an existing object with content" do
@@ -81,20 +65,29 @@ RSpec.shared_examples "an object that can have content" do
81
65
  expect(subject.derivatives).to receive(:update_derivatives)
82
66
  subject.upload! file
83
67
  end
84
- describe "file characterization" do
85
- context "characterize files is false" do
86
- before { allow(Ddr::Models).to receive(:characterize_files?) { false } }
87
- it "should not enqueue a FITS file characterization job" do
88
- expect(Resque).to_not receive(:enqueue).with(Ddr::Jobs::FitsFileCharacterization, instance_of(String))
89
- subject.upload! file
90
- end
68
+ context "and the file has not previously been characterized" do
69
+ it "does not try to delete the existing characterization data" do
70
+ expect(subject.fits).not_to receive(:delete)
71
+ subject.upload! file
91
72
  end
92
- context "characterize files is true" do
93
- before { allow(Ddr::Models).to receive(:characterize_files?) { true } }
94
- it "should enqueue a FITS file characterization job" do
95
- expect(Resque).to receive(:enqueue).with(Ddr::Jobs::FitsFileCharacterization, instance_of(String))
96
- subject.upload! file
97
- end
73
+ end
74
+ context "and the file has new characterization data" do
75
+ before {
76
+ subject.fits.content = fixture_file_upload("fits/document.xml")
77
+ }
78
+ it "preserves the characterization data" do
79
+ subject.upload! file
80
+ expect(subject.reload.fits).to have_content
81
+ end
82
+ end
83
+ context "and the file has previously been characterized" do
84
+ before {
85
+ subject.fits.content = fixture_file_upload("fits/document.xml")
86
+ subject.save!
87
+ }
88
+ it "deletes the existing characterization data" do
89
+ subject.upload! file
90
+ expect(subject.reload.fits).to_not have_content
98
91
  end
99
92
  end
100
93
  end
@@ -3,13 +3,13 @@ RSpec.shared_examples "an object that has a display title" do
3
3
  let(:object) { described_class.new }
4
4
  subject { object.title_display }
5
5
  context "has title" do
6
- before { object.descMetadata.title = [ 'Title' ] }
6
+ before { object.desc_metadata.title = [ 'Title' ] }
7
7
  it "should return the first title" do
8
8
  expect(subject).to eq('Title')
9
9
  end
10
10
  end
11
11
  context "has no title, has identifier" do
12
- before { object.descMetadata.identifier = [ 'id001' ] }
12
+ before { object.desc_metadata.identifier = [ 'id001' ] }
13
13
  it "should return the first identifier" do
14
14
  expect(subject).to eq('id001')
15
15
  end
@@ -27,8 +27,8 @@ RSpec.shared_examples "an object that has a display title" do
27
27
  # end
28
28
  # end
29
29
  context "has no title, no identifier, no original_filename" do
30
- let(:object) { described_class.new(:pid => 'duke-test') }
31
- it "should return the PID in square brackets" do
30
+ let(:object) { described_class.new(id: 'duke-test') }
31
+ it "should return the id in square brackets" do
32
32
  expect(subject).to eq "[duke-test]"
33
33
  end
34
34
  end
@@ -37,22 +37,22 @@ end
37
37
 
38
38
  RSpec.shared_examples "an object that has identifiers" do
39
39
  describe "#all_identifiers" do
40
- let(:object) { described_class.new(pid: 'test:3') }
40
+ let(:object) { described_class.new(id: 'test-3') }
41
41
  subject { object.all_identifiers }
42
- context "has descriptive identifiers, local ID, permanent ID, and PID" do
42
+ context "has descriptive identifiers, local ID, permanent ID, and id" do
43
43
  before do
44
- object.descMetadata.identifier = [ 'ID001', 'ID002' ]
44
+ object.desc_metadata.identifier = [ 'ID001', 'ID002' ]
45
45
  object.local_id = 'LOCAL_ID_A'
46
46
  object.permanent_id = 'ark:/999999/cd3'
47
47
  end
48
48
  it "should return all the identifiers" do
49
- expect(subject).to match_array([ 'ID001', 'ID002', 'LOCAL_ID_A', 'ark:/999999/cd3', 'test:3' ])
49
+ expect(subject).to match_array([ 'ID001', 'ID002', 'LOCAL_ID_A', 'ark:/999999/cd3', 'test-3' ])
50
50
  end
51
51
  end
52
52
  context "no descriptive identifiers or local ID" do
53
53
  before { object.permanent_id = 'ark:/999999/cd3' }
54
54
  it "should return the permanent ID and PID" do
55
- expect(subject).to match_array([ 'ark:/999999/cd3', 'test:3' ])
55
+ expect(subject).to match_array([ 'ark:/999999/cd3', 'test-3' ])
56
56
  end
57
57
  end
58
58
  end
@@ -4,7 +4,7 @@ RSpec.shared_examples "a non-collection model" do
4
4
  let(:user) { FactoryGirl.build(:user) }
5
5
  before { subject.grant_roles_to_creator(user) }
6
6
  it "should include the Editor role in resource scope" do
7
- expect(subject.roles.to_a).to eq([Ddr::Auth::Roles::Role.build(role_type: "Editor", agent: user.agent, scope: "resource")])
7
+ expect(subject.roles.to_a).to eq([Ddr::Auth::Roles::Role.new(role_type: "Editor", agent: user.agent, scope: "resource")])
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddr-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta.4
4
+ version: 3.0.0.beta.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Coble
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-08 00:00:00.000000000 Z
12
+ date: 2016-02-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -487,6 +487,7 @@ files:
487
487
  - lib/ddr/events/event.rb
488
488
  - lib/ddr/events/fixity_check_event.rb
489
489
  - lib/ddr/events/ingestion_event.rb
490
+ - lib/ddr/events/migration_event.rb
490
491
  - lib/ddr/events/preservation_event_behavior.rb
491
492
  - lib/ddr/events/reindex_object_after_save.rb
492
493
  - lib/ddr/events/update_event.rb
@@ -502,7 +503,6 @@ files:
502
503
  - lib/ddr/index/field_attribute.rb
503
504
  - lib/ddr/index/fields.rb
504
505
  - lib/ddr/index/filter.rb
505
- - lib/ddr/index/filters.rb
506
506
  - lib/ddr/index/query.rb
507
507
  - lib/ddr/index/query_builder.rb
508
508
  - lib/ddr/index/query_clause.rb
@@ -1,24 +0,0 @@
1
- module Ddr::Index
2
- module Filters
3
- extend Deprecation
4
-
5
- def self.is_governed_by(pid)
6
- Deprecation.warn(self,
7
- "`Ddr::Index:Filters.is_governed_by` is deprecated and will be removed in ddr-models 3.0." \
8
- " Use `Ddr::Index::Filter.is_governed_by` instead.")
9
- Filter.is_governed_by(pid)
10
- end
11
-
12
- def self.const_missing(name)
13
- if name == :HAS_CONTENT
14
- Deprecation.warn(self,
15
- "`Ddr::Index::Filters::#{name}` is deprecated and will be removed in ddr-models 3.0." \
16
- " Use `Ddr::Index::Filter.has_content` instead.")
17
- Filter.has_content
18
- else
19
- super
20
- end
21
- end
22
-
23
- end
24
- end