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-22 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-02 phone service is now an array rather than creating individual phone records per service
7
7
  # Stan Smith 2016-10-02 refactored for mdJson 2.0.0
8
8
  # Stan Smith 2015-07-14 refactored to remove global namespace constants
@@ -19,14 +19,16 @@ module ADIWG
19
19
 
20
20
  module Phone
21
21
 
22
- def self.unpack(hPhone, responseObj)
22
+ def self.unpack(hPhone, responseObj, inContext = nil)
23
+
24
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
23
25
 
24
26
  # instance classes needed in script
25
27
  intMetadataClass = InternalMetadata.new
26
28
  intPhone = intMetadataClass.newPhone
27
29
 
28
30
  if hPhone.empty?
29
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: phone object is empty'
31
+ @MessagePath.issueWarning(630, responseObj, inContext)
30
32
  return nil
31
33
  end
32
34
 
@@ -36,9 +38,7 @@ module ADIWG
36
38
  intPhone[:phoneNumber] = hPhone['phoneNumber']
37
39
  end
38
40
  if hPhone['phoneNumber'].nil? || hPhone['phoneNumber'] == ''
39
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: phone number is missing'
40
- responseObj[:readerExecutionPass] = false
41
- return nil
41
+ @MessagePath.issueError(631, responseObj, inContext)
42
42
  end
43
43
 
44
44
  # phone - phoneName
@@ -53,7 +53,7 @@ module ADIWG
53
53
  intPhone[:phoneServiceTypes] = hPhone['service']
54
54
  end
55
55
  if intPhone[:phoneServiceTypes].empty?
56
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: phone service type is missing'
56
+ @MessagePath.issueWarning(632, responseObj, inContext)
57
57
  end
58
58
 
59
59
  return intPhone
@@ -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-22 refactored error and warning messaging
6
6
  # Stan Smith 2017-08-30 added support for process step sources
7
7
  # Stan Smith 2016-10-15 refactored for mdJson 2.0
8
8
  # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
@@ -22,11 +22,13 @@ module ADIWG
22
22
 
23
23
  module ProcessStep
24
24
 
25
- def self.unpack(hProcStep, responseObj)
25
+ def self.unpack(hProcStep, responseObj, inContext = nil)
26
+
27
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
26
28
 
27
29
  # return nil object if input is empty
28
30
  if hProcStep.empty?
29
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: process step object is empty'
31
+ @MessagePath.issueWarning(640, responseObj, inContext)
30
32
  return nil
31
33
  end
32
34
 
@@ -34,6 +36,9 @@ module ADIWG
34
36
  intMetadataClass = InternalMetadata.new
35
37
  intProcStep = intMetadataClass.newProcessStep
36
38
 
39
+ outContext = 'process step'
40
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
41
+
37
42
  # process step - step ID
38
43
  if hProcStep.has_key?('stepId')
39
44
  unless hProcStep['stepId'] == ''
@@ -46,9 +51,7 @@ module ADIWG
46
51
  intProcStep[:description] = hProcStep['description']
47
52
  end
48
53
  if intProcStep[:description].nil? || intProcStep[:description] == ''
49
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: process step description is missing'
50
- responseObj[:readerExecutionPass] = false
51
- return nil
54
+ @MessagePath.issueError(641, responseObj, inContext)
52
55
  end
53
56
 
54
57
  # process step - rationale
@@ -62,7 +65,7 @@ module ADIWG
62
65
  if hProcStep.has_key?('timePeriod')
63
66
  hObject = hProcStep['timePeriod']
64
67
  unless hObject.empty?
65
- hReturn = TimePeriod.unpack(hObject, responseObj)
68
+ hReturn = TimePeriod.unpack(hObject, responseObj, outContext)
66
69
  unless hReturn.nil?
67
70
  intProcStep[:timePeriod] = hReturn
68
71
  end
@@ -73,7 +76,7 @@ module ADIWG
73
76
  if hProcStep.has_key?('processor')
74
77
  aProc = hProcStep['processor']
75
78
  aProc.each do |item|
76
- hParty = ResponsibleParty.unpack(item, responseObj)
79
+ hParty = ResponsibleParty.unpack(item, responseObj, outContext)
77
80
  unless hParty.nil?
