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-19 refactored error and warning messaging
5
+ # Stan Smith 2018-06-27 refactored error and warning messaging
6
6
  # Stan Smith 2017-11-07 add geologic age
7
7
  # Stan Smith 2016-10-14 original script
8
8
 
@@ -19,11 +19,13 @@ module ADIWG
19
19
 
20
20
  module TimePeriod
21
21
 
22
- def self.unpack(hTimePeriod, responseObj)
22
+ def self.unpack(hTimePeriod, responseObj, inContext = nil)
23
+
24
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
23
25
 
24
26
  # return nil object if input is empty
25
27
  if hTimePeriod.empty?
26
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: time period object is empty'
28
+ @MessagePath.issueWarning(870, responseObj, inContext)
27
29
  return nil
28
30
  end
29
31
 
@@ -31,6 +33,9 @@ module ADIWG
31
33
  intMetadataClass = InternalMetadata.new
32
34
  intTimePer = intMetadataClass.newTimePeriod
33
35
 
36
+ outContext = 'time period'
37
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
38
+
34
39
  haveTime = false
35
40
 
36
41
  # time period - id
@@ -50,7 +55,7 @@ module ADIWG
50
55
  # time period - identifier {Identifier}
51
56
  if hTimePeriod.has_key?('identifier')
52
57
  unless hTimePeriod['identifier'].empty?
53
- hReturn = Identifier.unpack(hTimePeriod['identifier'], responseObj)
58
+ hReturn = Identifier.unpack(hTimePeriod['identifier'], responseObj, outContext)
54
59
  unless hReturn.nil?
55
60
  intTimePer[:identifier] = hReturn
56
61
  end
@@ -69,7 +74,7 @@ module ADIWG
69
74
  # time period - start datetime (required if)
70
75
  if hTimePeriod.has_key?('startDateTime')
71
76
  unless hTimePeriod['startDateTime'] == ''
72
- hReturn = DateTime.unpack(hTimePeriod['startDateTime'], responseObj)
77
+ hReturn = DateTime.unpack(hTimePeriod['startDateTime'], responseObj, outContext)
73
78
  unless hReturn.nil?
74
79
  intTimePer[:startDateTime] = hReturn
75
80
  haveTime = true
@@ -80,7 +85,7 @@ module ADIWG
80
85
  # time period - end datetime (required if)
81
86
  if hTimePeriod.has_key?('endDateTime')
82
87
  unless hTimePeriod['endDateTime'] == ''
83
- hReturn = DateTime.unpack(hTimePeriod['endDateTime'], responseObj)
88
+ hReturn = DateTime.unpack(hTimePeriod['endDateTime'], responseObj, outContext)
84
89
  unless hReturn.nil?
85
90
  intTimePer[:endDateTime] = hReturn
86
91
  haveTime = true
@@ -91,7 +96,7 @@ module ADIWG
91
96
  # time period - start geologic age (required if)
92
97
  if hTimePeriod.has_key?('startGeologicAge')
93
98
  unless hTimePeriod['startGeologicAge'].empty?
94
- hReturn = GeologicAge.unpack(hTimePeriod['startGeologicAge'], responseObj)
99
+ hReturn = GeologicAge.unpack(hTimePeriod['startGeologicAge'], responseObj, outContext)
95
100
  unless hReturn.nil?
96
101
  intTimePer[:startGeologicAge] = hReturn
97
102
  haveTime = true
@@ -102,7 +107,7 @@ module ADIWG
102
107
  # time period - end geologic age (required if)
103
108
  if hTimePeriod.has_key?('endGeologicAge')
104
109
  unless hTimePeriod['endGeologicAge'].empty?
105
- hReturn = GeologicAge.unpack(hTimePeriod['endGeologicAge'], responseObj)
110
+ hReturn = GeologicAge.unpack(hTimePeriod['endGeologicAge'], responseObj, outContext)
106
111
  unless hReturn.nil?
107
112
  intTimePer[:endGeologicAge] = hReturn
