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-24 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-02-15 original script
|
7
7
|
|
8
8
|
module ADIWG
|
@@ -12,11 +12,13 @@ module ADIWG
|
|
12
12
|
|
13
13
|
module ResourceType
|
14
14
|
|
15
|
-
def self.unpack(hType, responseObj)
|
15
|
+
def self.unpack(hType, 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 hType.empty?
|
19
|
-
responseObj
|
21
|
+
@MessagePath.issueWarning(690, responseObj, inContext)
|
20
22
|
return nil
|
21
23
|
end
|
22
24
|
|
@@ -31,9 +33,7 @@ module ADIWG
|
|
31
33
|
end
|
32
34
|
end
|
33
35
|
if intType[:type].nil?
|
34
|
-
responseObj
|
35
|
-
responseObj[:readerExecutionPass] = false
|
36
|
-
return nil
|
36
|
+
@MessagePath.issueError(691, responseObj, inContext)
|
37
37
|
end
|
38
38
|
|
39
39
|
# resource type - name
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-24 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-11 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)
|
@@ -25,9 +25,11 @@ module ADIWG
|
|
25
25
|
|
26
26
|
def self.unpack(hUsage, responseObj)
|
27
27
|
|
28
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
29
|
+
|
28
30
|
# return nil object if input is empty
|
29
31
|
if hUsage.empty?
|
30
|
-
responseObj
|
32
|
+
@MessagePath.issueWarning(700, responseObj)
|
31
33
|
return nil
|
32
34
|
end
|
33
35
|
|
@@ -40,9 +42,7 @@ module ADIWG
|
|
40
42
|
intUsage[:specificUsage] = hUsage['specificUsage']
|
41
43
|
end
|
42
44
|
if intUsage[:specificUsage].nil? || intUsage[:specificUsage] == ''
|
43
|
-
responseObj
|
44
|
-
responseObj[:readerExecutionPass] = false
|
45
|
-
return nil
|
45
|
+
@MessagePath.issueError(701, responseObj)
|
46
46
|
end
|
47
47
|
|
48
48
|
# resource usage - temporal extent []
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-24 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-01-19 changed timePeriod to extent []
|
7
7
|
# Stan Smith 2016-10-09 refactored for mdJson 2.0
|
8
8
|
# Stan Smith 2015-07-14 refactored to remove global namespace constants
|
@@ -25,11 +25,13 @@ module ADIWG
|
|
25
25
|
|
26
26
|
module ResponsibleParty
|
27
27
|
|
28
|
-
def self.unpack(hRParty, responseObj)
|
28
|
+
def self.unpack(hRParty, responseObj, inContext = nil)
|
29
|
+
|
30
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
29
31
|
|
30
32
|
# return nil object if input is empty
|
31
33
|
if hRParty.empty?
|
32
|
-
responseObj
|
34
|
+
@MessagePath.issueWarning(710, responseObj, inContext)
|
33
35
|
return nil
|
34
36
|
end
|
35
37
|
|
@@ -39,14 +41,15 @@ module ADIWG
|
|
39
41
|
intMetadataClass = InternalMetadata.new
|
40
42
|
intResParty = intMetadataClass.newResponsibility
|
41
43
|
|
44
|
+
outContext = 'responsible party'
|
45
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
46
|
+
|
42
47
|
# responsible party - role - (required)
|
43
48
|
if hRParty.has_key?('role')
|
44
49
|
intResParty[:roleName] = hRParty['role']
|
45
50
|
end
|
46
51
|
if intResParty[:roleName].nil? || intResParty[:roleName] == ''
|
47
|
-
responseObj
|
48
|
-
responseObj[:readerExecutionPass] = false
|
49
|
-
return nil
|
52
|
+
@MessagePath.issueError(711, responseObj, inContext)
|
50
53
|
end
|
51
54
|
|
52
55
|
# responsible party - role extent
|
@@ -54,7 +57,7 @@ module ADIWG
|
|
54
57
|
aExtent = hRParty['roleExtent']
|
55
58
|
aExtent.each do |hItem|
|
56
59
|
unless hItem.empty?
|
57
|
-
hTimeExtent = Extent.unpack(hItem, responseObj)
|
60
|
+
hTimeExtent = Extent.unpack(hItem, responseObj, outContext)
|
58
61
|
unless hTimeExtent.nil?
|
59
62
|
intResParty[:roleExtents] << hTimeExtent
|
60
63
|
end
|
@@ -66,7 +69,7 @@ module ADIWG
|
|
66
69
|
if hRParty.has_key?('party')
|
67
70
|
hRParty['party'].each do |hParty|
|
68
71
|
unless hParty.empty?
|
69
|
-
party = Party.unpack(hParty, responseObj)
|
72
|
+
party = Party.unpack(hParty, responseObj, outContext)
|
70
73
|
unless party.nil?
|
71
74
|
intResParty[:parties] << party
|
72
75
|
end
|
@@ -74,9 +77,7 @@ module ADIWG
|
|
74
77
|
end
|
75
78
|
end
|
76
79
|
if intResParty[:parties].empty?
|
77
|
-
responseObj
|
78
|
-
responseObj[:readerExecutionPass] = false
|
79
|
-
return nil
|
80
|
+
@MessagePath.issueError(712, responseObj, inContext)
|
80
81
|
end
|
81
82
|
|
82
83
|
return intResParty
|
@@ -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-25 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-11-02 original script
|
7
7
|
|
8
8
|
module ADIWG
|
@@ -14,10 +14,11 @@ module ADIWG
|
|
14
14
|
|
15
15
|
def self.unpack(hSchema, responseObj)
|
16
16
|
|
17
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
18
|
+
|
17
19
|
# return nil object if input is empty
|
18
20
|
if hSchema.empty?
|
19
|
-
responseObj
|
20
|
-
responseObj[:readerExecutionPass] = false
|
21
|
+
@MessagePath.issueError(720, responseObj)
|
21
22
|
return nil
|
22
23
|
end
|
23
24
|
|
@@ -30,9 +31,7 @@ module ADIWG
|
|
30
31
|
intSchema[:name] = hSchema['name']
|
31
32
|
end
|
32
33
|
if intSchema[:name].nil? || intSchema[:name] == ''
|
33
|
-
responseObj
|
34
|
-
responseObj[:readerExecutionPass] = false
|
35
|
-
return nil
|
34
|
+
@MessagePath.issueError(721, responseObj)
|
36
35
|
end
|
37
36
|
|
38
37
|
# schema - version (required)
|
@@ -40,9 +39,7 @@ module ADIWG
|
|
40
39
|
intSchema[:version] = hSchema['version']
|
41
40
|
end
|
42
41
|
if intSchema[:version].nil? || intSchema[:version] == ''
|
43
|
-
responseObj
|
44
|
-
responseObj[:readerExecutionPass] = false
|
45
|
-
return nil
|
42
|
+
@MessagePath.issueWarning(722, responseObj)
|
46
43
|
end
|
47
44
|
|
48
45
|
return intSchema
|
@@ -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-25 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-14 original script
|
7
7
|
|
8
8
|
require_relative 'module_scopeDescription'
|
@@ -16,11 +16,13 @@ module ADIWG
|
|
16
16
|
|
17
17
|
module Scope
|
18
18
|
|
19
|
-
def self.unpack(hScope, responseObj)
|
19
|
+
def self.unpack(hScope, responseObj, inContext = nil)
|
20
|
+
|
21
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
20
22
|
|
21
23
|
# return nil object if input is empty
|
22
24
|
if hScope.empty?
|
23
|
-
responseObj
|
25
|
+
@MessagePath.issueWarning(730, responseObj, inContext)
|
24
26
|
return nil
|
25
27
|
end
|
26
28
|
|
@@ -28,21 +30,22 @@ module ADIWG
|
|
28
30
|
intMetadataClass = InternalMetadata.new
|
29
31
|
intScope = intMetadataClass.newScope
|
30
32
|
|
33
|
+
outContext = 'scope'
|
34
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
35
|
+
|
31
36
|
# scope - scope code (required)
|
32
37
|
if hScope.has_key?('scopeCode')
|
33
38
|
intScope[:scopeCode] = hScope['scopeCode']
|
34
39
|
end
|
35
40
|
if intScope[:scopeCode].nil? || intScope[:scopeCode] == ''
|
36
|
-
responseObj
|
37
|
-
responseObj[:readerExecutionPass] = false
|
38
|
-
return nil
|
41
|
+
@MessagePath.issueError(731, responseObj, inContext)
|
39
42
|
end
|
40
43
|
|
41
44
|
# scope - scope description [] {MD_ScopeDescription}
|
42
45
|
if hScope.has_key?('scopeDescription')
|
43
46
|
aScopeDes = hScope['scopeDescription']
|
44
47
|
aScopeDes.each do |item|
|
45
|
-
hScopeDes = ScopeDescription.unpack(item, responseObj)
|
48
|
+
hScopeDes = ScopeDescription.unpack(item, responseObj, outContext)
|
46
49
|
unless hScopeDes.nil?
|
47
50
|
intScope[:scopeDescriptions] << hScopeDes
|
48
51
|
end
|
@@ -53,7 +56,7 @@ module ADIWG
|
|
53
56
|
if hScope.has_key?('scopeExtent')
|
54
57
|
aExtents = hScope['scopeExtent']
|
55
58
|
aExtents.each do |item|
|
56
|
-
hExtent = Extent.unpack(item, responseObj)
|
59
|
+
hExtent = Extent.unpack(item, responseObj, outContext)
|
57
60
|
unless hExtent.nil?
|
58
61
|
intScope[:extents] << hExtent
|
59
62
|
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-25 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-13 original script
|
7
7
|
|
8
8
|
module ADIWG
|
@@ -12,11 +12,13 @@ module ADIWG
|
|
12
12
|
|
13
13
|
module ScopeDescription
|
14
14
|
|
15
|
-
def self.unpack(hScopeDes, responseObj)
|
15
|
+
def self.unpack(hScopeDes, 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 hScopeDes.empty?
|
19
|
-
responseObj
|
21
|
+
@MessagePath.issueWarning(740, responseObj, inContext)
|
20
22
|
return nil
|
21
23
|
end
|
22
24
|
|
@@ -60,10 +62,7 @@ module ADIWG
|
|
60
62
|
|
61
63
|
# error messages
|
62
64
|
unless haveScope
|
63
|
-
responseObj
|
64
|
-
'ERROR: mdJson reader: scope description needs at least one dataset, attribute, feature, or other'
|
65
|
-
responseObj[:readerExecutionPass] = false
|
66
|
-
return nil
|
65
|
+
@MessagePath.issueError(741, responseObj, inContext)
|
67
66
|
end
|
68
67
|
|
69
68
|
return intScopeDes
|
@@ -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-25 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-15 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)
|
@@ -17,11 +17,13 @@ module ADIWG
|
|
17
17
|
|
18
18
|
module SecurityConstraint
|
19
19
|
|
20
|
-
def self.unpack(hSecurityCon, responseObj)
|
20
|
+
def self.unpack(hSecurityCon, responseObj, inContext = nil)
|
21
|
+
|
22
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
21
23
|
|
22
24
|
# return nil object if input is empty
|
23
25
|
if hSecurityCon.empty?
|
24
|
-
responseObj
|
26
|
+
@MessagePath.issueWarning(750, responseObj, inContext)
|
25
27
|
return nil
|
26
28
|
end
|
27
29
|
|
@@ -34,9 +36,7 @@ module ADIWG
|
|
34
36
|
intSecCon[:classCode] = hSecurityCon['classification']
|
35
37
|
end
|
36
38
|
if intSecCon[:classCode].nil? || intSecCon[:classCode] == ''
|
37
|
-
responseObj
|
38
|
-
responseObj[:readerExecutionPass] = false
|
39
|
-
return nil
|
39
|
+
@MessagePath.issueError(751, responseObj, inContext)
|
40
40
|
end
|
41
41
|
|
42
42
|
# security constraint - user note
|
@@ -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-25 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-12 original script
|
7
7
|
|
8
8
|
module ADIWG
|
@@ -12,11 +12,13 @@ module ADIWG
|
|
12
12
|
|
13
13
|
module Series
|
14
14
|
|
15
|
-
def self.unpack(hSeries, responseObj)
|
15
|
+
def self.unpack(hSeries, 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 hSeries.empty?
|
19
|
-
responseObj
|
21
|
+
@MessagePath.issueWarning(760, responseObj, inContext)
|
20
22
|
return nil
|
21
23
|
end
|
22
24
|
|
@@ -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-25 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,11 +23,13 @@ module ADIWG
|
|
23
23
|
|
24
24
|
module Source
|
25
25
|
|
26
|
-
def self.unpack(hSource, responseObj)
|
26
|
+
def self.unpack(hSource, responseObj, inContext = nil)
|
27
|
+
|
28
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
27
29
|
|
28
30
|
# return nil object if input is empty
|
29
31
|
if hSource.empty?
|
30
|
-
responseObj
|
32
|
+
@MessagePath.issueWarning(770, responseObj, inContext)
|
31
33
|
return nil
|
32
34
|
end
|
33
35
|
|
@@ -35,6 +37,9 @@ module ADIWG
|
|
35
37
|
intMetadataClass = InternalMetadata.new
|
36
38
|
intSource = intMetadataClass.newDataSource
|
37
39
|
|
40
|
+
outContext = 'source'
|
41
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
42
|
+
|
38
43
|
haveRequired = false
|
39
44
|
|
40
45
|
# source - source ID
|
@@ -56,7 +61,7 @@ module ADIWG
|
|
56
61
|
if hSource.has_key?('sourceCitation')
|
57
62
|
hObject = hSource['sourceCitation']
|
58
63
|
unless hObject.empty?
|
59
|
-
hReturn = Citation.unpack(hObject, responseObj)
|
64
|
+
hReturn = Citation.unpack(hObject, responseObj, outContext)
|
60
65
|
unless hReturn.nil?
|
61
66
|
intSource[:sourceCitation] = hReturn
|
62
67
|
end
|
@@ -67,7 +72,7 @@ module ADIWG
|
|
67
72
|
if hSource.has_key?('metadataCitation')
|
68
73
|
aCitation = hSource['metadataCitation']
|
69
74
|
aCitation.each do |item|
|
70
|
-
hCitation = Citation.unpack(item, responseObj)
|
75
|
+
hCitation = Citation.unpack(item, responseObj, outContext)
|
71
76
|
unless hCitation.nil?
|
72
77
|
intSource[:metadataCitation] << hCitation
|
73
78
|
end
|
@@ -78,7 +83,7 @@ module ADIWG
|
|
78
83
|
if hSource.has_key?('spatialResolution')
|
79
84
|
hObject = hSource['spatialResolution']
|
80
85
|
unless hObject.empty?
|
81
|
-
hReturn = SpatialResolution.unpack(hObject, responseObj)
|
86
|
+
hReturn = SpatialResolution.unpack(hObject, responseObj, outContext)
|
82
87
|
unless hReturn.nil?
|
83
88
|
intSource[:spatialResolution] = hReturn
|
84
89
|
end
|
@@ -89,7 +94,7 @@ module ADIWG
|
|
89
94
|
if hSource.has_key?('referenceSystem')
|
90
95
|
hObject = hSource['referenceSystem']
|
91
96
|
unless hObject.empty?
|
92
|
-
hReturn = SpatialReferenceSystem.unpack(hObject, responseObj)
|
97
|
+
hReturn = SpatialReferenceSystem.unpack(hObject, responseObj, outContext)
|
93
98
|
unless hReturn.nil?
|
94
99
|
intSource[:referenceSystem] = hReturn
|
95
100
|
end
|
@@ -100,7 +105,7 @@ module ADIWG
|
|
100
105
|
if hSource.has_key?('sourceProcessStep')
|
101
106
|
aSteps = hSource['sourceProcessStep']
|
102
107
|
aSteps.each do |item|
|
103
|
-
hStep = ProcessStep.unpack(item, responseObj)
|
108
|
+
hStep = ProcessStep.unpack(item, responseObj, outContext)
|
104
109
|
unless hStep.nil?
|
105
110
|
intSource[:sourceSteps] << hStep
|
106
111
|
end
|
@@ -111,7 +116,7 @@ module ADIWG
|
|
111
116
|
if hSource.has_key?('scope')
|
112
117
|
hObject = hSource['scope']
|
113
118
|
unless hObject.empty?
|
114
|
-
hReturn = Scope.unpack(hObject, responseObj)
|
119
|
+
hReturn = Scope.unpack(hObject, responseObj, outContext)
|
115
120
|
unless hReturn.nil?
|
116
121
|
intSource[:scope] = hReturn
|
117
122
|
haveRequired = true
|
@@ -120,10 +125,7 @@ module ADIWG
|
|
120
125
|
end
|
121
126
|
|
122
127
|
unless haveRequired
|
123
|
-
responseObj
|
124
|
-
'ERROR: mdJson reader: source requires a description or scope'
|
125
|
-
responseObj[:readerExecutionPass] = false
|
126
|
-
return nil
|
128
|
+
@MessagePath.issueError(771, responseObj, inContext)
|
127
129
|
end
|
128
130
|
|
129
131
|
return intSource
|
@@ -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-25 refactored error and warning messaging
|
6
6
|
# Stan Smith 2018-01-10 added reference system WKT
|
7
7
|
# Stan Smith 2017-10-23 added reference system parameter set
|
8
8
|
# Stan Smith 2016-10-16 refactored for mdJson 2.0
|
@@ -21,11 +21,13 @@ module ADIWG
|
|
21
21
|
|
22
22
|
module SpatialReferenceSystem
|
23
23
|
|
24
|
-
def self.unpack(hSpatialRef, responseObj)
|
24
|
+
def self.unpack(hSpatialRef, responseObj, inContext = nil)
|
25
|
+
|
26
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
25
27
|
|
26
28
|
# return nil object if input is empty
|
27
29
|
if hSpatialRef.empty?
|
28
|
-
responseObj
|
30
|
+
@MessagePath.issueWarning(780, responseObj, inContext)
|
29
31
|
return nil
|
30
32
|
end
|
31
33
|
|
@@ -33,6 +35,8 @@ module ADIWG
|
|
33
35
|
intMetadataClass = InternalMetadata.new
|
34
36
|
intSpatialRef = intMetadataClass.newSpatialReferenceSystem
|
35
37
|
|
38
|
+
outContext = 'spatial reference system'
|
39
|
+
|
36
40
|
haveSystem = false
|
37
41
|
|
38
42
|
# spatial reference system - type
|
@@ -47,7 +51,7 @@ module ADIWG
|
|
47
51
|
if hSpatialRef.has_key?('referenceSystemIdentifier')
|
48
52
|
hObject = hSpatialRef['referenceSystemIdentifier']
|
49
53
|
unless hObject.empty?
|
50
|
-
hReturn = Identifier.unpack(hObject, responseObj)
|
54
|
+
hReturn = Identifier.unpack(hObject, responseObj, outContext)
|
51
55
|
unless hReturn.nil?
|
52
56
|
intSpatialRef[:systemIdentifier] = hReturn
|
53
57
|
haveSystem = true
|
@@ -67,7 +71,7 @@ module ADIWG
|
|
67
71
|
if hSpatialRef.has_key?('referenceSystemParameterSet')
|
68
72
|
hObject = hSpatialRef['referenceSystemParameterSet']
|
69
73
|
unless hObject.empty?
|
70
|
-
hReturn = ReferenceSystemParameters.unpack(hObject, responseObj)
|
74
|
+
hReturn = ReferenceSystemParameters.unpack(hObject, responseObj, outContext)
|
71
75
|
unless hReturn.nil?
|
72
76
|
intSpatialRef[:systemParameterSet] = hReturn
|
73
77
|
haveSystem = true
|
@@ -76,10 +80,7 @@ module ADIWG
|
|
76
80
|
end
|
77
81
|
|
78
82
|
unless haveSystem
|
79
|
-
responseObj
|
80
|
-
'ERROR: mdJson reader: spatial reference system must declare reference system type, identifier, WKT, or parameter set'
|
81
|
-
responseObj[:readerExecutionPass] = false
|
82
|
-
return nil
|
83
|
+
@MessagePath.issueError(781, responseObj, inContext)
|
83
84
|
end
|
84
85
|
|
85
86
|
return intSpatialRef
|