adiwg-mdtranslator 2.6.1 → 2.7.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 +8 -1
- data/adiwg-mdtranslator.gemspec +1 -1
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +3 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +7 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +35 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb +10 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb +69 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb +6 -10
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb +3 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +3 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_raster.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_source.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialOrganization.rb +6 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +6 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +6 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +101 -94
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +2 -2
- data/lib/adiwg/mdtranslator/version.rb +4 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_browse.rb +54 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +35 -15
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb +53 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_description.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +39 -3
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +148 -89
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_keyword.rb +6 -6
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_lineage.rb +91 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +94 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb +55 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +119 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_publisher.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_quality.rb +64 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_security.rb +69 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_series.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb +124 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialDomain.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialOrganization.rb +177 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_status.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomy.rb +70 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyClassification.rb +65 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb +55 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +154 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +22 -16
- data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb +19 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/readme.md +2 -2
- data/lib/adiwg/mdtranslator/writers/html/html_writer.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_source.rb +7 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entityAttribute.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_source.rb +1 -0
- metadata +19 -4
@@ -0,0 +1,91 @@
|
|
1
|
+
# FGDC <<Class>> Lineage
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-12-15 original script
|
6
|
+
|
7
|
+
require_relative 'class_method'
|
8
|
+
require_relative 'class_source'
|
9
|
+
require_relative 'class_process'
|
10
|
+
|
11
|
+
module ADIWG
|
12
|
+
module Mdtranslator
|
13
|
+
module Writers
|
14
|
+
module Fgdc
|
15
|
+
|
16
|
+
class Lineage
|
17
|
+
|
18
|
+
def initialize(xml, hResponseObj)
|
19
|
+
@xml = xml
|
20
|
+
@hResponseObj = hResponseObj
|
21
|
+
end
|
22
|
+
|
23
|
+
def writeXML(aLineage)
|
24
|
+
|
25
|
+
# take only the first lineage description
|
26
|
+
hLineage = aLineage[0]
|
27
|
+
aSourceCollection = []
|
28
|
+
haveStep = false
|
29
|
+
|
30
|
+
# classes used
|
31
|
+
methodClass = Method.new(@xml, @hResponseObj)
|
32
|
+
sourceClass = Source.new(@xml, @hResponseObj)
|
33
|
+
processClass = Process.new(@xml, @hResponseObj)
|
34
|
+
|
35
|
+
# lineage bio (method) - methodology
|
36
|
+
methodClass.writeXML(hLineage)
|
37
|
+
|
38
|
+
# lineage 2.5.1 (srcinfo) - source information []
|
39
|
+
# <- lineage.source
|
40
|
+
hLineage[:dataSources].each do |hSource|
|
41
|
+
sourceClass.writeXML(hSource, aSourceCollection)
|
42
|
+
end
|
43
|
+
|
44
|
+
# lineage 2.5.1 (srcinfo) - source information from source process steps []
|
45
|
+
# <- lineage.processSteps.stepSources/stepProducts
|
46
|
+
hLineage[:processSteps].each do |hProcess|
|
47
|
+
hProcess[:stepSources].each do |hStepSource|
|
48
|
+
sourceClass.writeXML(hStepSource, aSourceCollection)
|
49
|
+
end
|
50
|
+
hProcess[:stepProducts].each do |hStepProduct|
|
51
|
+
sourceClass.writeXML(hStepProduct, aSourceCollection)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# the search for sources is circular, I'm stopping here.
|
56
|
+
|
57
|
+
if aSourceCollection.empty? && @hResponseObj[:writerShowTags]
|
58
|
+
@xml.tag!('srcinfo')
|
59
|
+
end
|
60
|
+
|
61
|
+
# lineage 2.5.2 (procstep) - process step (required)
|
62
|
+
hLineage[:processSteps].each do |hStep|
|
63
|
+
@xml.tag!('procstep') do
|
64
|
+
processClass.writeXML(hStep)
|
65
|
+
haveStep = true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# lineage 2.5.2 (procstep) - process steps from source (required)
|
70
|
+
hLineage[:dataSources].each do |hSource|
|
71
|
+
hSource[:sourceSteps].each do |hStep|
|
72
|
+
@xml.tag!('procstep') do
|
73
|
+
processClass.writeXML(hStep)
|
74
|
+
haveStep = true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
unless haveStep
|
79
|
+
@hResponseObj[:writerPass] = false
|
80
|
+
@hResponseObj[:writerMessages] << 'Lineage Source is missing process steps'
|
81
|
+
end
|
82
|
+
|
83
|
+
# the search for process steps is circular, I'm stopping here.
|
84
|
+
|
85
|
+
end # writeXML
|
86
|
+
end # lineage
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# FGDC <<Class>> Method
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-12-20 original script
|
6
|
+
|
7
|
+
require_relative '../fgdc_writer'
|
8
|
+
require_relative 'class_methodKeywords'
|
9
|
+
require_relative 'class_citation'
|
10
|
+
|
11
|
+
module ADIWG
|
12
|
+
module Mdtranslator
|
13
|
+
module Writers
|
14
|
+
module Fgdc
|
15
|
+
|
16
|
+
class Method
|
17
|
+
|
18
|
+
def initialize(xml, hResponseObj)
|
19
|
+
@xml = xml
|
20
|
+
@hResponseObj = hResponseObj
|
21
|
+
end
|
22
|
+
|
23
|
+
def writeXML(hLineage)
|
24
|
+
|
25
|
+
# classes used
|
26
|
+
keywordClass = MethodKeyword.new(@xml, @hResponseObj)
|
27
|
+
citationClass = Citation.new(@xml, @hResponseObj)
|
28
|
+
|
29
|
+
hIntObj = ADIWG::Mdtranslator::Writers::Fgdc.get_intObj
|
30
|
+
haveMethod = false
|
31
|
+
haveMethod = true unless hLineage[:statement].nil?
|
32
|
+
haveMethod = true unless hLineage[:lineageCitation].empty?
|
33
|
+
aKeywords = hIntObj[:metadata][:resourceInfo][:keywords]
|
34
|
+
aKeywords.each do |hKeyword|
|
35
|
+
if hKeyword[:keywordType] == 'method'
|
36
|
+
haveMethod = true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
if haveMethod
|
41
|
+
@xml.tag!('method') do
|
42
|
+
|
43
|
+
# methodology bio (methtype) - method type (required)
|
44
|
+
# <- resourceLineage.statement
|
45
|
+
unless hLineage[:statement].nil?
|
46
|
+
@xml.tag!('methtype', hLineage[:statement])
|
47
|
+
end
|
48
|
+
if hLineage[:statement].nil?
|
49
|
+
@hResponseObj[:writerPass] = false
|
50
|
+
@hResponseObj[:writerMessages] << 'Lineage Method is missing type and/or description'
|
51
|
+
end
|
52
|
+
|
53
|
+
# methodology bio (methodid) - method id [] {keywords} (required)
|
54
|
+
# <- resourceInfo.keywords.keywordType = 'method'
|
55
|
+
keywordClass.writeXML(aKeywords)
|
56
|
+
|
57
|
+
# methodology bio (methdesc) - method description (required)
|
58
|
+
# <- resourceLineage.statement
|
59
|
+
unless hLineage[:statement].nil?
|
60
|
+
@xml.tag!('methdesc', hLineage[:statement])
|
61
|
+
end
|
62
|
+
if hLineage[:statement].nil?
|
63
|
+
@hResponseObj[:writerPass] = false
|
64
|
+
@hResponseObj[:writerMessages] << 'Lineage Method is missing type and/or description'
|
65
|
+
end
|
66
|
+
|
67
|
+
# methodology bio (methcite) - method citation [] (required)
|
68
|
+
# <- resourceLineage.lineageCitation
|
69
|
+
hLineage[:lineageCitation].each do |hCitation|
|
70
|
+
unless hCitation.empty?
|
71
|
+
@xml.tag!('methcite') do
|
72
|
+
citationClass.writeXML(hCitation, [])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
if hLineage[:lineageCitation].empty?
|
77
|
+
@hResponseObj[:writerPass] = false
|
78
|
+
@hResponseObj[:writerMessages] << 'Lineage Method is missing citation'
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if !haveMethod && @hResponseObj[:writerShowTags]
|
85
|
+
@xml.tag!('method')
|
86
|
+
end
|
87
|
+
|
88
|
+
end # writeXML
|
89
|
+
end # Method
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# FGDC <<Class>> MethodKeyword
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-12-20 original script
|
6
|
+
|
7
|
+
module ADIWG
|
8
|
+
module Mdtranslator
|
9
|
+
module Writers
|
10
|
+
module Fgdc
|
11
|
+
|
12
|
+
class MethodKeyword
|
13
|
+
|
14
|
+
def initialize(xml, hResponseObj)
|
15
|
+
@xml = xml
|
16
|
+
@hResponseObj = hResponseObj
|
17
|
+
end
|
18
|
+
|
19
|
+
def writeXML(aKeywords)
|
20
|
+
|
21
|
+
# method bio (methodid) - lineage method keywords (required)
|
22
|
+
haveMethod = false
|
23
|
+
aKeywords.each do |hKeySet|
|
24
|
+
type = hKeySet[:keywordType]
|
25
|
+
if type == 'method'
|
26
|
+
aKeywords = hKeySet[:keywords]
|
27
|
+
thesaurus = hKeySet[:thesaurus]
|
28
|
+
if thesaurus.empty?
|
29
|
+
@hResponseObj[:writerPass] = false
|
30
|
+
@hResponseObj[:writerMessages] << 'Lineage Method Keyword Set is missing thesaurus'
|
31
|
+
end
|
32
|
+
@xml.tag!('methodid') do
|
33
|
+
@xml.tag!('methkt', thesaurus[:title])
|
34
|
+
aKeywords.each do |hKeyword|
|
35
|
+
keyword = hKeyword[:keyword]
|
36
|
+
unless keyword.nil?
|
37
|
+
@xml.tag!('methkey', keyword)
|
38
|
+
haveMethod = true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
unless haveMethod
|
45
|
+
@hResponseObj[:writerPass] = false
|
46
|
+
@hResponseObj[:writerMessages] << 'Lineage Method is missing keyword set'
|
47
|
+
end
|
48
|
+
|
49
|
+
end # writeXML
|
50
|
+
end # MethodKeyword
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# FGDC <<Class>> Process
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-12-18 original script
|
6
|
+
|
7
|
+
require 'adiwg/mdtranslator/internal/module_dateTimeFun'
|
8
|
+
require_relative '../fgdc_writer'
|
9
|
+
require_relative 'class_contact'
|
10
|
+
|
11
|
+
module ADIWG
|
12
|
+
module Mdtranslator
|
13
|
+
module Writers
|
14
|
+
module Fgdc
|
15
|
+
|
16
|
+
class Process
|
17
|
+
|
18
|
+
def initialize(xml, hResponseObj)
|
19
|
+
@xml = xml
|
20
|
+
@hResponseObj = hResponseObj
|
21
|
+
end
|
22
|
+
|
23
|
+
def writeXML(hStep)
|
24
|
+
|
25
|
+
# classes used
|
26
|
+
contactClass = Contact.new(@xml, @hResponseObj)
|
27
|
+
|
28
|
+
# process 2.5.2.1 (procdesc) - process description (required)
|
29
|
+
# <- resourceLineage.processStep.description
|
30
|
+
unless hStep[:description].nil?
|
31
|
+
@xml.tag!('procdesc', hStep[:description] )
|
32
|
+
end
|
33
|
+
if hStep[:description].nil?
|
34
|
+
@hResponseObj[:writerPass] = false
|
35
|
+
@hResponseObj[:writerMessages] << 'Lineage Source is missing description'
|
36
|
+
end
|
37
|
+
|
38
|
+
# process 2.5.2.2 (srcused) - source used citation abbreviation []
|
39
|
+
# <- processStep.stepSources.sourceId
|
40
|
+
haveSource = false
|
41
|
+
hStep[:stepSources].each do |hSource|
|
42
|
+
unless hSource[:sourceId].nil?
|
43
|
+
@xml.tag!('srcused', hSource[:sourceId])
|
44
|
+
haveSource = true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
if !haveSource && @hResponseObj[:writerShowTags]
|
48
|
+
@xml.tag!('srcused')
|
49
|
+
end
|
50
|
+
|
51
|
+
# process 2.5.2.3 (procdate) - process date (required)
|
52
|
+
# process 2.5.2.4 (proctime) - process time
|
53
|
+
# <- processStep.timePeriod.endDateTime
|
54
|
+
haveProcDate = false
|
55
|
+
haveProcTime = false
|
56
|
+
unless hStep[:timePeriod].empty?
|
57
|
+
hTimePeriod = hStep[:timePeriod]
|
58
|
+
unless hTimePeriod.empty?
|
59
|
+
hEndDT = hTimePeriod[:endDateTime]
|
60
|
+
unless hEndDT.empty?
|
61
|
+
procDate = AdiwgDateTimeFun.stringDateFromDateTime(hEndDT[:dateTime], hEndDT[:dateResolution])
|
62
|
+
procTime = AdiwgDateTimeFun.stringTimeFromDateTime(hEndDT[:dateTime], hEndDT[:dateResolution])
|
63
|
+
unless procDate == 'ERROR'
|
64
|
+
@xml.tag!('procdate', procDate)
|
65
|
+
haveProcDate = true
|
66
|
+
end
|
67
|
+
unless procTime == 'ERROR'
|
68
|
+
@xml.tag!('proctime', procTime)
|
69
|
+
haveProcTime = true
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
unless haveProcDate
|
75
|
+
@hResponseObj[:writerPass] = false
|
76
|
+
@hResponseObj[:writerMessages] << 'Process Step is missing process date'
|
77
|
+
end
|
78
|
+
if !haveProcTime && @hResponseObj[:writerShowTags]
|
79
|
+
@xml.tag!('proctime')
|
80
|
+
end
|
81
|
+
|
82
|
+
# process 2.5.2.5 (srcprod) - source products citation abbreviation []
|
83
|
+
# <- processStep.stepProducts.sourceId
|
84
|
+
haveSource = false
|
85
|
+
hStep[:stepProducts].each do |hSource|
|
86
|
+
unless hSource[:sourceId].nil?
|
87
|
+
@xml.tag!('srcprod', hSource[:sourceId])
|
88
|
+
haveSource = true
|
89
|
+
end
|
90
|
+
end
|
91
|
+
if !haveSource && @hResponseObj[:writerShowTags]
|
92
|
+
@xml.tag!('srcprod')
|
93
|
+
end
|
94
|
+
|
95
|
+
# process 2.5.2.6 (proccont) - process contact {contact} first
|
96
|
+
haveProcessor = false
|
97
|
+
aRParties = hStep[:processors]
|
98
|
+
aProcessors = ADIWG::Mdtranslator::Writers::Fgdc.find_responsibility(aRParties, 'processor')
|
99
|
+
aProcessors.each do |contactId|
|
100
|
+
hContact = ADIWG::Mdtranslator::Writers::Fgdc.get_contact(contactId)
|
101
|
+
unless hContact.empty?
|
102
|
+
@xml.tag!('proccont') do
|
103
|
+
contactClass.writeXML(hContact)
|
104
|
+
haveProcessor = true
|
105
|
+
break
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
if !haveProcessor && @hResponseObj[:writerShowTags]
|
110
|
+
@xml.tag!('proccont')
|
111
|
+
end
|
112
|
+
|
113
|
+
end # writeXML
|
114
|
+
end # Process
|
115
|
+
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# FGDC <<Class>> Quality
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-12-15 original script
|
6
|
+
|
7
|
+
require_relative 'class_lineage'
|
8
|
+
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Writers
|
12
|
+
module Fgdc
|
13
|
+
|
14
|
+
class Quality
|
15
|
+
|
16
|
+
def initialize(xml, hResponseObj)
|
17
|
+
@xml = xml
|
18
|
+
@hResponseObj = hResponseObj
|
19
|
+
end
|
20
|
+
|
21
|
+
def writeXML(intObj)
|
22
|
+
|
23
|
+
# classes used
|
24
|
+
lineageClass = Lineage.new(@xml, @hResponseObj)
|
25
|
+
|
26
|
+
# data quality 2.1 (attracc) - attribute accuracy (not implemented)
|
27
|
+
if @hResponseObj[:writerShowTags]
|
28
|
+
@xml.tag!('attracc', 'Not Reported')
|
29
|
+
end
|
30
|
+
|
31
|
+
# data quality 2.2 (logic) - logical consistency (not implemented) (required)
|
32
|
+
@xml.tag!('logic', 'Not Reported')
|
33
|
+
|
34
|
+
# data quality 2.3 (complete) - completion report (not implemented) (required)
|
35
|
+
@xml.tag!('complete', 'Not Reported')
|
36
|
+
|
37
|
+
# data quality 2.4 (position) - positional accuracy (not implemented)
|
38
|
+
if @hResponseObj[:writerShowTags]
|
39
|
+
@xml.tag!('position', 'Not Reported')
|
40
|
+
end
|
41
|
+
|
42
|
+
# data quality 2.5 (lineage) - lineage (required)
|
43
|
+
unless intObj[:metadata][:lineageInfo].empty?
|
44
|
+
@xml.tag!('lineage') do
|
45
|
+
lineageClass.writeXML(intObj[:metadata][:lineageInfo])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
if intObj[:metadata][:lineageInfo].empty?
|
49
|
+
@hResponseObj[:writerPass] = false
|
50
|
+
@hResponseObj[:writerMessages] << 'Data Quality is missing lineage section'
|
51
|
+
end
|
52
|
+
|
53
|
+
# data quality 2.6 (cloud) - cloud cover (not implemented)
|
54
|
+
if @hResponseObj[:writerShowTags]
|
55
|
+
@xml.tag!('cloud', 'Not Reported')
|
56
|
+
end
|
57
|
+
|
58
|
+
end # writeXML
|
59
|
+
end # Quality
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# FGDC <<Class>> Security
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-12-12 original script
|
6
|
+
|
7
|
+
module ADIWG
|
8
|
+
module Mdtranslator
|
9
|
+
module Writers
|
10
|
+
module Fgdc
|
11
|
+
|
12
|
+
class Security
|
13
|
+
|
14
|
+
def initialize(xml, hResponseObj)
|
15
|
+
@xml = xml
|
16
|
+
@hResponseObj = hResponseObj
|
17
|
+
end
|
18
|
+
|
19
|
+
def writeXML(aConstraints)
|
20
|
+
|
21
|
+
# <- resourceInfo.constraints. first type = security
|
22
|
+
haveSecurity = false
|
23
|
+
aConstraints.each do |hConstraint|
|
24
|
+
if hConstraint[:type] == 'security'
|
25
|
+
hSecurity = hConstraint[:securityConstraint]
|
26
|
+
@xml.tag!('secinfo') do
|
27
|
+
haveSecurity = true
|
28
|
+
|
29
|
+
# security 1.12.1 (secsys) - security system name (required)
|
30
|
+
unless hSecurity[:classSystem].nil?
|
31
|
+
@xml.tag!('secsys', hSecurity[:classSystem])
|
32
|
+
end
|
33
|
+
if hSecurity[:classSystem].nil?
|
34
|
+
@hResponseObj[:writerPass] = false
|
35
|
+
@hResponseObj[:writerMessages] << 'Security is missing classification system'
|
36
|
+
end
|
37
|
+
|
38
|
+
# security 1.12.2 (secclass) - security classification (required)
|
39
|
+
unless hSecurity[:classCode].nil?
|
40
|
+
@xml.tag!('secclass', hSecurity[:classCode])
|
41
|
+
end
|
42
|
+
if hSecurity[:classCode].nil?
|
43
|
+
@hResponseObj[:writerPass] = false
|
44
|
+
@hResponseObj[:writerMessages] << 'Security is missing classification'
|
45
|
+
end
|
46
|
+
|
47
|
+
# security 1.12.3 (sechandl) - security classification (required)
|
48
|
+
unless hSecurity[:handling].nil?
|
49
|
+
@xml.tag!('sechandl', hSecurity[:handling])
|
50
|
+
end
|
51
|
+
if hSecurity[:handling].nil?
|
52
|
+
@hResponseObj[:writerPass] = false
|
53
|
+
@hResponseObj[:writerMessages] << 'Security is missing handling instructions'
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
if !haveSecurity && @hResponseObj[:writerShowTags]
|
60
|
+
@xml.tag!('secinfo')
|
61
|
+
end
|
62
|
+
|
63
|
+
end # writeXML
|
64
|
+
end # Security
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|