78
81
  intProcStep[:processors] << hParty
79
82
  end
@@ -84,7 +87,7 @@ module ADIWG
84
87
  if hProcStep.has_key?('reference')
85
88
  aReference = hProcStep['reference']
86
89
  aReference.each do |item|
87
- hReference = Citation.unpack(item, responseObj)
90
+ hReference = Citation.unpack(item, responseObj, outContext)
88
91
  unless hReference.nil?
89
92
  intProcStep[:references] << hReference
90
93
  end
@@ -95,7 +98,7 @@ module ADIWG
95
98
  if hProcStep.has_key?('stepSource')
96
99
  aSources = hProcStep['stepSource']
97
100
  aSources.each do |item|
98
- hSource = Source.unpack(item, responseObj)
101
+ hSource = Source.unpack(item, responseObj, outContext)
99
102
  unless hSource.nil?
100
103
  intProcStep[:stepSources] << hSource
101
104
  end
@@ -106,7 +109,7 @@ module ADIWG
106
109
  if hProcStep.has_key?('stepProduct')
107
110
  aSources = hProcStep['stepProduct']
108
111
  aSources.each do |item|
109
- hSource = Source.unpack(item, responseObj)
112
+ hSource = Source.unpack(item, responseObj, outContext)
110
113
  unless hSource.nil?
111
114
  intProcStep[:stepProducts] << hSource
112
115
  end
@@ -117,7 +120,7 @@ module ADIWG
117
120
  if hProcStep.has_key?('scope')
118
121
  hObject = hProcStep['scope']
119
122
  unless hObject.empty?
120
- hReturn = Scope.unpack(hObject, responseObj)
123
+ hReturn = Scope.unpack(hObject, responseObj, outContext)
121
124
  unless hReturn.nil?
122
125
  intProcStep[:scope] = hReturn
123
126
  end
@@ -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-22 refactored error and warning messaging
6
6
  # Stan Smith 2017-10-23 original script
7
7
 
8
8
  require_relative 'module_identifier'
@@ -15,12 +15,13 @@ module ADIWG
15
15
 
16
16
  module ProjectionParameters
17
17
 
18
- def self.unpack(hProjection, responseObj)
18
+ def self.unpack(hProjection, responseObj, inContext = nil)
19
+
20
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
19
21
 
20
22
  # return nil object if input is empty
21
23
  if hProjection.empty?
22
- responseObj[:readerExecutionMessages] <<
23
- 'WARNING: mdJson reader: reference system projection parameters object is empty'
24
+ @MessagePath.issueWarning(650, responseObj, inContext)
24
25
  return nil
25
26
  end
26
27
 
@@ -28,10 +29,13 @@ module ADIWG
28
29
  intMetadataClass = InternalMetadata.new
29
30
  intProjection = intMetadataClass.newProjection
30
31
 
32
+ outContext = 'projection parameters'
33
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
34
+
31
35
  # projection parameters - projection identifier {identifier}
32
36
  if hProjection.has_key?('projectionIdentifier')
33
37
  unless hProjection['projectionIdentifier'].empty?
34
- hReturn = Identifier.unpack(hProjection['projectionIdentifier'], responseObj)
38
+ hReturn = Identifier.unpack(hProjection['projectionIdentifier'], responseObj, outContext)
35
39
  unless hReturn.nil?
36
40
  intProjection[:projectionIdentifier] = hReturn
37
41
  end
@@ -57,10 +61,7 @@ module ADIWG
57
61
  intProjection[:projection] = hProjection['projection']
58
62
  end
59
63
  if intProjection[:projection].nil? || intProjection[:projection] == ''
60
- responseObj[:readerExecutionMessages] <<
61
- 'ERROR: mdJson reader: spatial reference projection type is missing'
62
- responseObj[:readerExecutionPass] = false
63
- return nil
64
+ @MessagePath.issueError(651, responseObj, inContext)
64
65
  end
65
66
 
66
67
  # projection parameters - projection name
@@ -200,7 +201,7 @@ module ADIWG
200
201
  if hProjection.has_key?('obliqueLinePoint')
201
202
  aItems = hProjection['obliqueLinePoint']
