adiwg-mdtranslator 2.13.0 → 2.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +26 -14
  3. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +1 -0
  4. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +56 -41
  5. data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +3 -1
  6. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +1 -0
  7. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader_messages_eng.yml +377 -0
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +6 -8
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +6 -6
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +6 -7
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +7 -11
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +12 -13
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +10 -6
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +11 -21
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +18 -38
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +10 -8
  17. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +22 -28
  18. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +17 -18
  19. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contactPostprocess.rb +5 -3
  20. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +9 -15
  21. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +6 -8
  22. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +8 -13
  23. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +8 -12
  24. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +6 -6
  25. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +7 -11
  26. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +6 -5
  27. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +17 -8
  28. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +12 -12
  29. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +9 -13
  30. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +6 -6
  31. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +14 -12
  32. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +20 -19
  33. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +8 -15
  34. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +7 -10
  35. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +12 -10
  36. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +8 -13
  37. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +10 -7
  38. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +8 -6
  39. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +8 -3
  40. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +11 -8
  41. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -10
  42. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +10 -13
  43. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +11 -10
  44. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +8 -12
  45. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +8 -12
  46. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +7 -12
  47. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +4 -2
  48. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +13 -20
  49. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +12 -14
  50. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +8 -8
  51. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +6 -6
  52. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +12 -13
  53. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +10 -7
  54. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +9 -3
  55. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +8 -6
  56. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +6 -5
  57. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +6 -6
  58. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +10 -10
  59. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +7 -9
  60. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +12 -10
  61. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +59 -17
  62. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +9 -16
  63. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +10 -5
  64. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +6 -9
  65. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +16 -16
  66. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +8 -6
  67. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -12
  68. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +6 -6
  69. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +5 -3
  70. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +25 -28
  71. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +7 -7
  72. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +15 -12
  73. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +11 -10
  74. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +12 -11
  75. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +10 -8
  76. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +29 -40
  77. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +6 -6
  78. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +5 -5
  79. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +12 -11
  80. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +6 -9
  81. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +11 -8
  82. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +6 -7
  83. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +6 -6
  84. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +5 -3
  85. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -13
  86. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +10 -9
  87. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +14 -11
  88. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +14 -10
  89. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +8 -15
  90. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +5 -5
  91. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +7 -11
  92. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +12 -9
  93. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +12 -9
  94. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +9 -13
  95. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +22 -26
  96. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +13 -9
  97. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +7 -9
  98. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +6 -6
  99. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +12 -10
  100. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +10 -8
  101. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +12 -13
  102. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +10 -10
  103. data/lib/adiwg/mdtranslator/version.rb +8 -3
  104. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialOrganization.rb +78 -84
  105. data/lib/adiwg/mdtranslator/writers/html/sections/html_responsibility.rb +3 -3
  106. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +23 -14
  107. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer_messages_eng.yml +2 -1
  108. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +10 -2
  109. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_date.rb +1 -0
  110. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dictionary.rb +1 -1
  111. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geographicExtent.rb +1 -1
  112. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb +5 -5
  113. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_medium.rb +1 -1
  114. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_party.rb +1 -5
  115. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_repository.rb +4 -2
  116. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_verticalDatumParameters.rb +1 -0
  117. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +11 -11
  118. metadata +4 -3
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-18 refactored error and warning messaging
5
+ # Stan Smith 2018-06-15 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-13 refactored for mdJson 2.0
7
7
  # Stan Smith 2015-08-28 added alternate title
8
8
  # Stan Smith 2015-07-14 refactored to remove global namespace constants
@@ -29,12 +29,13 @@ module ADIWG
29
29
 
30
30
  module Citation
31
31
 
32
- def self.unpack(hCitation, responseObj)
32
+ def self.unpack(hCitation, responseObj, inContext = nil)
33
33
 
34
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
34
35
 
35
36
  # return nil object if input is empty
36
37
  if hCitation.empty?
