adiwg-mdtranslator 2.9.2 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -2
  3. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +8 -8
  4. data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +179 -160
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +1 -2
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +1 -2
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +1 -2
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +1 -2
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +1 -2
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +1 -2
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +1 -2
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +1 -2
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +1 -2
  14. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +1 -2
  15. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +1 -2
  16. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +1 -2
  17. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +1 -2
  18. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +1 -2
  19. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +1 -2
  20. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +1 -2
  21. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +1 -2
  22. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +1 -2
  23. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +1 -2
  24. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +1 -2
  25. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +1 -2
  26. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +16 -4
  27. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_citation.rb +14 -1
  28. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_codeSet.rb +8 -2
  29. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +36 -8
  30. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +2 -2
  31. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +2 -2
  32. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_digitalForm.rb +8 -2
  33. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_distribution.rb +8 -2
  34. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +12 -3
  35. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb +5 -0
  36. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +4 -1
  37. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +12 -3
  38. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +2 -2
  39. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +13 -4
  40. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +13 -4
  41. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geologicAge.rb +6 -0
  42. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +3 -3
  43. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +58 -12
  44. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +36 -0
  45. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb +8 -2
  46. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +1 -1
  47. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +51 -12
  48. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +46 -9
  49. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapLocalPlanar.rb +8 -2
  50. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +4 -1
  51. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb +10 -4
  52. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb +4 -1
  53. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_offlineOption.rb +16 -4
  54. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_onlineOption.rb +13 -4
  55. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_orderProcess.rb +9 -1
  56. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_pointVector.rb +21 -4
  57. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb +8 -1
  58. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_publication.rb +8 -2
  59. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb +14 -3
  60. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +8 -2
  61. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_raster.rb +12 -3
  62. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_security.rb +12 -3
  63. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_series.rb +8 -2
  64. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_source.rb +20 -5
  65. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb +32 -8
  66. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonClass.rb +8 -2
  67. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +20 -5
  68. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +8 -2
  69. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +4 -1
  70. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +12 -3
  71. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +9 -0
  72. data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +2 -1
  73. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +10 -10
  74. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +13 -16
  75. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +55 -55
  76. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +85 -85
  77. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +8 -8
  78. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +91 -92
  79. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +212 -212
  80. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +43 -43
  81. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +8 -8
  82. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +11 -11
  83. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +17 -17
  84. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +26 -13
  85. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +13 -12
  86. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +8 -5
  87. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +77 -77
  88. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +9 -7
  89. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +54 -54
  90. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +35 -35
  91. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +70 -70
  92. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +15 -4
  93. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +53 -53
  94. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +5 -5
  95. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +5 -5
  96. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +92 -91
  97. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +10 -10
  98. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +28 -18
  99. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +58 -59
  100. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +52 -53
  101. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +70 -56
  102. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +64 -63
  103. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +6 -6
  104. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +9 -6
  105. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +47 -47
  106. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +7 -7
  107. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -7
  108. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +6 -5
  109. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +6 -6
  110. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +63 -63
  111. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +84 -84
  112. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +50 -49
  113. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +57 -57
  114. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +115 -100
  115. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +85 -82
  116. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +46 -46
  117. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +78 -78
  118. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +61 -56
  119. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +72 -72
  120. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +106 -107
  121. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +4 -4
  122. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +46 -46
  123. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +55 -51
  124. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +87 -83
  125. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +46 -46
  126. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +73 -74
  127. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +11 -5
  128. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +56 -55
  129. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +88 -88
  130. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +106 -105
  131. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +4 -3
  132. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +4 -4
  133. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -4
  134. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +60 -61
  135. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +47 -47
  136. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +57 -57
  137. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +49 -51
  138. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +6 -6
  139. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +31 -30
  140. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +16 -2
  141. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +53 -47
  142. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +15 -13
  143. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +46 -46
  144. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +95 -95
  145. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +67 -67
  146. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +47 -46
  147. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +47 -47
  148. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +68 -63
  149. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +50 -50
  150. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +38 -38
  151. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +8 -8
  152. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +6 -5
  153. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +77 -75
  154. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +8 -14
  155. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +71 -72
  156. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +46 -45
  157. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +118 -116
  158. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +48 -46
  159. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +8 -8
  160. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +50 -50
  161. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +21 -14
  162. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +86 -75
  163. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +4 -4
  164. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +45 -45
  165. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +45 -33
  166. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +28 -6
  167. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +59 -59
  168. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +43 -43
  169. data/lib/adiwg/mdtranslator/readers/mdReaders.rb +6 -2
  170. data/lib/adiwg/mdtranslator/version.rb +9 -1
  171. data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +3 -3
  172. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureConstraint.rb +50 -46
  173. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb +53 -43
  174. data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +3 -1
  175. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entityAttribute.rb +1 -1
  176. data/lib/adiwg/mdtranslator/writers/mdWriters.rb +58 -58
  177. data/lib/adiwg/mdtranslator.rb +177 -165
  178. data/lib/adiwg/mdtranslator_cli.rb +8 -3
  179. metadata +2 -2
