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-19 refactored error and warning messaging
5
6
  # Stan Smith 2017-10-23 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 hLinePt.empty?
18
- responseObj[:readerExecutionMessages] << 'Oblique Line Point object is empty'
19
- responseObj[:readerExecutionPass] = false
19
+ responseObj[:readerExecutionMessages] <<
20
+ 'WARNING: mdJson reader: spatial reference oblique line-point object is empty'
20
21
  return nil
21
22
  end
22
23
 
@@ -29,7 +30,8 @@ module ADIWG
29
30
  intLinePoint[:azimuthLineLatitude] = hLinePt['azimuthLineLatitude']
30
31
  end
31
32
  if intLinePoint[:azimuthLineLatitude].nil? || intLinePoint[:azimuthLineLatitude] == ''
32
- responseObj[:readerExecutionMessages] << 'Azimuth line point latitude is missing'
33
+ responseObj[:readerExecutionMessages] <<
34
+ 'ERROR: mdJson reader: spatial reference oblique line-point latitude is missing'
33
35
  responseObj[:readerExecutionPass] = false
34
36
  return nil
35
37
  end
@@ -39,7 +41,8 @@ module ADIWG
39
41
  intLinePoint[:azimuthLineLongitude] = hLinePt['azimuthLineLongitude']
40
42
  end
41
43
  if intLinePoint[:azimuthLineLongitude].nil? || intLinePoint[:azimuthLineLongitude] == ''
42
- responseObj[:readerExecutionMessages] << 'Azimuth line point latitude is missing'
44
+ responseObj[:readerExecutionMessages] <<
45
+ 'ERROR: mdJson reader: spatial reference oblique line-point longitude is missing'
43
46
  responseObj[:readerExecutionPass] = false
44
47
  return nil
45
48
  end
@@ -2,81 +2,80 @@
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
6
  # Stan Smith 2016-10-03 original script
6
- # Stan Smith 2015-07-14 refactored to remove global namespace constants
7
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
8
- # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
9
- # Stan Smith 2014-12-10 changed to return nil intOlRes if input empty
10
- # Stan Smith 2014-08-21 changed url to uri for json 0.6.0
11
- # Stan Smith 2014-08-18 removed doi section for json 0.6.0
12
- # Stan Smith 2014-04-23 modified for json 0.3.0
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-15 refactored to handle namespacing readers and writers
10
+ # Stan Smith 2014-12-10 changed to return nil intOlRes if input empty
11
+ # Stan Smith 2014-08-21 changed url to uri for json 0.6.0
12
+ # Stan Smith 2014-08-18 removed doi section for json 0.6.0
13
+ # Stan Smith 2014-04-23 modified for json 0.3.0
13
14
  # Stan Smith 2013-09-25 original script
14
15
 
15
16
  module ADIWG
16
- module Mdtranslator
17
- module Readers
18
- module MdJson
17
+ module Mdtranslator
18
+ module Readers
19
+ module MdJson
19
20
 
20
- module OnlineResource
21
+ module OnlineResource
21
22
 
22
- def self.unpack(hOnlineRes, responseObj)
23
+ def self.unpack(hOnlineRes, responseObj)
23
24
 
24
- # return nil object if input is empty
25
- if hOnlineRes.empty?
26
- responseObj[:readerExecutionMessages] << 'OnlineResource object is empty'
27
- responseObj[:readerExecutionPass] = false
28
- return nil
29
- end
25
+ # return nil object if input is empty
26
+ if hOnlineRes.empty?
27
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: online resource object is empty'
28
+ return nil
29
+ end
30
30
 
31
- # instance classes needed in script
32
- intMetadataClass = InternalMetadata.new
33
- intOLRes = intMetadataClass.newOnlineResource
31
+ # instance classes needed in script
32
+ intMetadataClass = InternalMetadata.new
33
+ intOLRes = intMetadataClass.newOnlineResource
34
34
 
