dor-services 9.2.1 → 9.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39bd6a1c73843860a182c886b4075b6a6c7216c69cec108467d76e72bbba658d
4
- data.tar.gz: c49fbea2b7311b3bd80640b90c764ad54bbf959b27f4f8994c4d3a9c38ccb403
3
+ metadata.gz: 5015214a6f687ad0a64a9ea35914ac2984cf7efbd16cf7e60baea93f306d4d2f
4
+ data.tar.gz: 279ee95befcb33f476fde1d5f159c8a45b4b6d3333ef367a444bc6a076900401
5
5
  SHA512:
6
- metadata.gz: a9e04dcdc34a7d0df4265b77e08f5b20756325418ccfee501216c813bdbb5393f5295633e5f2b41e7898e1a87ca5a5cc3d42e63a6ca6d421de00b3fb281dd2fb
7
- data.tar.gz: 826b55305ff535e531a0531dd0673e82a5df710343121329fe2443bd642dd45771cea326ecf956da1973447a32f10946e9341806ea596a9e2d014ffa9129e6ba
6
+ metadata.gz: 466bea3e00aad80400d0e7be95c28275a1396be4ba139fed6f1b41f6d7f19edd1976dbc7f091ff1ecfd101276d491ebb48a9b91069889a845abed9a438094eaa
7
+ data.tar.gz: f34079d71a227261b7d9d587b9501ff4fc537adada8a69c0b520bd002f0fde2737e0e632b376b2f191bb527d875887bbda0536ca0b6f95b9835273f1e2f6df08
@@ -92,7 +92,6 @@ module Dor
92
92
  autoload :OpenDataLicenseService
93
93
  autoload :SearchService
94
94
  autoload :SuriService
95
- autoload :TagService
96
95
  end
97
96
 
98
97
  eager_load!
@@ -69,16 +69,6 @@ module Dor
69
69
  end
70
70
  alias source_id= sourceId=
71
71
 
72
- def tags
73
- tag
74
- end
75
-
76
- # helper method to get just the content type tag
77
- def content_type_tag
78
- content_tag = tags.select { |tag| tag.include?('Process : Content Type') }
79
- content_tag.size == 1 ? content_tag[0].split(':').last.strip : ''
80
- end
81
-
82
72
  def otherId(type = nil)
83
73
  result = find_by_terms(:otherId).to_a
84
74
  if type.nil?
@@ -193,30 +183,6 @@ module Dor
193
183
  add_solr_value(solr_doc, "#{name}_id", id, :symbol, [])
194
184
  end
195
185
 
196
- # do some stuff to make tags in general and project tags specifically more easily searchable and facetable
197
- find_by_terms(:tag).each do |tag|
198
- (prefix, rest) = tag.text.split(/:/, 2)
199
- prefix = prefix.downcase.strip.gsub(/\s/, '_')
200
- unless rest.nil?
201
- # this part will index a value in a field specific to the tag, e.g. registered_by_tag_*,
202
- # book_tag_*, project_tag_*, remediated_by_tag_*, etc. project_tag_* and registered_by_tag_*
203
- # definitley get used, but most don't. we can limit the prefixes that get solrized if things
204
- # get out of hand.
205
- add_solr_value(solr_doc, "#{prefix}_tag", rest.strip, :symbol, [])
206
- end
207
-
208
- # solrize each possible prefix for the tag, inclusive of the full tag.
209
- # e.g., for a tag such as "A : B : C", this will solrize to an _ssim field
210
- # that contains ["A", "A : B", "A : B : C"].
211
- tag_parts = tag.text.split(/:/)
212
- progressive_tag_prefix = ''
213
- tag_parts.each_with_index do |part, index|
214
- progressive_tag_prefix += ' : ' if index > 0
215
- progressive_tag_prefix += part.strip
216
- add_solr_value(solr_doc, 'exploded_tag', progressive_tag_prefix, :symbol, [])
217
- end
218
- end
219
-
220
186
  solr_doc
221
187
  end
222
188
 
@@ -79,8 +79,8 @@ module Dor
79
79
  delegate :catkey, :catkey=, :source_id, :source_id=,
80
80
  :objectId, :objectId=, :objectCreator, :objectCreator=,
81
81
  :objectLabel, :objectLabel=, :objectType, :objectType=,
82
- :other_ids=, :otherId, :tag=, :tags, :release_tags,
83
- :previous_catkeys, :content_type_tag, to: :identityMetadata
82
+ :other_ids=, :otherId, :release_tags, :previous_catkeys,
83
+ to: :identityMetadata
84
84
 
85
85
  def read_rights=(rights)
86
86
  rightsMetadata.set_read_rights(rights)
@@ -22,10 +22,11 @@ module Dor
22
22
  :regactiondttm, :documentaccess, :submit_date, :symphonyStatus,
23
23
  datastream: 'properties', multiple: false
24
24
 
25
- has_attributes :citation_verified, :abstract_provided, :dissertation_uploaded,
26
- :supplemental_files_uploaded, :permissions_provided,
27
- :permission_files_uploaded, :rights_selected,
28
- :cc_license_selected, :submitted_to_registrar,
25
+ has_attributes :citation_verified, :abstract_provided, :format_reviewed,
26
+ :dissertation_uploaded, :supplemental_files_uploaded,
27
+ :permissions_provided, :permission_files_uploaded,
28
+ :rights_selected, :cc_license_selected,
29
+ :submitted_to_registrar,
29
30
  datastream: 'workflow', multiple: false
30
31
 
31
32
  has_metadata name: 'properties', type: ActiveFedora::SimpleDatastream, versionable: false do |m|