108
113
  haveTime = true
@@ -112,26 +117,20 @@ module ADIWG
112
117
 
113
118
  # error messages
114
119
  unless haveTime
115
- responseObj[:readerExecutionMessages] <<
116
- 'ERROR: mdJson reader: time period must have a start and/or end dateTime, or geologic age'
117
- responseObj[:readerExecutionPass] = false
118
- return nil
120
+ @MessagePath.issueError(871, responseObj, inContext)
119
121
  end
120
122
 
121
123
  # time period - time interval
122
124
  # time interval must have a start and/or end time
123
125
  if hTimePeriod.has_key?('timeInterval')
124
126
  unless hTimePeriod['timeInterval'].empty?
125
- hReturn = TimeInterval.unpack(hTimePeriod['timeInterval'], responseObj)
127
+ hReturn = TimeInterval.unpack(hTimePeriod['timeInterval'], responseObj, outContext)
126
128
  unless hReturn.nil?
127
129
  intTimePer[:timeInterval] = hReturn
128
130
  end
129
- end
130
- if intTimePer[:startDateTime].empty? && intTimePer[:endDateTime].empty?
131
- responseObj[:readerExecutionMessages] <<
132
- 'ERROR: mdJson reader: time interval must be accompanied by a start and/or end dateTime'
133
- responseObj[:readerExecutionPass] = false
134
- return nil
131
+ if intTimePer[:startDateTime].empty? && intTimePer[:endDateTime].empty?
132
+ @MessagePath.issueError(872, responseObj, inContext)
133
+ end
135
134
  end
136
135
  end
137
136
 
@@ -139,16 +138,13 @@ module ADIWG
139
138
  # duration must have a start and/or end time
140
139
  if hTimePeriod.has_key?('duration')
141
140
  unless hTimePeriod['duration'].empty?
142
- hReturn = Duration.unpack(hTimePeriod['duration'], responseObj)
141
+ hReturn = Duration.unpack(hTimePeriod['duration'], responseObj, outContext)
143
142
  unless hReturn.nil?
144
143
  intTimePer[:duration] = hReturn
145
144
  end
146
- end
147
- if intTimePer[:startDateTime].empty? && intTimePer[:endDateTime].empty?
148
- responseObj[:readerExecutionMessages] <<
149
- 'ERROR: mdJson reader: duration must be accompanied by a start and/or end dateTime'
150
- responseObj[:readerExecutionPass] = false
151
- return nil
145
+ if intTimePer[:startDateTime].empty? && intTimePer[:endDateTime].empty?
146
+ @MessagePath.issueError(873, responseObj, inContext)
147
+ end
152
148
  end
153
149
  end
154
150
 
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-19 refactored error and warning messaging
5
+ # Stan Smith 2018-06-27 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-21 original script
7
7
 
8
8
  require_relative 'module_medium'
@@ -17,11 +17,13 @@ module ADIWG
17
17
 
18
18
  module TransferOption
19
19
 
20
- def self.unpack(hTransOp, responseObj)
20
+ def self.unpack(hTransOp, responseObj, inContext = nil)
21
+
22
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
21
23
 
22
24
  # return nil object if input is empty
23
25
  if hTransOp.empty?
24
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: distributor transfer option object is empty'
26
+ @MessagePath.issueWarning(880, responseObj, inContext)
25
27
  return nil
26
28
  end
27
29
 
@@ -29,6 +31,9 @@ module ADIWG
29
31
  intMetadataClass = InternalMetadata.new
30
32
  intTransOpt = intMetadataClass.newTransferOption
31
33
 
34
+ outContext = 'transfer option'
35
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
36
+
32
37
  # transfer option - units of distribution
33
38
  if hTransOp.has_key?('unitsOfDistribution')
34
39
  unless hTransOp['unitsOfDistribution'] == ''
@@ -47,7 +52,7 @@ module ADIWG
47
52
  # transfer option - online option [onlineResource]
48
53
  if hTransOp.has_key?('onlineOption')