35
- # resource - web link (required)
36
- # return nil if no web link is provided
37
- if hOnlineRes.has_key?('uri')
38
- intOLRes[:olResURI] = hOnlineRes['uri']
39
- end
40
- if intOLRes[:olResURI].nil? || intOLRes[:olResURI] == ''
41
- responseObj[:readerExecutionMessages] << 'Online Resource URI is missing'
42
- responseObj[:readerExecutionPass] = false
43
- return nil
44
- end
35
+ # resource - web link (required)
36
+ if hOnlineRes.has_key?('uri')
37
+ intOLRes[:olResURI] = hOnlineRes['uri']
38
+ end
39
+ if intOLRes[:olResURI].nil? || intOLRes[:olResURI] == ''
40
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: online resource URI is missing'
41
+ responseObj[:readerExecutionPass] = false
42
+ return nil
43
+ end
45
44
 
46
- # resource - web link protocol
47
- if hOnlineRes.has_key?('protocol')
48
- if hOnlineRes['protocol'] != ''
49
- intOLRes[:olResProtocol] = hOnlineRes['protocol']
50
- end
51
- end
45
+ # resource - web link protocol
46
+ if hOnlineRes.has_key?('protocol')
47
+ unless hOnlineRes['protocol'] == ''
48
+ intOLRes[:olResProtocol] = hOnlineRes['protocol']
49
+ end
50
+ end
52
51
 
53
- # resource - web link name
54
- if hOnlineRes.has_key?('name')
55
- if hOnlineRes['name'] != ''
56
- intOLRes[:olResName] = hOnlineRes['name']
57
- end
58
- end
52
+ # resource - web link name
53
+ if hOnlineRes.has_key?('name')
54
+ unless hOnlineRes['name'] == ''
55
+ intOLRes[:olResName] = hOnlineRes['name']
56
+ end
57
+ end
59
58
 
60
- # resource - web link description
61
- if hOnlineRes.has_key?('description')
62
- if hOnlineRes['description'] != ''
63
- intOLRes[:olResDesc] = hOnlineRes['description']
64
- end
65
- end
59
+ # resource - web link description
60
+ if hOnlineRes.has_key?('description')
61
+ unless hOnlineRes['description'] == ''
62
+ intOLRes[:olResDesc] = hOnlineRes['description']
63
+ end
64
+ end
66
65
 
67
- # resource - web link function
68
- if hOnlineRes.has_key?('function')
69
- if hOnlineRes['function'] != ''
70
- intOLRes[:olResFunction] = hOnlineRes['function']
71
- end
72
- end
66
+ # resource - web link function
67
+ if hOnlineRes.has_key?('function')
68
+ unless hOnlineRes['function'] == ''
69
+ intOLRes[:olResFunction] = hOnlineRes['function']
70
+ end
71
+ end
73
72
 
74
- return intOLRes
75
- end
76
-
77
- end
73
+ return intOLRes
74
+ end
78
75
 
79
76
  end
80
- end
81
- end
77
+
78
+ end
79
+ end
80
+ end
82
81
  end
@@ -2,67 +2,67 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-10-21 original script
5
+ # Stan Smith 2018-02-19 refactored error and warning messaging
6
+ # Stan Smith 2016-10-21 original script
6
7
 
7
8
  require_relative 'module_dateTime'
8
9
 
9
10
  module ADIWG
10
- module Mdtranslator
11
- module Readers
12
- module MdJson
11
+ module Mdtranslator
12
+ module Readers
13
+ module MdJson
13
14
 
14
- module OrderProcess
15
+ module OrderProcess
15
16
 
16
- def self.unpack(hOrder, responseObj)
17
+ def self.unpack(hOrder, responseObj)
17
18
 
18
- # return nil object if input is empty
19
- if hOrder.empty?
20
- responseObj[:readerExecutionMessages] << 'Order Process object is empty'
21
- responseObj[:readerExecutionPass] = false
22
- return nil
23
- end
24
-
25
- # instance classes needed in script
26
- intMetadataClass = InternalMetadata.new
27
- intOrder = intMetadataClass.newOrderProcess
19
+ # return nil object if input is empty
20
+ if hOrder.empty?
21
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: distribution order process object is empty'
22
+ return nil
23
+ end
28
24
 
