dor-services 5.2.0 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +5 -13
  2. data/config/certs/robots-dor-dev.crt +29 -0
  3. data/config/certs/robots-dor-dev.key +27 -0
  4. data/config/config_defaults.yml +2 -0
  5. data/config/dev_console_env.rb +77 -0
  6. data/lib/dor-services.rb +31 -27
  7. data/lib/dor/config.rb +25 -19
  8. data/lib/dor/datastreams/administrative_metadata_ds.rb +19 -20
  9. data/lib/dor/datastreams/content_metadata_ds.rb +238 -177
  10. data/lib/dor/datastreams/datastream_spec_solrizer.rb +1 -1
  11. data/lib/dor/datastreams/default_object_rights_ds.rb +99 -16
  12. data/lib/dor/datastreams/desc_metadata_ds.rb +37 -34
  13. data/lib/dor/datastreams/embargo_metadata_ds.rb +16 -16
  14. data/lib/dor/datastreams/events_ds.rb +2 -2
  15. data/lib/dor/datastreams/geo_metadata_ds.rb +5 -10
  16. data/lib/dor/datastreams/identity_metadata_ds.rb +22 -22
  17. data/lib/dor/datastreams/rights_metadata_ds.rb +43 -32
  18. data/lib/dor/datastreams/role_metadata_ds.rb +5 -5
  19. data/lib/dor/datastreams/simple_dublin_core_ds.rb +13 -14
  20. data/lib/dor/datastreams/version_metadata_ds.rb +22 -23
  21. data/lib/dor/datastreams/workflow_definition_ds.rb +15 -15
  22. data/lib/dor/datastreams/workflow_ds.rb +64 -70
  23. data/lib/dor/exceptions.rb +0 -1
  24. data/lib/dor/migrations/identifiable/uriify_augmented_contentlocation_refs.rb +4 -4
  25. data/lib/dor/migrations/processable/unify_workflows.rb +1 -1
  26. data/lib/dor/models/admin_policy_object.rb +4 -4
  27. data/lib/dor/models/assembleable.rb +2 -3
  28. data/lib/dor/models/collection.rb +1 -1
  29. data/lib/dor/models/contentable.rb +113 -108
  30. data/lib/dor/models/describable.rb +136 -95
  31. data/lib/dor/models/editable.rb +205 -119
  32. data/lib/dor/models/embargoable.rb +16 -16
  33. data/lib/dor/models/eventable.rb +2 -2
  34. data/lib/dor/models/geoable.rb +3 -3
  35. data/lib/dor/models/governable.rb +25 -26
  36. data/lib/dor/models/identifiable.rb +66 -55
  37. data/lib/dor/models/item.rb +0 -1
  38. data/lib/dor/models/itemizable.rb +7 -8
  39. data/lib/dor/models/preservable.rb +7 -8
  40. data/lib/dor/models/processable.rb +76 -73
  41. data/lib/dor/models/publishable.rb +25 -30
  42. data/lib/dor/models/releaseable.rb +118 -155
  43. data/lib/dor/models/rightsable.rb +2 -3
  44. data/lib/dor/models/set.rb +1 -1
  45. data/lib/dor/models/shelvable.rb +8 -10
  46. data/lib/dor/models/upgradable.rb +5 -6
  47. data/lib/dor/models/versionable.rb +3 -4
  48. data/lib/dor/models/workflow_object.rb +15 -16
  49. data/lib/dor/services/cleanup_reset_service.rb +15 -16
  50. data/lib/dor/services/cleanup_service.rb +2 -4
  51. data/lib/dor/services/digital_stacks_service.rb +10 -13
  52. data/lib/dor/services/merge_service.rb +8 -9
  53. data/lib/dor/services/metadata_handlers/catalog_handler.rb +1 -1
  54. data/lib/dor/services/metadata_handlers/mdtoolkit_handler.rb +3 -3
  55. data/lib/dor/services/metadata_service.rb +19 -20
  56. data/lib/dor/services/registration_service.rb +80 -61
  57. data/lib/dor/services/reset_workspace_service.rb +6 -10
  58. data/lib/dor/services/sdr_ingest_service.rb +15 -16
  59. data/lib/dor/services/search_service.rb +18 -23
  60. data/lib/dor/services/suri_service.rb +6 -6
  61. data/lib/dor/services/technical_metadata_service.rb +27 -44
  62. data/lib/dor/utils/ng_tidy.rb +3 -3
  63. data/lib/dor/utils/sdr_client.rb +2 -3
  64. data/lib/dor/utils/solr_doc_helper.rb +1 -3
  65. data/lib/dor/version.rb +1 -1
  66. data/lib/dor/workflow/document.rb +43 -40
  67. data/lib/dor/workflow/graph.rb +26 -26
  68. data/lib/dor/workflow/process.rb +34 -35
  69. data/lib/tasks/rdoc.rake +5 -5
  70. metadata +129 -111
  71. data/lib/dor/models/presentable.rb +0 -146
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MTIxOTE5NDBmNGMxNDI2OTg5ZWZiMzVhYWFlNmNlYWVkMjI0MTljZg==
5
- data.tar.gz: !binary |-
6
- YjMzM2M1ZThjYjZmZjdjMjJjY2VlODM3OTYzMDg1MjZiOTNjMDE4Yg==
2
+ SHA1:
3
+ metadata.gz: 23867d4b182bfb98fe6e40f940fc7353080d446f
4
+ data.tar.gz: d57f27f17462ccea10c3ea4b6e2e48b2e4c88bb4
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YzBjMzFiOTU0YmY3OGE5ZDA1NzZlYWM5ZjYwNTMxYmU3MDM4MzkwOWI0MzVi
10
- N2UyM2U5MTUxMzJjNjFjMjRkM2U3NTFjNWFhMDVkYTg5M2UyYmUxYzkzOTQ2
11
- MGM5MTYxMDM1ZTIyY2U0MDYwNDJkODhiNDc4YWZiZjlhNTNkZTc=
12
- data.tar.gz: !binary |-
13
- NmE4ZjZjNjMwYTM1YTBhY2Q0MzJmZjQxNGZkOGVhMzUxYWQ0MTRmNDYwMTYy
14
- NDgxNWVmMzFlOTAwMDkzOTNiMWE4MjQ1ZmJhNjc0NGFlMTY1NzI5MzQ5MDVk
15
- NWU1NmJlZWNmODIzNjA1NDVmNzJmODcwNDA5ZDFiZmQ3ZjRlN2I=
6
+ metadata.gz: d74d65c086f2a549ebff3abe402665166617225ff9f7ffa2cc2b43d10cd8506dd67928b0011ed35e0bc7231166faa5a85a04afeb2172885f054f096c1b01fcbd
7
+ data.tar.gz: f15acd410e5db8345bc38fdf7398c5b09301f03a3067010fc0aeb772c589048c063632040bdb369745b1f725e72e219920d2eddbacc36fa05b83321e1792bd21
@@ -0,0 +1,29 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIE9zCCAt8CCQCcUJVDTu7rTjANBgkqhkiG9w0BAQUFADCBvzELMAkGA1UEBhMC
3
+ VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAP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yA9djtrCfNC5icr4VsaLfku5nKJQ4t4bLxkGhNmBCejwSA/S09+x9O
23
+ Wu0JX3zR3y+IMczQ+tRGmNiU5qXhCJ4fbQHSeGqIN3Io7h/RR6E/QlJU59RrRG/a
24
+ SjqAV+ECgYEA2mA5VFK3jECnLde+biEaXidIOuBMcqaP0VG6sBwz2wTGSTBE1WkG
25
+ 6prCD0McWVAgDTm3MMKxeuMaoW5eEi83+G+CywLaTBpc8Hz7qgRhBpKhRirCfHMW
26
+ EfQV5k32vEGoSI+eG8zcGb9mwDeb/EWXAMGXrx2YuYFu7txtwC2mZXc=
27
+ -----END RSA PRIVATE KEY-----
@@ -61,5 +61,7 @@
61
61
  :workflow:
62
62
  :url:
63
63
  :timeout: 60
64
+ :logfile: workflow_service.log
65
+ :shift_age: weekly
64
66
  :dor_services:
65
67
  :url:
@@ -0,0 +1,77 @@
1
+ cert_dir = File.join(File.dirname(__FILE__), 'certs')
2
+
3
+ Dor::Config.configure do
4
+
5
+ ssl do
6
+ cert_file File.join(cert_dir, 'robots-dor-dev.crt')
7
+ key_file File.join(cert_dir, 'robots-dor-dev.key')
8
+ key_pass ''
9
+ end
10
+
11
+ suri do
12
+ mint_ids true
13
+ id_namespace 'druid'
14
+ url 'https://lyberservices-dev.stanford.edu'
15
+ user 'labware'
16
+ pass 'lyberteam'
17
+ end
18
+
19
+ metadata do
20
+ exist.url 'http://viewer:l3l%40nd@lyberapps-dev.stanford.edu/exist/rest/'
21
+ catalog.url 'http://lyberservices-prod.stanford.edu/catalog/mods'
22
+ end
23
+
24
+ stacks do
25
+ document_cache_host 'purl-dev.stanford.edu'
26
+ local_stacks_root '/stacks'
27
+ local_document_cache_root '/purl/document_cache'
28
+ local_workspace_root '/dor/workspace'
29
+ end
30
+
31
+ solrizer.url 'http://sul-solr.stanford.edu/solr/argo_test'
32
+ fedora.url 'https://sul-dor-test.stanford.edu/fedora'
33
+ workflow.url 'https://lyberservices-dev.stanford.edu/workflow/'
34
+ dor_services.url 'https://dorAdmin:dorAdmin@sul-lyberservices-dev.stanford.edu/dor'
35
+
36
+ cleanup do
37
+ local_workspace_root '/dor/workspace'
38
+ local_export_home '/dor/export'
39
+ end
40
+
41
+ sdr do
42
+ url 'https://sdrAdmin:sdrAdmin@sdr-services-test.stanford.edu/sdr/'
43
+ local_workspace_root '/dor/workspace'
44
+ local_export_home '/dor/export'
45
+ datastreams do
46
+ administrativeMetadata 'optional'
47
+ contentMetadata 'optional'
48
+ descMetadata 'required'
49
+ defaultObjectRights 'optional'
50
+ events 'optional'
51
+ embargoMetadata 'optional'
52
+ identityMetadata 'required'
53
+ provenanceMetadata 'required'
54
+ relationshipMetadata 'required'
55
+ rightsMetadata 'optional'
56
+ roleMetadata 'optional'
57
+ sourceMetadata 'optional'
58
+ technicalMetadata 'optional'
59
+ versionMetadata 'required'
60
+ workflows 'optional'
61
+ end
62
+ end
63
+
64
+ accessioning_robot_sleep_time 30
65
+
66
+ end
67
+
68
+ # WORKFLOW_URI = 'http://lyberservices-test.stanford.edu/workflow'
69
+
70
+ # Constants for Dor::WorkflowService
71
+ # module Dor
72
+ # CREATE_WORKFLOW = DOR_CREATE_WORKFLOW = true
73
+ # WF_URI = 'http://lyberservices-test.stanford.edu/workflow'
74
+ # end
75
+
76
+ # External application locations
77
+ JHOVE_HOME = File.join(ENV['HOME'], 'jhoveToolkit')
data/lib/dor-services.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'active_fedora'
2
2
  require 'active_support/core_ext/module/attribute_accessors'