@@ -77,6 +78,7 @@ module Dor
77
78
  has_metadata name: 'workflow', type: ActiveFedora::SimpleDatastream, versionable: false do |m|
78
79
  m.field 'citation_verified', :string
79
80
  m.field 'abstract_provided', :string
81
+ m.field 'format_reviewed', :string
80
82
  m.field 'dissertation_uploaded', :string
81
83
  m.field 'supplemental_files_uploaded', :string
82
84
  m.field 'permissions_provided', :string
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dor
4
- VERSION = '9.2.1'
4
+ VERSION = '9.3.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.2.1
4
+ version: 9.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein
@@ -20,7 +20,7 @@ authors:
20
20
  autorequire:
21
21
  bindir: bin
22
22
  cert_chain: []
23
- date: 2020-03-16 00:00:00.000000000 Z
23
+ date: 2020-04-23 00:00:00.000000000 Z
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: active-fedora
@@ -450,7 +450,6 @@ files:
450
450
  - lib/dor/services/open_data_license_service.rb
451
451
  - lib/dor/services/search_service.rb
452
452
  - lib/dor/services/suri_service.rb
453
- - lib/dor/services/tag_service.rb
454
453
  - lib/dor/static_config.rb
455
454
  - lib/dor/static_config/fedora_config.rb
456
455
  - lib/dor/static_config/solr_config.rb
@@ -484,7 +483,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
484
483
  - !ruby/object:Gem::Version
485
484
  version: 1.3.6
486
485
  requirements: []
487
- rubygems_version: 3.1.2
486
+ rubygems_version: 3.0.8
488
487
  signing_key:
489
488
  specification_version: 4
490
489
  summary: Ruby implmentation of DOR services used by the SULAIR Digital Library
@@ -1,100 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Dor
4
- # Manage tags on an object
5
- class TagService
6
- def self.add(item, tag)
7
- new(item).add(tag)
8
- end
9
-
10
- def self.remove(item, tag)
11
- new(item).remove(tag)
12
- end
13
-
14
- def self.update(item, old_tag, new_tag)
15
- new(item).update(old_tag, new_tag)
16
- end
17
-
18
- def initialize(item)
19
- @item = item
20
- end
21
-
22
- # Add an administrative tag to an item, you will need to seperately save the item to write it to fedora
23
- # @param tag [string] The tag you wish to add
24
- def add(tag)
25
- normalized_tag = validate_and_normalize_tag(tag, identity_metadata.tags)
26
- identity_metadata.add_value(:tag, normalized_tag)
27
- end
28
-
29
- def remove(tag)
30
- normtag = normalize_tag(tag)
31
- tag_nodes
32
- .select { |node| normalize_tag(node.content) == normtag }
33
- .each { identity_metadata.ng_xml_will_change! }
34
- .each(&:remove)
35
- .any?
36
- end
37
-
38
- def update(old_tag, new_tag)
39
- normtag = normalize_tag(old_tag)
40
- tag_nodes
41
- .select { |node| normalize_tag(node.content) == normtag }
42
- .each { identity_metadata.ng_xml_will_change! }
43
- .each { |node| node.content = normalize_tag(new_tag) }
44
- .any?
45
- end
46
-
47
- private
48
-
49
- attr_reader :item
50
- def identity_metadata
51
- item.identityMetadata
52
- end
53
-
54
- def tag_nodes
55
- identity_metadata.ng_xml.search('//tag')
56
- end
57
-
58
- # turns a tag string into an array with one element per tag part.
59
- # split on ":", disregard leading and trailing whitespace on tokens.
60
- def split_tag_to_arr(tag_str)
61
- tag_str.split(':').map(&:strip)
62
- end
63
-
64
- # turn a tag array back into a tag string with a standard format
65
- def normalize_tag_arr(tag_arr)
66
- tag_arr.join(' : ')
67
- end
68
-
69
- # take a tag string and return a normalized tag string
70
- def normalize_tag(tag_str)
71
- normalize_tag_arr(split_tag_to_arr(tag_str))
72
- end
73
-
74
- # take a proposed tag string and a list of the existing tags for the object being edited. if
75
- # the proposed tag is valid, return it in normalized form. if not, raise an exception with an
76
- # explanatory message.
77
- def validate_and_normalize_tag(tag_str, existing_tag_list)
78
- tag_arr = validate_tag_format(tag_str)
79
-
80
- # note that the comparison for duplicate tags is case-insensitive, but we don't change case as part of the normalized version
81
- # we return, because we want to preserve the user's intended case.
82
- normalized_tag = normalize_tag_arr(tag_arr)
83
- dupe_existing_tag = existing_tag_list.detect { |existing_tag| normalize_tag(existing_tag).casecmp(normalized_tag) == 0 }
84
- raise "An existing tag (#{dupe_existing_tag}) is the same, consider using update_tag?" if dupe_existing_tag
85
-
86
- normalized_tag
87
- end
88
-
89
- # Ensure that an administrative tag meets the proper mininum format
90
- # @param tag_str [String] the tag
91
- # @return [Array] the tag split into an array via ':'
92
- def validate_tag_format(tag_str)
93
- tag_arr = split_tag_to_arr(tag_str)
94
- raise ArgumentError, "Invalid tag structure: tag '#{tag_str}' must have at least 2 elements" if tag_arr.length < 2
95
- raise ArgumentError, "Invalid tag structure: tag '#{tag_str}' contains empty elements" if tag_arr.detect(&:empty?)
96
-
97
- tag_arr
98
- end
99
- end
100
- end