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-20 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-25 original script
7
7
 
8
8
  require_relative 'module_identifier'
@@ -16,9 +16,11 @@ module ADIWG
16
16
 
17
17
  def self.unpack(hGeoProp, responseObj)
18
18
 
19
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
20
+
19
21
  # return nil object if input is empty
20
22
  if hGeoProp.empty?
21
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: GeoJSON geometry properties object is empty'
23
+ @MessagePath.issueWarning(390, responseObj)
22
24
  return nil
23
25
  end
24
26
 
@@ -3,7 +3,7 @@
3
3
  # Reader - ADIwg JSON to internal data structure
4
4
 
5
5
  # History:
6
- # Stan Smith 2018-02-18 refactored error and warning messaging
6
+ # Stan Smith 2018-06-20 refactored error and warning messaging
7
7
  # Stan Smith 2016-10-19 original script
8
8
 
9
9
  require_relative 'module_gridRepresentation'
@@ -15,12 +15,13 @@ module ADIWG
15
15
 
16
16
  module GeorectifiedRepresentation
17
17
 
18
- def self.unpack(hGeoRec, responseObj)
18
+ def self.unpack(hGeoRec, 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 hGeoRec.empty?
22
- responseObj[:readerExecutionMessages] <<
23
- 'WARNING: mdJson reader: georectified spatial representation object is empty'
24
+ @MessagePath.issueWarning(400, responseObj, inContext)
24
25
  return nil
25
26
  end
26
27
 
@@ -28,21 +29,21 @@ module ADIWG
28
29
  intMetadataClass = InternalMetadata.new
29
30
  intGeoRec = intMetadataClass.newGeorectifiedInfo
30
31
 
32
+ outContext = 'georectified representation'
33
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
34
+
31
35
  # georectified representation - grid representation (required)
32
36
  if hGeoRec.has_key?('gridRepresentation')
33
37
  hObject = hGeoRec['gridRepresentation']
34
38
  unless hObject.empty?
35
- hReturn = GridRepresentation.unpack(hObject, responseObj)
39
+ hReturn = GridRepresentation.unpack(hObject, responseObj, outContext)
36
40
  unless hReturn.nil?
37
41
  intGeoRec[:gridRepresentation] = hReturn
38
42
  end
39
43
  end
40
44
  end
41
45
  if intGeoRec[:gridRepresentation].empty?
42
- responseObj[:readerExecutionMessages] <<
43
- 'ERROR: mdJson reader: georectified spatial representation grid representation is missing'
44
- responseObj[:readerExecutionPass] = false
45
- return nil
46
+ @MessagePath.issueError(401, responseObj, inContext)
46
47
  end
47
48
 
48
49
  # georectified representation - check point availability (required)
@@ -66,10 +67,7 @@ module ADIWG
66
67
  end
67
68
  end
68
69
  unless intGeoRec[:cornerPoints].length == 2 || intGeoRec[:cornerPoints].length == 4
69
- responseObj[:readerExecutionMessages] <<
70
- 'ERROR: mdJson reader: georectified spatial representation must have either 2 or 4 corner points'
71
- responseObj[:readerExecutionPass] = false
72
- return nil
70
+ @MessagePath.issueError(402, responseObj, inContext)
73
71
  end
74
72
 
75
73
  # georectified representation - center points
@@ -78,10 +76,7 @@ module ADIWG
78
76
  intGeoRec[:centerPoint] = hGeoRec['centerPoint']
79
77
  end
80
78
  unless intGeoRec[:centerPoint].length == 2
81
- responseObj[:readerExecutionMessages] <<
82
- 'ERROR: mdJson reader: georectified spatial representation center point must be single 2D coordinate'
83
- responseObj[:readerExecutionPass] = false
84
- return nil
79
+ @MessagePath.issueError(403, responseObj, inContext)
85
80
  end
86
81
  end
87
82
 
@@ -92,9 +87,7 @@ module ADIWG
92
87
  end
93
88
  end
94
89
  if intGeoRec[:pointInPixel].nil?
95
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: georectified spatial representation point-in-pixel is missing'
96
- responseObj[:readerExecutionPass] = false
97
- return nil
90
+ @MessagePath.issueError(404, responseObj, inContext)
98
91
  end
99
92
 
100
93
  # georectified representation - transformation dimension description
@@ -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-20 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-19 original script
7
7
 
8
8
  require_relative 'module_gridRepresentation'
@@ -15,12 +15,13 @@ module ADIWG
15
15
 
16
16
  module GeoreferenceableRepresentation
17
17
 
18
- def self.unpack(hGeoRef, responseObj)
18
+ def self.unpack(hGeoRef, 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 hGeoRef.empty?
22
- responseObj[:readerExecutionMessages] <<
23
- 'WARNING: mdJson reader: georeferenceable spatial representation object is empty'
24
+ @MessagePath.issueWarning(410, responseObj, inContext)
24
25
  return nil
25
26
  end
26
27
 
@@ -28,21 +29,21 @@ module ADIWG
28
29
  intMetadataClass = InternalMetadata.new
29
30
  intGeoRef = intMetadataClass.newGeoreferenceableInfo
30
31
 
32
+ outContext = 'georeferenceable representation'
33
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
34
+
31
35
  # georeferenceable representation - grid representation (required)
32
36
  if hGeoRef.has_key?('gridRepresentation')
33
37
  hObject = hGeoRef['gridRepresentation']
34
38
  unless hObject.empty?
35
- hReturn = GridRepresentation.unpack(hObject, responseObj)
39
+ hReturn = GridRepresentation.unpack(hObject, responseObj, outContext)
36
40
  unless hReturn.nil?
37
41
  intGeoRef[:gridRepresentation] = hReturn
38
42
  end
39
43
  end
40
44
  end
41
45
  if intGeoRef[:gridRepresentation].empty?
42
- responseObj[:readerExecutionMessages] <<
43
- 'ERROR: mdJson reader: georeferenceable spatial representation grid representation is missing'
44
- responseObj[:readerExecutionPass] = false
45
- return nil
46
+ @MessagePath.issueError(411, responseObj, inContext)
46
47
  end
47
48
 
48
49
  # georeferenceable representation - control point availability (required)
@@ -73,17 +74,14 @@ module ADIWG
73
74
  end
74
75
  end
75
76
  if intGeoRef[:georeferencedParameter].nil?
76
- responseObj[:readerExecutionMessages] <<
77
- 'ERROR: mdJson reader: georeferenceable spatial representation georeferenced parameters are missing'
78
- responseObj[:readerExecutionPass] = false
79
- return nil
77
+ @MessagePath.issueError(412, responseObj, inContext)
80
78
  end
81
79
 
82
80
  # georeferenceable representation - parameter citation [citation]
83
81
  if hGeoRef.has_key?('parameterCitation')
84
82
  aCitation = hGeoRef['parameterCitation']
85
83
  aCitation.each do |item|
86
- hCitation = Citation.unpack(item, responseObj)
84
+ hCitation = Citation.unpack(item, responseObj, outContext)
87
85
  unless hCitation.nil?
88
86
  intGeoRef[:parameterCitation] << hCitation
89
87
  end
@@ -2,9 +2,11 @@
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-20 refactored error and warning messaging
6
6
  # Stan Smith 2016-11-30 original script
7
7
 
8
+ # TODO verify this method is not used
9
+
8
10
  module ADIWG
9
11
  module Mdtranslator
10
12
  module Readers
@@ -14,9 +16,11 @@ module ADIWG
14
16
 
15
17
  def self.unpack(hIdentifier, responseObj)
16
18
 
19
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
20
+
17
21
  # return nil object if input is empty
18
22
  if hIdentifier.empty?
19
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: GML Identifier object is empty'
23
+ @MessagePath.issueWarning(420, responseObj)
20
24
  return nil
21
25
  end
22
26
 
@@ -29,9 +33,7 @@ module ADIWG
29
33
  intIdentifier[:identifier] = hIdentifier['identifier']
30
34
  end
31
35
  if intIdentifier[:identifier].nil? || intIdentifier[:identifier] == ''
32
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GML Identifier identifier is missing'
33
- responseObj[:readerExecutionPass] = false
34
- return nil
36
+ @MessagePath.issueError(421, responseObj)
35
37
  end
36
38
 
37
39
  # gml identifier - namespace (required)
@@ -39,9 +41,7 @@ module ADIWG
39
41
  intIdentifier[:namespace] = hIdentifier['namespace']
40
42
  end
41
43
  if intIdentifier[:namespace].nil? || intIdentifier[:namespace] == ''
42
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GML Identifier namespace is missing'
43
- responseObj[:readerExecutionPass] = false
44
- return nil
44
+ @MessagePath.issueError(422, responseObj)
45
45
  end
46
46
 
47
47
  return intIdentifier
@@ -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-20 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-12 refactored for mdJson 2.0
7
7
  # Stan Smith 2015-07-14 refactored to remove global namespace constants
8
8
  # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
@@ -23,11 +23,13 @@ module ADIWG
23
23
 
24
24
  module Graphic
25
25
 
26
- def self.unpack(hGraphic, responseObj)
26
+ def self.unpack(hGraphic, responseObj, inContext = nil)
27
+
28
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
27
29
 
28
30
  # return nil object if input is empty
29
31
  if hGraphic.empty?
30
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: graphic overview object is empty'
32
+ @MessagePath.issueWarning(430, responseObj, inContext)
31
33
  return nil
32
34
  end
33
35
 
@@ -40,9 +42,7 @@ module ADIWG
40
42
  intGraphic[:graphicName] = hGraphic['fileName']
41
43
  end
42
44
  if intGraphic[:graphicName].nil? || intGraphic[:graphicName] == ''
43
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: graphic overview file name is missing'
44
- responseObj[:readerExecutionPass] = false
45
- return nil
45
+ @MessagePath.issueError(431, responseObj, inContext)
46
46
  end
47
47
 
48
48
  # graphic - file description
@@ -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-20 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-19 original script
7
7
 
8
8
  require_relative 'module_dimension'
@@ -14,11 +14,13 @@ module ADIWG
14
14
 
15
15
  module GridRepresentation
16
16
 
17
- def self.unpack(hGrid, responseObj)
17
+ def self.unpack(hGrid, 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 hGrid.empty?
21
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: grid representation object is empty'
23
+ @MessagePath.issueWarning(440, responseObj, inContext)
22
24
  return nil
23
25
  end
24
26
 
@@ -26,6 +28,9 @@ module ADIWG
26
28
  intMetadataClass = InternalMetadata.new
27
29
  intGrid = intMetadataClass.newGridInfo
28
30
 
31
+ outContext = 'grid representation'
32
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
33
+
29
34
  # grid representation - number of dimensions (required)
30
35
  if hGrid.has_key?('numberOfDimensions')
31
36
  unless hGrid['numberOfDimensions'] == ''
@@ -33,24 +38,20 @@ module ADIWG
33
38
  end
34
39
  end
35
40
  if intGrid[:numberOfDimensions].nil?
36
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: grid representation number-of-dimensions is missing'
37
- responseObj[:readerExecutionPass] = false
38
- return nil
41
+ @MessagePath.issueError(441, responseObj, inContext)
39
42
  end
40
43
 
41
44
  # grid representation - dimensions [] (required)
42
45
  if hGrid.has_key?('dimension')
43
46
  hGrid['dimension'].each do |item|
44
- hDim = Dimension.unpack(item, responseObj)
47
+ hDim = Dimension.unpack(item, responseObj, outContext)
45
48
  unless hDim.nil?
46
49
  intGrid[:dimension] << hDim
47
50
  end
48
51
  end
49
52
  end
50
53
  if intGrid[:dimension].empty?
51
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: grid representation dimensions are missing'
52
- responseObj[:readerExecutionPass] = false
53
- return nil
54
+ @MessagePath.issueError(442, responseObj, inContext)
54
55
  end
55
56
 
56
57
  # grid representation - cell geometry (required)
@@ -60,9 +61,7 @@ module ADIWG
60
61
  end
61
62
  end
62
63
  if intGrid[:cellGeometry].nil?
63
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: grid representation cell geometry is missing'
64
- responseObj[:readerExecutionPass] = false
65
- return nil
64
+ @MessagePath.issueError(443, responseObj, inContext)
66
65
  end
67
66
 
68
67
  # grid representation - transformation parameter available {Boolean} (required)
@@ -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-20 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-13 refactored for mdJson 2.0
7
7
  # Stan Smith 2015-07-31 added support for fields added by ISO 19115-1 (RS_Identifier)
8
8
  # Stan Smith 2015-07-14 refactored to remove global namespace constants
@@ -21,14 +21,19 @@ module ADIWG
21
21
 
22
22
  module Identifier
23
23
 
24
- def self.unpack(hIdentifier, responseObj)
24
+ def self.unpack(hIdentifier, responseObj, inContext = nil)
25
+
26
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
25
27
 
26
28
  # return nil object if input is empty
27
29
  if hIdentifier.empty?
28
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: identifier object is empty'
30
+ @MessagePath.issueWarning(450, responseObj, inContext)
29
31
  return nil
30
32
  end
31
33
 
34
+ outContext = 'identifier'
35
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
36
+
32
37
  # instance classes needed in script
33
38
  intMetadataClass = InternalMetadata.new
34
39
  intIdent = intMetadataClass.newIdentifier
@@ -38,9 +43,7 @@ module ADIWG
38
43
  intIdent[:identifier] = hIdentifier['identifier']
39
44
  end
40
45
  if intIdent[:identifier].nil? || intIdent[:identifier] == ''
41
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: identifier object identifier is missing'
42
- responseObj[:readerExecutionPass] = false
43
- return nil
46
+ @MessagePath.issueError(451, responseObj, inContext)
44
47
  end
45
48
 
46
49
  # identifier - namespace
@@ -68,7 +71,7 @@ module ADIWG
68
71
  if hIdentifier.has_key?('authority')
69
72
  hObject = hIdentifier['authority']
70
73
  unless hObject.empty?
71
- hReturn = Citation.unpack(hObject, responseObj)
74
+ hReturn = Citation.unpack(hObject, responseObj, outContext)
72
75
  unless hReturn.nil?
73
76
  intIdent[:citation] = hReturn
74
77
  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-21 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-18 original script
7
7
 
8
8
  require_relative 'module_identifier'
@@ -16,9 +16,13 @@ module ADIWG
16
16
 
17
17
  def self.unpack(hImageInfo, responseObj)
18
18
 
19
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
20
+
21
+ inContext = 'coverage description'
22
+
19
23
  # return nil object if input is empty
20
24
  if hImageInfo.empty?
21
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: image description object is empty'
25
+ @MessagePath.issueWarning(460, responseObj, inContext)
22
26
  return nil
23
27
  end
24
28
 
@@ -26,6 +30,8 @@ module ADIWG
26
30
  intMetadataClass = InternalMetadata.new
27
31
  hImage = intMetadataClass.newImageDescription
28
32
 
33
+ outContext = inContext + ' image description'
34
+
29
35
  # image description - elevation angle of illumination
30
36
  if hImageInfo.has_key?('illuminationElevationAngle')
31
37
  unless hImageInfo['illuminationElevationAngle'] == ''
@@ -51,7 +57,7 @@ module ADIWG
51
57
  if hImageInfo.has_key?('imageQualityCode')
52
58
  hObject = hImageInfo['imageQualityCode']
53
59
  unless hObject.empty?
54
- hReturn = Identifier.unpack(hObject, responseObj)
60
+ hReturn = Identifier.unpack(hObject, responseObj, outContext)
55
61
  unless hReturn.nil?
56
62
  hImage[:imageQualityCode] = hReturn
57
63
  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-21 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-23 refactored for mdJson 2.0
7
7
  # Stan Smith 2015-08-24 added return if input hash is empty
8
8
  # Stan Smith 2015-07-14 refactored to remove global namespace constants
@@ -26,9 +26,11 @@ module ADIWG
26
26
 
27
27
  def self.unpack(hKeyword, responseObj)
28
28
 
29
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
30
+
29
31
  # return nil object if input is empty
30
32
  if hKeyword.empty?
31
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: keyword object is empty'
33
+ @MessagePath.issueWarning(470, responseObj)
32
34
  return nil
33
35
  end
34
36
 
@@ -36,6 +38,8 @@ module ADIWG
36
38
  intMetadataClass = InternalMetadata.new
37
39
  intKeyword = intMetadataClass.newKeyword
38
40
 
41
+ outContext = 'keywords'
42
+
39
43
  # keyword - keyword [] (required)
40
44
  if hKeyword.has_key?('keyword')
41
45
  hKeyword['keyword'].each do |hItem|
@@ -48,9 +52,7 @@ module ADIWG
48
52
  end
49
53
  end
50
54
  if intKeyword[:keywords].empty?
51
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: keyword keyword list is missing'
52
- responseObj[:readerExecutionPass] = false
53
- return nil
55
+ @MessagePath.issueError(471, responseObj)
54
56
  end
55
57
 
56
58
  # keyword - keyType
@@ -64,7 +66,7 @@ module ADIWG
64
66
  if hKeyword.has_key?('thesaurus')
65
67
  hObject = hKeyword['thesaurus']
66
68
  unless hObject.empty?
67
- hReturn = Citation.unpack(hObject, responseObj)
69
+ hReturn = Citation.unpack(hObject, responseObj, outContext)
68
70
  unless hReturn.nil?
69
71
  intKeyword[:thesaurus] = hReturn
70
72
  end