49
54
  hTransOp['onlineOption'].each do |item|
50
- hReturn = OnlineResource.unpack(item, responseObj)
55
+ hReturn = OnlineResource.unpack(item, responseObj, outContext)
51
56
  unless hReturn.nil?
52
57
  intTransOpt[:onlineOptions] << hReturn
53
58
  haveOption = true
@@ -58,7 +63,7 @@ module ADIWG
58
63
  # transfer option - offline option [medium]
59
64
  if hTransOp.has_key?('offlineOption')
60
65
  hTransOp['offlineOption'].each do |item|
61
- hReturn = Medium.unpack(item, responseObj)
66
+ hReturn = Medium.unpack(item, responseObj, outContext)
62
67
  unless hReturn.nil?
63
68
  intTransOpt[:offlineOptions] << hReturn
64
69
  haveOption = true
@@ -70,7 +75,7 @@ module ADIWG
70
75
  if hTransOp.has_key?('transferFrequency')
71
76
  hObject = hTransOp['transferFrequency']
72
77
  unless hObject.empty?
73
- hReturn = Duration.unpack(hObject, responseObj)
78
+ hReturn = Duration.unpack(hObject, responseObj, outContext)
74
79
  unless hReturn.nil?
75
80
  intTransOpt[:transferFrequency] = hReturn
76
81
  end
@@ -80,7 +85,7 @@ module ADIWG
80
85
  # transfer option - distribution format [format]
81
86
  if hTransOp.has_key?('distributionFormat')
82
87
  hTransOp['distributionFormat'].each do |item|
83
- hReturn = Format.unpack(item, responseObj)
88
+ hReturn = Format.unpack(item, responseObj, outContext)
84
89
  unless hReturn.nil?
85
90
  intTransOpt[:distributionFormats] << hReturn
86
91
  end
@@ -89,8 +94,7 @@ module ADIWG
89
94
 
90
95
  # error messages
91
96
  unless haveOption
92
- responseObj[:readerExecutionMessages] <<
93
- 'WARNING: mdJson reader: transfer option did not provide an online or offline option'
97
+ @MessagePath.issueWarning(881, responseObj, inContext)
94
98
  end
95
99
 
96
100
  return intTransOpt
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-19 refactored error and warning messaging
5
+ # Stan Smith 2018-06-27 refactored error and warning messaging
6
6
  # Stan Smith 2017-11-01 original script
7
7
 
8
8
  module ADIWG
@@ -12,11 +12,13 @@ module ADIWG
12
12
 
13
13
  module ValueRange
14
14
 
15
- def self.unpack(hRange, responseObj)
15
+ def self.unpack(hRange, responseObj, inContext = nil)
16
+
17
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
16
18
 
17
19
  # return nil object if input is empty
18
20
  if hRange.empty?
19
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: value range object is empty'
21
+ @MessagePath.issueWarning(890, responseObj, inContext)
20
22
  return nil
21
23
  end
22
24
 
@@ -29,9 +31,7 @@ module ADIWG
29
31
  intRange[:minRangeValue] = hRange['minRangeValue']
30
32
  end
31
33
  if intRange[:minRangeValue].nil? || intRange[:minRangeValue] == ''
32
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: value range minimum is missing'
33
- responseObj[:readerExecutionPass] = false
34
- return nil
34
+ @MessagePath.issueError(891, responseObj, inContext)
35
35
  end
36
36
 
37
37
  # value range - maximum range value (required)
@@ -39,9 +39,7 @@ module ADIWG
39
39
  intRange[:maxRangeValue] = hRange['maxRangeValue']
40
40
  end
41
41
  if intRange[:maxRangeValue].nil? || intRange[:maxRangeValue] == ''
42
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: value range maximum is missing'
43
- responseObj[:readerExecutionPass] = false
44
- return nil
42
+ @MessagePath.issueError(892, responseObj, inContext)
45
43
  end
46
44
 
47
45
  return intRange
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-19 refactored error and warning messaging
5
+ # Stan Smith 2018-06-27 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-19 original script
7
7
 
