adiwg-mdtranslator 2.12.0 → 2.13.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 +15 -1
- data/adiwg-mdtranslator.gemspec +1 -1
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +2 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/fgdc_reader.rb +4 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +7 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +12 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +1 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +15 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +1 -3
- data/lib/adiwg/mdtranslator/version.rb +5 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +7 -7
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +6 -5
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_address.rb +104 -104
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_aggregateInformation.rb +63 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/{class_attributeGroup.rb → class_attribute.rb} +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_baseUnit.rb +23 -23
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_boundingBox.rb +64 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_browseGraphic.rb +55 -51
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +24 -14
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contact.rb +96 -91
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_conventionalUnit.rb +45 -45
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_coverageDescription.rb +104 -77
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +23 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +57 -52
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_date.rb +49 -46
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_definitionUnit.rb +20 -20
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_derivedUnit.rb +32 -32
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dimension.rb +56 -50
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distribution.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +77 -74
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_enumerationList.rb +34 -34
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +190 -186
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extent.rb +66 -66
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_feature.rb +50 -45
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb +35 -35
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureProperties.rb +43 -43
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_format.rb +73 -69
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_fraction.rb +37 -33
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicElement.rb +59 -54
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicExtent.rb +58 -58
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometricObjects.rb +49 -46
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometryCollection.rb +68 -63
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georectified.rb +113 -110
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb +78 -75
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gmlIdentifier.rb +17 -17
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_grid.rb +55 -52
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gridRepresentation.rb +19 -19
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_hierarchy.rb +47 -47
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_image.rb +132 -132
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +5 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineString.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineage.rb +55 -55
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_locale.rb +51 -48
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenance.rb +114 -105
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdBand.rb +111 -111
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdIdentifier.rb +9 -3
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb +58 -41
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_medium.rb +104 -104
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miBand.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +51 -16
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiLine.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPoint.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPolygon.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +79 -76
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_orderProcess.rb +67 -67
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_phone.rb +67 -67
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb +8 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_polygon.rb +89 -89
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +9 -3
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rangeDimension.rb +59 -54
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +47 -47
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +111 -105
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rsIdentifier.rb +71 -65
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scope.rb +54 -50
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scopeDescription.rb +45 -42
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_securityConstraints.rb +92 -89
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_series.rb +55 -55
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb +98 -91
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +42 -42
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicClassification.rb +63 -59
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicSystem.rb +40 -40
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +133 -130
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_temporalExtent.rb +49 -49
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timeInstant.rb +60 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timePeriod.rb +110 -108
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_transferOptions.rb +71 -69
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_unitsOfMeasure.rb +243 -243
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_usage.rb +98 -95
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +38 -38
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vectorRepresentation.rb +48 -48
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_verticalExtent.rb +74 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb +56 -53
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +61 -11
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +109 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +3 -2
- data/lib/adiwg/mdtranslator_cli.rb +21 -4
- metadata +6 -5
@@ -2,75 +2,75 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
5
|
+
# Stan Smith 2016-12-13 refactored for mdTranslator/mdJson 2.0
|
6
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
7
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
8
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
9
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
10
|
+
# Stan Smith 2014-07-09 modify require statements to function in RubyGem structure
|
11
11
|
# Stan Smith 2013-11-20 original script.
|
12
12
|
|
13
13
|
require_relative 'class_processStep'
|
14
14
|
require_relative 'class_source'
|
15
15
|
|
16
16
|
module ADIWG
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
module Mdtranslator
|
18
|
+
module Writers
|
19
|
+
module Iso19115_2
|
20
20
|
|
21
|
-
|
21
|
+
class LI_Lineage
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
def initialize(xml, hResponseObj)
|
24
|
+
@xml = xml
|
25
|
+
@hResponseObj = hResponseObj
|
26
|
+
end
|
27
27
|
|
28
|
-
|
28
|
+
def writeXML(hLineage)
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
# classes used
|
31
|
+
sourceClass = LI_Source.new(@xml, @hResponseObj)
|
32
|
+
pStepClass = LI_ProcessStep.new(@xml, @hResponseObj)
|
33
33
|
|
34
|
-
|
34
|
+
@xml.tag!('gmd:LI_Lineage') do
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
36
|
+
# lineage - statement
|
37
|
+
s = hLineage[:statement]
|
38
|
+
unless s.nil?
|
39
|
+
@xml.tag!('gmd:statement') do
|
40
|
+
@xml.tag!('gco:CharacterString', s)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
44
|
+
@xml.tag!('gmd:statement')
|
45
|
+
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
47
|
+
# lineage - process step [{LI_ProcessStep}]
|
48
|
+
aProcSteps = hLineage[:processSteps]
|
49
|
+
aProcSteps.each do |pStep|
|
50
|
+
@xml.tag!('gmd:processStep') do
|
51
|
+
pStepClass.writeXML(pStep)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
if aProcSteps.empty? && @hResponseObj[:writerShowTags]
|
55
|
+
@xml.tag!('gmd:processStep')
|
56
|
+
end
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
58
|
+
# lineage - source [{LI_Source}]
|
59
|
+
aSources = hLineage[:dataSources]
|
60
|
+
aSources.each do |hSource|
|
61
|
+
@xml.tag!('gmd:source') do
|
62
|
+
sourceClass.writeXML(hSource)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
if aSources.empty? && @hResponseObj[:writerShowTags]
|
66
|
+
@xml.tag!('gmd:source')
|
67
|
+
end
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
end # gmd:LI_Lineage tag
|
70
|
+
end # writeXML
|
71
|
+
end # LI_Lineage class
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
76
|
end
|
@@ -2,70 +2,73 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
5
|
+
# Stan Smith 2018-04-09 add error and warning messaging
|
6
|
+
# Stan Smith 2016-11-21 refactored for mdTranslator/mdJson 2.0
|
6
7
|
# Stan Smith 2015-07-28 original script.
|
7
8
|
|
9
|
+
require_relative '../iso19115_2_writer'
|
8
10
|
require_relative 'class_codelist'
|
9
11
|
|
10
12
|
module ADIWG
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
module Mdtranslator
|
14
|
+
module Writers
|
15
|
+
module Iso19115_2
|
14
16
|
|
15
|
-
|
17
|
+
class PT_Locale
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
def initialize(xml, hResponseObj)
|
20
|
+
@xml = xml
|
21
|
+
@hResponseObj = hResponseObj
|
22
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
23
|
+
end
|
21
24
|
|
22
|
-
|
25
|
+
def writeXML(hLocale, inContext = nil)
|
23
26
|
|
24
|
-
|
25
|
-
|
27
|
+
# classes used
|
28
|
+
codelistClass = MD_Codelist.new(@xml, @hResponseObj)
|
26
29
|
|
27
|
-
|
30
|
+
@xml.tag!('gmd:PT_Locale') do
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
# locale - country
|
41
|
-
s = hLocale[:countryCode]
|
42
|
-
unless s.nil?
|
43
|
-
@xml.tag!('gmd:country') do
|
44
|
-
codelistClass.writeXML('gmd', 'iso_countries', s)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
if s.nil? && @hResponseObj[:writerShowTags]
|
48
|
-
@xml.tag!('gmd:country')
|
49
|
-
end
|
32
|
+
# locale - language (required)
|
33
|
+
s = hLocale[:languageCode]
|
34
|
+
unless s.nil?
|
35
|
+
@xml.tag!('gmd:languageCode') do
|
36
|
+
codelistClass.writeXML('gmd', 'iso_language', s)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
if s.nil?
|
40
|
+
@NameSpace.issueWarning(210, 'gmd:languageCode', inContext)
|
41
|
+
end
|
50
42
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
43
|
+
# locale - country
|
44
|
+
s = hLocale[:countryCode]
|
45
|
+
unless s.nil?
|
46
|
+
@xml.tag!('gmd:country') do
|
47
|
+
codelistClass.writeXML('gmd', 'iso_countries', s)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
51
|
+
@xml.tag!('gmd:country')
|
52
|
+
end
|
61
53
|
|
54
|
+
# locale - character encoding (required)
|
55
|
+
s = hLocale[:characterEncoding]
|
56
|
+
unless s.nil?
|
57
|
+
@xml.tag!('gmd:characterEncoding') do
|
58
|
+
codelistClass.writeXML('gmd', 'iso_characterSet', s)
|
62
59
|
end
|
60
|
+
end
|
61
|
+
if s.nil?
|
62
|
+
@NameSpace.issueWarning(211, 'gmd:characterEncoding', inContext)
|
63
|
+
end
|
63
64
|
|
64
|
-
|
65
|
+
end
|
65
66
|
|
66
|
-
|
67
|
+
end
|
67
68
|
|
68
69
|
end
|
69
|
-
|
70
|
-
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
71
74
|
end
|
@@ -2,118 +2,127 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
5
|
+
# Stan Smith 2018-04-10 add error and warning messaging
|
6
|
+
# Stan Smith 2016-12-12 refactored for mdTranslator/mdJson 2.0
|
7
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
8
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
9
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
10
|
+
# Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
|
11
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
12
|
+
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
12
13
|
# Stan Smith 2013-12-18 added contact
|
13
14
|
# Stan Smith 2013-10-31 original script.
|
14
15
|
|
16
|
+
require_relative '../iso19115_2_writer'
|
15
17
|
require_relative 'class_codelist'
|
16
18
|
require_relative 'class_responsibleParty'
|
17
19
|
require_relative 'class_scopeDescription'
|
18
20
|
require_relative 'class_gcoDateTime'
|
19
21
|
|
20
22
|
module ADIWG
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
23
|
+
module Mdtranslator
|
24
|
+
module Writers
|
25
|
+
module Iso19115_2
|
26
|
+
|
27
|
+
class MD_MaintenanceInformation
|
28
|
+
|
29
|
+
def initialize(xml, hResponseObj)
|
30
|
+
@xml = xml
|
31
|
+
@hResponseObj = hResponseObj
|
32
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
33
|
+
end
|
34
|
+
|
35
|
+
def writeXML(hMaintenance, inContext = nil)
|
36
|
+
|
37
|
+
# classes used
|
38
|
+
codelistClass = MD_Codelist.new(@xml, @hResponseObj)
|
39
|
+
partyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
|
40
|
+
dateTimeClass = GcoDateTime.new(@xml, @hResponseObj)
|
41
|
+
|
42
|
+
outContext = 'maintenance information'
|
43
|
+
outContext = inContext + ' maintenance information' unless inContext.nil?
|
44
|
+
|
45
|
+
@xml.tag! 'gmd:MD_MaintenanceInformation' do
|
46
|
+
|
47
|
+
# maintenance information - frequency code (required)
|
48
|
+
s = hMaintenance[:frequency]
|
49
|
+
unless s.nil?
|
50
|
+
@xml.tag!('gmd:maintenanceAndUpdateFrequency') do
|
51
|
+
codelistClass.writeXML('gmd', 'iso_maintenanceFrequency', s)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
if s.nil?
|
55
|
+
@NameSpace.issueWarning(220, 'gmd:maintenanceAndUpdateFrequency', inContext)
|
56
|
+
end
|
57
|
+
|
58
|
+
# maintenance information - date of next update
|
59
|
+
found = false
|
60
|
+
aDates = hMaintenance[:dates]
|
61
|
+
aDates.each do |hDate|
|
62
|
+
if hDate[:dateType] == 'nextUpdate'
|
63
|
+
found = true
|
64
|
+
@xml.tag!('gmd:dateOfNextUpdate') do
|
65
|
+
dateTimeClass.writeXML(hDate)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
if !found && @hResponseObj[:writerShowTags]
|
70
|
+
@xml.tag!('gmd:dateOfNextUpdate')
|
71
|
+
end
|
72
|
+
|
73
|
+
# maintenance information - user defined maintenance frequency (not supported)
|
74
|
+
|
75
|
+
# maintenance information - update scope [{MD_ScopeCode}]
|
76
|
+
haveScope = false
|
77
|
+
aScopes = hMaintenance[:scopes]
|
78
|
+
aScopes.each do |hScope|
|
79
|
+
s = hScope[:scopeCode]
|
80
|
+
haveScope = true
|
81
|
+
@xml.tag!('gmd:updateScope') do
|
82
|
+
codelistClass.writeXML('gmd', 'iso_scope', s)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
if !haveScope && @hResponseObj[:writerShowTags]
|
86
|
+
@xml.tag!('gmd:updateScope')
|
87
|
+
end
|
88
|
+
|
89
|
+
# maintenance information - update scope description [] (dropped)
|
90
|
+
# according to XSD content type is 'element only' - so tag only, no text within
|
91
|
+
# allowed tags are [featureInstances, attributes, features, other, attributeInstances, dataset]
|
92
|
+
# not collecting this info in mdJson
|
93
|
+
# this field was dropped in 19115-1
|
94
|
+
|
95
|
+
# maintenance information - note []
|
96
|
+
aNotes = hMaintenance[:notes]
|
97
|
+
aNotes.each do |note|
|
98
|
+
@xml.tag!('gmd:maintenanceNote') do
|
99
|
+
@xml.tag!('gco:CharacterString', note)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
if aNotes.empty? && @hResponseObj[:writerShowTags]
|
103
|
+
@xml.tag!('gmd:maintenanceNote')
|
104
|
+
end
|
105
|
+
|
106
|
+
# maintenance information - contact [{CI_ResponsibleParty}]
|
107
|
+
aParties = hMaintenance[:contacts]
|
108
|
+
aParties.each do |hRParty|
|
109
|
+
role = hRParty[:roleName]
|
110
|
+
aParties = hRParty[:parties]
|
111
|
+
aParties.each do |hParty|
|
112
|
+
@xml.tag!('gmd:contact') do
|
113
|
+
partyClass.writeXML(role, hParty, outContext)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
if aParties.empty? && @hResponseObj[:writerShowTags]
|
118
|
+
@xml.tag!('gmd:contact')
|
119
|
+
end
|
120
|
+
|
121
|
+
end # gmd:MD_MaintenanceInformation tag
|
122
|
+
end # writeXML
|
123
|
+
end # MD_MaintenanceInformation class
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
119
128
|
end
|