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-15 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-13 refactored for mdJson 2.0
|
7
7
|
# Stan Smith 2015-08-28 added alternate title
|
8
8
|
# Stan Smith 2015-07-14 refactored to remove global namespace constants
|
@@ -29,12 +29,13 @@ module ADIWG
|
|
29
29
|
|
30
30
|
module Citation
|
31
31
|
|
32
|
-
def self.unpack(hCitation, responseObj)
|
32
|
+
def self.unpack(hCitation, responseObj, inContext = nil)
|
33
33
|
|
34
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
34
35
|
|
35
36
|
# return nil object if input is empty
|
36
37
|
if hCitation.empty?
|
37
|
-
responseObj
|
38
|
+
@MessagePath.issueWarning(80, responseObj, inContext)
|
38
39
|
return nil
|
39
40
|
end
|
40
41
|
|
@@ -42,14 +43,15 @@ module ADIWG
|
|
42
43
|
intMetadataClass = InternalMetadata.new
|
43
44
|
intCitation = intMetadataClass.newCitation
|
44
45
|
|
46
|
+
outContext = 'citation'
|
47
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
48
|
+
|
45
49
|
# citation - title (required)
|
46
50
|
if hCitation.has_key?('title')
|
47
51
|
intCitation[:title] = hCitation['title']
|
48
52
|
end
|
49
53
|
if intCitation[:title].nil? || intCitation[:title] == ''
|
50
|
-
responseObj
|
51
|
-
responseObj[:readerExecutionPass] = false
|
52
|
-
return nil
|
54
|
+
@MessagePath.issueError(81, responseObj, inContext)
|
53
55
|
end
|
54
56
|
|
55
57
|
# citation - alternate title []
|
@@ -114,7 +116,7 @@ module ADIWG
|
|
114
116
|
if hCitation.has_key?('series')
|
115
117
|
hObject = hCitation['series']
|
116
118
|
unless hObject.empty?
|
117
|
-
hReturn = Series.unpack(hObject, responseObj)
|
119
|
+
hReturn = Series.unpack(hObject, responseObj, outContext)
|
118
120
|
unless hReturn.nil?
|
119
121
|
intCitation[:series] = hReturn
|
120
122
|
end
|
@@ -145,7 +147,7 @@ module ADIWG
|
|
145
147
|
if hCitation.has_key?('graphic')
|
146
148
|
aItems = hCitation['graphic']
|
147
149
|
aItems.each do |item|
|
148
|
-
hReturn = Graphic.unpack(item, responseObj)
|
150
|
+
hReturn = Graphic.unpack(item, responseObj, outContext)
|
149
151
|
unless hReturn.nil?
|
150
152
|
intCitation[:browseGraphics] << hReturn
|
151
153
|
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-16 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-15 original script
|
7
7
|
|
8
8
|
require_relative 'module_scope'
|
@@ -20,11 +20,13 @@ module ADIWG
|
|
20
20
|
|
21
21
|
module Constraint
|
22
22
|
|
23
|
-
def self.unpack(hConstraint, responseObj)
|
23
|
+
def self.unpack(hConstraint, responseObj, inContext = nil)
|
24
|
+
|
25
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
24
26
|
|
25
27
|
# return nil object if input is empty
|
26
28
|
if hConstraint.empty?
|
27
|
-
responseObj
|
29
|
+
@MessagePath.issueWarning(90, responseObj, inContext)
|
28
30
|
return nil
|
29
31
|
end
|
30
32
|
|
@@ -40,18 +42,18 @@ module ADIWG
|
|
40
42
|
if %w{ use legal security }.one? {|word| word == type}
|
41
43
|
intConstraint[:type] = hConstraint['type']
|
42
44
|
else
|
43
|
-
|
44
|
-
responseObj[:readerExecutionPass] = false
|
45
|
-
return nil
|
45
|
+
@MessagePath.issueError(91, responseObj, inContext)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
49
|
if intConstraint[:type].nil? || intConstraint[:type] == ''
|
50
|
-
responseObj
|
51
|
-
responseObj[:readerExecutionPass] = false
|
52
|
-
return nil
|
50
|
+
@MessagePath.issueError(92, responseObj, inContext)
|
53
51
|
end
|
54
52
|
|
53
|
+
outContext = 'constraint'
|
54
|
+
outContext = intConstraint[:type] + ' constraint' unless intConstraint[:type].nil?
|
55
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
56
|
+
|
55
57
|
# constraint - use limitation [] (required if type='use')
|
56
58
|
if hConstraint.has_key?('useLimitation')
|
57
59
|
hConstraint['useLimitation'].each do |item|
|
@@ -65,7 +67,7 @@ module ADIWG
|
|
65
67
|
if hConstraint.has_key?('scope')
|
66
68
|
hObject = hConstraint['scope']
|
67
69
|
unless hObject.empty?
|
68
|
-
hReturn = Scope.unpack(hObject, responseObj)
|
70
|
+
hReturn = Scope.unpack(hObject, responseObj, outContext)
|
69
71
|
unless hReturn.nil?
|
70
72
|
intConstraint[:scope] = hReturn
|
71
73
|
end
|
@@ -76,7 +78,7 @@ module ADIWG
|
|
76
78
|
if hConstraint.has_key?('graphic')
|
77
79
|
aGraphic = hConstraint['graphic']
|
78
80
|
aGraphic.each do |item|
|
79
|
-
hGraphic = Graphic.unpack(item, responseObj)
|
81
|
+
hGraphic = Graphic.unpack(item, responseObj, outContext)
|
80
82
|
unless hGraphic.nil?
|
81
83
|
intConstraint[:graphic] << hGraphic
|
82
84
|
end
|
@@ -87,7 +89,7 @@ module ADIWG
|
|
87
89
|
if hConstraint.has_key?('reference')
|
88
90
|
aReference = hConstraint['reference']
|
89
91
|
aReference.each do |item|
|
90
|
-
hReference = Citation.unpack(item, responseObj)
|
92
|
+
hReference = Citation.unpack(item, responseObj, outContext)
|
91
93
|
unless hReference.nil?
|
92
94
|
intConstraint[:reference] << hReference
|
93
95
|
end
|
@@ -98,7 +100,7 @@ module ADIWG
|
|
98
100
|
if hConstraint.has_key?('releasability')
|
99
101
|
hObject = hConstraint['releasability']
|
100
102
|
unless hObject.empty?
|
101
|
-
hReturn = Releasability.unpack(hObject, responseObj)
|
103
|
+
hReturn = Releasability.unpack(hObject, responseObj, outContext)
|
102
104
|
unless hReturn.nil?
|
103
105
|
intConstraint[:releasability] = hReturn
|
104
106
|
end
|
@@ -109,7 +111,7 @@ module ADIWG
|
|
109
111
|
if hConstraint.has_key?('responsibleParty')
|
110
112
|
aRParty = hConstraint['responsibleParty']
|
111
113
|
aRParty.each do |item|
|
112
|
-
hParty = ResponsibleParty.unpack(item, responseObj)
|
114
|
+
hParty = ResponsibleParty.unpack(item, responseObj, outContext)
|
113
115
|
unless hParty.nil?
|
114
116
|
intConstraint[:responsibleParty] << hParty
|
115
117
|
end
|
@@ -120,7 +122,7 @@ module ADIWG
|
|
120
122
|
if hConstraint.has_key?('legal')
|
121
123
|
hObject = hConstraint['legal']
|
122
124
|
unless hObject.empty?
|
123
|
-
hReturn = LegalConstraint.unpack(hObject, responseObj)
|
125
|
+
hReturn = LegalConstraint.unpack(hObject, responseObj, inContext)
|
124
126
|
unless hReturn.nil?
|
125
127
|
intConstraint[:legalConstraint] = hReturn
|
126
128
|
end
|
@@ -129,14 +131,10 @@ module ADIWG
|
|
129
131
|
end
|
130
132
|
end
|
131
133
|
if hObject.empty?
|
132
|
-
responseObj
|
133
|
-
responseObj[:readerExecutionPass] = false
|
134
|
-
return nil
|
134
|
+
@MessagePath.issueError(93, responseObj, inContext)
|
135
135
|
end
|
136
136
|
else
|
137
|
-
responseObj
|
138
|
-
responseObj[:readerExecutionPass] = false
|
139
|
-
return nil
|
137
|
+
@MessagePath.issueError(93, responseObj, inContext)
|
140
138
|
end
|
141
139
|
end
|
142
140
|
|
@@ -144,7 +142,7 @@ module ADIWG
|
|
144
142
|
if hConstraint.has_key?('security')
|
145
143
|
hObject = hConstraint['security']
|
146
144
|
unless hObject.empty?
|
147
|
-
hReturn = SecurityConstraint.unpack(hObject, responseObj)
|
145
|
+
hReturn = SecurityConstraint.unpack(hObject, responseObj, inContext)
|
148
146
|
unless hReturn.nil?
|
149
147
|
intConstraint[:securityConstraint] = hReturn
|
150
148
|
end
|
@@ -153,14 +151,10 @@ module ADIWG
|
|
153
151
|
end
|
154
152
|
end
|
155
153
|
if hObject.empty?
|
156
|
-
responseObj
|
157
|
-
responseObj[:readerExecutionPass] = false
|
158
|
-
return nil
|
154
|
+
@MessagePath.issueError(94, responseObj, inContext)
|
159
155
|
end
|
160
156
|
else
|
161
|
-
responseObj
|
162
|
-
responseObj[:readerExecutionPass] = false
|
163
|
-
return nil
|
157
|
+
@MessagePath.issueError(94, responseObj, inContext)
|
164
158
|
end
|
165
159
|
end
|
166
160
|
|
@@ -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-17 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-23 original script
|
7
7
|
|
8
8
|
require_relative 'module_onlineResource'
|
@@ -19,11 +19,11 @@ module ADIWG
|
|
19
19
|
|
20
20
|
def self.unpack(hContact, responseObj)
|
21
21
|
|
22
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
22
23
|
|
23
24
|
# return nil object if input is empty
|
24
25
|
if hContact.empty?
|
25
|
-
responseObj
|
26
|
-
responseObj[:readerExecutionPass] = false
|
26
|
+
@MessagePath.issueWarning(100, responseObj)
|
27
27
|
return nil
|
28
28
|
end
|
29
29
|
|
@@ -31,14 +31,15 @@ module ADIWG
|
|
31
31
|
intMetadataClass = InternalMetadata.new
|
32
32
|
intContact = intMetadataClass.newContact
|
33
33
|
|
34
|
+
outContext = nil
|
35
|
+
|
34
36
|
# contact - contact id (required)
|
35
37
|
if hContact.has_key?('contactId')
|
36
38
|
intContact[:contactId] = hContact['contactId']
|
39
|
+
outContext = 'contact ID ' + hContact['contactId']
|
37
40
|
end
|
38
41
|
if intContact[:contactId].nil? || intContact[:contactId] == ''
|
39
|
-
responseObj
|
40
|
-
responseObj[:readerExecutionPass] = false
|
41
|
-
return nil
|
42
|
+
@MessagePath.issueError(101, responseObj)
|
42
43
|
end
|
43
44
|
|
44
45
|
# contact - is organization (required)
|
@@ -65,14 +66,11 @@ module ADIWG
|
|
65
66
|
end
|
66
67
|
if intContact[:name].nil? || intContact[:name] == ''
|
67
68
|
if intContact[:isOrganization] === true
|
68
|
-
responseObj
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: individual contact name and/or position are missing'
|
74
|
-
responseObj[:readerExecutionPass] = false
|
75
|
-
return nil
|
69
|
+
@MessagePath.issueError(102, responseObj, outContext)
|
70
|
+
else
|
71
|
+
if intContact[:positionName].nil? || intContact[:positionName] == ''
|
72
|
+
@MessagePath.issueError(103, responseObj, outContext)
|
73
|
+
end
|
76
74
|
end
|
77
75
|
end
|
78
76
|
|
@@ -89,7 +87,7 @@ module ADIWG
|
|
89
87
|
if hContact.has_key?('logoGraphic')
|
90
88
|
aItems = hContact['logoGraphic']
|
91
89
|
aItems.each do |item|
|
92
|
-
hReturn = Graphic.unpack(item, responseObj)
|
90
|
+
hReturn = Graphic.unpack(item, responseObj, outContext)
|
93
91
|
unless hReturn.nil?
|
94
92
|
intContact[:logos] << hReturn
|
95
93
|
end
|
@@ -100,18 +98,19 @@ module ADIWG
|
|
100
98
|
if hContact.has_key?('phone')
|
101
99
|
aItems = hContact['phone']
|
102
100
|
aItems.each do |item|
|
103
|
-
hReturn = Phone.unpack(item, responseObj)
|
101
|
+
hReturn = Phone.unpack(item, responseObj, outContext)
|
104
102
|
unless hReturn.nil?
|
105
103
|
intContact[:phones] << hReturn
|
106
104
|
end
|
107
105
|
end
|
108
106
|
end
|
109
107
|
|
108
|
+
# TODO need outContext
|
110
109
|
# contact - address [address]
|
111
110
|
if hContact.has_key?('address')
|
112
111
|
aItems = hContact['address']
|
113
112
|
aItems.each do |item|
|
114
|
-
hReturn = Address.unpack(item, responseObj)
|
113
|
+
hReturn = Address.unpack(item, responseObj, outContext)
|
115
114
|
unless hReturn.nil?
|
116
115
|
intContact[:addresses] << hReturn
|
117
116
|
end
|
@@ -131,7 +130,7 @@ module ADIWG
|
|
131
130
|
if hContact.has_key?('onlineResource')
|
132
131
|
aItems = hContact['onlineResource']
|
133
132
|
aItems.each do |item|
|
134
|
-
hReturn = OnlineResource.unpack(item, responseObj)
|
133
|
+
hReturn = OnlineResource.unpack(item, responseObj, outContext)
|
135
134
|
unless hReturn.nil?
|
136
135
|
intContact[:onlineResources] << hReturn
|
137
136
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-06-17 refactored error and warning messaging
|
5
6
|
# Stan Smith 2018-02-20 original script
|
6
7
|
|
7
8
|
require_relative 'module_mdJson'
|
@@ -15,15 +16,16 @@ module ADIWG
|
|
15
16
|
|
16
17
|
def self.examine(aContact, responseObj)
|
17
18
|
|
19
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
20
|
+
|
18
21
|
# test that all organizationMember IDs are in the contacts array
|
19
22
|
aContact.each do |hContact|
|
20
23
|
contactId = hContact[:contactId]
|
21
24
|
hContact[:memberOfOrgs].each do |orgId|
|
22
25
|
hOrg = MdJson.findContact(orgId)
|
23
26
|
if hOrg[0].nil?
|
24
|
-
|
25
|
-
|
26
|
-
responseObj[:readerExecutionPass] = false
|
27
|
+
outContext = "contact #{contactId}, membership organization ID #{orgId}"
|
28
|
+
@MessagePath.issueWarning(110, responseObj, outContext)
|
27
29
|
end
|
28
30
|
end
|
29
31
|
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-17 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-10-19 original script
|
7
7
|
|
8
8
|
module ADIWG
|
@@ -12,12 +12,14 @@ module ADIWG
|
|
12
12
|
|
13
13
|
module CoordinateResolution
|
14
14
|
|
15
|
-
def self.unpack(hCoordRes, responseObj)
|
15
|
+
def self.unpack(hCoordRes, responseObj, inContext = nil)
|
16
|
+
|
17
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
18
|
+
|
16
19
|
|
17
20
|
# return nil object if input is empty
|
18
21
|
if hCoordRes.empty?
|
19
|
-
responseObj
|
20
|
-
'WARNING: mdJson reader: spatial resolution coordinate resolution object is empty'
|
22
|
+
@MessagePath.issueWarning(120, responseObj, inContext)
|
21
23
|
return nil
|
22
24
|
end
|
23
25
|
|
@@ -30,10 +32,7 @@ module ADIWG
|
|
30
32
|
intCoordRes[:abscissaResolutionX] = hCoordRes['abscissaResolutionX']
|
31
33
|
end
|
32
34
|
if intCoordRes[:abscissaResolutionX].nil? || intCoordRes[:abscissaResolutionX] == ''
|
33
|
-
responseObj
|
34
|
-
'ERROR: mdJson reader: coordinate spatial resolution abscissa resolution is missing'
|
35
|
-
responseObj[:readerExecutionPass] = false
|
36
|
-
return nil
|
35
|
+
@MessagePath.issueError(121, responseObj, inContext)
|
37
36
|
end
|
38
37
|
|
39
38
|
# coordinate resolution - ordinate (Y) (required)
|
@@ -41,10 +40,7 @@ module ADIWG
|
|
41
40
|
intCoordRes[:ordinateResolutionY] = hCoordRes['ordinateResolutionY']
|
42
41
|
end
|
43
42
|
if intCoordRes[:ordinateResolutionY].nil? || intCoordRes[:ordinateResolutionY] == ''
|
44
|
-
responseObj
|
45
|
-
'ERROR: mdJson reader: coordinate spatial resolution ordinate resolution is missing'
|
46
|
-
responseObj[:readerExecutionPass] = false
|
47
|
-
return nil
|
43
|
+
@MessagePath.issueError(122, responseObj, inContext)
|
48
44
|
end
|
49
45
|
|
50
46
|
# coordinate resolution - units of measure (required)
|
@@ -52,9 +48,7 @@ module ADIWG
|
|
52
48
|
intCoordRes[:unitOfMeasure] = hCoordRes['unitOfMeasure']
|
53
49
|
end
|
54
50
|
if intCoordRes[:unitOfMeasure].nil? || intCoordRes[:unitOfMeasure] == ''
|
55
|
-
responseObj
|
56
|
-
responseObj[:readerExecutionPass] = false
|
57
|
-
return nil
|
51
|
+
@MessagePath.issueError(123, responseObj, inContext)
|
58
52
|
end
|
59
53
|
|
60
54
|
return intCoordRes
|
@@ -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-18 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-18 original script
|
7
7
|
|
8
8
|
require_relative 'module_identifier'
|
@@ -18,9 +18,11 @@ module ADIWG
|
|
18
18
|
|
19
19
|
def self.unpack(hContent, responseObj)
|
20
20
|
|
21
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
22
|
+
|
21
23
|
# return nil object if input is empty
|
22
24
|
if hContent.empty?
|
23
|
-
responseObj
|
25
|
+
@MessagePath.issueWarning(130, responseObj)
|
24
26
|
return nil
|
25
27
|
end
|
26
28
|
|
@@ -35,9 +37,7 @@ module ADIWG
|
|
35
37
|
end
|
36
38
|
end
|
37
39
|
if intContent[:coverageName].nil?
|
38
|
-
responseObj
|
39
|
-
responseObj[:readerExecutionPass] = false
|
40
|
-
return nil
|
40
|
+
@MessagePath.issueError(131, responseObj)
|
41
41
|
end
|
42
42
|
|
43
43
|
# content information - coverage description (required)
|
@@ -47,9 +47,7 @@ module ADIWG
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
if intContent[:coverageDescription].nil?
|
50
|
-
responseObj
|
51
|
-
responseObj[:readerExecutionPass] = false
|
52
|
-
return nil
|
50
|
+
@MessagePath.issueError(132, responseObj)
|
53
51
|
end
|
54
52
|
|
55
53
|
# content information - processing level code
|
@@ -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-18 refactored error and warning messaging
|
6
6
|
# Stan Smith 2018-01-25 rename dictionaryFormat to dictionaryFunctionalLanguage
|
7
7
|
# Stan Smith 2017-11-09 add dictionary description
|
8
8
|
# Stan Smith 2017-01-20 refactored for mdJson/mdTranslator 2.0
|
@@ -26,9 +26,11 @@ module ADIWG
|
|
26
26
|
|
27
27
|
def self.unpack(hDictionary, responseObj)
|
28
28
|
|
29
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
30
|
+
|
29
31
|
# return nil object if input is empty
|
30
32
|
if hDictionary.empty?
|
31
|
-
responseObj
|
33
|
+
@MessagePath.issueWarning(140, responseObj)
|
32
34
|
return nil
|
33
35
|
end
|
34
36
|
|
@@ -55,9 +57,7 @@ module ADIWG
|
|
55
57
|
end
|
56
58
|
end
|
57
59
|
if intDictionary[:citation].empty?
|
58
|
-
responseObj
|
59
|
-
responseObj[:readerExecutionPass] = false
|
60
|
-
return nil
|
60
|
+
@MessagePath.issueError(141, responseObj)
|
61
61
|
end
|
62
62
|
|
63
63
|
# dictionary - subject [] (required)
|
@@ -70,9 +70,7 @@ module ADIWG
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
if intDictionary[:subjects].empty?
|
73
|
-
responseObj
|
74
|
-
responseObj[:readerExecutionPass] = false
|
75
|
-
return nil
|
73
|
+
@MessagePath.issueError(142, responseObj)
|
76
74
|
end
|
77
75
|
|
78
76
|
# dictionary - recommended use []
|
@@ -107,9 +105,7 @@ module ADIWG
|
|
107
105
|
end
|
108
106
|
end
|
109
107
|
if intDictionary[:responsibleParty].empty?
|
110
|
-
responseObj
|
111
|
-
responseObj[:readerExecutionPass] = false
|
112
|
-
return nil
|
108
|
+
@MessagePath.issueError(143, responseObj)
|
113
109
|
end
|
114
110
|
|
115
111
|
# dictionary - dictionary format
|
@@ -119,8 +115,7 @@ module ADIWG
|
|
119
115
|
s = hDictionary['dictionaryFunctionalLanguage']
|
120
116
|
elsif hDictionary.has_key?('dictionaryFormat')
|
121
117
|
s = hDictionary['dictionaryFormat']
|
122
|
-
responseObj
|
123
|
-
'WARNING: mdJson reader: data dictionary dictionaryFormat is deprecated, use dictionaryFunctionalLanguage'
|
118
|
+
@MessagePath.issueWarning(144, responseObj)
|
124
119
|
end
|
125
120
|
unless s.nil? || s == ''
|
126
121
|
intDictionary[:dictionaryFunctionalLanguage] = s
|