37
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: citation object is empty'
38
+ @MessagePath.issueWarning(80, responseObj, inContext)
38
39
  return nil
39
40
  end
40
41
 
@@ -42,14 +43,15 @@ module ADIWG
42
43
  intMetadataClass = InternalMetadata.new
43
44
  intCitation = intMetadataClass.newCitation
44
45
 
46
+ outContext = 'citation'
47
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
48
+
45
49
  # citation - title (required)
46
50
  if hCitation.has_key?('title')
47
51
  intCitation[:title] = hCitation['title']
48
52
  end
49
53
  if intCitation[:title].nil? || intCitation[:title] == ''
50
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: citation title is missing'
51
- responseObj[:readerExecutionPass] = false
52
- return nil
54
+ @MessagePath.issueError(81, responseObj, inContext)
53
55
  end
54
56
 
55
57
  # citation - alternate title []
@@ -114,7 +116,7 @@ module ADIWG
114
116
  if hCitation.has_key?('series')
115
117
  hObject = hCitation['series']
116
118
  unless hObject.empty?
117
- hReturn = Series.unpack(hObject, responseObj)
119
+ hReturn = Series.unpack(hObject, responseObj, outContext)
118
120
  unless hReturn.nil?
119
121
  intCitation[:series] = hReturn
120
122
  end
@@ -145,7 +147,7 @@ module ADIWG
145
147
  if hCitation.has_key?('graphic')
146
148
  aItems = hCitation['graphic']
147
149
  aItems.each do |item|
148
- hReturn = Graphic.unpack(item, responseObj)
150
+ hReturn = Graphic.unpack(item, responseObj, outContext)
149
151
  unless hReturn.nil?
150
152
  intCitation[:browseGraphics] << hReturn
151
153
  end
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-18 refactored error and warning messaging
5
+ # Stan Smith 2018-06-16 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-15 original script
7
7
 
8
8
  require_relative 'module_scope'
@@ -20,11 +20,13 @@ module ADIWG
20
20
 
21
21
  module Constraint
22
22
 
23
- def self.unpack(hConstraint, responseObj)
23
+ def self.unpack(hConstraint, responseObj, inContext = nil)
24
+
25
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
24
26
 
25
27
  # return nil object if input is empty
26
28
  if hConstraint.empty?
27
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: constraint object is empty'
29
+ @MessagePath.issueWarning(90, responseObj, inContext)
28
30
  return nil
29
31
  end
30
32
 
@@ -40,18 +42,18 @@ module ADIWG
40
42
  if %w{ use legal security }.one? {|word| word == type}
41
43
  intConstraint[:type] = hConstraint['type']
42
44
  else
43
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: constraint type must be use, legal, or security'
44
- responseObj[:readerExecutionPass] = false
45
- return nil
45
+ @MessagePath.issueError(91, responseObj, inContext)
46
46
  end
47
47
  end
48
48
  end
49
49
  if intConstraint[:type].nil? || intConstraint[:type] == ''
50
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: constraint type is missing'
51
- responseObj[:readerExecutionPass] = false
52
- return nil
50
+ @MessagePath.issueError(92, responseObj, inContext)
53
51
  end
54
52
 
53
+ outContext = 'constraint'
54
+ outContext = intConstraint[:type] + ' constraint' unless intConstraint[:type].nil?
55
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
56
+
55
57
  # constraint - use limitation [] (required if type='use')
56
58
  if hConstraint.has_key?('useLimitation')
57
59
  hConstraint['useLimitation'].each do |item|
@@ -65,7 +67,7 @@ module ADIWG
65
67
  if hConstraint.has_key?('scope')
66
68
  hObject = hConstraint['scope']
67
69
  unless hObject.empty?
68
- hReturn = Scope.unpack(hObject, responseObj)
70
+ hReturn = Scope.unpack(hObject, responseObj, outContext)
69
71
  unless hReturn.nil?
70
72
  intConstraint[:scope] = hReturn
71
73
  end