3
+ require 'modsulator'
4
+ require 'nokogiri-pretty'
3
5
 
4
6
  module Dor
5
7
  @@registered_classes = {}
@@ -8,7 +10,7 @@ module Dor
8
10
 
9
11
  class << self
10
12
 
11
- def configure *args, &block
13
+ def configure(*args, &block)
12
14
  Dor::Config.configure *args, &block
13
15
  end
14
16
 
@@ -16,7 +18,7 @@ module Dor
16
18
  # to adapt it to. This is necessary when the object is not indexed, or the
17
19
  # index is missing the objectType property.
18
20
  # @param [String] pid The object's PID
19
- def load_instance pid
21
+ def load_instance(pid)
20
22
  ensure_models_loaded!
21
23
  obj = Dor::Abstract.find pid
22
24
  return nil if obj.new_object?
@@ -27,14 +29,17 @@ module Dor
27
29
 
28
30
  # Get objectType information from solr and load the correct class the first time,
29
31
  # saving the overhead of using ActiveFedora::Base#adapt_to. It falls back to
30
- # Dor.load_instance() if the item is not in the index, or is improperly
31
- # indexed.
32
+ # Dor.load_instance() if the item is not in the index, or is improperly indexed.
32
33
  # @param [String] pid The object's PID
33
- def find pid, opts={}
34
- self.find_all(%{id:"#{pid}"}, opts).first || self.load_instance(pid)
34
+ # @return [Object] the ActiveFedora-modeled object
35
+ def find(pid, opts = {})
36
+ opts[:rows] = 1 # we know we are going to just pay attention to the .first doc anyway
37
+ find_all(%(id:"#{pid}"), opts).first || load_instance(pid)
35
38
  end
