Module: CurationConcerns::WithFileSets

Extended by:
ActiveSupport::Concern
Included in:
WorkBehavior
Defined in:
app/models/concerns/curation_concerns/with_file_sets.rb

Instance Method Summary collapse

Instance Method Details

#cleanup_file_setsObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/models/concerns/curation_concerns/with_file_sets.rb', line 17

def cleanup_file_sets
  # Destroy the list source first.  This prevents each file_set from attemping to
  # remove itself individually from the work. If hundreds of files are attached,
  # this would take too long.

  # Get list of member file_sets from Solr
  fs = file_sets
  list_source.destroy
  # Remove Work from Solr after it was removed from Fedora
  ActiveFedora::SolrService.delete(id)
  fs.each(&:destroy)
end

#copy_visibility_to_filesObject



30
31
32
33
34
35
# File 'app/models/concerns/curation_concerns/with_file_sets.rb', line 30

def copy_visibility_to_files
  file_sets.each do |fs|
    fs.visibility = visibility
    fs.save!
  end
end

#file_set_idsObject

Stopgap unil ActiveFedora ContainerAssociation includes an *_ids accessor. At the moment, this is no more efficient than calling file_sets, but hopefully that will change in the future.



13
14
15
# File 'app/models/concerns/curation_concerns/with_file_sets.rb', line 13

def file_set_ids
  file_sets.map(&:id)
end