Sha256: ec36469cdd32609b974cfd1d7b9e8d23b1da392609026fc9ac71bbf421c4c3dc

Contents?: true

Size: 1.04 KB

Versions: 146

Compression:

Stored size: 1.04 KB

Contents

module ActiveFedora
  module FixtureExporter

    def self.export_to_path(pid, path, extra_params={})
      foxml = export(pid, extra_params)
      name = "#{pid.gsub(":","_")}.foxml.xml"
      filename = File.join(path, name)
      file = File.new(filename,"w")
      file.syswrite(foxml)
      filename
    end

    def self.export(pid, extra_params={})
      extra_params = {:format=>:foxml, :context=>:archive}.merge!(extra_params)
      if extra_params[:format].kind_of?(String)
        format = extra_params[:format]
      else
        format = case extra_params[:format]
          when :atom then "info:fedora/fedora-system:ATOM-1.1"
          when :atom_zip then "info:fedora/fedora-system:ATOMZip-1.1"
          when :mets then "info:fedora/fedora-system:METSFedoraExt-1.1"
          when :foxml then "info:fedora/fedora-system:FOXML-1.1"
          else "info:fedora/fedora-system:FOXML-1.1"
        end
      end

      ActiveFedora::Base.connection_for_pid(pid).export(:pid=>pid, :format=>format, :context=>extra_params[:context].to_s)
    end


  end
end

Version data entries

146 entries across 146 versions & 1 rubygems

Version Path
active-fedora-8.7.0 lib/active_fedora/fixture_exporter.rb
active-fedora-8.6.0 lib/active_fedora/fixture_exporter.rb
active-fedora-8.5.0 lib/active_fedora/fixture_exporter.rb
active-fedora-8.4.2 lib/active_fedora/fixture_exporter.rb
active-fedora-8.4.1 lib/active_fedora/fixture_exporter.rb
active-fedora-7.3.1 lib/active_fedora/fixture_exporter.rb
active-fedora-7.3.0 lib/active_fedora/fixture_exporter.rb
active-fedora-8.4.0 lib/active_fedora/fixture_exporter.rb
active-fedora-8.3.0 lib/active_fedora/fixture_exporter.rb
active-fedora-8.2.2 lib/active_fedora/fixture_exporter.rb
active-fedora-8.2.1 lib/active_fedora/fixture_exporter.rb
active-fedora-8.2.0 lib/active_fedora/fixture_exporter.rb
active-fedora-7.2.0 lib/active_fedora/fixture_exporter.rb
active-fedora-6.8.0 lib/active_fedora/fixture_exporter.rb
active-fedora-8.1.0 lib/active_fedora/fixture_exporter.rb
active-fedora-8.0.1 lib/active_fedora/fixture_exporter.rb
active-fedora-8.0.0 lib/active_fedora/fixture_exporter.rb
active-fedora-8.0.0.rc3 lib/active_fedora/fixture_exporter.rb
active-fedora-8.0.0.rc2 lib/active_fedora/fixture_exporter.rb
active-fedora-8.0.0.rc1 lib/active_fedora/fixture_exporter.rb