@@ -76,7 +78,7 @@ module ADIWG
76
78
  if hConstraint.has_key?('graphic')
77
79
  aGraphic = hConstraint['graphic']
78
80
  aGraphic.each do |item|
79
- hGraphic = Graphic.unpack(item, responseObj)
81
+ hGraphic = Graphic.unpack(item, responseObj, outContext)
80
82
  unless hGraphic.nil?
81
83
  intConstraint[:graphic] << hGraphic
82
84
  end
@@ -87,7 +89,7 @@ module ADIWG
87
89
  if hConstraint.has_key?('reference')
88
90
  aReference = hConstraint['reference']
89
91
  aReference.each do |item|
90
- hReference = Citation.unpack(item, responseObj)
92
+ hReference = Citation.unpack(item, responseObj, outContext)
91
93
  unless hReference.nil?
92
94
  intConstraint[:reference] << hReference
93
95
  end
@@ -98,7 +100,7 @@ module ADIWG
98
100
  if hConstraint.has_key?('releasability')
99
101
  hObject = hConstraint['releasability']
100
102
  unless hObject.empty?
101
- hReturn = Releasability.unpack(hObject, responseObj)
103
+ hReturn = Releasability.unpack(hObject, responseObj, outContext)
102
104
  unless hReturn.nil?
103
105
  intConstraint[:releasability] = hReturn
104
106
  end
@@ -109,7 +111,7 @@ module ADIWG
109
111
  if hConstraint.has_key?('responsibleParty')
110
112
  aRParty = hConstraint['responsibleParty']
111
113
  aRParty.each do |item|
112
- hParty = ResponsibleParty.unpack(item, responseObj)
114
+ hParty = ResponsibleParty.unpack(item, responseObj, outContext)
113
115
  unless hParty.nil?
114
116
  intConstraint[:responsibleParty] << hParty
115
117
  end
@@ -120,7 +122,7 @@ module ADIWG
120
122
  if hConstraint.has_key?('legal')
121
123
  hObject = hConstraint['legal']
122
124
  unless hObject.empty?
123
- hReturn = LegalConstraint.unpack(hObject, responseObj)
125
+ hReturn = LegalConstraint.unpack(hObject, responseObj, inContext)
124
126
  unless hReturn.nil?
125
127
  intConstraint[:legalConstraint] = hReturn
126
128
  end
@@ -129,14 +131,10 @@ module ADIWG
129
131
  end
130
132
  end
131
133
  if hObject.empty?
132
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: legal constraint object is missing'
133
- responseObj[:readerExecutionPass] = false
134
- return nil
134
+ @MessagePath.issueError(93, responseObj, inContext)
135
135
  end
136
136
  else
137
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: legal constraint object is missing'
138
- responseObj[:readerExecutionPass] = false
139
- return nil
137
+ @MessagePath.issueError(93, responseObj, inContext)
140
138
  end
141
139
  end
142
140
 
@@ -144,7 +142,7 @@ module ADIWG
144
142
  if hConstraint.has_key?('security')
145
143
  hObject = hConstraint['security']
146
144
  unless hObject.empty?
147
- hReturn = SecurityConstraint.unpack(hObject, responseObj)
145
+ hReturn = SecurityConstraint.unpack(hObject, responseObj, inContext)
148
146
  unless hReturn.nil?
149
147
  intConstraint[:securityConstraint] = hReturn
150
148
  end
@@ -153,14 +151,10 @@ module ADIWG
153
151
  end
154
152
  end
155
153
  if hObject.empty?
156
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: security constraint object is missing'
157
- responseObj[:readerExecutionPass] = false
158
- return nil
154
+ @MessagePath.issueError(94, responseObj, inContext)
159
155
  end
160
156
  else
161
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: security constraint object is missing'
162
- responseObj[:readerExecutionPass] = false
163
- return nil
157
+ @MessagePath.issueError(94, responseObj, inContext)
164
158
  end
165
159
  end
166
160
 
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-18 refactored error and warning messaging
5
+ # Stan Smith 2018-06-17 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-23 original script
7
7
 
8
8
  require_relative 'module_onlineResource'
@@ -19,11 +19,11 @@ module ADIWG
19
19
 
20
20
  def self.unpack(hContact, responseObj)
21
21
 
22
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
22
23
 
23
24
  # return nil object if input is empty
24
25
  if hContact.empty?
25
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: contact object is empty'
26
- responseObj[:readerExecutionPass] = false
26
+ @MessagePath.issueWarning(100, responseObj)
27
27
  return nil
28
28
  end
29
29
 
@@ -31,14 +31,15 @@ module ADIWG
31
31
  intMetadataClass = InternalMetadata.new
32
32
  intContact = intMetadataClass.newContact
33
33
 
34
+ outContext = nil
35
+
34
36
  # contact - contact id (required)
35
37
  if hContact.has_key?('contactId')
36
38
  intContact[:contactId] = hContact['contactId']
39
+ outContext = 'contact ID ' + hContact['contactId']
37
40
  end
38
41
  if intContact[:contactId].nil? || intContact[:contactId] == ''
39
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: contact id is missing'
40
- responseObj[:readerExecutionPass] = false
41
- return nil
42
+ @MessagePath.issueError(101, responseObj)
42
43
  end
43
44
 
44
45
  # contact - is organization (required)
@@ -65,14 +66,11 @@ module ADIWG
65
66
  end
66
67
  if intContact[:name].nil? || intContact[:name] == ''
67
68
  if intContact[:isOrganization] === true
68
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: organization contact name is missing'
69
- responseObj[:readerExecutionPass] = false
70
- return nil
71
- end
72
- if intContact[:positionName].nil? || intContact[:positionName] == ''
73
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: individual contact name and/or position are missing'
74
- responseObj[:readerExecutionPass] = false
75
- return nil
69
+ @MessagePath.issueError(102, responseObj, outContext)
70
+ else
71
+ if intContact[:positionName].nil? || intContact[:positionName] == ''
72
+ @MessagePath.issueError(103, responseObj, outContext)
73
+ end
76
74
  end
77
75
  end
78
76
 
@@ -89,7 +87,7 @@ module ADIWG
89
87
  if hContact.has_key?('logoGraphic')
90
88
  aItems = hContact['logoGraphic']
91
89
  aItems.each do |item|
92
- hReturn = Graphic.unpack(item, responseObj)
90
+ hReturn = Graphic.unpack(item, responseObj, outContext)
93
91
  unless hReturn.nil?
94
92
  intContact[:logos] << hReturn
95
93
  end
@@ -100,18 +98,19 @@ module ADIWG
100
98
  if hContact.has_key?('phone')
101
99
  aItems = hContact['phone']
102
100
  aItems.each do |item|
103
- hReturn = Phone.unpack(item, responseObj)
101
+ hReturn = Phone.unpack(item, responseObj, outContext)
104
102
  unless hReturn.nil?
105
103
  intContact[:phones] << hReturn
106
104
  end
107
105
  end
108
106
  end
109
107
 
108
+ # TODO need outContext
110
109
  # contact - address [address]
111
110
  if hContact.has_key?('address')
112
111
  aItems = hContact['address']
113
112
  aItems.each do |item|
114
- hReturn = Address.unpack(item, responseObj)
113
+ hReturn = Address.unpack(item, responseObj, outContext)
115
114
  unless hReturn.nil?
116
115
  intContact[:addresses] << hReturn
117
116
  end
@@ -131,7 +130,7 @@ module ADIWG
131
130
  if hContact.has_key?('onlineResource')
132
131
  aItems = hContact['onlineResource']
133
132
  aItems.each do |item|
134
- hReturn = OnlineResource.unpack(item, responseObj)
133
+ hReturn = OnlineResource.unpack(item, responseObj, outContext)
135
134
  unless hReturn.nil?