29
- # order process - fees
30
- if hOrder.has_key?('fees')
31
- if hOrder['fees'] != ''
32
- intOrder[:fees] = hOrder['fees']
33
- end
34
- end
25
+ # instance classes needed in script
26
+ intMetadataClass = InternalMetadata.new
27
+ intOrder = intMetadataClass.newOrderProcess
35
28
 
36
- # order process - planned availability
37
- if hOrder.has_key?('plannedAvailability')
38
- unless hOrder['plannedAvailability'].empty?
39
- hDate = DateTime.unpack(hOrder['plannedAvailability'], responseObj)
40
- unless hDate.nil?
41
- intOrder[:plannedAvailability] = hDate
42
- end
43
- end
44
- end
29
+ # order process - fees
30
+ if hOrder.has_key?('fees')
31
+ unless hOrder['fees'] == ''
32
+ intOrder[:fees] = hOrder['fees']
33
+ end
34
+ end
45
35
 
46
- # order process - ordering instructions
47
- if hOrder.has_key?('orderingInstructions')
48
- if hOrder['orderingInstructions'] != ''
49
- intOrder[:orderingInstructions] = hOrder['orderingInstructions']
50
- end
36
+ # order process - planned availability
37
+ if hOrder.has_key?('plannedAvailability')
38
+ unless hOrder['plannedAvailability'].empty?
39
+ hDate = DateTime.unpack(hOrder['plannedAvailability'], responseObj)
40
+ unless hDate.nil?
41
+ intOrder[:plannedAvailability] = hDate
51
42
  end
43
+ end
44
+ end
52
45
 
53
- # order process - turnaround
54
- if hOrder.has_key?('turnaround')
55
- if hOrder['turnaround'] != ''
56
- intOrder[:turnaround] = hOrder['turnaround']
57
- end
58
- end
46
+ # order process - ordering instructions
47
+ if hOrder.has_key?('orderingInstructions')
48
+ unless hOrder['orderingInstructions'] == ''
49
+ intOrder[:orderingInstructions] = hOrder['orderingInstructions']
50
+ end
51
+ end
59
52
 
60
- return intOrder
61
- end
53
+ # order process - turnaround
54
+ if hOrder.has_key?('turnaround')
55
+ unless hOrder['turnaround'] == ''
56
+ intOrder[:turnaround] = hOrder['turnaround']
57
+ end
58
+ end
62
59
 
63
- end
60
+ return intOrder
61
+ end
64
62
 
65
63
  end
66
- end
67
- end
64
+
65
+ end
66
+ end
67
+ end
68
68
  end
@@ -2,78 +2,78 @@
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
6
  # Stan Smith 2016-10-09 original script
6
7
 
7
8
  require_relative 'module_mdJson'
8
9
 
9
10
  module ADIWG
10
- module Mdtranslator
11
- module Readers
12
- module MdJson
11
+ module Mdtranslator
12
+ module Readers
13
+ module MdJson
13
14
 
14
- module Party
15
+ module Party
15
16
 
16
- def self.unpack(hParty, responseObj)
17
+ def self.unpack(hParty, responseObj)
17
18
 
18
- # return nil object if input is empty
19
- if hParty.empty?
20
- responseObj[:readerExecutionMessages] << 'Role Party object is empty'
21
- responseObj[:readerExecutionPass] = false
22
- return nil
23
- end
19
+ # return nil object if input is empty
20
+ if hParty.empty?
21
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: responsibility party object is empty'
22
+ return nil
23
+ end
24
24
 
25
- # instance classes needed in script
26
- intMetadataClass = InternalMetadata.new
27
- intParty = intMetadataClass.newParty
25
+ # instance classes needed in script
26
+ intMetadataClass = InternalMetadata.new
27
+ intParty = intMetadataClass.newParty
28
28
 
