lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb in adiwg-mdtranslator-2.13.0 vs lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb in adiwg-mdtranslator-2.13.1
- old
+ new
@@ -1,10 +1,10 @@
# unpack citation
# Reader - ADIwg JSON to internal data structure
# History:
-# Stan Smith 2018-02-19 refactored error and warning messaging
+# Stan Smith 2018-06-26 refactored error and warning messaging
# Stan Smith 2016-10-22 original script
require_relative 'module_taxonomicSystem'
require_relative 'module_identifier'
require_relative 'module_responsibleParty'
@@ -18,13 +18,15 @@
module Taxonomy
def self.unpack(hTaxonomy, responseObj)
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
+
# return nil object if input is empty
if hTaxonomy.empty?
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: taxonomy object is empty'
+ @MessagePath.issueWarning(830, responseObj)
return nil
end
# instance classes needed in script
intMetadataClass = InternalMetadata.new
@@ -39,13 +41,11 @@
intTaxonomy[:taxonSystem] << hReturn
end
end
end
if intTaxonomy[:taxonSystem].empty?
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: taxonomy taxonomic classification system object is missing'
- responseObj[:readerExecutionPass] = false
- return nil
+ @MessagePath.issueError(831, responseObj)
end
# taxonomy - general taxonomic scope
if hTaxonomy.has_key?('generalScope')
unless hTaxonomy['generalScope'] == ''
@@ -82,13 +82,11 @@
unless hTaxonomy['identificationProcedure'] == ''
intTaxonomy[:idProcedure] = hTaxonomy['identificationProcedure']
end
end
if intTaxonomy[:idProcedure].nil? || intTaxonomy[:idProcedure] == ''
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: taxonomy identification procedure is missing'
- responseObj[:readerExecutionPass] = false
- return nil
+ @MessagePath.issueError(832, responseObj)
end
# taxonomy - identification completeness
if hTaxonomy.has_key?('identificationCompleteness')
unless hTaxonomy['identificationCompleteness'] == ''
@@ -116,12 +114,10 @@
intTaxonomy[:taxonClass] = hReturn
end
end
end
if intTaxonomy[:taxonClass].empty?
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: taxonomic classification is missing'
- responseObj[:readerExecutionPass] = false
- return nil
+ @MessagePath.issueError(833, responseObj)
end
return intTaxonomy
end