8
8
  module ADIWG
@@ -12,11 +12,13 @@ module ADIWG
12
12
 
13
13
  module VectorObject
14
14
 
15
- def self.unpack(hVecObj, responseObj)
15
+ def self.unpack(hVecObj, responseObj, inContext = nil)
16
+
17
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
16
18
 
17
19
  # return nil object if input is empty
18
20
  if hVecObj.empty?
19
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: vector object is empty'
21
+ @MessagePath.issueWarning(900, responseObj, inContext)
20
22
  return nil
21
23
  end
22
24
 
@@ -31,9 +33,7 @@ module ADIWG
31
33
  end
32
34
  end
33
35
  if intVecObj[:objectType].nil?
34
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: vector object type is missing'
35
- responseObj[:readerExecutionPass] = false
36
- return nil
36
+ @MessagePath.issueError(901, responseObj, inContext)
37
37
  end
38
38
 
39
39
  # vector object - object count
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-19 refactored error and warning messaging
5
+ # Stan Smith 2018-06-27 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-19 original script
7
7
 
8
8
  require_relative 'module_vectorObject'
@@ -14,20 +14,25 @@ module ADIWG
14
14
 
15
15
  module VectorRepresentation
16
16
 
17
- def self.unpack(hVector, responseObj)
17
+ def self.unpack(hVector, responseObj, inContext = nil)
18
+
19
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
18
20
 
19
21
  # return nil object if input is empty
20
22
  if hVector.empty?
21
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: vector representation object is empty'
23
+ @MessagePath.issueWarning(910, responseObj, inContext)
22
24
  return nil
23
25
  end
24
26
 
25
- haveVector = false
26
-
27
27
  # instance classes needed in script
28
28
  intMetadataClass = InternalMetadata.new
29
29
  intVector = intMetadataClass.newVectorInfo
30
30
 
31
+ outContext = 'vector representation'
32
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
33
+
34
+ haveVector = false
35
+
31
36
  # vector representation - topology level
32
37
  if hVector.has_key?('topologyLevel')
33
38
  unless hVector['topologyLevel'] == ''
@@ -39,7 +44,7 @@ module ADIWG
39
44
  # vector representation - vector object []
40
45
  if hVector.has_key?('vectorObject')
41
46
  hVector['vectorObject'].each do |item|
42
- hVec = VectorObject.unpack(item, responseObj)
47
+ hVec = VectorObject.unpack(item, responseObj, outContext)
43
48
  unless hVec.nil?
44
49
  intVector[:vectorObject] << hVec
45
50
  haveVector = true
@@ -49,10 +54,7 @@ module ADIWG
49
54
 
50
55
  # error messages
51
56
  unless haveVector
52
- responseObj[:readerExecutionMessages] <<
53
- 'ERROR: mdJson reader: vector representation must have a topology level or vector object'
54
- responseObj[:readerExecutionPass] = false
55
- return nil
57
+ @MessagePath.issueError(911, responseObj, inContext)
56
58
  end
57
59
 
58
60
  return intVector
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-19 refactored error and warning messaging
5
+ # Stan Smith 2018-06-27 refactored error and warning messaging
6
6
  # Stan Smith 2017-10-23 original script
7
7
 
8
8
  require_relative 'module_identifier'
@@ -14,11 +14,13 @@ module ADIWG
14
14
 
15
15
  module VerticalDatum
16
16
 
17
- def self.unpack(hDatum, responseObj)
17
+ def self.unpack(hDatum, responseObj, inContext = nil)
18
+
19
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
18
20
 
19
21
  # return nil object if input is empty
20
22
  if hDatum.empty?
21
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: vertical datum object is empty'
23
+ @MessagePath.issueWarning(920, responseObj, inContext)
22
24
  return nil
23
25
  end
24
26
 
@@ -26,10 +28,13 @@ module ADIWG
26
28
  intMetadataClass = InternalMetadata.new
27
29
  intDatum = intMetadataClass.newVerticalDatum