@@ -2,6 +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
6
  # Stan Smith 2017-09-28 add altitude to support fgdc
6
7
  # Stan Smith 2016-12-01 original script
7
8
 
@@ -16,8 +17,7 @@ module ADIWG
16
17
 
17
18
  # return nil object if input is empty
18
19
  if hBBox.empty?
19
- responseObj[:readerExecutionMessages] << 'boundingBox object is empty'
20
- responseObj[:readerExecutionPass] = false
20
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: bounding box object is empty'
21
21
  return nil
22
22
  end
23
23
 
@@ -30,12 +30,12 @@ module ADIWG
30
30
  intBBox[:westLongitude] = hBBox['westLongitude']
31
31
  end
32
32
  if intBBox[:westLongitude].nil? || intBBox[:westLongitude] == ''
33
- responseObj[:readerExecutionMessages] << 'boundingBox west boundary is missing'
33
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box west boundary is missing'
34
34
  responseObj[:readerExecutionPass] = false
35
35
  return nil
36
36
  end
37
37
  if intBBox[:westLongitude].abs > 180
38
- responseObj[:readerExecutionMessages] << 'boundingBox longitude must be between -180 and +180'
38
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box longitude must be between -180 and +180'
39
39
  responseObj[:readerExecutionPass] = false
40
40
  return nil
41
41
  end
@@ -45,12 +45,12 @@ module ADIWG
45
45
  intBBox[:eastLongitude] = hBBox['eastLongitude']
46
46
  end
47
47
  if intBBox[:eastLongitude].nil? || intBBox[:eastLongitude] == ''
48
- responseObj[:readerExecutionMessages] << 'boundingBox east boundary is missing'
48
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box east boundary is missing'
49
49
  responseObj[:readerExecutionPass] = false
50
50
  return nil
51
51
  end
52
52
  if intBBox[:eastLongitude].abs > 180
53
- responseObj[:readerExecutionMessages] << 'boundingBox longitude must be between -180 and +180'
53
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box longitude must be between -180 and +180'
54
54
  responseObj[:readerExecutionPass] = false
55
55
  return nil
56
56
  end
@@ -60,12 +60,12 @@ module ADIWG
60
60
  intBBox[:southLatitude] = hBBox['southLatitude']
61
61
  end
62
62
  if intBBox[:southLatitude].nil? || intBBox[:southLatitude] == ''
63
- responseObj[:readerExecutionMessages] << 'boundingBox south boundary is missing'
63
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box south boundary is missing'
64
64
  responseObj[:readerExecutionPass] = false
65
65
  return nil
66
66
  end
67
67
  if intBBox[:southLatitude].abs > 90
68
- responseObj[:readerExecutionMessages] << 'boundingBox latitude must be between -90 and +90'
68
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box latitude must be between -90 and +90'
69
69
  responseObj[:readerExecutionPass] = false
70
70
  return nil
71
71
  end
@@ -75,12 +75,12 @@ module ADIWG
75
75
  intBBox[:northLatitude] = hBBox['northLatitude']
76
76
  end
77
77
  if intBBox[:northLatitude].nil? || intBBox[:northLatitude] == ''