36
39
 
37
- def find_all query, opts={}
40
+ # TODO: return enumerable and lazy load_instance
41
+ # TODO: restrict fieldlist (fl) for non-:lightweight queries
42
+ def find_all(query, opts = {})
38
43
  ensure_models_loaded!
39
44
  resp = SearchService.query query, opts
40
45
  resp.docs.collect do |solr_doc|
@@ -78,20 +83,20 @@ module Dor
78
83
  require 'druid-tools'
79
84
 
80
85
  # datastreams
81
- autoload :AdministrativeMetadataDS, 'dor/datastreams/administrative_metadata_ds'
82
- autoload :ContentMetadataDS, 'dor/datastreams/content_metadata_ds'
83
- autoload :DescMetadataDS, 'dor/datastreams/desc_metadata_ds'
84
- autoload :EmbargoMetadataDS, 'dor/datastreams/embargo_metadata_ds'
85
- autoload :EventsDS, 'dor/datastreams/events_ds'
86
- autoload :GeoMetadataDS, 'dor/datastreams/geo_metadata_ds'
87
- autoload :IdentityMetadataDS, 'dor/datastreams/identity_metadata_ds'
88
- autoload :RightsMetadataDS, 'dor/datastreams/rights_metadata_ds'
89
- autoload :RoleMetadataDS, 'dor/datastreams/role_metadata_ds'
90
- autoload :WorkflowDefinitionDs, 'dor/datastreams/workflow_definition_ds'
91
- autoload :WorkflowDs, 'dor/datastreams/workflow_ds'
92
- autoload :VersionMetadataDS, 'dor/datastreams/version_metadata_ds'
93
- autoload :DefaultObjectRightsDS, 'dor/datastreams/default_object_rights_ds'
94
- autoload :SimpleDublinCoreDs, 'dor/datastreams/simple_dublin_core_ds'
86
+ autoload :AdministrativeMetadataDS, 'dor/datastreams/administrative_metadata_ds'
87
+ autoload :ContentMetadataDS, 'dor/datastreams/content_metadata_ds'
88
+ autoload :DescMetadataDS, 'dor/datastreams/desc_metadata_ds'
89
+ autoload :EmbargoMetadataDS, 'dor/datastreams/embargo_metadata_ds'
90
+ autoload :EventsDS, 'dor/datastreams/events_ds'
91
+ autoload :GeoMetadataDS, 'dor/datastreams/geo_metadata_ds'
92
+ autoload :IdentityMetadataDS, 'dor/datastreams/identity_metadata_ds'
93
+ autoload :RightsMetadataDS, 'dor/datastreams/rights_metadata_ds'
94
+ autoload :RoleMetadataDS, 'dor/datastreams/role_metadata_ds'
95
+ autoload :WorkflowDefinitionDs, 'dor/datastreams/workflow_definition_ds'
96
+ autoload :WorkflowDs, 'dor/datastreams/workflow_ds'
97
+ autoload :VersionMetadataDS, 'dor/datastreams/version_metadata_ds'
98
+ autoload :DefaultObjectRightsDS, 'dor/datastreams/default_object_rights_ds'
99
+ autoload :SimpleDublinCoreDs, 'dor/datastreams/simple_dublin_core_ds'
95
100
 