29
- # party - contact ID (required)
30
- if hParty.has_key?('contactId')
31
- intParty[:contactId] = hParty['contactId']
32
- end
33
- if intParty[:contactId].nil? || intParty[:contactId] == ''
34
- responseObj[:readerExecutionMessages] << 'Role Party contact ID is missing'
35
- responseObj[:readerExecutionPass] = false
36
- return nil
37
- end
29
+ # party - contact ID (required)
30
+ if hParty.has_key?('contactId')
31
+ intParty[:contactId] = hParty['contactId']
32
+ end
33
+ 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
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] << "Responsible 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]
49
- end
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]
49
+ end
50
50
 
51
- # party - organization members []
52
- # organization member contact IDs not found in 'contacts' are reported as warnings
53
- if intParty[:contactType] == 'organization'
54
- if hParty.has_key?('organizationMembers')
55
- hParty['organizationMembers'].each do |contactId|
56
- hContact = MdJson.findContact(contactId)
57
- if hContact[0].nil?
58
- responseObj[:readerExecutionMessages] << "Responsible Party organization member #{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
65
- end
66
- end
67
- end
51
+ # party - organization members []
52
+ # organization member contact IDs not found in 'contacts' are reported as warnings
53
+ if intParty[:contactType] == 'organization'
54
+ if hParty.has_key?('organizationMembers')
55
+ hParty['organizationMembers'].each do |contactId|
56
+ hContact = MdJson.findContact(contactId)
57
+ 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
65
+ end
68
66
  end
67
+ end
68
+ end
69
69
 
70
- return intParty
71
-
72
- end
70
+ return intParty
73
71
 
74
- end
72
+ end
75
73
 
76
74
  end
77
- end
78
- end
75
+
76
+ end
77
+ end
78
+ end
79
79
  end
@@ -2,67 +2,65 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-10-02 phone service is now an array rather than creating individual phone records per service
6
- # Stan Smith 2016-10-02 refactored for mdJson 2.0.0
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-15 refactored to handle namespacing readers and writers
10
- # Stan Smith 2014-12-09 return empty phone object if no phone number
11
- # Stan Smith 2014-05-14 combine phone service types
5
+ # Stan Smith 2018-02-19 refactored error and warning messaging
6
+ # Stan Smith 2016-10-02 phone service is now an array rather than creating individual phone records per service
7
+ # Stan Smith 2016-10-02 refactored for mdJson 2.0.0
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-15 refactored to handle namespacing readers and writers
11
+ # Stan Smith 2014-12-09 return empty phone object if no phone number
12
+ # Stan Smith 2014-05-14 combine phone service types
12
13
  # Stan Smith 2013-12-16 original script
13
14
 
14
15
  module ADIWG
15
- module Mdtranslator
16
- module Readers
17
- module MdJson
16
+ module Mdtranslator
17
+ module Readers
18
+ module MdJson
18
19
 
19
- module Phone
20
+ module Phone
20
21
 
21
- def self.unpack(hPhone, responseObj)
22
+ def self.unpack(hPhone, responseObj)
22
23
 
23
- # instance classes needed in script
24
- intMetadataClass = InternalMetadata.new
25
- intPhone = intMetadataClass.newPhone
24
+ # instance classes needed in script
25
+ intMetadataClass = InternalMetadata.new
26
+ intPhone = intMetadataClass.newPhone
26
27
 
27
- if hPhone.empty?
28
- responseObj[:readerExecutionMessages] << 'Phone object is empty'
29
- responseObj[:readerExecutionPass] = false
30
- return nil
31
- end
28
+ if hPhone.empty?
29
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: phone object is empty'
30
+ return nil
31
+ end
32
32
 