78
- responseObj[:readerExecutionMessages] << 'boundingBox north boundary is missing'
78
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box north boundary is missing'
79
79
  responseObj[:readerExecutionPass] = false
80
80
  return nil
81
81
  end
82
82
  if intBBox[:northLatitude].abs > 90
83
- responseObj[:readerExecutionMessages] << 'boundingBox latitude must be between -90 and +90'
83
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box latitude must be between -90 and +90'
84
84
  responseObj[:readerExecutionPass] = false
85
85
  return nil
86
86
  end
@@ -107,7 +107,7 @@ module ADIWG
107
107
  end
108
108
  unless intBBox[:minimumAltitude].nil? && intBBox[:maximumAltitude].nil?
109
109
  if intBBox[:unitsOfAltitude].nil? || intBBox[:unitsOfAltitude] == ''
110
- responseObj[:readerExecutionMessages] << 'boundingBox altitude unit of measure is missing'
110
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box altitude units of measure are missing'
111
111
  responseObj[:readerExecutionPass] = false
112
112
  return nil
113
113
  end
@@ -2,16 +2,17 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-10-13 refactored for mdJson 2.0
6
- # Stan Smith 2015-08-28 added alternate title
7
- # Stan Smith 2015-07-14 refactored to remove global namespace constants
8
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
9
- # Stan Smith 2014-12-30 refactored
10
- # Stan Smith 2014-12-19 refactored to return nil when hCitation is empty
11
- # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
12
- # Stan Smith 2014-08-18 changed additionalIdentifier section to identifier schema 0.6.0
13
- # Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
14
- # Stan Smith 2014-04-25 modified to support json schema 0.3.0
5
+ # Stan Smith 2018-02-18 refactored error and warning messaging
6
+ # Stan Smith 2016-10-13 refactored for mdJson 2.0
7
+ # Stan Smith 2015-08-28 added alternate title
8
+ # Stan Smith 2015-07-14 refactored to remove global namespace constants
9
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
10
+ # Stan Smith 2014-12-30 refactored
11
+ # Stan Smith 2014-12-19 refactored to return nil when hCitation is empty
12
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
13
+ # Stan Smith 2014-08-18 changed additionalIdentifier section to identifier schema 0.6.0
14
+ # Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
15
+ # Stan Smith 2014-04-25 modified to support json schema 0.3.0
15
16
  # Stan Smith 2013-08-26 original script
16
17
 
17
18
  require_relative 'module_date'
@@ -33,8 +34,7 @@ module ADIWG
33
34
 
34
35
  # return nil object if input is empty
35
36
  if hCitation.empty?
36
- responseObj[:readerExecutionMessages] << 'Citation object is empty'
37
- responseObj[:readerExecutionPass] = false
37
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: citation object is empty'
38
38
  return nil
39
39
  end
40
40
 
@@ -47,7 +47,7 @@ module ADIWG
47
47
  intCitation[:title] = hCitation['title']
48
48
  end
49
49
  if intCitation[:title].nil? || intCitation[:title] == ''
50
- responseObj[:readerExecutionMessages] << 'Citation attribute title is missing'
50
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: citation title is missing'
51
51
  responseObj[:readerExecutionPass] = false
52
52
  return nil
53
53
  end
@@ -55,7 +55,7 @@ module ADIWG
55
55
  # citation - alternate title []
56
56
  if hCitation.has_key?('alternateTitle')
57
57
  hCitation['alternateTitle'].each do |item|
58
- if item != ''
58
+ unless item == ''
59
59
  intCitation[:alternateTitles] << item
60
60
  end
61
61
  end
@@ -74,7 +74,7 @@ module ADIWG
74
74
 
75
75
  # citation - edition
76
76
  if hCitation.has_key?('edition')
77
- if hCitation['edition'] != ''
77
+ unless hCitation['edition'] == ''
78
78
  intCitation[:edition] = hCitation['edition']
79
79
  end
80
80
  end
@@ -93,7 +93,7 @@ module ADIWG
93
93
  # citation - presentation form []
94
94
  if hCitation.has_key?('presentationForm')
