Sha256: f41d6352b2959c6f86c1704ca95065aa142d3fb0a7026112a13c78674c12a636

Contents?: true

Size: 755 Bytes

Versions: 12

Compression:

Stored size: 755 Bytes

Contents

class CreateWorkJob < ActiveJob::Base
  queue_as :ingest

  before_enqueue do |job|
    log = job.arguments.last
    log.pending_job(self)
  end

  # This copies metadata from the passed in attribute to all of the works that
  # are members of the given upload set
  # @param [User] user
  # @param [String] model
  # @param [Hash] attributes
  # @param [BatchCreateOperation] log
  def perform(user, model, attributes, log)
    log.performing!
    work = model.constantize.new
    actor = work_actor(work, user)
    status = actor.create(attributes)
    return log.success! if status
    log.fail!(work.errors.full_messages.join(' '))
  end

  private

    def work_actor(work, user)
      CurationConcerns::CurationConcern.actor(work, user)
    end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sufia-7.4.1 app/jobs/create_work_job.rb
sufia-7.4.0 app/jobs/create_work_job.rb
sufia-7.3.1 app/jobs/create_work_job.rb
sufia-7.3.0 app/jobs/create_work_job.rb
sufia-7.3.0.rc3 app/jobs/create_work_job.rb
sufia-7.3.0.rc2 app/jobs/create_work_job.rb
sufia-7.3.0.rc1 app/jobs/create_work_job.rb
sufia-7.2.0 app/jobs/create_work_job.rb
sufia-7.1.0 app/jobs/create_work_job.rb
sufia-7.0.0 app/jobs/create_work_job.rb
sufia-7.0.0.rc2 app/jobs/create_work_job.rb
sufia-7.0.0.rc1 app/jobs/create_work_job.rb