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-21 refactored error and warning messaging
6
6
  # Stan Smith 2016-10-20 original script
7
7
 
8
8
  require_relative 'module_citation'
@@ -15,14 +15,19 @@ module ADIWG
15
15
 
16
16
  module Medium
17
17
 
18
- def self.unpack(hMedium, responseObj)
18
+ def self.unpack(hMedium, 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 hMedium.empty?
22
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: offline distribution medium object is empty'
24
+ @MessagePath.issueWarning(550, responseObj, inContext)
23
25
  return nil
24
26
  end
25
27
 
28
+ outContext = 'offline option'
29
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
30
+
26
31
  # instance classes needed in script
27
32
  intMetadataClass = InternalMetadata.new
28
33
  intMedium = intMetadataClass.newMedium
@@ -31,7 +36,7 @@ module ADIWG
31
36
  if hMedium.has_key?('mediumSpecification')
32
37
  hObject = hMedium['mediumSpecification']
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
  intMedium[:mediumSpecification] = hReturn
37
42
  end
@@ -86,7 +91,7 @@ module ADIWG
86
91
  if hMedium.has_key?('identifier')
87
92
  hObject = hMedium['identifier']
88
93
  unless hObject.empty?
89
- hReturn = Identifier.unpack(hObject, responseObj)
94
+ hReturn = Identifier.unpack(hObject, responseObj, outContext)
90
95
  unless hReturn.nil?
91
96
  intMedium[:identifier] = hReturn
92
97
  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-21 refactored error and warning messaging
6
6
  # Stan Smith 2016-11-02 original script
7
7
 
8
8
  require_relative 'module_metadataInfo'
@@ -22,10 +22,11 @@ module ADIWG
22
22
 
23
23
  def self.unpack(hMetadata, responseObj)
24
24
 
25
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
26
+
25
27
  # return nil object if input is empty
26
28
  if hMetadata.empty?
27
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: metadata object is empty'
28
- responseObj[:readerExecutionPass] = false
29
+ @MessagePath.issueWarning(560, responseObj)
29
30
  return nil
30
31
  end
31
32
 
@@ -44,9 +45,7 @@ module ADIWG
44
45
  end
45
46
  end
46
47
  if intMetadata[:metadataInfo].empty?
47
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: metadata metadata-info object is missing'
48
- responseObj[:readerExecutionPass] = false
49
- return nil
48
+ @MessagePath.issueError(561, responseObj)
50
49
  end
51
50
 
52
51
  # metadata - resource info {resourceInfo} (required)
@@ -60,9 +59,7 @@ module ADIWG
60
59
  end
61
60
  end
62
61
  if intMetadata[:resourceInfo].empty?
63
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: metadata resource info object is missing'
64
- responseObj[:readerExecutionPass] = false
65
- return nil
62
+ @MessagePath.issueError(562, responseObj)
66
63
  end
67
64
 
68
65
  # metadata - resource lineage [] {lineage}
@@ -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-21 refactored error and warning messaging
6
6
  # Stan Smith 2018-01-27 add metadataConstraints
7
7
  # Stan Smith 2017-01-31 remove metadataCreationDate
8
8
  # Stan Smith 2016-10-31 original script
@@ -25,11 +25,11 @@ module ADIWG
25
25
 
26
26
  def self.unpack(hMetaInfo, responseObj)
27
27
 
28
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
28
29
 
29
30
  # return nil object if input is empty
30
31
  if hMetaInfo.empty?
31
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: metadata info object is empty'
32
- responseObj[:readerExecutionPass] = false
32
+ @MessagePath.issueError(570, responseObj)
33
33
  return nil
34
34
  end
35
35
 
@@ -37,11 +37,13 @@ module ADIWG
37
37
  intMetadataClass = InternalMetadata.new
38
38
  intMetaInfo = intMetadataClass.newMetadataInfo
39
39
 
40
+ outContext = 'metadata-info'
41
+
40
42
  # metadata information - metadata identifier {identifier}
41
43
  if hMetaInfo.has_key?('metadataIdentifier')
42
44
  hObject = hMetaInfo['metadataIdentifier']
43
45
  unless hObject.empty?
44
- hReturn = Identifier.unpack(hObject, responseObj)
46
+ hReturn = Identifier.unpack(hObject, responseObj, outContext)
45
47
  unless hReturn.nil?
46
48
  intMetaInfo[:metadataIdentifier] = hReturn
47
49
  end
@@ -52,7 +54,7 @@ module ADIWG
52
54
  if hMetaInfo.has_key?('parentMetadata')
53
55
  hObject = hMetaInfo['parentMetadata']
54
56
  unless hObject.empty?
55
- hReturn = Citation.unpack(hObject, responseObj)
57
+ hReturn = Citation.unpack(hObject, responseObj, outContext)
56
58
  unless hReturn.nil?
57
59
  intMetaInfo[:parentMetadata] = hReturn
58
60
  end
@@ -63,7 +65,7 @@ module ADIWG
63
65
  if hMetaInfo.has_key?('defaultMetadataLocale')
64
66
  hObject = hMetaInfo['defaultMetadataLocale']
65
67
  unless hObject.empty?
66
- hReturn = Locale.unpack(hObject, responseObj)
68
+ hReturn = Locale.unpack(hObject, responseObj, outContext)
67
69
  unless hReturn.nil?
68
70
  intMetaInfo[:defaultMetadataLocale] = hReturn
69
71
  end
@@ -74,7 +76,7 @@ module ADIWG
74
76
  if hMetaInfo.has_key?('otherMetadataLocale')
75
77
  aItems = hMetaInfo['otherMetadataLocale']
76
78
  aItems.each do |item|
77
- hReturn = Locale.unpack(item, responseObj)
79
+ hReturn = Locale.unpack(item, responseObj, outContext)
78
80
  unless hReturn.nil?
79
81
  intMetaInfo[:otherMetadataLocales] << hReturn
80
82
  end
@@ -85,23 +87,21 @@ module ADIWG
85
87
  if hMetaInfo.has_key?('metadataContact')
86
88
  aItems = hMetaInfo['metadataContact']
87
89
  aItems.each do |item|
88
- hReturn = ResponsibleParty.unpack(item, responseObj)
90
+ hReturn = ResponsibleParty.unpack(item, responseObj, outContext)
89
91
  unless hReturn.nil?
90
92
  intMetaInfo[:metadataContacts] << hReturn
91
93
  end
92
94
  end
93
95
  end
94
96
  if intMetaInfo[:metadataContacts].empty?
95
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: metadata info contact is missing'
96
- responseObj[:readerExecutionPass] = false
97
- return nil
97
+ @MessagePath.issueError(571, responseObj, outContext)
98
98
  end
99
99
 
100
100
  # metadata information - metadata dates [] {date}
101
101
  if hMetaInfo.has_key?('metadataDate')
102
102
  aItems = hMetaInfo['metadataDate']
103
103
  aItems.each do |item|
104
- hReturn = Date.unpack(item, responseObj)
104
+ hReturn = Date.unpack(item, responseObj, outContext)
105
105
  unless hReturn.nil?
106
106
  intMetaInfo[:metadataDates] << hReturn
107
107
  end
@@ -112,7 +112,7 @@ module ADIWG
112
112
  if hMetaInfo.has_key?('metadataOnlineResource')
113
113
  aItems = hMetaInfo['metadataOnlineResource']
114
114
  aItems.each do |item|
115
- hReturn = OnlineResource.unpack(item, responseObj)
115
+ hReturn = OnlineResource.unpack(item, responseObj, outContext)
116
116
  unless hReturn.nil?
117
117
  intMetaInfo[:metadataLinkages] << hReturn
118
118
  end
@@ -122,7 +122,7 @@ module ADIWG
122
122
  # metadata information - metadata constraint [] {constraint}
123
123
  if hMetaInfo.has_key?('metadataConstraint')
124
124
  hMetaInfo['metadataConstraint'].each do |hItem|
125
- hReturn = Constraint.unpack(hItem, responseObj)
125
+ hReturn = Constraint.unpack(hItem, responseObj, outContext)
126
126
  unless hReturn.nil?
127
127
  intMetaInfo[:metadataConstraints] << hReturn
128
128
  end
@@ -133,7 +133,7 @@ module ADIWG
133
133
  if hMetaInfo.has_key?('metadataMaintenance')
134
134
  hObject = hMetaInfo['metadataMaintenance']
135
135
  unless hObject.empty?
136
- hReturn = Maintenance.unpack(hObject, responseObj)
136
+ hReturn = Maintenance.unpack(hObject, responseObj, outContext)
137
137
  unless hReturn.nil?
138
138
  intMetaInfo[:metadataMaintenance] = hReturn
139
139
  end
@@ -144,7 +144,7 @@ module ADIWG
144
144
  if hMetaInfo.has_key?('alternateMetadataReference')
145
145
  aItems = hMetaInfo['alternateMetadataReference']
146
146
  aItems.each do |item|
147
- hReturn = Citation.unpack(item, responseObj)
147
+ hReturn = Citation.unpack(item, responseObj, outContext)
148
148
  unless hReturn.nil?
149
149
  intMetaInfo[:alternateMetadataReferences] << hReturn
150
150
  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-21 refactored error and warning messaging
6
6
  # Stan Smith 2017-06-06 add citation to repository
7
7
  # Stan Smith 2017-02-09 original script
8
8
 
@@ -17,9 +17,11 @@ module ADIWG
17
17
 
18
18
  def self.unpack(hMdDist, responseObj)
19
19
 
20
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
21
+
20
22
  # return nil object if input is empty
21
23
  if hMdDist.empty?
22
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: metadata repository object is empty'
24
+ @MessagePath.issueWarning(580, responseObj)
23
25
  return nil
24
26
  end
25
27
 
@@ -27,20 +29,20 @@ module ADIWG
27
29
  intMetadataClass = InternalMetadata.new
28
30
  intMdDist = intMetadataClass.newMetadataRepository
29
31
 
32
+ outContext = 'metadata repository'
33
+
30
34
  # metadata distribution - repository (required)
31
35
  if hMdDist.has_key?('repository')
32
36
  intMdDist[:repository] = hMdDist['repository']
33
37
  end
34
38
  if intMdDist[:repository].nil? || intMdDist[:repository] == ''
35
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: metadata repository name is missing'
36
- responseObj[:readerExecutionPass] = false
37
- return nil
39
+ @MessagePath.issueError(581, responseObj)
38
40
  end
39
41
 
40
42
  # metadata distribution - citation
41
43
  if hMdDist.has_key?('citation')
42
44
  unless hMdDist['citation'].empty?
43
- hReturn = Citation.unpack(hMdDist['citation'], responseObj)
45
+ hReturn = Citation.unpack(hMdDist['citation'], responseObj, outContext)
44
46
  unless hReturn.nil?
45
47
  intMdDist[:citation] = hReturn
46
48
  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-21 refactored error and warning messaging
6
6
  # Stan Smith 2017-10-23 original script
7
7
 
8
8
  module ADIWG
@@ -12,12 +12,13 @@ module ADIWG
12
12
 
13
13
  module ObliqueLinePoint
14
14
 
15
- def self.unpack(hLinePt, responseObj)
15
+ def self.unpack(hLinePt, 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 hLinePt.empty?
19
- responseObj[:readerExecutionMessages] <<
20
- 'WARNING: mdJson reader: spatial reference oblique line-point object is empty'
21
+ @MessagePath.issueWarning(590, responseObj, inContext)
21
22
  return nil
22
23
  end
23
24
 
@@ -30,10 +31,7 @@ module ADIWG
30
31
  intLinePoint[:azimuthLineLatitude] = hLinePt['azimuthLineLatitude']
31
32
  end
32
33
  if intLinePoint[:azimuthLineLatitude].nil? || intLinePoint[:azimuthLineLatitude] == ''
33
- responseObj[:readerExecutionMessages] <<
34
- 'ERROR: mdJson reader: spatial reference oblique line-point latitude is missing'
35
- responseObj[:readerExecutionPass] = false
36
- return nil
34
+ @MessagePath.issueError(591, responseObj, inContext)
37
35
  end
38
36
 
39
37
  # oblique line point - azimuth line longitude (required)
@@ -41,10 +39,7 @@ module ADIWG
41
39
  intLinePoint[:azimuthLineLongitude] = hLinePt['azimuthLineLongitude']
42
40
  end
43
41
  if intLinePoint[:azimuthLineLongitude].nil? || intLinePoint[:azimuthLineLongitude] == ''
44
- responseObj[:readerExecutionMessages] <<
45
- 'ERROR: mdJson reader: spatial reference oblique line-point longitude is missing'
46
- responseObj[:readerExecutionPass] = false
47
- return nil
42
+ @MessagePath.issueError(592, responseObj, inContext)
48
43
  end
49
44
 
50
45
  return intLinePoint
@@ -2,7 +2,7 @@
2
2
  # Reader - ADIwg JSON V1 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-03 original script
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)
@@ -20,11 +20,13 @@ module ADIWG
20
20
 
21
21
  module OnlineResource
22
22
 
23
- def self.unpack(hOnlineRes, responseObj)
23
+ def self.unpack(hOnlineRes, responseObj, inContext = nil)
24
+
25
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
24
26
 
25
27
  # return nil object if input is empty
26
28
  if hOnlineRes.empty?
27
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: online resource object is empty'
29
+ @MessagePath.issueWarning(600, responseObj, inContext)
28
30
  return nil
29
31
  end
30
32
 
@@ -37,9 +39,7 @@ module ADIWG
37
39
  intOLRes[:olResURI] = hOnlineRes['uri']
38
40
  end
39
41
  if intOLRes[:olResURI].nil? || intOLRes[:olResURI] == ''
40
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: online resource URI is missing'
41
- responseObj[:readerExecutionPass] = false
42
- return nil
42
+ @MessagePath.issueError(601, responseObj, inContext)
43
43
  end
44
44
 
45
45
  # resource - web link protocol
@@ -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-21 original script
7
7
 
8
8
  require_relative 'module_dateTime'
@@ -14,11 +14,13 @@ module ADIWG
14
14
 
15
15
  module OrderProcess
16
16
 
17
- def self.unpack(hOrder, responseObj)
17
+ def self.unpack(hOrder, 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 hOrder.empty?
21
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: distribution order process object is empty'
23
+ @MessagePath.issueWarning(610, responseObj, inContext)
22
24
  return nil
23
25
  end
24
26
 
@@ -2,11 +2,9 @@
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-09 original script
7
7
 
8
- require_relative 'module_mdJson'
9
-
10
8
  module ADIWG
11
9
  module Mdtranslator
12
10
  module Readers
@@ -14,11 +12,13 @@ module ADIWG
14
12
 
15
13
  module Party
16
14
 
17
- def self.unpack(hParty, responseObj)
15
+ def self.unpack(hParty, responseObj, inContext = nil)
16
+
17
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
18
18
 
19
19
  # return nil object if input is empty
20
20
  if hParty.empty?
21
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: responsibility party object is empty'
21
+ @MessagePath.issueWarning(620, responseObj, inContext)
22
22
  return nil
23
23
  end
24
24
 
@@ -27,25 +27,25 @@ module ADIWG
27
27
  intParty = intMetadataClass.newParty
28
28
 
29
29
  # party - contact ID (required)
30
+ # load party with contact index, contact type, and name
31
+ # return nil if contact ID does not exist in contact array
30
32
  if hParty.has_key?('contactId')
31
33
  intParty[:contactId] = hParty['contactId']
34
+ unless intParty[:contactId].nil? || intParty[:contactId] == ''
35
+ hContact = @MessagePath.findContact(hParty['contactId'])
36
+ if hContact[0].nil?
37
+ outContext = 'contact ID ' + intParty[:contactId]
38
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
39
+ @MessagePath.issueError(622, responseObj, outContext)
40
+ else
41
+ intParty[:contactIndex] = hContact[0]
42
+ intParty[:contactType] = hContact[1]
43
+ intParty[:contactName] = hContact[2]
44
+ end
45
+ end
32
46
  end
33
47
  if intParty[:contactId].nil? || intParty[:contactId] == ''
34
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: responsibility party contact ID is missing'
35
- responseObj[:readerExecutionPass] = false
36
- return nil
37
- end
38
-
39
- # party - contact index, contact type (computed)
40
- # return nil if contact ID does not exist in contact array
41
- hContact = MdJson.findContact(hParty['contactId'])
42
- if hContact[0].nil?
43
- responseObj[:readerExecutionMessages] << "ERROR: mdJson reader: responsibility party contact ID #{hParty['contactId']} not found"
44
- responseObj[:readerExecutionPass] = false
45
- return nil
46
- else
47
- intParty[:contactIndex] = hContact[0]
48
- intParty[:contactType] = hContact[1]
48
+ @MessagePath.issueError(621, responseObj, inContext)
49
49
  end
50
50
 
51
51
  # party - organization members []
@@ -53,15 +53,12 @@ module ADIWG
53
53
  if intParty[:contactType] == 'organization'
54
54
  if hParty.has_key?('organizationMembers')
55
55
  hParty['organizationMembers'].each do |contactId|
56
- hContact = MdJson.findContact(contactId)
56
+ intParty[:organizationMembers] << contactId
57
+ hContact = @MessagePath.findContact(contactId)
57
58
  if hContact[0].nil?
58
- responseObj[:readerExecutionMessages] << "WARNING: mdJson reader: responsibility party organization member contact ID #{contactId} not found"
59
- else
60
- newParty = intMetadataClass.newParty
61
- newParty[:contactId] = contactId
62
- newParty[:contactIndex] = hContact[0]
63
- newParty[:contactType] = hContact[1]
64
- intParty[:organizationMembers] << newParty
59
+ outContext = 'contact ID ' + contactId
60
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
61
+ @MessagePath.issueWarning(623, responseObj, outContext)
65
62
  end
66
63
  end
67
64
  end