95
95
  hCitation['presentationForm'].each do |item|
96
- if item != ''
96
+ unless item == ''
97
97
  intCitation[:presentationForms] << item
98
98
  end
99
99
  end
@@ -124,7 +124,7 @@ module ADIWG
124
124
  # citation - other details
125
125
  if hCitation.has_key?('otherCitationDetails')
126
126
  hCitation['otherCitationDetails'].each do |item|
127
- if item != ''
127
+ unless item == ''
128
128
  intCitation[:otherDetails] << item
129
129
  end
130
130
  end
@@ -2,6 +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
6
  # Stan Smith 2016-10-15 original script
6
7
 
7
8
  require_relative 'module_scope'
@@ -21,11 +22,9 @@ module ADIWG
21
22
 
22
23
  def self.unpack(hConstraint, responseObj)
23
24
 
24
-
25
25
  # return nil object if input is empty
26
26
  if hConstraint.empty?
27
- responseObj[:readerExecutionMessages] << 'Constraint object is empty'
28
- responseObj[:readerExecutionPass] = false
27
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: constraint object is empty'
29
28
  return nil
30
29
  end
31
30
 
@@ -36,19 +35,19 @@ module ADIWG
36
35
  # constraint - type (required)
37
36
  type = nil
38
37
  if hConstraint.has_key?('type')
39
- if hConstraint['type'] != ''
38
+ unless hConstraint['type'] == ''
40
39
  type = hConstraint['type']
41
40
  if %w{ use legal security }.one? {|word| word == type}
42
41
  intConstraint[:type] = hConstraint['type']
43
42
  else
44
- responseObj[:readerExecutionMessages] << 'Constraint type must be use, legal, or security'
43
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: constraint type must be use, legal, or security'
45
44
  responseObj[:readerExecutionPass] = false
46
45
  return nil
47
46
  end
48
47
  end
49
48
  end
50
49
  if intConstraint[:type].nil? || intConstraint[:type] == ''
51
- responseObj[:readerExecutionMessages] << 'Constraint type declaration is missing'
50
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: constraint type is missing'
52
51
  responseObj[:readerExecutionPass] = false
53
52
  return nil
54
53
  end
@@ -56,7 +55,7 @@ module ADIWG
56
55
  # constraint - use limitation [] (required if type='use')
57
56
  if hConstraint.has_key?('useLimitation')
58
57
  hConstraint['useLimitation'].each do |item|
59
- if item != ''
58
+ unless item == ''
60
59
  intConstraint[:useLimitation] << item
61
60
  end
62
61
  end
@@ -125,10 +124,17 @@ module ADIWG
125
124
  unless hReturn.nil?
126
125
  intConstraint[:legalConstraint] = hReturn
127
126
  end
127
+ if hReturn.nil?
128
+ return nil
129
+ end
128
130
  end
129
- end
130
- if intConstraint[:legalConstraint].empty?
131
- responseObj[:readerExecutionMessages] << 'Legal Constraint object is missing or empty'
131
+ if hObject.empty?
132
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: legal constraint object is missing'
133
+ responseObj[:readerExecutionPass] = false
134
+ return nil
135
+ end
136
+ else
137
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: legal constraint object is missing'
132
138
  responseObj[:readerExecutionPass] = false
133
139
  return nil
134
140
  end
@@ -142,10 +148,17 @@ module ADIWG
142
148
  unless hReturn.nil?
143
149
  intConstraint[:securityConstraint] = hReturn
144
150
  end
151
+ if hReturn.nil?
152
+ return nil
153
+ end
145
154
  end
146
- end
147
- if intConstraint[:securityConstraint].empty?
148
- responseObj[:readerExecutionMessages] << 'Security Constraint object is missing or empty'
155
+ if hObject.empty?
156
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: security constraint object is missing'
157
+ responseObj[:readerExecutionPass] = false
158
+ return nil
159
+ end
160
+ else
161
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: security constraint object is missing'
149
162
  responseObj[:readerExecutionPass] = false
150
163
  return nil
151
164
  end