96
101
  # DOR Concerns
97
102
  autoload :Identifiable, 'dor/models/identifiable'
@@ -111,15 +116,14 @@ module Dor
111
116
  autoload :Editable, 'dor/models/editable'
112
117
  autoload :Discoverable, 'dor/models/discoverable'
113
118
  autoload :Geoable, 'dor/models/geoable'
114
- autoload :Presentable, 'dor/models/presentable'
115
- autoload :Releaseable, 'dor/models/releaseable'
119
+ autoload :Releaseable, 'dor/models/releaseable'
116
120
  autoload :Rightsable, 'dor/models/rightsable'
117
121
 
118
122
  # ActiveFedora Classes
119
- autoload :Abstract, 'dor/models/item'
120
- autoload :Item, 'dor/models/item'
121
- autoload :Set, 'dor/models/set'
122
- autoload :Collection, 'dor/models/collection'
123
+ autoload :Abstract, 'dor/models/item'
124
+ autoload :Item, 'dor/models/item'
125
+ autoload :Set, 'dor/models/set'
126
+ autoload :Collection, 'dor/models/collection'
123
127
  autoload :AdminPolicyObject, 'dor/models/admin_policy_object'
124
128
  autoload :WorkflowObject, 'dor/models/workflow_object'
125
129
 
data/lib/dor/config.rb CHANGED
@@ -9,12 +9,12 @@ module Dor
9
9
  define_callbacks :initialize
10
10
  define_callbacks :configure
11
11
 
12
- def initialize *args
12
+ def initialize(*args)
13
13
  super *args
14
14
  run_callbacks(:initialize) { }
15
15
  end
16
16
 
17
- def configure *args
17
+ def configure(*args)
18
18
  result = self
19
19
  temp_v = $-v
20
20
  $-v = nil
@@ -26,29 +26,35 @@ module Dor
26
26
  $-v = temp_v
27
27
  end
28
28
  params = { :dor_services_url => result.dor_services.url }
29
+
30
+ if result.workflow.logfile && result.workflow.shift_age
31
+ params[:logger] = Logger.new(result.workflow.logfile, result.workflow.shift_age)
32
+ elsif result.workflow.logfile
33
+ params[:logger] = Logger.new(result.workflow.logfile)
34
+ end
29
35
  params[:timeout] = result.workflow.timeout if result.workflow.timeout
30
36
  Dor::WorkflowService.configure result.workflow.url, params
31
- return result
37
+ result
32
38
  end
33
39
 
34
- def autoconfigure(url, cert_file=Config.ssl.cert_file, key_file=Config.ssl.key_file, key_pass=Config.ssl.key_pass)
40
+ def autoconfigure(url, cert_file = Config.ssl.cert_file, key_file = Config.ssl.key_file, key_pass = Config.ssl.key_pass)
35
41
  client = make_rest_client(url, cert_file, key_file, key_pass)
