dor-services 4.7.0 → 4.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dor/datastreams/administrative_metadata_ds.rb +66 -31
- data/lib/dor/models/governable.rb +20 -8
- data/lib/dor/models/processable.rb +4 -2
- data/lib/dor/version.rb +1 -1
- metadata +10 -4
@@ -1,5 +1,5 @@
|
|
1
1
|
module Dor
|
2
|
-
class AdministrativeMetadataDS < ActiveFedora::OmDatastream
|
2
|
+
class AdministrativeMetadataDS < ActiveFedora::OmDatastream
|
3
3
|
|
4
4
|
set_terminology do |t|
|
5
5
|
t.root :path => 'administrativeMetadata', :index_as => [:not_searchable]
|
@@ -21,7 +21,7 @@ class AdministrativeMetadataDS < ActiveFedora::OmDatastream
|
|
21
21
|
end
|
22
22
|
t.workflow :path => 'registration/workflow'
|
23
23
|
t.deposit :index_as => [:not_searchable]
|
24
|
-
|
24
|
+
|
25
25
|
t.accessioning :index_as => [:not_searchable] do
|
26
26
|
t.workflow_id :path => 'workflow/@id', :index_as => [:facetable]
|
27
27
|
end
|
@@ -31,14 +31,24 @@ class AdministrativeMetadataDS < ActiveFedora::OmDatastream
|
|
31
31
|
t.harvester
|
32
32
|
t.releaseDelayLimit
|
33
33
|
end
|
34
|
+
t.defaults do
|
35
|
+
t.initiate_workflow :path => 'initiateWorkflow' do
|
36
|
+
t.lane :path => { :attribute => 'lane' }
|
37
|
+
end
|
38
|
+
t.shelving :path => 'shelving' do
|
39
|
+
t.path :path => { :attribute => 'path'}
|
40
|
+
end
|
41
|
+
end
|
34
42
|
end
|
43
|
+
|
35
44
|
define_template :default_collection do |xml|
|
36
|
-
|
37
|
-
|
38
|
-
|
45
|
+
xml.administrativeMetadata{
|
46
|
+
xml.registration{
|
47
|
+
xml.collection(:id => '')
|
48
|
+
}
|
39
49
|
}
|
40
|
-
}
|
41
50
|
end
|
51
|
+
|
42
52
|
define_template :agreementId do |xml|
|
43
53
|
xml.administrativeMetadata {
|
44
54
|
xml.registration{
|
@@ -46,39 +56,64 @@ class AdministrativeMetadataDS < ActiveFedora::OmDatastream
|
|
46
56
|
}
|
47
57
|
}
|
48
58
|
end
|
59
|
+
|
49
60
|
define_template :metadata_format do |xml|
|
50
61
|
xml.descMetadata{
|
51
62
|
xml.format
|
52
63
|
}
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
64
|
+
end
|
65
|
+
|
66
|
+
define_template :metadata_source do |xml|
|
67
|
+
xml.administrativeMetadata{
|
57
68
|
xml.descMetadata{
|
58
69
|
xml.source
|
59
|
-
|
60
|
-
|
70
|
+
}
|
71
|
+
}
|
61
72
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
73
|
+
|
74
|
+
define_template :registration do |xml|
|
75
|
+
xml.administrativeMetadata {
|
76
|
+
xml.registration{
|
77
|
+
xml.workflow(:id=> '')
|
67
78
|
}
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
define_template :default_collection do |xml|
|
83
|
+
xml.administrativeMetadata {
|
84
|
+
xml.registration{
|
85
|
+
xml.collection
|
86
|
+
}
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.xml_template
|
91
|
+
Nokogiri::XML::Builder.new do |xml|
|
92
|
+
xml.administrativeMetadata{ }
|
93
|
+
end.doc
|
94
|
+
end
|
95
|
+
|
96
|
+
#################################################################################
|
97
|
+
# Convenience methods to get and set properties
|
98
|
+
# Hides complexity/verbosity of OM TermOperators for simple, non-repeating values
|
99
|
+
#################################################################################
|
100
|
+
|
101
|
+
def default_workflow_lane= lane
|
102
|
+
self.defaults.initiate_workflow.lane = lane
|
103
|
+
end
|
104
|
+
|
105
|
+
def default_workflow_lane
|
106
|
+
self.defaults.initiate_workflow.lane.first
|
107
|
+
end
|
108
|
+
|
109
|
+
def default_shelving_path= path
|
110
|
+
self.defaults.shelving.path = path
|
111
|
+
end
|
112
|
+
|
113
|
+
def default_shelving_path
|
114
|
+
self.defaults.shelving.path.first
|
115
|
+
end
|
116
|
+
|
82
117
|
end
|
83
118
|
|
84
119
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module Dor
|
1
|
+
module Dor
|
2
2
|
module Governable
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
include ActiveFedora::Relationships
|
@@ -13,6 +13,18 @@ module Dor
|
|
13
13
|
self.initialize_workflow(name, 'dor', !self.new_object?)
|
14
14
|
end
|
15
15
|
|
16
|
+
# Returns the default lane_id from the item's APO. Will return 'default' if the item does not have
|
17
|
+
# and APO, or if the APO does not have a default_lane
|
18
|
+
# @return [String] the lane id
|
19
|
+
def default_workflow_lane
|
20
|
+
return 'default' if self.admin_policy_object.nil? # TODO log warning?
|
21
|
+
|
22
|
+
admin_md = admin_policy_object.datastreams['administrativeMetadata']
|
23
|
+
lane = admin_md.default_workflow_lane
|
24
|
+
return 'default' if lane.nil? or lane.strip == ''
|
25
|
+
lane
|
26
|
+
end
|
27
|
+
|
16
28
|
def reset_to_apo_default()
|
17
29
|
rights_metadata_ds = self.rightsMetadata
|
18
30
|
#get the apo for this object
|
@@ -59,7 +71,7 @@ module Dor
|
|
59
71
|
node.add_child(machine_node)
|
60
72
|
machine_node.add_child(none_node)
|
61
73
|
end
|
62
|
-
end
|
74
|
+
end
|
63
75
|
end
|
64
76
|
|
65
77
|
def add_collection(collection_or_druid)
|
@@ -71,8 +83,8 @@ module Dor
|
|
71
83
|
end
|
72
84
|
self.collections << collection
|
73
85
|
self.sets << collection
|
74
|
-
end
|
75
|
-
|
86
|
+
end
|
87
|
+
|
76
88
|
def remove_collection(collection_or_druid)
|
77
89
|
|
78
90
|
collection = case collection_or_druid
|
@@ -117,19 +129,19 @@ module Dor
|
|
117
129
|
['dor-administrator','dor-apo-manager', 'dor-apo-depositor']
|
118
130
|
end
|
119
131
|
def groups_which_manage_content
|
120
|
-
['dor-administrator','dor-apo-manager', 'dor-apo-depositor']
|
132
|
+
['dor-administrator','dor-apo-manager', 'dor-apo-depositor']
|
121
133
|
end
|
122
134
|
def groups_which_manage_rights
|
123
135
|
['dor-administrator','dor-apo-manager', 'dor-apo-depositor']
|
124
136
|
end
|
125
137
|
def groups_which_manage_embargo
|
126
|
-
['dor-administrator','dor-apo-manager', 'dor-apo-depositor']
|
138
|
+
['dor-administrator','dor-apo-manager', 'dor-apo-depositor']
|
127
139
|
end
|
128
140
|
def groups_which_view_content
|
129
|
-
['dor-administrator','dor-apo-manager', 'dor-apo-depositor', 'dor-viewer']
|
141
|
+
['dor-administrator','dor-apo-manager', 'dor-apo-depositor', 'dor-viewer']
|
130
142
|
end
|
131
143
|
def groups_which_view_metadata
|
132
|
-
['dor-administrator','dor-apo-manager', 'dor-apo-depositor', 'dor-viewer']
|
144
|
+
['dor-administrator','dor-apo-manager', 'dor-apo-depositor', 'dor-viewer']
|
133
145
|
end
|
134
146
|
def intersect arr1, arr2
|
135
147
|
return (arr1 & arr2).length > 0
|
@@ -114,14 +114,14 @@ module Dor
|
|
114
114
|
end
|
115
115
|
|
116
116
|
current_milestones = []
|
117
|
-
#only get steps that are part of accessioning and part of the current version. That can mean they were archived with the current version
|
117
|
+
#only get steps that are part of accessioning and part of the current version. That can mean they were archived with the current version
|
118
118
|
#number, or they might be active (no version number).
|
119
119
|
milestones.each do |m|
|
120
120
|
if STEPS.keys.include?(m[:milestone]) and (m[:version].nil? or m[:version] == current_version)
|
121
121
|
current_milestones << m unless m[:milestone] == 'registered' and current_version.to_i > 1
|
122
122
|
end
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
status_code = 0
|
126
126
|
status_time = ''
|
127
127
|
#for each milestone in the current version, see if it comes after the current 'last' step, if so, make it the last and record the date/time
|
@@ -208,6 +208,7 @@ module Dor
|
|
208
208
|
|
209
209
|
# Initilizes workflow for the object in the workflow service
|
210
210
|
# It will set the priorty of the new workflow to the current_priority if it is > 0
|
211
|
+
# It will set lane_id from the item's APO default workflow lane
|
211
212
|
# @param [String] name of the workflow to be initialized
|
212
213
|
# @param [String] repo name of the repository to create workflow for
|
213
214
|
# @param [Boolean] create_ds create a 'workflows' datastream in Fedora for the object
|
@@ -215,6 +216,7 @@ module Dor
|
|
215
216
|
priority = workflows.current_priority if priority == 0
|
216
217
|
opts = { :create_ds => create_ds }
|
217
218
|
opts[:priority] = priority if(priority > 0)
|
219
|
+
opts[:lane_id] = default_workflow_lane
|
218
220
|
Dor::WorkflowService.create_workflow(repo, self.pid, name, Dor::WorkflowObject.initial_workflow(name), opts)
|
219
221
|
end
|
220
222
|
|
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: 4.
|
4
|
+
version: 4.8.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2014-06-
|
16
|
+
date: 2014-06-17 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: active-fedora
|
@@ -36,17 +36,23 @@ dependencies:
|
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
none: false
|
38
38
|
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '3.2'
|
39
42
|
- - ! '>='
|
40
43
|
- !ruby/object:Gem::Version
|
41
|
-
version: 3.2.
|
44
|
+
version: 3.2.18
|
42
45
|
type: :runtime
|
43
46
|
prerelease: false
|
44
47
|
version_requirements: !ruby/object:Gem::Requirement
|
45
48
|
none: false
|
46
49
|
requirements:
|
50
|
+
- - ~>
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '3.2'
|
47
53
|
- - ! '>='
|
48
54
|
- !ruby/object:Gem::Version
|
49
|
-
version: 3.2.
|
55
|
+
version: 3.2.18
|
50
56
|
- !ruby/object:Gem::Dependency
|
51
57
|
name: confstruct
|
52
58
|
requirement: !ruby/object:Gem::Requirement
|