@@ -2,7 +2,8 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-10-23 original script
5
+ # Stan Smith 2018-02-18 refactored error and warning messaging
6
+ # Stan Smith 2016-10-23 original script
6
7
 
7
8
  require_relative 'module_onlineResource'
8
9
  require_relative 'module_phone'
@@ -21,7 +22,7 @@ module ADIWG
21
22
 
22
23
  # return nil object if input is empty
23
24
  if hContact.empty?
24
- responseObj[:readerExecutionMessages] << 'Contact object is empty'
25
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: contact object is empty'
25
26
  responseObj[:readerExecutionPass] = false
26
27
  return nil
27
28
  end
@@ -35,7 +36,7 @@ module ADIWG
35
36
  intContact[:contactId] = hContact['contactId']
36
37
  end
37
38
  if intContact[:contactId].nil? || intContact[:contactId] == ''
38
- responseObj[:readerExecutionMessages] << 'Contact is missing contactId'
39
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: contact id is missing'
39
40
  responseObj[:readerExecutionPass] = false
40
41
  return nil
41
42
  end
@@ -49,7 +50,7 @@ module ADIWG
49
50
 
50
51
  # contact - position name
51
52
  if hContact.has_key?('positionName')
52
- if hContact['positionName'] != ''
53
+ unless hContact['positionName'] == ''
53
54
  intContact[:positionName] = hContact['positionName']
54
55
  end
55
56
  end
@@ -58,18 +59,18 @@ module ADIWG
58
59
  # ... isOrganization = true
59
60
  # ... isOrganization = false && positionName = nil
60
61
  if hContact.has_key?('name')
61
- if hContact['name'] != ''
62
+ unless hContact['name'] == ''
62
63
  intContact[:name] = hContact['name']
63
64
  end
64
65
  end
65
66
  if intContact[:name].nil? || intContact[:name] == ''
66
67
  if intContact[:isOrganization] === true
67
- responseObj[:readerExecutionMessages] << 'Organization contact is missing name'
68
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: organization contact name is missing'
68
69
  responseObj[:readerExecutionPass] = false
69
70
  return nil
70
71
  end
71
72
  if intContact[:positionName].nil? || intContact[:positionName] == ''
72
- responseObj[:readerExecutionMessages] << 'Individual contact is missing name and position'
73
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: individual contact name and/or position are missing'
73
74
  responseObj[:readerExecutionPass] = false
74
75
  return nil
75
76
  end
@@ -78,7 +79,7 @@ module ADIWG
78
79
  # contact - member of organization []
79
80
  if hContact.has_key?('memberOfOrganization')
80
81
  hContact['memberOfOrganization'].each do |item|
81
- if item != ''
82
+ unless item == ''
82
83
  intContact[:memberOfOrgs] << item
83
84
  end
84
85
  end
@@ -120,7 +121,7 @@ module ADIWG
120
121
  # contact - electronic mail addresses []
121
122
  if hContact.has_key?('electronicMailAddress')
122
123
  hContact['electronicMailAddress'].each do |item|
123
- if item != ''
124
+ unless item == ''
124
125
  intContact[:eMailList] << item
125
126
  end
126
127
  end
@@ -140,7 +141,7 @@ module ADIWG
140
141
  # contact - hours of service []
141
142
  if hContact.has_key?('hoursOfService')
142
143
  hContact['hoursOfService'].each do |item|
143
- if item != ''
144
+ unless item == ''
144
145
  intContact[:hoursOfService] << item
145
146
  end
146
147
  end
@@ -148,14 +149,14 @@ module ADIWG
148
149
 
149
150
  # contact - contact instructions
150
151
  if hContact.has_key?('contactInstructions')
151
- if hContact['contactInstructions'] != ''
152
+ unless hContact['contactInstructions'] == ''
152
153
  intContact[:contactInstructions] = hContact['contactInstructions']
153
154
  end
154
155
  end
155
156
 
156
157
  # contact - contact type
157
158
  if hContact.has_key?('contactType')
158
- if hContact['contactType'] != ''
159
+ unless hContact['contactType'] == ''
159
160
  intContact[:contactType] = hContact['contactType']
160
161
  end