36
42
  config = Confstruct::Configuration.symbolize_hash JSON.parse(client.get :accept => 'application/json')
37
- self.configure(config)
43
+ configure(config)
38
44
  end
39
45
 
40
46
  def sanitize
41
- self.dup
47
+ dup
42
48
  end
43
49
 
44
- def make_rest_client(url, cert=Config.ssl.cert_file, key=Config.ssl.key_file, pass=Config.ssl.key_pass)
50
+ def make_rest_client(url, cert = Config.ssl.cert_file, key = Config.ssl.key_file, pass = Config.ssl.key_pass)
45
51
  params = {}
46
52
  params[:ssl_client_cert] = OpenSSL::X509::Certificate.new(File.read(cert)) if cert
47
53
  params[:ssl_client_key] = OpenSSL::PKey::RSA.new(File.read(key), pass) if key
48
54
  RestClient::Resource.new(url, params)
49
55
  end
50
56
 
51
- def make_solr_connection(add_opts={})
57
+ def make_solr_connection(add_opts = {})
52
58
  opts = Config.solrizer.opts.merge(add_opts).merge(
53
59
  :url => Config.solrizer.url
54
60
  )
@@ -99,17 +105,17 @@ module Dor
99
105
  if ActiveFedora.respond_to?(:configurator)
100
106
  if config.solrizer.url.present?
101
107
  ActiveFedora::SolrService.register
102
- ActiveFedora::SolrService.instance.instance_variable_set :@conn, self.make_solr_connection
108
+ ActiveFedora::SolrService.instance.instance_variable_set :@conn, make_solr_connection
103
109
  end
104
110
  else
105
- ActiveFedora::RubydoraConnection.connect self.fedora_config if self.fedora.url.present?
106
- if self.solrizer.url.present?
111
+ ActiveFedora::RubydoraConnection.connect fedora_config if fedora.url.present?
112
+ if solrizer.url.present?
107
113
  ActiveFedora::SolrService.register config.solrizer.url, config.solrizer.opts
108
114
  conn = ActiveFedora::SolrService.instance.conn.connection
109
115
  if config.ssl.cert_file.present?
110
116
  conn.use_ssl = true
111
117
  conn.cert = OpenSSL::X509::Certificate.new(File.read(config.ssl.cert_file))
112
- conn.key = OpenSSL::PKey::RSA.new(File.read(config.ssl.key_file),config.ssl.key_pass) if config.ssl.key_file.present?
118
+ conn.key = OpenSSL::PKey::RSA.new(File.read(config.ssl.key_file), config.ssl.key_pass) if config.ssl.key_file.present?
113
119
  conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
114
120
  end
115
121
  end
@@ -120,22 +126,22 @@ module Dor
120
126
 
121
127
  # Act like an ActiveFedora.configurator
122
128
 
123
- def init *args; end
129
+ def init(*args); end
124
130
 
125
131
  def fedora_config
126
- fedora_uri = URI.parse(self.fedora.url)
127
- connection_opts = { :url => self.fedora.safeurl, :user => fedora_uri.user, :password => fedora_uri.password }
128
- connection_opts[:ssl_client_cert] = OpenSSL::X509::Certificate.new(File.read(self.ssl.cert_file)) if self.ssl.cert_file.present?
129
- connection_opts[:ssl_client_key] = OpenSSL::PKey::RSA.new(File.read(self.ssl.key_file),self.ssl.key_pass) if self.ssl.key_file.present?
132
+ fedora_uri = URI.parse(fedora.url)
133
+ connection_opts = { :url => fedora.safeurl, :user => fedora_uri.user, :password => fedora_uri.password }
134
+ connection_opts[:ssl_client_cert] = OpenSSL::X509::Certificate.new(File.read(ssl.cert_file)) if ssl.cert_file.present?
135
+ connection_opts[:ssl_client_key] = OpenSSL::PKey::RSA.new(File.read(ssl.key_file), ssl.key_pass) if ssl.key_file.present?
130
136
  connection_opts
