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 V1 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-02-14 rename allowMany to mustBeUnique
7
7
  # Stan Smith 2017-11-01 added new elements to support fgdc and flat files
8
8
  # Stan Smith 2016-10-05 refactored for mdJson 2.0
@@ -13,7 +13,6 @@
13
13
  # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
14
14
  # Stan Smith 2013-12-01 original script
15
15
 
16
-
17
16
  require_relative 'module_citation'
18
17
  require_relative 'module_valueRange'
19
18
  require_relative 'module_timePeriod'
@@ -25,11 +24,13 @@ module ADIWG
25
24
 
26
25
  module EntityAttribute
27
26
 
28
- def self.unpack(hAttribute, responseObj)
27
+ def self.unpack(hAttribute, responseObj, inContext = nil)
28
+
29
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
29
30
 
30
31
  # return nil object if input is empty
31
32
  if hAttribute.empty?
32
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data dictionary entity attribute object is empty'
33
+ @MessagePath.issueWarning(240, responseObj, inContext)
33
34
  return nil
34
35
  end
35
36
 
@@ -37,6 +38,8 @@ module ADIWG
37
38
  intMetadataClass = InternalMetadata.new
38
39
  intAttribute = intMetadataClass.newEntityAttribute
39
40
 
41
+ outContext = nil
42
+
40
43
  # attribute - common name
41
44
  if hAttribute.has_key?('commonName')
42
45
  unless hAttribute['commonName'] == ''
@@ -49,9 +52,13 @@ module ADIWG
49
52
  intAttribute[:attributeCode] = hAttribute['codeName']
50
53
  end
51
54
  if intAttribute[:attributeCode].nil? || intAttribute[:attributeCode] == ''
52
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary entity attribute code name is missing'
53
- responseObj[:readerExecutionPass] = false
54
- return nil
55
+ @MessagePath.issueError(241, responseObj, inContext)
56
+ else
57
+ if inContext.nil?
58
+ outContext = 'attribute code name ' + hAttribute['codeName']
59
+ else
60
+ outContext = inContext + ' attribute code name ' + hAttribute['codeName']
61
+ end
55
62
  end
56
63
 
57
64
  # attribute - alias []
@@ -68,16 +75,14 @@ module ADIWG
68
75
  intAttribute[:attributeDefinition] = hAttribute['definition']
69
76
  end
70
77
  if intAttribute[:attributeDefinition].nil? || intAttribute[:attributeDefinition] == ''
71
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary entity attribute definition is missing'
72
- responseObj[:readerExecutionPass] = false
73
- return nil
78
+ @MessagePath.issueError(242, responseObj, outContext)
74
79
  end
75
80
 
76
81
  # attribute - attribute reference
77
82
  if hAttribute.has_key?('attributeReference')
78
83
  hCitation = hAttribute['attributeReference']
79
84
  unless hCitation.empty?
80
- hReturn = Citation.unpack(hCitation, responseObj)
85
+ hReturn = Citation.unpack(hCitation, responseObj, outContext)
81
86
  unless hReturn.nil?
82
87
  intAttribute[:attributeReference] = hReturn
83
88
  end
@@ -89,9 +94,7 @@ module ADIWG
89
94
  intAttribute[:dataType] = hAttribute['dataType']
90
95
  end
91
96
  if intAttribute[:dataType].nil? || intAttribute[:dataType] == ''
92
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary entity attribute data type is missing'
93
- responseObj[:readerExecutionPass] = false
94
- return nil
97
+ @MessagePath.issueError(243, responseObj, outContext)
95
98
  end
96
99
 
97
100
  # attribute - allow nulls (required)
@@ -106,9 +109,7 @@ module ADIWG
106
109
  if hAttribute.has_key?('allowMany')
107
110
  if hAttribute['allowMany'] === false
108
111
  intAttribute[:mustBeUnique] = hAttribute['allowMany']
109
- responseObj[:readerExecutionMessages] <<
110
- 'NOTICE: mdJson reader: data dictionary entity attribute "allowMany" is deprecated, use "mustBeUnique"'
111
- return nil
112
+ @MessagePath.issueNotice(244, responseObj, outContext)
112
113
  end
113
114
  end
114
115
  if hAttribute.has_key?('mustBeUnique')
@@ -178,7 +179,7 @@ module ADIWG
178
179
  aValueRange = hAttribute['valueRange']
179
180
  aValueRange.each do |hRange|
180
181
  unless hRange.empty?