202
203
  aItems.each do |item|
203
- hReturn = ObliqueLinePoint.unpack(item, responseObj)
204
+ hReturn = ObliqueLinePoint.unpack(item, responseObj, outContext)
204
205
  unless hReturn.nil?
205
206
  intProjection[:obliqueLinePoints] << hReturn
206
207
  end
@@ -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-22 refactored error and warning messaging
6
6
  # Stan Smith 2017-10-23 original script
7
7
 
8
8
  require_relative 'module_projectionParameters'
@@ -16,12 +16,13 @@ module ADIWG
16
16
 
17
17
  module ReferenceSystemParameters
18
18
 
19
- def self.unpack(hParams, responseObj)
19
+ def self.unpack(hParams, responseObj, inContext = nil)
20
+
21
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
20
22
 
21
23
  # return nil object if input is empty
22
24
  if hParams.empty?
23
- responseObj[:readerExecutionMessages] <<
24
- 'WARNING: mdJson reader: spatial reference system parameters object is empty'
25
+ @MessagePath.issueWarning(660, responseObj, inContext)
25
26
  return nil
26
27
  end
27
28
 
@@ -29,12 +30,15 @@ module ADIWG
29
30
  intMetadataClass = InternalMetadata.new
30
31
  intParamSet = intMetadataClass.newReferenceSystemParameterSet
31
32
 
33
+ outContext = 'reference system parameter set'
34
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
35
+
32
36
  haveParams = false
33
37
 
34
38
  # reference system parameters - projection parameters
35
39
  if hParams.has_key?('projection')
36
40
  unless hParams['projection'].empty?
37
- hReturn = ProjectionParameters.unpack(hParams['projection'], responseObj)
41
+ hReturn = ProjectionParameters.unpack(hParams['projection'], responseObj, outContext)
38
42
  unless hReturn.nil?
39
43
  intParamSet[:projection] = hReturn
40
44
  haveParams = true
@@ -45,7 +49,7 @@ module ADIWG
45
49
  # reference system parameters - ellipsoid parameters
46
50
  if hParams.has_key?('geodetic')
47
51
  unless hParams['geodetic'].empty?
48
- hReturn = Geodetic.unpack(hParams['geodetic'], responseObj)
52
+ hReturn = Geodetic.unpack(hParams['geodetic'], responseObj, outContext)
49
53
  unless hReturn.nil?
50
54
  intParamSet[:geodetic] = hReturn
51
55
  haveParams = true
@@ -56,7 +60,7 @@ module ADIWG
56
60
  # reference system parameters - vertical datum parameters
57
61
  if hParams.has_key?('verticalDatum')
58
62
  unless hParams['verticalDatum'].empty?
59
- hReturn = VerticalDatum.unpack(hParams['verticalDatum'], responseObj)
63
+ hReturn = VerticalDatum.unpack(hParams['verticalDatum'], responseObj, outContext)
60
64
  unless hReturn.nil?
61
65
  intParamSet[:verticalDatum] = hReturn
62
66
  haveParams = true
@@ -66,10 +70,7 @@ module ADIWG
66
70
 
67
71
  # error messages
68
72
  unless haveParams
69
- responseObj[:readerExecutionMessages] <<
70
- 'WARNING: mdJson reader: spatial reference system parameters must have at least one projection, geodetic, or vertical datum'
71
- responseObj[:readerExecutionPass] = false
72
- return nil
73
+ @MessagePath.issueWarning(661, responseObj, inContext)
73
74
  end
74
75
 
75
76
  return intParamSet
@@ -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-22 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-15 original script
7
7
 
8
8
  require_relative 'module_responsibleParty'
@@ -14,11 +14,13 @@ module ADIWG
14
14
 
15
15
  module Releasability
16
16
 
