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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb', line 20
def self.unpack(xMetaInfo, hResponseObj)
intMetadataClass = InternalMetadata.new
hMetadataInfo = intMetadataClass.newMetadataInfo
hLegal = intMetadataClass.newLegalConstraint
date = xMetaInfo.xpath('./metd').text
unless date.empty?
hDate = Date.unpack(date, '', 'creation', hResponseObj)
unless hDate.nil?
hMetadataInfo[:metadataDates] << hDate
end
end
if date.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: metadata creation date is missing'
end
date = xMetaInfo.xpath('./metrd').text
unless date.empty?
hDate = Date.unpack(date, '', 'review', hResponseObj)
unless hDate.nil?
hMetadataInfo[:metadataDates] << hDate
end
end
date = xMetaInfo.xpath('./metfrd').text
unless date.empty?
hDate = Date.unpack(date, '', 'nextReview', hResponseObj)
unless hDate.nil?
hMetadataInfo[:metadataDates] << hDate
end
end
xContact = xMetaInfo.xpath('./metc')
unless xContact.empty?
hResponsibility = Contact.unpack(xContact, hResponseObj)
unless hResponsibility.nil?
hResponsibility[:roleName] = 'pointOfContact'
hMetadataInfo[:metadataContacts] << hResponsibility
end
end
if xContact.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: metadata point of contact is missing'
end
accessCode = xMetaInfo.xpath('metac').text
unless accessCode.empty?
hLegal[:accessCodes] << accessCode
end
useCode = xMetaInfo.xpath('metuc').text
unless useCode.empty?
hLegal[:useCodes] << useCode
end
legal = accessCode + useCode
if legal != ''
hConstraint = intMetadataClass.newConstraint
hConstraint[:type] = 'legal'
hConstraint[:legalConstraint] = hLegal
hMetadataInfo[:metadataConstraints] << hConstraint
end
xSecurity = xMetaInfo.xpath('./metsi')
unless xSecurity.empty?
hSecurity = intMetadataClass.newSecurityConstraint
system = xSecurity.xpath('./metscs').text
unless system.empty?
hSecurity[:classSystem] = system
end
classCode = xSecurity.xpath('./metsc').text
unless classCode.empty?
hSecurity[:classCode] = classCode
end
handling = xSecurity.xpath('./metshd').text
unless handling.empty?
hSecurity[:handling] = handling
end
security = system + classCode + handling
if security != ''
hConstraint = intMetadataClass.newConstraint
hConstraint[:type] = 'security'
hConstraint[:securityConstraint] = hSecurity
hMetadataInfo[:metadataConstraints] << hConstraint
end
end
return hMetadataInfo
end
|