181
- hReturn = ValueRange.unpack(hRange, responseObj)
182
+ hReturn = ValueRange.unpack(hRange, responseObj, outContext)
182
183
  unless hReturn.nil?
183
184
  intAttribute[:valueRange] << hReturn
184
185
  end
@@ -191,7 +192,7 @@ module ADIWG
191
192
  aTimePeriods = hAttribute['timePeriod']
192
193
  aTimePeriods.each do |hTimePeriod|
193
194
  unless hTimePeriod.empty?
194
- hReturn = TimePeriod.unpack(hTimePeriod, responseObj)
195
+ hReturn = TimePeriod.unpack(hTimePeriod, responseObj, outContext)
195
196
  unless hReturn.nil?
196
197
  intAttribute[:timePeriod] << hReturn
197
198
  end
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON V1 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-06 refactored for mdJson 2.0
7
7
  # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
8
8
  # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
@@ -17,11 +17,13 @@ module ADIWG
17
17
 
18
18
  module EntityForeignKey
19
19
 
20
- def self.unpack(hFKey, responseObj)
20
+ def self.unpack(hFKey, 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 hFKey.empty?
24
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data entity foreign key object is empty'
26
+ @MessagePath.issueWarning(250, responseObj, inContext)
25
27
  return nil
26
28
  end
27
29
 
@@ -35,10 +37,7 @@ module ADIWG
35
37
  intFKey[:fkLocalAttributes] = hFKey['localAttributeCodeName']
36
38
  end
37
39
  if intFKey[:fkLocalAttributes].empty?
38
- responseObj[:readerExecutionMessages] <<
39
- 'ERROR: mdJson reader: data entity foreign key local attribute code name is missing'
40
- responseObj[:readerExecutionPass] = false
41
- return nil
40
+ @MessagePath.issueError(251, responseObj, inContext)
42
41
  end
43
42
 
44
43
  # entity foreign key - referenced entity code name (required)
@@ -47,10 +46,7 @@ module ADIWG
47
46
  intFKey[:fkReferencedEntity] = hFKey['referencedEntityCodeName']
48
47
  end
49
48
  if intFKey[:fkReferencedEntity].nil? || intFKey[:fkReferencedEntity] == ''
50
- responseObj[:readerExecutionMessages] <<
51
- 'ERROR: mdJson reader: data entity foreign key referenced entity name is missing'
52
- responseObj[:readerExecutionPass] = false
53
- return nil
49
+ @MessagePath.issueError(252, responseObj, inContext)
54
50
  end
55
51
 
56
52
  # entity foreign key - referenced attribute code name [] (required)
@@ -59,10 +55,7 @@ module ADIWG
59
55
  intFKey[:fkReferencedAttributes] = hFKey['referencedAttributeCodeName']
60
56
  end
61
57
  if intFKey[:fkReferencedAttributes].empty?
62
- responseObj[:readerExecutionMessages] <<
63
- 'ERROR: mdJson reader: data entity foreign key referenced attribute name is missing'
64
- responseObj[:readerExecutionPass] = false
65
- return nil
58
+ @MessagePath.issueError(253, responseObj, inContext)
66
59
  end
67
60
 
68
61
  return intFKey
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON V1 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-07 refactored for mdJson 2.0
7
7
  # Stan Smith 2015-07-24 added error reporting of missing items
8
8
  # Stan Smith 2015-07-14 refactored to remove global namespace constants
@@ -17,11 +17,13 @@ module ADIWG
17
17
 
18
18
  module EntityIndex
19
19
 
20
- def self.unpack(hIndex, responseObj)
20
+ def self.unpack(hIndex, 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 hIndex.empty?
24
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data dictionary entity index object is empty'
26
+ @MessagePath.issueWarning(260, responseObj, inContext)
25
27
  return nil
26
28
  end
27
29
 
@@ -35,9 +37,7 @@ module ADIWG
35
37
  intIndex[:indexCode] = hIndex['codeName']
36
38
  end
37
39
  if intIndex[:indexCode].nil? || intIndex[:indexCode] == ''
38
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary entity index code name is missing'
39
- responseObj[:readerExecutionPass] = false
40
- return nil
40
+ @MessagePath.issueError(261, responseObj, inContext)
41
41
  end
42
42
 
43
43
  # entity index - allow duplicates (required)
@@ -53,10 +53,7 @@ module ADIWG
53
53
  intIndex[:attributeNames] = hIndex['attributeCodeName']
54
54
  end
55
55
  if intIndex[:attributeNames].empty?
56
- responseObj[:readerExecutionMessages] <<
57
- 'ERROR: mdJson reader: data dictionary entity index attribute list is missing'
58
- responseObj[:readerExecutionPass] = false
59
- return nil
56
+ @MessagePath.issueError(262, responseObj, inContext)
60
57
  end
61
58
 
62
59
  return intIndex
@@ -2,7 +2,7 @@
2
2
  # Reader - mdJson 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-30 original script
7
7
 
8
8
  require_relative 'module_geographicExtent'
@@ -16,11 +16,13 @@ module ADIWG
16
16
 
17
17
  module Extent
18
18
 
19
- def self.unpack(hExtent, responseObj)
19
+ def self.unpack(hExtent, 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 hExtent.empty?
23
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: extent object is empty'
25
+ @MessagePath.issueWarning(270, responseObj, inContext)
24
26
  return nil
25
27
  end
26
28
 
@@ -28,6 +30,9 @@ module ADIWG
28
30
  intMetadataClass = InternalMetadata.new
29
31
  intExtent = intMetadataClass.newExtent
30
32
 
33
+ outContext = 'extent'
34
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
35
+
31
36
  haveExtent = false
32
37
 
33
38
  # extent - description
@@ -42,7 +47,7 @@ module ADIWG
42
47
  if hExtent.has_key?('geographicExtent')
43
48
  hExtent['geographicExtent'].each do |item|
44
49
  unless item.empty?
45
- hReturn = GeographicExtent.unpack(item, responseObj)
50
+ hReturn = GeographicExtent.unpack(item, responseObj, outContext)
46
51
  unless hReturn.nil?
47
52
  intExtent[:geographicExtents] << hReturn
48
53
  haveExtent = true
@@ -55,7 +60,7 @@ module ADIWG
55
60
  if hExtent.has_key?('temporalExtent')
56
61
  hExtent['temporalExtent'].each do |item|
57
62
  unless item.empty?
58
- hReturn = TemporalExtent.unpack(item, responseObj)
63
+ hReturn = TemporalExtent.unpack(item, responseObj, outContext)
59
64
  unless hReturn.nil?
60
65
  intExtent[:temporalExtents] << hReturn
61
66
  haveExtent = true
@@ -68,7 +73,7 @@ module ADIWG
68
73
  if hExtent.has_key?('verticalExtent')
69
74
  hExtent['verticalExtent'].each do |item|
70
75
  unless item.empty?
71
- hReturn = VerticalExtent.unpack(item, responseObj)
76
+ hReturn = VerticalExtent.unpack(item, responseObj, outContext)
72
77
  unless hReturn.nil?
73
78
  intExtent[:verticalExtents] << hReturn
74
79
  haveExtent = true
@@ -79,10 +84,7 @@ module ADIWG
79
84
 
80
85
  # error messages
81
86
  unless haveExtent
82
- responseObj[:readerExecutionMessages] <<
83
- 'ERROR: mdJson reader: extent must have description or at least one geographic, temporal, or vertical extent'
84
- responseObj[:readerExecutionPass] = false
85
- return nil
87
+ @MessagePath.issueError(271, responseObj, inContext)
86
88
  end
87
89
 
88
90
  return intExtent
@@ -2,12 +2,12 @@
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-19 refactored error and warning messaging
6
6
  # Stan Smith 2016-11-10 added computedBbox computation
7
7
  # Stan Smith 2016-10-25 original script
8
8
 
9
- require_relative 'module_geoJson'
10
9
  require 'adiwg/mdtranslator/internal/module_coordinates'
10
+ require_relative 'module_geoJson'
11
11
 
12
12
  module ADIWG
13
13
  module Mdtranslator
@@ -18,9 +18,11 @@ module ADIWG
18
18
 
19
19
  def self.unpack(hFeatCol, responseObj)
20
20
 
21
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
22
+
21
23
  # return nil object if input is empty
22
24
  if hFeatCol.empty?
23
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: GeoJson feature collection object is empty'
25
+ @MessagePath.issueWarning(280, responseObj)
24
26
  return nil
25
27
  end
26
28
 
@@ -34,17 +36,12 @@ module ADIWG
34
36
  if hFeatCol['type'] == 'FeatureCollection'
35
37
  intFeatCol[:type] = hFeatCol['type']
36
38
  else
37
- responseObj[:readerExecutionMessages] <<
38
- 'ERROR: mdJson reader: GeoJson feature collection type must be FeatureCollection'
39
- responseObj[:readerExecutionPass] = false
40
- return nil
39
+ @MessagePath.issueError(281, responseObj)
41
40
  end
42
41
  end
43
42
  end
44
43
  if intFeatCol[:type].nil? || intFeatCol[:type] == ''
45
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GeoJson feature collection type is missing'
46
- responseObj[:readerExecutionPass] = false
47
- return nil
44
+ @MessagePath.issueError(282, responseObj)
48
45
  end
49
46
 
50
47
  # feature collection - bounding box
@@ -63,9 +60,7 @@ module ADIWG
63
60
  end
64
61
  end
65
62
  else
66
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GeoJson feature collection features are missing'
67
- responseObj[:readerExecutionPass] = false
68
- return nil
63
+ @MessagePath.issueError(283, responseObj)
69
64
  end
70
65
 
71
66
  # geometry feature - computed bounding box for extent
@@ -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-19 refactored error and warning messaging
6
6
  # Stan Smith 2018-02-05 add 'technicalPrerequisite'
7
7
  # Stan Smith 2016-10-20 original script
8
8
 
@@ -15,11 +15,13 @@ module ADIWG
15
15
 
16
16
  module Format
17
17
 
18
- def self.unpack(hFormat, responseObj)
18
+ def self.unpack(hFormat, 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 hFormat.empty?
22
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: distribution media format object is empty'
24
+ @MessagePath.issueWarning(290, responseObj, inContext)
23
25
  return nil
24
26
  end
25
27
 
@@ -27,20 +29,21 @@ module ADIWG
27
29
  intMetadataClass = InternalMetadata.new
28
30
  intFormat = intMetadataClass.newResourceFormat
29
31
 
32
+ outContext = 'medium format'
33
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
34
+
30
35
  # format - format specification {citation} (required)
31
36
  if hFormat.has_key?('formatSpecification')
32
37
  hObject = hFormat['formatSpecification']
33
38
  unless hObject.empty?
34
- hReturn = Citation.unpack(hObject, responseObj)
39
+ hReturn = Citation.unpack(hObject, responseObj, outContext)
35
40
  unless hReturn.nil?
36
41
  intFormat[:formatSpecification] = hReturn
37
42
  end
38
43
  end
39
44
  end
40
45
  if intFormat[:formatSpecification].empty?
41
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: distribution media format specification is missing'
42
- responseObj[:readerExecutionPass] = false
43
- return nil
46
+ @MessagePath.issueError(291, responseObj, inContext)
44
47
  end
45
48
 
46
49
  # format - amendment number
@@ -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-19 refactored error and warning messaging
6
6
  # Stan Smith 2017-08-30 refactored for mdJson schema 2.3
7
7
  # Stan Smith 2016-10-30 original script
8
8
 
@@ -18,9 +18,11 @@ module ADIWG
18
18
 
19
19
  def self.unpack(hFunding, responseObj)
20
20
 
21
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
22
+
21
23
  # return nil object if input is empty
22
24
  if hFunding.empty?
23
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: funding object is empty'
25
+ @MessagePath.issueWarning(300, responseObj)
24
26
  return nil
25
27
  end
26
28
 
@@ -28,6 +30,8 @@ module ADIWG
28
30
  intMetadataClass = InternalMetadata.new
29
31
  intFunding = intMetadataClass.newFunding
30
32
 
33
+ outContext = 'funding'
34
+
31
35
  # funding - description
32
36
  if hFunding.has_key?('description')
33
37
  unless hFunding['description'] == ''
@@ -39,7 +43,7 @@ module ADIWG
39
43
  if hFunding.has_key?('timePeriod')
40
44
  hObject = hFunding['timePeriod']
41
45
  unless hObject.empty?
42
- hReturn = TimePeriod.unpack(hObject, responseObj)
46
+ hReturn = TimePeriod.unpack(hObject, responseObj, outContext)
43
47
  unless hReturn.nil?
44
48
  intFunding[:timePeriod] = hReturn
45
49
  end
@@ -59,9 +63,7 @@ module ADIWG
59
63
 
60
64
  # error messages
61
65
  if intFunding[:allocations].empty? && intFunding[:timePeriod].empty?
62
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: funding must have either allocation or timePeriod'
63
- responseObj[:readerExecutionPass] = false
64
- return nil
66
+ @MessagePath.issueError(301, responseObj)
65
67
  end
66
68
 
67
69
  return intFunding