17
- def self.unpack(hRelease, responseObj)
17
+ def self.unpack(hRelease, 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 hRelease.empty?
21
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: releasability object is empty'
23
+ @MessagePath.issueWarning(670, responseObj, inContext)
22
24
  return nil
23
25
  end
24
26
 
@@ -26,13 +28,16 @@ module ADIWG
26
28
  intMetadataClass = InternalMetadata.new
27
29
  intRelease = intMetadataClass.newRelease
28
30
 
31
+ outContext = 'releasability'
32
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
33
+
29
34
  haveRelease = false
30
35
 
31
36
  # releasability - addressee [responsibleParty]
32
37
  if hRelease.has_key?('addressee')
33
38
  aRParty = hRelease['addressee']
34
39
  aRParty.each do |item|
35
- hParty = ResponsibleParty.unpack(item, responseObj)
40
+ hParty = ResponsibleParty.unpack(item, responseObj, outContext)
36
41
  unless hParty.nil?
37
42
  intRelease[:addressee] << hParty
38
43
  haveRelease = true
@@ -59,10 +64,7 @@ module ADIWG
59
64
 
60
65
  # error messages
61
66
  unless haveRelease
62
- responseObj[:readerExecutionMessages] <<
63
- 'ERROR: mdJson reader: releasability must have at least one addressee or statement'
64
- responseObj[:readerExecutionPass] = false
65
- return nil
67
+ @MessagePath.issueError(671, responseObj, inContext)
66
68
  end
67
69
 
68
70
  return intRelease
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-04-06 change taxonomy to an array
5
+ # Stan Smith 2018-06-24 refactored error and warning messaging
6
6
  # Stan Smith 2018-02-19 refactored error and warning messaging
7
7
  # Stan Smith 2017-05-16 deprecated topic category
8
8
  # ... topic category is now handled as keyword list
@@ -37,10 +37,11 @@ module ADIWG
37
37
 
38
38
  def self.unpack(hResInfo, responseObj)
39
39
 
40
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
41
+
40
42
  # return nil object if input is empty
41
43
  if hResInfo.empty?
42
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info object is empty'
43
- responseObj[:readerExecutionPass] = false
44
+ @MessagePath.issueError(680, responseObj)
44
45
  return nil
45
46
  end
46
47
 
@@ -48,11 +49,13 @@ module ADIWG
48
49
  intMetadataClass = InternalMetadata.new
49
50
  intResInfo = intMetadataClass.newResourceInfo
50
51
 
52
+ outContext = 'resource information'
53
+
51
54
  # resource information - resource type [] (required) {resourceType}
52
55
  if hResInfo.has_key?('resourceType')
53
56
  hResInfo['resourceType'].each do |item|
54
57
  unless item.empty?
55
- hReturn = ResourceType.unpack(item, responseObj)
58
+ hReturn = ResourceType.unpack(item, responseObj, outContext)
56
59
  unless hReturn.nil?
57
60
  intResInfo[:resourceTypes] << hReturn
58
61
  end
@@ -60,25 +63,21 @@ module ADIWG
60
63
  end
61
64
  end
62
65
  if intResInfo[:resourceTypes].empty?
63
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info resource type is missing'
64
- responseObj[:readerExecutionPass] = false
65
- return nil
66
+ @MessagePath.issueError(681, responseObj, outContext)
66
67
  end
67
68
 
68
69
  # resource information - citation {citation} (required)
69
70
  if hResInfo.has_key?('citation')
70
71
  hObject = hResInfo['citation']
71
72
  unless hObject.empty?
72
- hReturn = Citation.unpack(hObject, responseObj)
73
+ hReturn = Citation.unpack(hObject, responseObj, outContext)
73
74
  unless hReturn.nil?
74
75
  intResInfo[:citation] = hReturn
75
76
  end
76
77
  end
77
78
  end
78
79
  if intResInfo[:citation].empty?
79
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info citation is missing'
80
- responseObj[:readerExecutionPass] = false
81
- return nil
80
+ @MessagePath.issueError(682, responseObj, outContext)
82
81
  end
83
82
 
84
83
  # resource information - abstract (required)
@@ -86,9 +85,7 @@ module ADIWG
86
85
  intResInfo[:abstract] = hResInfo['abstract']
87
86
  end
88
87
  if intResInfo[:abstract].nil? || intResInfo[:abstract] == ''
89
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info abstract is missing'
90
- responseObj[:readerExecutionPass] = false
91
- return nil
88
+ @MessagePath.issueError(683, responseObj, outContext)
92
89
  end
93
90
 
94
91
  # resource information - short abstract
@@ -110,7 +107,7 @@ module ADIWG
110
107
  hObject = hResInfo['timePeriod']
111
108
  unless hObject.empty?
112
109
  hObject[:description] = 'resource time period' if hObject[:description].nil?
113
- hReturn = TimePeriod.unpack(hObject, responseObj)
110
+ hReturn = TimePeriod.unpack(hObject, responseObj, outContext)
114
111
  unless hReturn.nil?
115
112
  intResInfo[:timePeriod] = hReturn
116
113
  end
@@ -135,9 +132,7 @@ module ADIWG
135
132
  end
136
133
  end
137
134
  if intResInfo[:status].empty?
138
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info status is missing'
139
- responseObj[:readerExecutionPass] = false
140
- return nil
135
+ @MessagePath.issueError(684, responseObj, outContext)
141
136
  end
142
137
 
143
138
  # resource information - topic category (deprecated)
@@ -156,8 +151,7 @@ module ADIWG
156
151
  unless hReturn.nil?
157
152
  intResInfo[:keywords] << hReturn
158
153
  end
159
- responseObj[:readerExecutionMessages] <<
160
- 'NOTICE: mdJson reader: TopicCategory is deprecated, items were moved to keywords "isoTopicCategory"'
154
+ @MessagePath.issueNotice(685, responseObj, outContext)
161
155
  end
162
156
  end
163
157
 
@@ -165,23 +159,21 @@ module ADIWG
165
159
  if hResInfo.has_key?('pointOfContact')
166
160
  aItems = hResInfo['pointOfContact']
167
161
  aItems.each do |item|
168
- hReturn = ResponsibleParty.unpack(item, responseObj)
162
+ hReturn = ResponsibleParty.unpack(item, responseObj, outContext)
169
163
  unless hReturn.nil?
170
164
  intResInfo[:pointOfContacts] << hReturn
171
165
  end
172
166
  end
173
167
  end
174
168
  if intResInfo[:pointOfContacts].empty?
175
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info point-of-contact is missing'
176
- responseObj[:readerExecutionPass] = false
177
- return nil
169
+ @MessagePath.issueError(686, responseObj, outContext)
178
170
  end
179
171
 
180
172
  # resource information - spatial reference system [] {spatialReference}
181
173
  if hResInfo.has_key?('spatialReferenceSystem')
182
174
  aItems = hResInfo['spatialReferenceSystem']
183
175
  aItems.each do |item|
184
- hReturn = SpatialReferenceSystem.unpack(item, responseObj)
176
+ hReturn = SpatialReferenceSystem.unpack(item, responseObj, outContext)
185
177
  unless hReturn.nil?
186
178
  intResInfo[:spatialReferenceSystems] << hReturn
187
179
  end
@@ -201,7 +193,7 @@ module ADIWG
201
193
  if hResInfo.has_key?('spatialRepresentation')
202
194
  aItems = hResInfo['spatialRepresentation']
203
195
  aItems.each do |item|
204
- hReturn = SpatialRepresentation.unpack(item, responseObj)
196
+ hReturn = SpatialRepresentation.unpack(item, responseObj, outContext)
205
197
  unless hReturn.nil?
206
198
  intResInfo[:spatialRepresentations] << hReturn
207
199
  end
@@ -212,7 +204,7 @@ module ADIWG
212
204
  if hResInfo.has_key?('spatialResolution')
213
205
  aItems = hResInfo['spatialResolution']
214
206
  aItems.each do |item|
215
- hReturn = SpatialResolution.unpack(item, responseObj)
207
+ hReturn = SpatialResolution.unpack(item, responseObj, outContext)
216
208
  unless hReturn.nil?
217
209
  intResInfo[:spatialResolutions] << hReturn
218
210
  end
@@ -223,7 +215,7 @@ module ADIWG
223
215
  if hResInfo.has_key?('temporalResolution')
224
216
  aItems = hResInfo['temporalResolution']
225
217
  aItems.each do |item|
226
- hReturn = Duration.unpack(item, responseObj)
218
+ hReturn = Duration.unpack(item, responseObj, outContext)
227
219
  unless hReturn.nil?
228
220
  intResInfo[:temporalResolutions] << hReturn
229
221
  end
@@ -234,7 +226,7 @@ module ADIWG
234
226
  if hResInfo.has_key?('extent')
235
227
  aItems = hResInfo['extent']
236
228
  aItems.each do |item|
237
- hReturn = Extent.unpack(item, responseObj)
229
+ hReturn = Extent.unpack(item, responseObj, outContext)
238
230
  unless hReturn.nil?
239
231
  intResInfo[:extents] << hReturn
240
232
  end
@@ -268,8 +260,7 @@ module ADIWG
268
260
  unless hReturn.nil?
269
261
  intResInfo[:taxonomy] << hReturn
270
262
  end
271
- responseObj[:readerExecutionMessages] <<
272
- 'NOTICE: mdJson reader: taxonomy is an array, use of a single taxonomy object was deprecated'
263
+ @MessagePath.issueNotice(687, responseObj, outContext)
273
264
  end
274
265
  end
275
266
 
@@ -277,7 +268,7 @@ module ADIWG
277
268
  if hResInfo.has_key?('graphicOverview')
278
269
  aItems = hResInfo['graphicOverview']
279
270
  aItems.each do |item|
280
- hReturn = Graphic.unpack(item, responseObj)
271
+ hReturn = Graphic.unpack(item, responseObj, outContext)
281
272
  unless hReturn.nil?
282
273
  intResInfo[:graphicOverviews] << hReturn
283
274
  end
@@ -288,7 +279,7 @@ module ADIWG
288
279
  if hResInfo.has_key?('resourceFormat')
289
280
  aItems = hResInfo['resourceFormat']
290
281
  aItems.each do |item|
291
- hReturn = Format.unpack(item, responseObj)
282
+ hReturn = Format.unpack(item, responseObj, outContext)
292
283
  unless hReturn.nil?
293
284
  intResInfo[:resourceFormats] << hReturn
294
285
  end
@@ -321,7 +312,7 @@ module ADIWG
321
312
  if hResInfo.has_key?('constraint')
322
313
  aCons = hResInfo['constraint']
323
314
  aCons.each do |hItem|
324
- hReturn = Constraint.unpack(hItem, responseObj)
315
+ hReturn = Constraint.unpack(hItem, responseObj, outContext)
325
316
  unless hReturn.nil?
326
317
  intResInfo[:constraints] << hReturn
327
318
  end
@@ -332,23 +323,21 @@ module ADIWG
332
323
  if hResInfo.has_key?('defaultResourceLocale')
333
324
  hObject = hResInfo['defaultResourceLocale']
334
325
  unless hObject.empty?
335
- hReturn = Locale.unpack(hObject, responseObj)
326
+ hReturn = Locale.unpack(hObject, responseObj, outContext)
336
327
  unless hReturn.nil?
337
328
  intResInfo[:defaultResourceLocale] = hReturn
338
329
  end
339
330
  end
340
331
  end
341
332
  if intResInfo[:defaultResourceLocale].empty?
342
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource info default locale is missing'
343
- responseObj[:readerExecutionPass] = false
344
- return nil
333
+ @MessagePath.issueError(688, responseObj, outContext)
345
334
  end
346
335
 
347
336
  # resource information - other resource locale [] {locale}
348
337
  if hResInfo.has_key?('otherResourceLocale')
349
338
  aItems = hResInfo['otherResourceLocale']
350
339
  aItems.each do |item|
351
- hReturn = Locale.unpack(item, responseObj)
340
+ hReturn = Locale.unpack(item, responseObj, outContext)
352
341
  unless hReturn.nil?
353
342
  intResInfo[:otherResourceLocales] << hReturn
354
343
  end
@@ -359,7 +348,7 @@ module ADIWG
359
348
  if hResInfo.has_key?('resourceMaintenance')
360
349
  aItems = hResInfo['resourceMaintenance']
361
350
  aItems.each do |item|
362
- hReturn = Maintenance.unpack(item, responseObj)
351
+ hReturn = Maintenance.unpack(item, responseObj, outContext)
363
352
  unless hReturn.nil?
364
353
  intResInfo[:resourceMaintenance] << hReturn
365
354
  end