28
30
 
31
+ outContext = 'vertical datum'
32
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
33
+
29
34
  # vertical datum - identifier {identifier}
30
35
  if hDatum.has_key?('datumIdentifier')
31
36
  unless hDatum['datumIdentifier'].empty?
32
- hReturn = Identifier.unpack(hDatum['datumIdentifier'], responseObj)
37
+ hReturn = Identifier.unpack(hDatum['datumIdentifier'], responseObj, outContext)
33
38
  unless hReturn.nil?
34
39
  intDatum[:datumIdentifier] = hReturn
35
40
  end
@@ -79,10 +84,7 @@ module ADIWG
79
84
 
80
85
  # error messages
81
86
  if intDatum[:datumIdentifier].empty? && haveOthers != 4
82
- responseObj[:readerExecutionMessages] <<
83
- 'ERROR: mdJson reader: vertical datum must have an identifier or all other elements'
84
- responseObj[:readerExecutionPass] = false
85
- return nil
87
+ @MessagePath.issueError(921, responseObj, inContext)
86
88
  end
87
89
 
88
90
  return intDatum
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-19 refactored error and warning messaging
5
+ # Stan Smith 2018-06-27 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-24 original script
7
7
 
8
8
  require_relative 'module_spatialReference'
@@ -14,11 +14,13 @@ module ADIWG
14
14
 
15
15
  module VerticalExtent
16
16
 
17
- def self.unpack(hVertical, responseObj)
17
+ def self.unpack(hVertical, responseObj, inContext = nil)
18
+
19
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
18
20
 
19
21
  # return nil object if input is empty
20
22
  if hVertical.empty?
21
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: vertical extent object is empty'
23
+ @MessagePath.issueWarning(930, responseObj, inContext)
22
24
  return nil
23
25
  end
24
26
 
@@ -26,6 +28,9 @@ module ADIWG
26
28
  intMetadataClass = InternalMetadata.new
27
29
  intVertical = intMetadataClass.newVerticalExtent
28
30
 
31
+ outContext = 'vertical extent'
32
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
33
+
29
34
  # vertical extent - description
30
35
  if hVertical.has_key?('description')
31
36
  unless hVertical['description'] == ''
@@ -38,9 +43,7 @@ module ADIWG
38
43
  intVertical[:minValue] = hVertical['minValue']
39
44
  end
40
45
  if intVertical[:minValue].nil? || intVertical[:minValue] == ''
41
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: vertical extent minimum value is missing'
42
- responseObj[:readerExecutionPass] = false
43
- return nil
46
+ @MessagePath.issueError(931, responseObj, inContext)
44
47
  end
45
48
 
46
49
  # vertical extent - max value (required)
@@ -48,25 +51,21 @@ module ADIWG
48
51
  intVertical[:maxValue] = hVertical['maxValue']
49
52
  end
50
53
  if intVertical[:maxValue].nil? || intVertical[:maxValue] == ''
51
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: vertical extent maximum value is missing'
52
- responseObj[:readerExecutionPass] = false
53
- return nil
54
+ @MessagePath.issueError(932, responseObj, inContext)
54
55
  end
55
56
 
56
57
  # vertical extent - crs ID {spatialReference} (required)
57
58
  if hVertical.has_key?('crsId')
58
59
  hObject = hVertical['crsId']
59
60
  unless hObject.empty?
60
- hReturn = SpatialReferenceSystem.unpack(hObject, responseObj)
61
+ hReturn = SpatialReferenceSystem.unpack(hObject, responseObj, outContext)
61
62
  unless hReturn.nil?
62
63
  intVertical[:crsId] = hReturn
63
64
  end
64
65
  end
65
66
  end
66
67
  if intVertical[:crsId].empty?
67
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: vertical extent CRS identifier is missing'
68
- responseObj[:readerExecutionPass] = false
69
- return nil
68
+ @MessagePath.issueError(933, responseObj, inContext)
70
69
  end
71
70
 
72
71
  return intVertical