adiwg-mdtranslator 2.13.0 → 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +26 -14
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +1 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +56 -41
- data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +1 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader_messages_eng.yml +377 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +6 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +6 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +7 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +12 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +10 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +11 -21
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +18 -38
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +10 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +22 -28
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +17 -18
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contactPostprocess.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +9 -15
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +6 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +8 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +8 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +7 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +17 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +12 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +9 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +14 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +20 -19
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +8 -15
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +7 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +8 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +10 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +8 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +8 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +11 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +10 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +11 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +8 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +8 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +7 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +4 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +13 -20
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +12 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +12 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +10 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +9 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +8 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +10 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +7 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +59 -17
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +9 -16
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +10 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +6 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +16 -16
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +8 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +25 -28
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +15 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +11 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +12 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +10 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +29 -40
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +12 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +6 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +11 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +6 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +10 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +14 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +14 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +8 -15
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +7 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +12 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +12 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +9 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +22 -26
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +13 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +7 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +10 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +12 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +10 -10
- data/lib/adiwg/mdtranslator/version.rb +8 -3
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialOrganization.rb +78 -84
- data/lib/adiwg/mdtranslator/writers/html/sections/html_responsibility.rb +3 -3
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +23 -14
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer_messages_eng.yml +2 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +10 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_date.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dictionary.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geographicExtent.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb +5 -5
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_medium.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_party.rb +1 -5
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_repository.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_verticalDatumParameters.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +11 -11
- metadata +4 -3
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-13 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-17 refactored for mdJson 2.0
|
7
7
|
# Stan Smith 2015-07-14 refactored to remove global namespace constants
|
8
8
|
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
@@ -23,9 +23,11 @@ module ADIWG
|
|
23
23
|
|
24
24
|
def self.unpack(hAddDoc, responseObj)
|
25
25
|
|
26
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
27
|
+
|
26
28
|
# return nil object if input is empty
|
27
29
|
if hAddDoc.empty?
|
28
|
-
responseObj
|
30
|
+
@MessagePath.issueWarning(1, responseObj)
|
29
31
|
return nil
|
30
32
|
end
|
31
33
|
|
@@ -45,9 +47,7 @@ module ADIWG
|
|
45
47
|
end
|
46
48
|
end
|
47
49
|
if intAddDoc[:resourceTypes].empty?
|
48
|
-
responseObj
|
49
|
-
responseObj[:readerExecutionPass] = false
|
50
|
-
return nil
|
50
|
+
@MessagePath.issueError(2, responseObj)
|
51
51
|
end
|
52
52
|
|
53
53
|
# additional documentation - citation [] (required)
|
@@ -60,9 +60,7 @@ module ADIWG
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
if intAddDoc[:citation].empty?
|
63
|
-
responseObj
|
64
|
-
responseObj[:readerExecutionPass] = false
|
65
|
-
return nil
|
63
|
+
@MessagePath.issueError(3, responseObj)
|
66
64
|
end
|
67
65
|
|
68
66
|
return intAddDoc
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-13 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-03 refactored for mdJson 2.0
|
7
7
|
# Stan Smith 2015-07-14 refactored to remove global namespace constants
|
8
8
|
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
@@ -19,11 +19,13 @@ module ADIWG
|
|
19
19
|
|
20
20
|
module Address
|
21
21
|
|
22
|
-
def self.unpack(hAddress, responseObj)
|
22
|
+
def self.unpack(hAddress, responseObj, inContext = nil)
|
23
|
+
|
24
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
23
25
|
|
24
26
|
# return nil object if input is empty
|
25
27
|
if hAddress.empty?
|
26
|
-
responseObj
|
28
|
+
@MessagePath.issueWarning(10, responseObj, inContext)
|
27
29
|
return nil
|
28
30
|
end
|
29
31
|
|
@@ -40,9 +42,7 @@ module ADIWG
|
|
40
42
|
end
|
41
43
|
end
|
42
44
|
if intAdd[:addressTypes].empty?
|
43
|
-
responseObj
|
44
|
-
responseObj[:readerExecutionPass] = false
|
45
|
-
return nil
|
45
|
+
@MessagePath.issueError(11, responseObj, inContext)
|
46
46
|
end
|
47
47
|
|
48
48
|
# address - description
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-06-15 refactored error and warning messaging
|
5
6
|
# Stan Smith 2018-03-28 add responsible party array
|
6
7
|
# Stan Smith 2018-02-18 refactored error and warning messaging
|
7
8
|
# Stan Smith 2017-08-30 refactored for mdJson schema 2.3
|
@@ -19,9 +20,11 @@ module ADIWG
|
|
19
20
|
|
20
21
|
def self.unpack(hAlloc, responseObj)
|
21
22
|
|
23
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
24
|
+
|
22
25
|
# return nil object if input is empty
|
23
26
|
if hAlloc.empty?
|
24
|
-
responseObj
|
27
|
+
@MessagePath.issueWarning(20, responseObj)
|
25
28
|
return nil
|
26
29
|
end
|
27
30
|
|
@@ -41,9 +44,7 @@ module ADIWG
|
|
41
44
|
intAlloc[:amount] = hAlloc['amount']
|
42
45
|
end
|
43
46
|
if intAlloc[:amount].nil? || intAlloc[:amount] == ''
|
44
|
-
responseObj
|
45
|
-
responseObj[:readerExecutionPass] = false
|
46
|
-
return nil
|
47
|
+
@MessagePath.issueError(21, responseObj)
|
47
48
|
end
|
48
49
|
|
49
50
|
# allocation - currency (required)
|
@@ -51,9 +52,7 @@ module ADIWG
|
|
51
52
|
intAlloc[:currency] = hAlloc['currency']
|
52
53
|
end
|
53
54
|
if intAlloc[:currency].nil? || intAlloc[:currency] == ''
|
54
|
-
responseObj
|
55
|
-
responseObj[:readerExecutionPass] = false
|
56
|
-
return nil
|
55
|
+
@MessagePath.issueError(22, responseObj)
|
57
56
|
end
|
58
57
|
|
59
58
|
# allocation - source ID {contactId}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-15 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-18 refactored for mdJson 2.0
|
7
7
|
# Stan Smith 2015-07-14 refactored to remove global namespace constants
|
8
8
|
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
@@ -27,9 +27,11 @@ module ADIWG
|
|
27
27
|
|
28
28
|
def self.unpack(hAssocRes, responseObj)
|
29
29
|
|
30
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
31
|
+
|
30
32
|
# return nil object if input is empty
|
31
33
|
if hAssocRes.empty?
|
32
|
-
responseObj
|
34
|
+
@MessagePath.issueWarning(30, responseObj)
|
33
35
|
return nil
|
34
36
|
end
|
35
37
|
|
@@ -49,9 +51,7 @@ module ADIWG
|
|
49
51
|
end
|
50
52
|
end
|
51
53
|
if intAssocRes[:resourceTypes].empty?
|
52
|
-
responseObj
|
53
|
-
responseObj[:readerExecutionPass] = false
|
54
|
-
return nil
|
54
|
+
@MessagePath.issueError(31, responseObj)
|
55
55
|
end
|
56
56
|
|
57
57
|
# associated resource - association type (required)
|
@@ -59,9 +59,7 @@ module ADIWG
|
|
59
59
|
intAssocRes[:associationType] = hAssocRes['associationType']
|
60
60
|
end
|
61
61
|
if intAssocRes[:associationType].nil? || intAssocRes[:associationType] == ''
|
62
|
-
responseObj
|
63
|
-
responseObj[:readerExecutionPass] = false
|
64
|
-
return nil
|
62
|
+
@MessagePath.issueError(32, responseObj)
|
65
63
|
end
|
66
64
|
|
67
65
|
# associated resource - initiative type
|
@@ -82,9 +80,7 @@ module ADIWG
|
|
82
80
|
end
|
83
81
|
end
|
84
82
|
if intAssocRes[:resourceCitation].empty?
|
85
|
-
responseObj
|
86
|
-
responseObj[:readerExecutionPass] = false
|
87
|
-
return nil
|
83
|
+
@MessagePath.issueError(33, responseObj)
|
88
84
|
end
|
89
85
|
|
90
86
|
# associated resource - metadata citation
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-15 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-18 original script
|
7
7
|
|
8
8
|
require_relative 'module_identifier'
|
@@ -14,11 +14,13 @@ module ADIWG
|
|
14
14
|
|
15
15
|
module Attribute
|
16
16
|
|
17
|
-
def self.unpack(hAttribute, responseObj)
|
17
|
+
def self.unpack(hAttribute, responseObj, inContext = nil)
|
18
|
+
|
19
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
18
20
|
|
19
21
|
# return nil object if input is empty
|
20
22
|
if hAttribute.empty?
|
21
|
-
responseObj
|
23
|
+
@MessagePath.issueWarning(40, responseObj, inContext)
|
22
24
|
return nil
|
23
25
|
end
|
24
26
|
|
@@ -26,6 +28,9 @@ module ADIWG
|
|
26
28
|
intMetadataClass = InternalMetadata.new
|
27
29
|
intAttGroup = intMetadataClass.newAttribute
|
28
30
|
|
31
|
+
outContext = 'attribute'
|
32
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
33
|
+
|
29
34
|
# attribute group - sequence identifier
|
30
35
|
if hAttribute.has_key?('sequenceIdentifier')
|
31
36
|
unless hAttribute['sequenceIdentifier'] == ''
|
@@ -41,9 +46,7 @@ module ADIWG
|
|
41
46
|
end
|
42
47
|
end
|
43
48
|
if intAttGroup[:sequenceIdentifierType].nil?
|
44
|
-
responseObj
|
45
|
-
responseObj[:readerExecutionPass] = false
|
46
|
-
return nil
|
49
|
+
@MessagePath.issueError(41, responseObj, inContext)
|
47
50
|
end
|
48
51
|
end
|
49
52
|
|
@@ -58,7 +61,7 @@ module ADIWG
|
|
58
61
|
if hAttribute.has_key?('attributeIdentifier')
|
59
62
|
aItems = hAttribute['attributeIdentifier']
|
60
63
|
aItems.each do |item|
|
61
|
-
hReturn = Identifier.unpack(item, responseObj)
|
64
|
+
hReturn = Identifier.unpack(item, responseObj, outContext)
|
62
65
|
unless hReturn.nil?
|
63
66
|
intAttGroup[:attributeIdentifiers] << hReturn
|
64
67
|
end
|
@@ -87,9 +90,7 @@ module ADIWG
|
|
87
90
|
end
|
88
91
|
end
|
89
92
|
if intAttGroup[:units].nil?
|
90
|
-
responseObj
|
91
|
-
responseObj[:readerExecutionPass] = false
|
92
|
-
return nil
|
93
|
+
@MessagePath.issueError(42, responseObj, inContext)
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
@@ -157,9 +158,7 @@ module ADIWG
|
|
157
158
|
end
|
158
159
|
end
|
159
160
|
if intAttGroup[:boundUnits].nil?
|
160
|
-
responseObj
|
161
|
-
responseObj[:readerExecutionPass] = false
|
162
|
-
return nil
|
161
|
+
@MessagePath.issueError(43, responseObj, inContext)
|
163
162
|
end
|
164
163
|
end
|
165
164
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-15 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-18 original script
|
7
7
|
|
8
8
|
require_relative 'module_attribute'
|
@@ -16,9 +16,13 @@ module ADIWG
|
|
16
16
|
|
17
17
|
def self.unpack(hAttGroup, responseObj)
|
18
18
|
|
19
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
20
|
+
|
21
|
+
inContext = 'coverage description'
|
22
|
+
|
19
23
|
# return nil object if input is empty
|
20
24
|
if hAttGroup.empty?
|
21
|
-
responseObj
|
25
|
+
@MessagePath.issueWarning(50, responseObj, inContext)
|
22
26
|
return nil
|
23
27
|
end
|
24
28
|
|
@@ -26,6 +30,8 @@ module ADIWG
|
|
26
30
|
intMetadataClass = InternalMetadata.new
|
27
31
|
intAttGroup = intMetadataClass.newAttributeGroup
|
28
32
|
|
33
|
+
outContext = inContext + ' attribute group'
|
34
|
+
|
29
35
|
# attribute group - attribute content type [] (required)
|
30
36
|
if hAttGroup.has_key?('attributeContentType')
|
31
37
|
hAttGroup['attributeContentType'].each do |item|
|
@@ -35,16 +41,14 @@ module ADIWG
|
|
35
41
|
end
|
36
42
|
end
|
37
43
|
if intAttGroup[:attributeContentTypes].empty?
|
38
|
-
responseObj
|
39
|
-
responseObj[:readerExecutionPass] = false
|
40
|
-
return nil
|
44
|
+
@MessagePath.issueError(51, responseObj, inContext)
|
41
45
|
end
|
42
46
|
|
43
47
|
# attribute group - attribute []
|
44
48
|
if hAttGroup.has_key?('attribute')
|
45
49
|
aItems = hAttGroup['attribute']
|
46
50
|
aItems.each do |item|
|
47
|
-
hReturn = Attribute.unpack(item, responseObj)
|
51
|
+
hReturn = Attribute.unpack(item, responseObj, outContext)
|
48
52
|
unless hReturn.nil?
|
49
53
|
intAttGroup[:attributes] << hReturn
|
50
54
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-15 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-10-19 original script
|
7
7
|
|
8
8
|
module ADIWG
|
@@ -12,11 +12,13 @@ module ADIWG
|
|
12
12
|
|
13
13
|
module BearingDistanceResolution
|
14
14
|
|
15
|
-
def self.unpack(hBearRes, responseObj)
|
15
|
+
def self.unpack(hBearRes, responseObj, inContext = nil)
|
16
|
+
|
17
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
16
18
|
|
17
19
|
# return nil object if input is empty
|
18
20
|
if hBearRes.empty?
|
19
|
-
responseObj
|
21
|
+
@MessagePath.issueWarning(60, responseObj, inContext)
|
20
22
|
return nil
|
21
23
|
end
|
22
24
|
|
@@ -29,9 +31,7 @@ module ADIWG
|
|
29
31
|
intBearRes[:distanceResolution] = hBearRes['distanceResolution']
|
30
32
|
end
|
31
33
|
if intBearRes[:distanceResolution].nil? || intBearRes[:distanceResolution] == ''
|
32
|
-
responseObj
|
33
|
-
responseObj[:readerExecutionPass] = false
|
34
|
-
return nil
|
34
|
+
@MessagePath.issueError(61, responseObj, inContext)
|
35
35
|
end
|
36
36
|
|
37
37
|
# bearing distance resolution - distance unit of measure (required)
|
@@ -39,9 +39,7 @@ module ADIWG
|
|
39
39
|
intBearRes[:distanceUnitOfMeasure] = hBearRes['distanceUnitOfMeasure']
|
40
40
|
end
|
41
41
|
if intBearRes[:distanceUnitOfMeasure].nil? || intBearRes[:distanceUnitOfMeasure] == ''
|
42
|
-
responseObj
|
43
|
-
responseObj[:readerExecutionPass] = false
|
44
|
-
return nil
|
42
|
+
@MessagePath.issueError(62, responseObj, inContext)
|
45
43
|
end
|
46
44
|
|
47
45
|
# bearing distance resolution - bearing resolution (required)
|
@@ -49,9 +47,7 @@ module ADIWG
|
|
49
47
|
intBearRes[:bearingResolution] = hBearRes['bearingResolution']
|
50
48
|
end
|
51
49
|
if intBearRes[:bearingResolution].nil? || intBearRes[:bearingResolution] == ''
|
52
|
-
responseObj
|
53
|
-
responseObj[:readerExecutionPass] = false
|
54
|
-
return nil
|
50
|
+
@MessagePath.issueError(63, responseObj, inContext)
|
55
51
|
end
|
56
52
|
|
57
53
|
# bearing distance resolution - bearing unit of measure (required)
|
@@ -59,9 +55,7 @@ module ADIWG
|
|
59
55
|
intBearRes[:bearingUnitOfMeasure] = hBearRes['bearingUnitOfMeasure']
|
60
56
|
end
|
61
57
|
if intBearRes[:bearingUnitOfMeasure].nil? || intBearRes[:bearingUnitOfMeasure] == ''
|
62
|
-
responseObj
|
63
|
-
responseObj[:readerExecutionPass] = false
|
64
|
-
return nil
|
58
|
+
@MessagePath.issueError(64, responseObj, inContext)
|
65
59
|
end
|
66
60
|
|
67
61
|
# bearing distance resolution - bearing reference direction (required)
|
@@ -69,9 +63,7 @@ module ADIWG
|
|
69
63
|
intBearRes[:bearingReferenceDirection] = hBearRes['bearingReferenceDirection']
|
70
64
|
end
|
71
65
|
if intBearRes[:bearingReferenceDirection].nil? || intBearRes[:bearingReferenceDirection] == ''
|
72
|
-
responseObj
|
73
|
-
responseObj[:readerExecutionPass] = false
|
74
|
-
return nil
|
66
|
+
@MessagePath.issueError(65, responseObj, inContext)
|
75
67
|
end
|
76
68
|
|
77
69
|
# bearing distance resolution - bearing reference meridian (required)
|
@@ -79,9 +71,7 @@ module ADIWG
|
|
79
71
|
intBearRes[:bearingReferenceMeridian] = hBearRes['bearingReferenceMeridian']
|
80
72
|
end
|
81
73
|
if intBearRes[:bearingReferenceMeridian].nil? || intBearRes[:bearingReferenceMeridian] == ''
|
82
|
-
responseObj
|
83
|
-
responseObj[:readerExecutionPass] = false
|
84
|
-
return nil
|
74
|
+
@MessagePath.issueError(66, responseObj, inContext)
|
85
75
|
end
|
86
76
|
|
87
77
|
return intBearRes
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-15 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-09-28 add altitude to support fgdc
|
7
7
|
# Stan Smith 2016-12-01 original script
|
8
8
|
|
@@ -13,11 +13,13 @@ module ADIWG
|
|
13
13
|
|
14
14
|
module BoundingBox
|
15
15
|
|
16
|
-
def self.unpack(hBBox, responseObj)
|
16
|
+
def self.unpack(hBBox, responseObj, inContext = nil)
|
17
|
+
|
18
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
17
19
|
|
18
20
|
# return nil object if input is empty
|
19
21
|
if hBBox.empty?
|
20
|
-
responseObj
|
22
|
+
@MessagePath.issueWarning(70, responseObj, inContext)
|
21
23
|
return nil
|
22
24
|
end
|
23
25
|
|
@@ -30,14 +32,9 @@ module ADIWG
|
|
30
32
|
intBBox[:westLongitude] = hBBox['westLongitude']
|
31
33
|
end
|
32
34
|
if intBBox[:westLongitude].nil? || intBBox[:westLongitude] == ''
|
33
|
-
responseObj
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
if intBBox[:westLongitude].abs > 180
|
38
|
-
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box longitude must be between -180 and +180'
|
39
|
-
responseObj[:readerExecutionPass] = false
|
40
|
-
return nil
|
35
|
+
@MessagePath.issueError(71, responseObj, inContext)
|
36
|
+
elsif intBBox[:westLongitude].abs > 180
|
37
|
+
@MessagePath.issueError(72, responseObj, inContext)
|
41
38
|
end
|
42
39
|
|
43
40
|
# bounding box - east longitude (required)
|
@@ -45,14 +42,9 @@ module ADIWG
|
|
45
42
|
intBBox[:eastLongitude] = hBBox['eastLongitude']
|
46
43
|
end
|
47
44
|
if intBBox[:eastLongitude].nil? || intBBox[:eastLongitude] == ''
|
48
|
-
responseObj
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
if intBBox[:eastLongitude].abs > 180
|
53
|
-
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box longitude must be between -180 and +180'
|
54
|
-
responseObj[:readerExecutionPass] = false
|
55
|
-
return nil
|
45
|
+
@MessagePath.issueError(73, responseObj, inContext)
|
46
|
+
elsif intBBox[:eastLongitude].abs > 180
|
47
|
+
@MessagePath.issueError(72, responseObj, inContext)
|
56
48
|
end
|
57
49
|
|
58
50
|
# bounding box - south latitude (required)
|
@@ -60,14 +52,9 @@ module ADIWG
|
|
60
52
|
intBBox[:southLatitude] = hBBox['southLatitude']
|
61
53
|
end
|
62
54
|
if intBBox[:southLatitude].nil? || intBBox[:southLatitude] == ''
|
63
|
-
responseObj
|
64
|
-
|
65
|
-
|
66
|
-
end
|
67
|
-
if intBBox[:southLatitude].abs > 90
|
68
|
-
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box latitude must be between -90 and +90'
|
69
|
-
responseObj[:readerExecutionPass] = false
|
70
|
-
return nil
|
55
|
+
@MessagePath.issueError(74, responseObj, inContext)
|
56
|
+
elsif intBBox[:southLatitude].abs > 90
|
57
|
+
@MessagePath.issueError(75, responseObj, inContext)
|
71
58
|
end
|
72
59
|
|
73
60
|
# bounding box - north latitude (required)
|
@@ -75,14 +62,9 @@ module ADIWG
|
|
75
62
|
intBBox[:northLatitude] = hBBox['northLatitude']
|
76
63
|
end
|
77
64
|
if intBBox[:northLatitude].nil? || intBBox[:northLatitude] == ''
|
78
|
-
responseObj
|
79
|
-
|
80
|
-
|
81
|
-
end
|
82
|
-
if intBBox[:northLatitude].abs > 90
|
83
|
-
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: bounding box latitude must be between -90 and +90'
|
84
|
-
responseObj[:readerExecutionPass] = false
|
85
|
-
return nil
|
65
|
+
@MessagePath.issueError(76, responseObj, inContext)
|
66
|
+
elsif intBBox[:northLatitude].abs > 90
|
67
|
+
@MessagePath.issueError(75, responseObj, inContext)
|
86
68
|
end
|
87
69
|
|
88
70
|
# bounding box - minimum altitude
|
@@ -107,9 +89,7 @@ module ADIWG
|
|
107
89
|
end
|
108
90
|
unless intBBox[:minimumAltitude].nil? && intBBox[:maximumAltitude].nil?
|
109
91
|
if intBBox[:unitsOfAltitude].nil? || intBBox[:unitsOfAltitude] == ''
|
110
|
-
responseObj
|
111
|
-
responseObj[:readerExecutionPass] = false
|
112
|
-
return nil
|
92
|
+
@MessagePath.issueError(77, responseObj, inContext)
|
113
93
|
end
|
114
94
|
end
|
115
95
|
|