Sha256: fa166158db6172d5770b72b3629a23e159170d987ba442de0880ad00fdd170b6

Contents?: true

Size: 768 Bytes

Versions: 22

Compression:

Stored size: 768 Bytes

Contents

class JettyCleaner

  def self.clean(namespace=nil)
    objects = Fedora::Repository.instance.find_objects(:limit=>1000000)
    
    objects.each do |obj|
      case obj
      when ActiveFedora::Base
        puts "deleting #{obj.pid}"
      when Fedora::FedoraObject
        puts "found FedoraObject #{obj.pid}"
        if namespace
          if obj.pid.match(/^#{namespace}:/)
            puts "deleting #{obj.pid} from namespace #{namespace}" 
            ActiveFedora::Base.load_instance( obj.pid ).delete
          end
        else
          puts "deleting #{obj.pid}"
          ActiveFedora::Base.load_instance( obj.pid ).delete
        end
      else
        puts "#{obj.pid} is a #{obj.class}. Could not load and delete it."
      end
    end
    nil
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
hydra-head-3.2.0 lib/jetty_cleaner.rb
hydra-head-3.2.0.pre3 lib/jetty_cleaner.rb
hydra-head-3.2.0.pre2 lib/jetty_cleaner.rb
hydra-head-3.2.0.pre1 lib/jetty_cleaner.rb
hydra-head-3.1.5 lib/jetty_cleaner.rb
hydra-head-3.1.4 lib/jetty_cleaner.rb
hydra-head-3.1.3 lib/jetty_cleaner.rb
hydra-head-3.1.2 lib/jetty_cleaner.rb
hydra-head-3.1.1 lib/jetty_cleaner.rb
hydra-head-3.1.0 lib/jetty_cleaner.rb
hydra-head-3.1.0.rc2 lib/jetty_cleaner.rb
hydra-head-3.1.0.rc1 lib/jetty_cleaner.rb
hydra-head-3.1.0.pre5 lib/jetty_cleaner.rb
hydra-head-3.1.0.pre4 lib/jetty_cleaner.rb
hydra-head-3.1.0.pre3 lib/jetty_cleaner.rb
hydra-head-3.0.1 lib/jetty_cleaner.rb
hydra-head-3.1.0.pre2 lib/jetty_cleaner.rb
hydra-head-3.0.0 lib/jetty_cleaner.rb
hydra-head-3.1.0.pre1 lib/jetty_cleaner.rb
hydra-head-3.0.0.rc2 lib/jetty_cleaner.rb