136
135
  intContact[:onlineResources] << hReturn
137
136
  end
@@ -2,6 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-06-17 refactored error and warning messaging
5
6
  # Stan Smith 2018-02-20 original script
6
7
 
7
8
  require_relative 'module_mdJson'
@@ -15,15 +16,16 @@ module ADIWG
15
16
 
16
17
  def self.examine(aContact, responseObj)
17
18
 
19
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
20
+
18
21
  # test that all organizationMember IDs are in the contacts array
19
22
  aContact.each do |hContact|
20
23
  contactId = hContact[:contactId]
21
24
  hContact[:memberOfOrgs].each do |orgId|
22
25
  hOrg = MdJson.findContact(orgId)
23
26
  if hOrg[0].nil?
24
- responseObj[:readerExecutionMessages] <<
25
- "ERROR: mdJson reader: contact #{contactId} organization contact ID #{orgId} not found"
26
- responseObj[:readerExecutionPass] = false
27
+ outContext = "contact #{contactId}, membership organization ID #{orgId}"
28
+ @MessagePath.issueWarning(110, responseObj, outContext)
27
29
  end
28
30
  end
29
31
  end
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-18 refactored error and warning messaging
5
+ # Stan Smith 2018-06-17 refactored error and warning messaging
6
6
  # Stan Smith 2017-10-19 original script
7
7
 
8
8
  module ADIWG
@@ -12,12 +12,14 @@ module ADIWG
12
12
 
13
13
  module CoordinateResolution
14
14
 
15
- def self.unpack(hCoordRes, responseObj)
15
+ def self.unpack(hCoordRes, responseObj, inContext = nil)
16
+
17
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
18
+
16
19
 
17
20
  # return nil object if input is empty
18
21
  if hCoordRes.empty?
19
- responseObj[:readerExecutionMessages] <<
20
- 'WARNING: mdJson reader: spatial resolution coordinate resolution object is empty'
22
+ @MessagePath.issueWarning(120, responseObj, inContext)
21
23
  return nil
22
24
  end
23
25
 
@@ -30,10 +32,7 @@ module ADIWG
30
32
  intCoordRes[:abscissaResolutionX] = hCoordRes['abscissaResolutionX']
31
33
  end
32
34
  if intCoordRes[:abscissaResolutionX].nil? || intCoordRes[:abscissaResolutionX] == ''
33
- responseObj[:readerExecutionMessages] <<
34
- 'ERROR: mdJson reader: coordinate spatial resolution abscissa resolution is missing'
35
- responseObj[:readerExecutionPass] = false
36
- return nil
35
+ @MessagePath.issueError(121, responseObj, inContext)
37
36
  end
38
37
 
39
38
  # coordinate resolution - ordinate (Y) (required)
@@ -41,10 +40,7 @@ module ADIWG
41
40
  intCoordRes[:ordinateResolutionY] = hCoordRes['ordinateResolutionY']
42
41
  end
43
42
  if intCoordRes[:ordinateResolutionY].nil? || intCoordRes[:ordinateResolutionY] == ''
44
- responseObj[:readerExecutionMessages] <<
45
- 'ERROR: mdJson reader: coordinate spatial resolution ordinate resolution is missing'
46
- responseObj[:readerExecutionPass] = false
47
- return nil
43
+ @MessagePath.issueError(122, responseObj, inContext)
48
44
  end
49
45
 
50
46
  # coordinate resolution - units of measure (required)
@@ -52,9 +48,7 @@ module ADIWG
52
48
  intCoordRes[:unitOfMeasure] = hCoordRes['unitOfMeasure']
53
49
  end
54
50
  if intCoordRes[:unitOfMeasure].nil? || intCoordRes[:unitOfMeasure] == ''
55
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: coordinate spatial resolution units are missing'
56
- responseObj[:readerExecutionPass] = false
57
- return nil
51
+ @MessagePath.issueError(123, responseObj, inContext)
58
52
  end
59
53
 