161
162
  end
@@ -2,6 +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
6
  # Stan Smith 2017-10-19 original script
6
7
 
7
8
  module ADIWG
@@ -15,8 +16,8 @@ module ADIWG
15
16
 
16
17
  # return nil object if input is empty
17
18
  if hCoordRes.empty?
18
- responseObj[:readerExecutionMessages] << 'Coordinate Resolution object is empty'
19
- responseObj[:readerExecutionPass] = false
19
+ responseObj[:readerExecutionMessages] <<
20
+ 'WARNING: mdJson reader: spatial resolution coordinate resolution object is empty'
20
21
  return nil
21
22
  end
22
23
 
@@ -29,7 +30,8 @@ module ADIWG
29
30
  intCoordRes[:abscissaResolutionX] = hCoordRes['abscissaResolutionX']
30
31
  end
31
32
  if intCoordRes[:abscissaResolutionX].nil? || intCoordRes[:abscissaResolutionX] == ''
32
- responseObj[:readerExecutionMessages] << 'Coordinate Resolution is missing abscissa resolution'
33
+ responseObj[:readerExecutionMessages] <<
34
+ 'ERROR: mdJson reader: coordinate spatial resolution abscissa resolution is missing'
33
35
  responseObj[:readerExecutionPass] = false
34
36
  return nil
35
37
  end
@@ -39,7 +41,8 @@ module ADIWG
39
41
  intCoordRes[:ordinateResolutionY] = hCoordRes['ordinateResolutionY']
40
42
  end
41
43
  if intCoordRes[:ordinateResolutionY].nil? || intCoordRes[:ordinateResolutionY] == ''
42
- responseObj[:readerExecutionMessages] << 'Coordinate Resolution is missing ordinate resolution'
44
+ responseObj[:readerExecutionMessages] <<
45
+ 'ERROR: mdJson reader: coordinate spatial resolution ordinate resolution is missing'
43
46
  responseObj[:readerExecutionPass] = false
44
47
  return nil
45
48
  end
@@ -49,7 +52,7 @@ module ADIWG
49
52
  intCoordRes[:unitOfMeasure] = hCoordRes['unitOfMeasure']
50
53
  end
51
54
  if intCoordRes[:unitOfMeasure].nil? || intCoordRes[:unitOfMeasure] == ''
52
- responseObj[:readerExecutionMessages] << 'Coordinate Resolution is missing units of measure'
55
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: coordinate spatial resolution units are missing'
53
56
  responseObj[:readerExecutionPass] = false
54
57
  return nil
55
58
  end
@@ -2,6 +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
6
  # Stan Smith 2016-10-18 original script
6
7
 
7
8
  require_relative 'module_identifier'
@@ -9,88 +10,87 @@ require_relative 'module_attributeGroup'
9
10
  require_relative 'module_imageDescription'
10
11
 
11
12
  module ADIWG