131
137
  end
132
138
 
133
139
  def solr_config
134
- { :url => self.solrizer.url }
140
+ { :url => solrizer.url }
135
141
  end
136
142
 
137
143
  def predicate_config
138
- YAML.load(File.read(File.expand_path('../../../config/predicate_mappings.yml',__FILE__)))
144
+ YAML.load(File.read(File.expand_path('../../../config/predicate_mappings.yml', __FILE__)))
139
145
  end
140
146
  end
141
147
 
@@ -43,8 +43,8 @@ class AdministrativeMetadataDS < ActiveFedora::OmDatastream
43
43
  end
44
44
 
45
45
  define_template :default_collection do |xml|
46
- xml.administrativeMetadata{
47
- xml.registration{
46
+ xml.administrativeMetadata {
47
+ xml.registration {
48
48
  xml.collection(:id => '')
49
49
  }
50
50
  }
@@ -52,37 +52,37 @@ class AdministrativeMetadataDS < ActiveFedora::OmDatastream
52
52
 
53
53
  define_template :agreementId do |xml|
54
54
  xml.administrativeMetadata {
55
- xml.registration{
55
+ xml.registration {
56
56
  xml.agreementId
57
57
  }
58
58
  }
59
59
  end
60
60
 
61
61
  define_template :metadata_format do |xml|
62
- xml.descMetadata{
63
- xml.format
64
- }
62
+ xml.descMetadata {
63
+ xml.format
64
+ }
65
65
  end
66
66
 
67
67
  define_template :metadata_source do |xml|
68
- xml.administrativeMetadata{
69
- xml.descMetadata{
70
- xml.source
68
+ xml.administrativeMetadata {
69
+ xml.descMetadata {
70
+ xml.source
71
71
  }
72
72
  }
73
73
  end
74
74
 
75
75
  define_template :registration do |xml|
76
76
  xml.administrativeMetadata {
77
- xml.registration{
78
- xml.workflow(:id=> '')
77
+ xml.registration {
78
+ xml.workflow(:id => '')
79
79
  }
80
80
  }
81
81
  end
82
82
 
83
83
  define_template :default_collection do |xml|
84
84
  xml.administrativeMetadata {
85
- xml.registration{
85
+ xml.registration {
86
86
  xml.collection
87
87
  }
88
88
  }
@@ -90,7 +90,7 @@ class AdministrativeMetadataDS < ActiveFedora::OmDatastream
90
90
 
91
91
  def self.xml_template
92
92
  Nokogiri::XML::Builder.new do |xml|
93
- xml.administrativeMetadata{ }
93
+ xml.administrativeMetadata { }
94
94
  end.doc
95
95
  end
96
96
 
@@ -99,22 +99,21 @@ class AdministrativeMetadataDS < ActiveFedora::OmDatastream
99
99
  # Hides complexity/verbosity of OM TermOperators for simple, non-repeating values
100
100
  #################################################################################
101
101
 
102
- def default_workflow_lane= lane
103
- self.defaults.initiate_workflow.lane = lane
102
+ def default_workflow_lane=(lane)
103
+ defaults.initiate_workflow.lane = lane
104
104
  end
105
105
 
106
106
  def default_workflow_lane
107
- self.defaults.initiate_workflow.lane.first
107
+ defaults.initiate_workflow.lane.first
108
108
  end
109
109
 
110
- def default_shelving_path= path
111
- self.defaults.shelving.path = path
110
+ def default_shelving_path=(path)
111
+ defaults.shelving.path = path
112
112
  end
113
113
 
114
114
  def default_shelving_path
115
- self.defaults.shelving.path.first
115
+ defaults.shelving.path.first
116
116
  end
117
117
 
118
118
  end
119
-
120
119
  end