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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -2
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +8 -8
- data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +179 -160
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +16 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_citation.rb +14 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_codeSet.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +36 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_digitalForm.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_distribution.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb +5 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geologicAge.rb +6 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +3 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +58 -12
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +36 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +51 -12
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +46 -9
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapLocalPlanar.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb +10 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_offlineOption.rb +16 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_onlineOption.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_orderProcess.rb +9 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_pointVector.rb +21 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb +8 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_publication.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb +14 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_raster.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_security.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_series.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_source.rb +20 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb +32 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonClass.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +20 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +9 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +10 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +13 -16
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +55 -55
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +85 -85
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +91 -92
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +212 -212
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +43 -43
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +11 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +17 -17
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +26 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +13 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +8 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +77 -77
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +9 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +54 -54
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +35 -35
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +70 -70
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +15 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +53 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +92 -91
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +10 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +28 -18
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +58 -59
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +52 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +70 -56
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +64 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +9 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +63 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +84 -84
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +50 -49
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +57 -57
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +115 -100
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +85 -82
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +78 -78
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +61 -56
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +72 -72
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +106 -107
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +55 -51
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +87 -83
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +73 -74
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +11 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +56 -55
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +88 -88
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +106 -105
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +4 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +60 -61
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +57 -57
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +49 -51
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +31 -30
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +16 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +53 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +15 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +95 -95
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +67 -67
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +47 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +68 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +50 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +38 -38
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +77 -75
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +8 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +71 -72
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +46 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +118 -116
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +48 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +50 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +21 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +86 -75
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +45 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +45 -33
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +28 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +59 -59
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +43 -43
- data/lib/adiwg/mdtranslator/readers/mdReaders.rb +6 -2
- data/lib/adiwg/mdtranslator/version.rb +9 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +3 -3
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureConstraint.rb +50 -46
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb +53 -43
- data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +3 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entityAttribute.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdWriters.rb +58 -58
- data/lib/adiwg/mdtranslator.rb +177 -165
- data/lib/adiwg/mdtranslator_cli.rb +8 -3
- metadata +2 -2
@@ -2,6 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
5
6
|
# Stan Smith 2017-11-01 added domainReference
|
6
7
|
# Stan Smith 2016-10-07 refactored for mdJson 2.0
|
7
8
|
# Stan Smith 2015-07-23 added error reporting of missing items
|
@@ -24,8 +25,7 @@ module ADIWG
|
|
24
25
|
|
25
26
|
# return nil object if input is empty
|
26
27
|
if hDomain.empty?
|
27
|
-
responseObj[:readerExecutionMessages] << '
|
28
|
-
responseObj[:readerExecutionPass] = false
|
28
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data dictionary domain object is empty'
|
29
29
|
return nil
|
30
30
|
end
|
31
31
|
|
@@ -38,7 +38,7 @@ module ADIWG
|
|
38
38
|
intDomain[:domainId] = hDomain['domainId']
|
39
39
|
end
|
40
40
|
if intDomain[:domainId].nil? || intDomain[:domainId] == ''
|
41
|
-
responseObj[:readerExecutionMessages] << '
|
41
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary domain ID is missing'
|
42
42
|
responseObj[:readerExecutionPass] = false
|
43
43
|
return nil
|
44
44
|
end
|
@@ -55,7 +55,7 @@ module ADIWG
|
|
55
55
|
intDomain[:domainCode] = hDomain['codeName']
|
56
56
|
end
|
57
57
|
if intDomain[:domainCode].nil? || intDomain[:domainCode] == ''
|
58
|
-
responseObj[:readerExecutionMessages] << '
|
58
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary domain code is missing'
|
59
59
|
responseObj[:readerExecutionPass] = false
|
60
60
|
return nil
|
61
61
|
end
|
@@ -65,7 +65,7 @@ module ADIWG
|
|
65
65
|
intDomain[:domainDescription] = hDomain['description']
|
66
66
|
end
|
67
67
|
if intDomain[:domainDescription].nil? || intDomain[:domainDescription] == ''
|
68
|
-
responseObj[:readerExecutionMessages] << '
|
68
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary domain description is missing'
|
69
69
|
responseObj[:readerExecutionPass] = false
|
70
70
|
return nil
|
71
71
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
5
6
|
# Stan Smith 2018-01-24 add domain item reference
|
6
7
|
# Stan Smith 2016-10-07 refactored for mdJson 2.0
|
7
8
|
# Stan Smith 2015-07-23 added error reporting of missing items
|
@@ -23,8 +24,7 @@ module ADIWG
|
|
23
24
|
|
24
25
|
# return nil object if input is empty
|
25
26
|
if hDomItem.empty?
|
26
|
-
responseObj[:readerExecutionMessages] << '
|
27
|
-
responseObj[:readerExecutionPass] = false
|
27
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data dictionary domain item object is empty'
|
28
28
|
return nil
|
29
29
|
end
|
30
30
|
|
@@ -37,7 +37,7 @@ module ADIWG
|
|
37
37
|
intItem[:itemName] = hDomItem['name']
|
38
38
|
end
|
39
39
|
if intItem[:itemName].nil? || intItem[:itemName] == ''
|
40
|
-
responseObj[:readerExecutionMessages] << '
|
40
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary domain item name is missing'
|
41
41
|
responseObj[:readerExecutionPass] = false
|
42
42
|
return nil
|
43
43
|
end
|
@@ -47,7 +47,7 @@ module ADIWG
|
|
47
47
|
intItem[:itemValue] = hDomItem['value']
|
48
48
|
end
|
49
49
|
if intItem[:itemValue].nil? || intItem[:itemValue] == ''
|
50
|
-
responseObj[:readerExecutionMessages] << '
|
50
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary domain item value is missing'
|
51
51
|
responseObj[:readerExecutionPass] = false
|
52
52
|
return nil
|
53
53
|
end
|
@@ -57,7 +57,7 @@ module ADIWG
|
|
57
57
|
intItem[:itemDefinition] = hDomItem['definition']
|
58
58
|
end
|
59
59
|
if intItem[:itemDefinition].nil? || intItem[:itemDefinition] == ''
|
60
|
-
responseObj[:readerExecutionMessages] << '
|
60
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary domain item definition is missing'
|
61
61
|
responseObj[:readerExecutionPass] = false
|
62
62
|
return nil
|
63
63
|
end
|
@@ -2,111 +2,112 @@
|
|
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-03 original script
|
6
7
|
|
7
8
|
module ADIWG
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
module Mdtranslator
|
10
|
+
module Readers
|
11
|
+
module MdJson
|
11
12
|
|
12
|
-
|
13
|
+
module Duration
|
13
14
|
|
14
|
-
|
15
|
+
def self.unpack(hDuration, responseObj)
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
17
|
+
# return nil object if input is empty
|
18
|
+
if hDuration.empty?
|
19
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: duration object is empty'
|
20
|
+
return nil
|
21
|
+
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
# instance classes needed in script
|
24
|
+
intMetadataClass = InternalMetadata.new
|
25
|
+
intDuration = intMetadataClass.newDuration
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
# duration - years
|
28
|
+
if hDuration.has_key?('years')
|
29
|
+
if hDuration['years'].nil?
|
30
|
+
intDuration[:years] = 0
|
31
|
+
else
|
32
|
+
intDuration[:years] = hDuration['years']
|
33
|
+
end
|
34
|
+
else
|
35
|
+
intDuration[:years] = 0
|
36
|
+
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
38
|
+
# duration - months
|
39
|
+
if hDuration.has_key?('months')
|
40
|
+
if hDuration['months'].nil?
|
41
|
+
intDuration[:months] = 0
|
42
|
+
else
|
43
|
+
intDuration[:months] = hDuration['months']
|
44
|
+
end
|
45
|
+
else
|
46
|
+
intDuration[:months] = 0
|
47
|
+
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
49
|
+
# duration - days
|
50
|
+
if hDuration.has_key?('days')
|
51
|
+
if hDuration['days'].nil?
|
52
|
+
intDuration[:days] = 0
|
53
|
+
else
|
54
|
+
intDuration[:days] = hDuration['days']
|
55
|
+
end
|
56
|
+
else
|
57
|
+
intDuration[:days] = 0
|
58
|
+
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
60
|
+
# duration - hours
|
61
|
+
if hDuration.has_key?('hours')
|
62
|
+
if hDuration['hours'].nil?
|
63
|
+
intDuration[:hours] = 0
|
64
|
+
else
|
65
|
+
intDuration[:hours] = hDuration['hours']
|
66
|
+
end
|
67
|
+
else
|
68
|
+
intDuration[:hours] = 0
|
69
|
+
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
71
|
+
# duration - minutes
|
72
|
+
if hDuration.has_key?('minutes')
|
73
|
+
if hDuration['minutes'].nil?
|
74
|
+
intDuration[:minutes] = 0
|
75
|
+
else
|
76
|
+
intDuration[:minutes] = hDuration['minutes']
|
77
|
+
end
|
78
|
+
else
|
79
|
+
intDuration[:minutes] = 0
|
80
|
+
end
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
82
|
+
# duration - seconds
|
83
|
+
if hDuration.has_key?('seconds')
|
84
|
+
if hDuration['seconds'].nil?
|
85
|
+
intDuration[:seconds] = 0
|
86
|
+
else
|
87
|
+
intDuration[:seconds] = hDuration['seconds']
|
88
|
+
end
|
89
|
+
else
|
90
|
+
intDuration[:seconds] = 0
|
91
|
+
end
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
return intDuration
|
106
|
-
end
|
107
|
-
end
|
93
|
+
# error messages
|
94
|
+
totalDuration = intDuration[:years] +
|
95
|
+
intDuration[:months] +
|
96
|
+
intDuration[:days] +
|
97
|
+
intDuration[:hours] +
|
98
|
+
intDuration[:minutes] +
|
99
|
+
intDuration[:seconds]
|
100
|
+
unless totalDuration > 0
|
101
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: duration not specified'
|
102
|
+
responseObj[:readerExecutionPass] = false
|
103
|
+
return nil
|
104
|
+
end
|
108
105
|
|
106
|
+
return intDuration
|
107
|
+
end
|
109
108
|
end
|
110
|
-
|
111
|
-
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
112
113
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# Reader - mdJson to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
5
6
|
# Stan Smith 2017-11-01 added entityReference, fieldSeparator, headerLines, quoteCharacter
|
6
7
|
# Stan Smith 2016-10-07 refactored for mdJson 2.0
|
7
8
|
# Stan Smith 2015-07-24 added error reporting of missing items
|
@@ -27,8 +28,7 @@ module ADIWG
|
|
27
28
|
|
28
29
|
# return nil object if input is empty
|
29
30
|
if hEntity.empty?
|
30
|
-
responseObj[:readerExecutionMessages] << '
|
31
|
-
responseObj[:readerExecutionPass] = false
|
31
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data dictionary entity object is empty'
|
32
32
|
return nil
|
33
33
|
end
|
34
34
|
|
@@ -46,7 +46,7 @@ module ADIWG
|
|
46
46
|
|
47
47
|
# entity - name
|
48
48
|
if hEntity.has_key?('commonName')
|
49
|
-
|
49
|
+
unless hEntity['commonName'] == ''
|
50
50
|
intEntity[:entityName] = hEntity['commonName']
|
51
51
|
end
|
52
52
|
end
|
@@ -56,7 +56,7 @@ module ADIWG
|
|
56
56
|
intEntity[:entityCode] = hEntity['codeName']
|
57
57
|
end
|
58
58
|
if intEntity[:entityCode].nil? || intEntity[:entityCode] == ''
|
59
|
-
responseObj[:readerExecutionMessages] << '
|
59
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary entity code name is missing'
|
60
60
|
responseObj[:readerExecutionPass] = false
|
61
61
|
return nil
|
62
62
|
end
|
@@ -64,7 +64,7 @@ module ADIWG
|
|
64
64
|
# entity - alias []
|
65
65
|
if hEntity.has_key?('alias')
|
66
66
|
hEntity['alias'].each do |item|
|
67
|
-
|
67
|
+
unless item == ''
|
68
68
|
intEntity[:entityAlias] << item
|
69
69
|
end
|
70
70
|
end
|
@@ -75,7 +75,7 @@ module ADIWG
|
|
75
75
|
intEntity[:entityDefinition] = hEntity['definition']
|
76
76
|
end
|
77
77
|
if intEntity[:entityDefinition].nil? || intEntity[:entityDefinition] == ''
|
78
|
-
responseObj[:readerExecutionMessages] << '
|
78
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary entity definition is missing'
|
79
79
|
responseObj[:readerExecutionPass] = false
|
80
80
|
return nil
|
81
81
|
end
|
@@ -95,7 +95,7 @@ module ADIWG
|
|
95
95
|
# data entity - primary key (NOT required)
|
96
96
|
if hEntity.has_key?('primaryKeyAttributeCodeName')
|
97
97
|
hEntity['primaryKeyAttributeCodeName'].each do |item|
|
98
|
-
|
98
|
+
unless item == ''
|
99
99
|
intEntity[:primaryKey] << item
|
100
100
|
end
|
101
101
|
end
|
@@ -139,21 +139,21 @@ module ADIWG
|
|
139
139
|
|
140
140
|
# entity - field separator
|
141
141
|
if hEntity.has_key?('fieldSeparatorCharacter')
|
142
|
-
|
142
|
+
unless hEntity['fieldSeparatorCharacter'] == ''
|
143
143
|
intEntity[:fieldSeparatorCharacter] = hEntity['fieldSeparatorCharacter']
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
147
|
# entity - number of header lines
|
148
148
|
if hEntity.has_key?('numberOfHeaderLines')
|
149
|
-
|
149
|
+
unless hEntity['numberOfHeaderLines'] == ''
|
150
150
|
intEntity[:numberOfHeaderLines] = hEntity['numberOfHeaderLines'].to_i
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
154
|
# entity - quote character
|
155
155
|
if hEntity.has_key?('quoteCharacter')
|
156
|
-
|
156
|
+
unless hEntity['quoteCharacter'] == ''
|
157
157
|
intEntity[:quoteCharacter] = hEntity['quoteCharacter']
|
158
158
|
end
|
159
159
|
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
6
|
+
# Stan Smith 2018-02-14 rename allowMany to mustBeUnique
|
5
7
|
# Stan Smith 2017-11-01 added new elements to support fgdc and flat files
|
6
8
|
# Stan Smith 2016-10-05 refactored for mdJson 2.0
|
7
9
|
# Stan Smith 2015-07-24 added error reporting of missing items
|
@@ -27,8 +29,7 @@ module ADIWG
|
|
27
29
|
|
28
30
|
# return nil object if input is empty
|
29
31
|
if hAttribute.empty?
|
30
|
-
responseObj[:readerExecutionMessages] << '
|
31
|
-
responseObj[:readerExecutionPass] = false
|
32
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data dictionary entity attribute object is empty'
|
32
33
|
return nil
|
33
34
|
end
|
34
35
|
|
@@ -38,7 +39,7 @@ module ADIWG
|
|
38
39
|
|
39
40
|
# attribute - common name
|
40
41
|
if hAttribute.has_key?('commonName')
|
41
|
-
|
42
|
+
unless hAttribute['commonName'] == ''
|
42
43
|
intAttribute[:attributeName] = hAttribute['commonName']
|
43
44
|
end
|
44
45
|
end
|
@@ -48,7 +49,7 @@ module ADIWG
|
|
48
49
|
intAttribute[:attributeCode] = hAttribute['codeName']
|
49
50
|
end
|
50
51
|
if intAttribute[:attributeCode].nil? || intAttribute[:attributeCode] == ''
|
51
|
-
responseObj[:readerExecutionMessages] << '
|
52
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary entity attribute code name is missing'
|
52
53
|
responseObj[:readerExecutionPass] = false
|
53
54
|
return nil
|
54
55
|
end
|
@@ -56,7 +57,7 @@ module ADIWG
|
|
56
57
|
# attribute - alias []
|
57
58
|
if hAttribute.has_key?('alias')
|
58
59
|
hAttribute['alias'].each do |item|
|
59
|
-
|
60
|
+
unless item == ''
|
60
61
|
intAttribute[:attributeAlias] << item
|
61
62
|
end
|
62
63
|
end
|
@@ -67,7 +68,7 @@ module ADIWG
|
|
67
68
|
intAttribute[:attributeDefinition] = hAttribute['definition']
|
68
69
|
end
|
69
70
|
if intAttribute[:attributeDefinition].nil? || intAttribute[:attributeDefinition] == ''
|
70
|
-
responseObj[:readerExecutionMessages] << '
|
71
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary entity attribute definition is missing'
|
71
72
|
responseObj[:readerExecutionPass] = false
|
72
73
|
return nil
|
73
74
|
end
|
@@ -88,77 +89,86 @@ module ADIWG
|
|
88
89
|
intAttribute[:dataType] = hAttribute['dataType']
|
89
90
|
end
|
90
91
|
if intAttribute[:dataType].nil? || intAttribute[:dataType] == ''
|
91
|
-
responseObj[:readerExecutionMessages] << '
|
92
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary entity attribute data type is missing'
|
92
93
|
responseObj[:readerExecutionPass] = false
|
93
94
|
return nil
|
94
95
|
end
|
95
96
|
|
96
|
-
# attribute -
|
97
|
+
# attribute - allow nulls (required)
|
97
98
|
if hAttribute.has_key?('allowNull')
|
98
99
|
if hAttribute['allowNull'] === true
|
99
100
|
intAttribute[:allowNull] = hAttribute['allowNull']
|
100
101
|
end
|
101
102
|
end
|
102
103
|
|
103
|
-
# attribute -
|
104
|
+
# attribute - require value to be unique (required)
|
105
|
+
# ... allowMany deprecated
|
104
106
|
if hAttribute.has_key?('allowMany')
|
105
107
|
if hAttribute['allowMany'] === true
|
106
|
-
intAttribute[:
|
108
|
+
intAttribute[:mustBeUnique] = hAttribute['allowMany']
|
109
|
+
responseObj[:readerExecutionMessages] <<
|
110
|
+
'WARNING: mdJson reader: data dictionary entity attribute "allowMany" is deprecated, use "mustBeUnique"'
|
111
|
+
return nil
|
112
|
+
end
|
113
|
+
end
|
114
|
+
if hAttribute.has_key?('mustBeUnique')
|
115
|
+
if hAttribute['mustBeUnique'] === true
|
116
|
+
intAttribute[:mustBeUnique] = hAttribute['mustBeUnique']
|
107
117
|
end
|
108
118
|
end
|
109
119
|
|
110
120
|
# attribute - units of measure
|
111
121
|
if hAttribute.has_key?('units')
|
112
|
-
|
122
|
+
unless hAttribute['units'] == ''
|
113
123
|
intAttribute[:unitOfMeasure] = hAttribute['units']
|
114
124
|
end
|
115
125
|
end
|
116
126
|
|
117
127
|
# attribute - units of measure resolution
|
118
128
|
if hAttribute.has_key?('unitsResolution')
|
119
|
-
|
129
|
+
unless hAttribute['unitsResolution'] == ''
|
120
130
|
intAttribute[:measureResolution] = hAttribute['unitsResolution']
|
121
131
|
end
|
122
132
|
end
|
123
133
|
|
124
134
|
# attribute - case sensitive {Boolean} (default = false)
|
125
135
|
if hAttribute.has_key?('isCaseSensitive')
|
126
|
-
|
136
|
+
unless hAttribute['unitsResolution'] == ''
|
127
137
|
intAttribute[:isCaseSensitive] = hAttribute['isCaseSensitive']
|
128
138
|
end
|
129
139
|
end
|
130
140
|
|
131
141
|
# attribute - field width
|
132
142
|
if hAttribute.has_key?('fieldWidth')
|
133
|
-
|
143
|
+
unless hAttribute['fieldWidth'] == ''
|
134
144
|
intAttribute[:fieldWidth] = hAttribute['fieldWidth']
|
135
145
|
end
|
136
146
|
end
|
137
147
|
|
138
148
|
# attribute - missing value
|
139
149
|
if hAttribute.has_key?('missingValue')
|
140
|
-
|
150
|
+
unless hAttribute['missingValue'] == ''
|
141
151
|
intAttribute[:missingValue] = hAttribute['missingValue']
|
142
152
|
end
|
143
153
|
end
|
144
154
|
|
145
155
|
# attribute - domain ID
|
146
156
|
if hAttribute.has_key?('domainId')
|
147
|
-
|
157
|
+
unless hAttribute['domainId'] == ''
|
148
158
|
intAttribute[:domainId] = hAttribute['domainId']
|
149
159
|
end
|
150
160
|
end
|
151
161
|
|
152
162
|
# attribute - minimum value
|
153
163
|
if hAttribute.has_key?('minValue')
|
154
|
-
|
164
|
+
unless hAttribute['minValue'] == ''
|
155
165
|
intAttribute[:minValue] = hAttribute['minValue']
|
156
166
|
end
|
157
167
|
end
|
158
168
|
|
159
169
|
# attribute - maximum value
|
160
170
|
if hAttribute.has_key?('maxValue')
|
161
|
-
|
171
|
+
unless hAttribute['maxValue'] == ''
|
162
172
|
intAttribute[:maxValue] = hAttribute['maxValue']
|
163
173
|
end
|
164
174
|
end
|