dor-services 5.3.1 → 5.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dor/datastreams/identity_metadata_ds.rb +10 -6
- data/lib/dor/models/identifiable.rb +12 -4
- data/lib/dor/models/processable.rb +3 -4
- data/lib/dor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4612df0551e79474ccb0e568de29cf05c42f6f7
|
4
|
+
data.tar.gz: cf816af8f863af33f717fc63e9ec4ede906eb758
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91ada9a335362058cf16d42eb6fcd9e99542fc288577bd1cf1942004985302747dd19df89690c94ed0f476cd392f4a3e19b0426414ebc251969ae1a139849eed
|
7
|
+
data.tar.gz: 0341a7e1b9590783c3df4fd5d50fdc8872aecf4da3966375b2d35127edfccb42b61ec0b09347fe637d102147b6723da3ed551980dd8650854c037eb94ac8df3b
|
@@ -40,18 +40,22 @@ class IdentityMetadataDS < ActiveFedora::OmDatastream
|
|
40
40
|
node ? [node['source'], node.text].join(':') : nil
|
41
41
|
end
|
42
42
|
|
43
|
+
# @param [String, Nil] New value, or nil/empty string to delete sourceId node
|
44
|
+
# @return [String, Nil] The same value, as per Ruby convention for assignment operators
|
45
|
+
# @note The actual values assigned will have leading/trailing whitespace stripped.
|
43
46
|
def sourceId=(value)
|
44
47
|
node = find_by_terms(:sourceId).first
|
45
|
-
unless value.present?
|
48
|
+
unless value.present? # so setting it to '' is the same as removal: worth documenting maybe?
|
46
49
|
node.remove unless node.nil?
|
47
50
|
return nil
|
48
51
|
end
|
49
|
-
|
50
|
-
|
52
|
+
parts = value.split(':').map(&:strip)
|
53
|
+
# parts = value.split(/:/, 2).map(&:strip) # if we needed to allow colons in values or bunched colon separators
|
54
|
+
raise ArgumentError, "Source ID must follow the format 'namespace:value', not '#{value}'" unless
|
55
|
+
parts.length == 2 && parts[0].present? && parts[1].present?
|
51
56
|
node ||= ng_xml.root.add_child('<sourceId/>').first
|
52
|
-
node['source'] =
|
53
|
-
node.content =
|
54
|
-
node
|
57
|
+
node['source'] = parts[0]
|
58
|
+
node.content = parts[1]
|
55
59
|
end
|
56
60
|
|
57
61
|
def tags
|
@@ -90,9 +90,20 @@ module Dor
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
|
93
|
+
# Convenience method
|
94
|
+
def source_id
|
95
|
+
identityMetadata.sourceId
|
96
|
+
end
|
97
|
+
|
98
|
+
# Convenience method
|
99
|
+
# @param [String] source_id the new source identifier
|
100
|
+
# @return [String] same value, as per Ruby assignment convention
|
101
|
+
# @raise [ArgumentError] see IdentityMetadataDS for logic
|
102
|
+
def source_id=(source_id)
|
94
103
|
identityMetadata.sourceId = source_id
|
95
104
|
end
|
105
|
+
alias_method :set_source_id, :source_id=
|
106
|
+
deprecate set_source_id: 'Use source_id= instead'
|
96
107
|
|
97
108
|
def add_other_Id(type, val)
|
98
109
|
if identityMetadata.otherId(type).length > 0
|
@@ -144,7 +155,6 @@ module Dor
|
|
144
155
|
if dupe_existing_tag
|
145
156
|
raise "An existing tag (#{dupe_existing_tag}) is the same, consider using update_tag?"
|
146
157
|
end
|
147
|
-
|
148
158
|
normalized_tag
|
149
159
|
end
|
150
160
|
|
@@ -153,11 +163,9 @@ module Dor
|
|
153
163
|
# @return [Array] the tag split into an array via ':'
|
154
164
|
def validate_tag_format(tag_str)
|
155
165
|
tag_arr = split_tag_to_arr(tag_str)
|
156
|
-
|
157
166
|
if tag_arr.length < 2
|
158
167
|
raise ArgumentError, "Invalid tag structure: tag '#{tag_str}' must have at least 2 elements"
|
159
168
|
end
|
160
|
-
|
161
169
|
if tag_arr.detect {|str| str.empty?}
|
162
170
|
raise ArgumentError, "Invalid tag structure: tag '#{tag_str}' contains empty elements"
|
163
171
|
end
|
@@ -103,7 +103,7 @@ module Dor
|
|
103
103
|
Dor::WorkflowService.get_milestones('dor', pid)
|
104
104
|
end
|
105
105
|
|
106
|
-
# @return [Hash] including :current_version, :status_code and :status_time
|
106
|
+
# @return [Hash{Symbol => Object}] including :current_version, :status_code and :status_time
|
107
107
|
def status_info
|
108
108
|
current_version = '1'
|
109
109
|
begin
|
@@ -146,9 +146,8 @@ module Dor
|
|
146
146
|
result
|
147
147
|
end
|
148
148
|
|
149
|
-
# return
|
150
|
-
# e.g. 'In accessioning (described)' and 'In accessioning (described, published)' both
|
151
|
-
# as 'In accessioning'
|
149
|
+
# @return [String] text translation of the status code, minus any trailing parenthetical explanation
|
150
|
+
# e.g. 'In accessioning (described)' and 'In accessioning (described, published)' both return 'In accessioning'
|
152
151
|
def simplified_status_code_disp_txt(status_code)
|
153
152
|
STATUS_CODE_DISP_TXT[status_code].gsub(/\(.*\)$/, '').strip
|
154
153
|
end
|
data/lib/dor/version.rb
CHANGED
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: 5.3.
|
4
|
+
version: 5.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Klein
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2016-01-
|
17
|
+
date: 2016-01-27 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: active-fedora
|