Sha256: aac0c6cbc77d3e78041aa2bda8a831ca1829e832a0895e0f033786dbfc47096a

Contents?: true

Size: 1.87 KB

Versions: 6

Compression:

Stored size: 1.87 KB

Contents

# Writer - internal data structure to FGDC CSDGM FGDC-STD-001-1998

# History:
#  Stan Smith 2017-11-16 original script

require 'builder'
require_relative 'version'
require_relative 'classes/class_fgdc'

module ADIWG
   module Mdtranslator
      module Writers
         module Fgdc

            def self.startWriter(intObj, responseObj, whichDict: 0)

               # make objects available to the instance
               @intObj = intObj
               @contacts = intObj[:contacts]

               # set the format of the output file based on the writer
               responseObj[:writerOutputFormat] = 'xml'
               responseObj[:writerVersion] = ADIWG::Mdtranslator::Writers::Fgdc::VERSION

               # create new XML document
               xml = Builder::XmlMarkup.new(indent: 3)

               # start writing the FGDC XML record
               metadataWriter = Fgdc.new(xml, responseObj)
               metadata = metadataWriter.writeXML(intObj)

               return metadata

            end

            # find contact and return the contact hash
            def self.get_contact(contactId)
               @contacts.each do |contact|
                  if contact[:contactId] == contactId
                     return contact
                  end
               end
               return {}
            end

            def self.find_responsibility(aResponsibility, roleName)
               aParties = []
               aResponsibility.each do |hRParty|
                  if hRParty[:roleName] == roleName
                     hRParty[:parties].each do |hParty|
                        aParties << hParty[:contactId]
                     end
                  end
               end
               aParties = aParties.uniq
               return aParties
            end

            def  self.get_intObj
               return @intObj
            end

         end
      end
   end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.10.0 lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb
adiwg-mdtranslator-2.9.2 lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb
adiwg-mdtranslator-2.9.1 lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb
adiwg-mdtranslator-2.9.0 lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb
adiwg-mdtranslator-2.8.0 lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb