lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb in adiwg-mdtranslator-2.10.0 vs lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb in adiwg-mdtranslator-2.12.0.pre
- old
+ new
@@ -1,9 +1,10 @@
# FGDC <<Class>> Process
# FGDC CSDGM writer output in XML
# History:
+# Stan Smith 2018-03-19 refactored error and warning messaging
# Stan Smith 2017-12-18 original script
require 'adiwg/mdtranslator/internal/module_dateTimeFun'
require_relative '../fgdc_writer'
require_relative 'class_contact'
@@ -16,10 +17,11 @@
class Process
def initialize(xml, hResponseObj)
@xml = xml
@hResponseObj = hResponseObj
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
end
def writeXML(hStep)
# classes used
@@ -29,12 +31,11 @@
# <- resourceLineage.processStep.description
unless hStep[:description].nil?
@xml.tag!('procdesc', hStep[:description] )
end
if hStep[:description].nil?
- @hResponseObj[:writerPass] = false
- @hResponseObj[:writerMessages] << 'Lineage Source is missing description'
+ @NameSpace.issueWarning(240, 'procdesc')
end
# process 2.5.2.2 (srcused) - source used citation abbreviation []
# <- processStep.stepSources.sourceId
haveSource = false
@@ -71,12 +72,11 @@
end
end
end
end
unless haveProcDate
- @hResponseObj[:writerPass] = false
- @hResponseObj[:writerMessages] << 'Process Step is missing process date'
+ @NameSpace.issueWarning(241, 'procdate')
end
if !haveProcTime && @hResponseObj[:writerShowTags]
@xml.tag!('proctime')
end
@@ -94,12 +94,12 @@
end
# process 2.5.2.6 (proccont) - process contact {contact} first
haveProcessor = false
aRParties = hStep[:processors]
- aProcessors = ADIWG::Mdtranslator::Writers::Fgdc.find_responsibility(aRParties, 'processor')
+ aProcessors = @NameSpace.find_responsibility(aRParties, 'processor')
aProcessors.each do |contactId|
- hContact = ADIWG::Mdtranslator::Writers::Fgdc.get_contact(contactId)
+ hContact = @NameSpace.get_contact(contactId)
unless hContact.empty?
@xml.tag!('proccont') do
contactClass.writeXML(hContact)
haveProcessor = true
break