33
- # phone - phoneNumber (required)
34
- # return nil if no phone number is provided
35
- if hPhone.has_key?('phoneNumber')
36
- intPhone[:phoneNumber] = hPhone['phoneNumber']
37
- end
38
- if hPhone['phoneNumber'].nil? || hPhone['phoneNumber'] == ''
39
- responseObj[:readerExecutionMessages] << 'Phone object did not provide a phone number'
40
- responseObj[:readerExecutionPass] = false
41
- return nil
42
- end
33
+ # phone - phoneNumber (required)
34
+ # return nil if no phone number is provided
35
+ if hPhone.has_key?('phoneNumber')
36
+ intPhone[:phoneNumber] = hPhone['phoneNumber']
37
+ end
38
+ if hPhone['phoneNumber'].nil? || hPhone['phoneNumber'] == ''
39
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: phone number is missing'
40
+ responseObj[:readerExecutionPass] = false
41
+ return nil
42
+ end
43
43
 
44
- # phone - phoneName
45
- if hPhone.has_key?('phoneName')
46
- if hPhone['phoneName'] != ''
47
- intPhone[:phoneName] = hPhone['phoneName']
48
- end
49
- end
44
+ # phone - phoneName
45
+ if hPhone.has_key?('phoneName')
46
+ unless hPhone['phoneName'] == ''
47
+ intPhone[:phoneName] = hPhone['phoneName']
48
+ end
49
+ end
50
50
 
51
- # phone - service (recommended)
52
- if hPhone.has_key?('service')
53
- intPhone[:phoneServiceTypes] = hPhone['service']
54
- else
55
- intPhone[:phoneServiceTypes] = []
56
- end
57
- if intPhone[:phoneServiceTypes].empty?
58
- responseObj[:readerExecutionMessages] << 'Phone object did not provide a service'
59
- end
60
-
61
- return intPhone
62
- end
63
- end
51
+ # phone - service (recommended)
52
+ if hPhone.has_key?('service')
53
+ intPhone[:phoneServiceTypes] = hPhone['service']
54
+ end
55
+ if intPhone[:phoneServiceTypes].empty?
56
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: phone service type is missing'
57
+ end
64
58
 
59
+ return intPhone
60
+ end
65
61
  end
66
- end
67
- end
62
+
63
+ end
64
+ end
65
+ end
68
66
  end
@@ -2,6 +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
6
  # Stan Smith 2017-08-30 added support for process step sources
6
7
  # Stan Smith 2016-10-15 refactored for mdJson 2.0
7
8
  # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
@@ -25,8 +26,7 @@ module ADIWG
25
26
 
26
27
  # return nil object if input is empty
27
28
  if hProcStep.empty?
28
- responseObj[:readerExecutionMessages] << 'Process Step object is empty'
29
- responseObj[:readerExecutionPass] = false
29
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: process step object is empty'
30
30
  return nil
31
31
  end
32
32
 
@@ -36,24 +36,24 @@ module ADIWG
36
36
 
37
37
  # process step - step ID
38
38
  if hProcStep.has_key?('stepId')
39
- if hProcStep['stepId'] != ''
39
+ unless hProcStep['stepId'] == ''
40
40
  intProcStep[:stepId] = hProcStep['stepId']
41
41
  end
42
42
  end
43
43
 
44
- # process step - description - required
44
+ # process step - description - (required)
45
45
  if hProcStep.has_key?('description')
46
46
  intProcStep[:description] = hProcStep['description']
47
47
  end
48
48
  if intProcStep[:description].nil? || intProcStep[:description] == ''
49
- responseObj[:readerExecutionMessages] << 'Process Step attribute description is missing'
49
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: process step description is missing'
50
50
  responseObj[:readerExecutionPass] = false
51
51
  return nil
52
52
  end
53
53
 
54
54
  # process step - rationale
55
55
  if hProcStep.has_key?('rationale')
56
- if hProcStep['rationale'] != ''
56
+ unless hProcStep['rationale'] == ''
57
57
  intProcStep[:rationale] = hProcStep['rationale']
58
58
  end
59
59
  end