60
54
  return intCoordRes
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-18 refactored error and warning messaging
5
+ # Stan Smith 2018-06-18 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-18 original script
7
7
 
8
8
  require_relative 'module_identifier'
@@ -18,9 +18,11 @@ module ADIWG
18
18
 
19
19
  def self.unpack(hContent, responseObj)
20
20
 
21
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
22
+
21
23
  # return nil object if input is empty
22
24
  if hContent.empty?
23
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: coverage description object is empty'
25
+ @MessagePath.issueWarning(130, responseObj)
24
26
  return nil
25
27
  end
26
28
 
@@ -35,9 +37,7 @@ module ADIWG
35
37
  end
36
38
  end
37
39
  if intContent[:coverageName].nil?
38
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: coverage description name is missing'
39
- responseObj[:readerExecutionPass] = false
40
- return nil
40
+ @MessagePath.issueError(131, responseObj)
41
41
  end
42
42
 
43
43
  # content information - coverage description (required)
@@ -47,9 +47,7 @@ module ADIWG
47
47
  end
48
48
  end
49
49
  if intContent[:coverageDescription].nil?
50
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: coverage description description is missing'
51
- responseObj[:readerExecutionPass] = false
52
- return nil
50
+ @MessagePath.issueError(132, responseObj)
53
51
  end
54
52
 
55
53
  # content information - processing level code
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-18 refactored error and warning messaging
5
+ # Stan Smith 2018-06-18 refactored error and warning messaging
6
6
  # Stan Smith 2018-01-25 rename dictionaryFormat to dictionaryFunctionalLanguage
7
7
  # Stan Smith 2017-11-09 add dictionary description
8
8
  # Stan Smith 2017-01-20 refactored for mdJson/mdTranslator 2.0
@@ -26,9 +26,11 @@ module ADIWG
26
26
 
27
27
  def self.unpack(hDictionary, responseObj)
28
28
 
29
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
30
+
29
31
  # return nil object if input is empty
30
32
  if hDictionary.empty?
31
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data dictionary object is empty'
33
+ @MessagePath.issueWarning(140, responseObj)
32
34
  return nil
33
35
  end
34
36
 
@@ -55,9 +57,7 @@ module ADIWG
55
57
  end
56
58
  end
57
59
  if intDictionary[:citation].empty?
58
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary citation is missing'
59
- responseObj[:readerExecutionPass] = false
60
- return nil
60
+ @MessagePath.issueError(141, responseObj)
61
61
  end
62
62
 
63
63
  # dictionary - subject [] (required)
@@ -70,9 +70,7 @@ module ADIWG
70
70
  end
71
71
  end
72
72
  if intDictionary[:subjects].empty?
73
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary subject is missing'
74
- responseObj[:readerExecutionPass] = false
75
- return nil
73
+ @MessagePath.issueError(142, responseObj)
76
74
  end
77
75
 
78
76
  # dictionary - recommended use []
@@ -107,9 +105,7 @@ module ADIWG
107
105
  end
108
106
  end
109
107
  if intDictionary[:responsibleParty].empty?
110
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary responsible party is missing'
111
- responseObj[:readerExecutionPass] = false
112
- return nil
108
+ @MessagePath.issueError(143, responseObj)
113
109
  end
114
110
 
115
111
  # dictionary - dictionary format
@@ -119,8 +115,7 @@ module ADIWG
119
115
  s = hDictionary['dictionaryFunctionalLanguage']
120
116
  elsif hDictionary.has_key?('dictionaryFormat')
121
117
  s = hDictionary['dictionaryFormat']
122
- responseObj[:readerExecutionMessages] <<
123
- 'WARNING: mdJson reader: data dictionary dictionaryFormat is deprecated, use dictionaryFunctionalLanguage'
118
+ @MessagePath.issueWarning(144, responseObj)
124
119
  end
125
120
  unless s.nil? || s == ''
126
121
  intDictionary[:dictionaryFunctionalLanguage] = s