Class: AuditJob

Inherits:
ActiveFedoraIdBasedJob show all
Defined in:
app/jobs/audit_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ActiveFedoraIdBasedJob

#object

Instance Attribute Details

#file_idObject

Returns the value of attribute file_id.



4
5
6
# File 'app/jobs/audit_job.rb', line 4

def file_id
  @file_id
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'app/jobs/audit_job.rb', line 4

def id
  @id
end

#uriObject

Returns the value of attribute uri.



4
5
6
# File 'app/jobs/audit_job.rb', line 4

def uri
  @uri
end

Instance Method Details

#perform(id, file_id, uri) ⇒ Object

URI of the resource to audit. This URI could include the actual resource (e.g. content) and the version to audit:

http://localhost:8983/fedora/rest/test/a/b/c/abcxyz/content/fcr:versions/version1

but it could also just be:

http://localhost:8983/fedora/rest/test/a/b/c/abcxyz/content

Parameters:

  • id (String)

    of the parent object

  • file_id (String)

    used to find the file within its parent object (usually “original_file”)

  • uri (String)

    of the specific file/version to be audited



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/jobs/audit_job.rb', line 14

def perform(id, file_id, uri)
  @id = id
  @file_id = file_id
  @uri = uri
  log = run_audit
  fixity_ok = log.pass == 1
  unless fixity_ok
    if CurationConcerns.config.callback.set?(:after_audit_failure)
       = file_set.depositor
      user = User.find_by_user_key()
      CurationConcerns.config.callback.run(:after_audit_failure, file_set, user, log.created_at)
    end
  end
  fixity_ok
end