12
- module Mdtranslator
13
- module Readers
14
- module MdJson
15
-
16
- module CoverageDescription
17
-
18
- def self.unpack(hContent, responseObj)
19
-
20
- # return nil object if input is empty
21
- if hContent.empty?
22
- responseObj[:readerExecutionMessages] << 'Content Info object is empty'
23
- responseObj[:readerExecutionPass] = false
24
- return nil
25
- end
26
-
27
- # instance classes needed in script
28
- intMetadataClass = InternalMetadata.new
29
- intContent = intMetadataClass.newCoverageDescription
30
-
31
- # content information - coverage name (required)
32
- if hContent.has_key?('coverageName')
33
- if hContent['coverageName'] != ''
34
- intContent[:coverageName] = hContent['coverageName']
35
- end
36
- end
37
- if intContent[:coverageName].nil?
38
- responseObj[:readerExecutionMessages] << 'Content Info attribute coverageName is missing '
39
- responseObj[:readerExecutionPass] = false
40
- return nil
41
- end
42
-
43
- # content information - coverage description (required)
44
- if hContent.has_key?('coverageDescription')
45
- if hContent['coverageDescription'] != ''
46
- intContent[:coverageDescription] = hContent['coverageDescription']
47
- end
48
- end
49
- if intContent[:coverageDescription].nil?
50
- responseObj[:readerExecutionMessages] << 'Content Info attribute coverageDescription is missing '
51
- responseObj[:readerExecutionPass] = false
52
- return nil
53
- end
54
-
55
- # content information - processing level code
56
- if hContent.has_key?('processingLevelCode')
57
- hObject = hContent['processingLevelCode']
58
- unless hObject.empty?
59
- hReturn = Identifier.unpack(hObject, responseObj)
60
- unless hReturn.nil?
61
- intContent[:processingLevelCode] = hReturn
62
- end
63
- end
13
+ module Mdtranslator
14
+ module Readers
15
+ module MdJson
16
+
17
+ module CoverageDescription
18
+
19
+ def self.unpack(hContent, responseObj)
20
+
21
+ # return nil object if input is empty
22
+ if hContent.empty?
23
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: coverage description object is empty'
24
+ return nil
25
+ end
26
+
27
+ # instance classes needed in script
28
+ intMetadataClass = InternalMetadata.new
29
+ intContent = intMetadataClass.newCoverageDescription
30
+
31
+ # content information - coverage name (required)
32
+ if hContent.has_key?('coverageName')
33
+ unless hContent['coverageName'] == ''
34
+ intContent[:coverageName] = hContent['coverageName']
35
+ end
36
+ end
37
+ if intContent[:coverageName].nil?
38
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: coverage description name is missing'
39
+ responseObj[:readerExecutionPass] = false
40
+ return nil
41
+ end
42
+
43
+ # content information - coverage description (required)
44
+ if hContent.has_key?('coverageDescription')
45
+ unless hContent['coverageDescription'] == ''
46
+ intContent[:coverageDescription] = hContent['coverageDescription']
47
+ end
48
+ end
49
+ if intContent[:coverageDescription].nil?
50
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: coverage description description is missing'
51
+ responseObj[:readerExecutionPass] = false
52
+ return nil
53
+ end
54
+
55
+ # content information - processing level code
56
+ if hContent.has_key?('processingLevelCode')
57
+ hObject = hContent['processingLevelCode']
58
+ unless hObject.empty?
59
+ hReturn = Identifier.unpack(hObject, responseObj)
60
+ unless hReturn.nil?
61
+ intContent[:processingLevelCode] = hReturn
64
62
  end
65
-
66
- # content information - attribute group []
67
- if hContent.has_key?('attributeGroup')
68
- hContent['attributeGroup'].each do |item|
69
- hAttGrp = AttributeGroup.unpack(item, responseObj)
70
- unless hAttGrp.nil?
71
- intContent[:attributeGroups] << hAttGrp
72
- end
73
- end
63
+ end
64
+ end
65
+
66
+ # content information - attribute group []
67
+ if hContent.has_key?('attributeGroup')
68
+ hContent['attributeGroup'].each do |item|
69
+ hAttGrp = AttributeGroup.unpack(item, responseObj)
70
+ unless hAttGrp.nil?
71
+ intContent[:attributeGroups] << hAttGrp
74
72
  end
75
-
76
- # content information - image description
77
- if hContent.has_key?('imageDescription')
78
- hObject = hContent['imageDescription']
79
- unless hObject.empty?
80
- hReturn = ImageDescription.unpack(hObject, responseObj)
81
- unless hReturn.nil?
82
- intContent[:imageDescription] = hReturn
83
- end
84
- end
73
+ end
74
+ end
75
+
76
+ # content information - image description
77
+ if hContent.has_key?('imageDescription')
78
+ hObject = hContent['imageDescription']
79
+ unless hObject.empty?
80
+ hReturn = ImageDescription.unpack(hObject, responseObj)
81
+ unless hReturn.nil?
82
+ intContent[:imageDescription] = hReturn
85
83
  end
84
+ end
85
+ end
86
86
 
87
- return intContent
87
+ return intContent
88
88
 
89
- end
90
-
91
- end
89
+ end
92
90
 
93
91
  end
94
- end
95
- end
92
+
93
+ end
94
+ end
95
+ end
96
96
  end