18
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
|
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/module_publication.rb', line 18
def self.unpack(xPublication, hResponseObj)
intMetadataClass = InternalMetadata.new
hResponsibility = nil
contactId = nil
publisher = xPublication.xpath('./publish').text
unless publisher.empty?
contactId = Fgdc.find_contact_by_name(publisher)
if contactId.nil?
contactId = Fgdc.add_contact(publisher, true)
end
hResponsibility = Responsibility.unpack([contactId], 'publisher', hResponseObj)
end
if publisher.nil?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: citation publisher contact is missing'
end
place = xPublication.xpath('./pubplace').text
unless place.empty?
unless contactId.nil?
hContact = Fgdc.get_contact_by_id(contactId)
unless hContact.nil?
if hContact[:addresses].empty?
hAddress = intMetadataClass.newAddress
hContact[:addresses] << hAddress
else
hAddress = hContact[:addresses][0]
end
hAddress[:addressTypes] << 'mailing'
hAddress[:description] = place
Fgdc.set_contact(hContact)
end
end
end
if place.nil?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: citation publication place is missing'
end
return hResponsibility
end
|