19
20
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
|
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb', line 19
def self.unpack(xProcess, hLineage, hResponseObj)
intMetadataClass = InternalMetadata.new
hProcess = intMetadataClass.newProcessStep
description = xProcess.xpath('./procdesc').text
unless description.empty?
hProcess[:description] = description
end
if description.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: lineage process description is missing'
end
axUsed = xProcess.xpath('./srcused')
unless axUsed.empty?
axUsed.each do |xUsed|
usedSrc = xUsed.text
unless usedSrc.empty?
hLineage[:dataSources].each do |hSource|
unless hSource[:sourceId].nil?
if usedSrc == hSource[:sourceId]
hProcess[:stepSources] << hSource
end
end
end
end
end
end
hDateTime = nil
procDate = xProcess.xpath('./procdate').text
procTime = xProcess.xpath('./proctime').text
unless procDate.empty?
hDateTime = DateTime.unpack(procDate, procTime, hResponseObj)
unless hDateTime.nil?
hTimePeriod = intMetadataClass.newTimePeriod
hTimePeriod[:description] = 'Step completion dateTime'
hTimePeriod[:endDateTime] = hDateTime
hProcess[:timePeriod] = hTimePeriod
end
end
if hDateTime.nil?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: lineage procedure date is missing'
end
axProduct = xProcess.xpath('./srcprod')
unless axProduct.empty?
axProduct.each do |xProduct|
prodSrc = xProduct.text
unless prodSrc.empty?
hLineage[:dataSources].each do |hSource|
unless hSource[:sourceId].nil?
if prodSrc == hSource[:sourceId]
hProcess[:stepProducts] << hSource
end
end
end
end
end
end
xContact = xProcess.xpath('./proccont')
unless xContact.empty?
hResponsibility = Contact.unpack(xContact, hResponseObj)
unless hResponsibility.nil?
hResponsibility[:roleName] = 'processor'
hProcess[:processors] << hResponsibility
end
end
return hProcess
end
|