Class: Ddr::Batch::BatchObject
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Ddr::Batch::BatchObject
show all
- Defined in:
- app/models/ddr/batch/batch_object.rb
Overview
This is a superclass containing methods common to all batch object objects. It is not intended to be instantiated directly. This superclass and its subclasses are designed following the ActiveRecord single-table inheritance pattern.
Defined Under Namespace
Classes: Results
Constant Summary
collapse
- VERIFICATION_PASS =
"PASS"
- VERIFICATION_FAIL =
"FAIL"
- EVENT_SUMMARY =
<<-EOS
%{label}
Batch object database id: %{batch_id}
Batch object identifier: %{identifier}
Model: %{model}
EOS
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.pid_from_identifier(identifier, batch_id) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/models/ddr/batch/batch_object.rb', line 22
def self.pid_from_identifier(identifier, batch_id)
query = "identifier = :identifier"
query << " and batch_id = :batch_id" if batch_id
params = { :identifier => identifier }
params[:batch_id] = batch_id if batch_id
sort = "updated_at asc"
found_objects = BatchObject.where(query, params).order(sort)
pids = []
found_objects.each { |obj| pids << obj.pid }
return pids
end
|
Instance Method Details
#error_prefix ⇒ Object
34
35
36
|
# File 'app/models/ddr/batch/batch_object.rb', line 34
def error_prefix
I18n.t('ddr.batch.errors.prefix', :identifier => identifier, :id => id)
end
|
#local_validations ⇒ Object
47
48
49
|
# File 'app/models/ddr/batch/batch_object.rb', line 47
def local_validations
[]
end
|
#model_datastream_keys ⇒ Object
51
52
53
|
# File 'app/models/ddr/batch/batch_object.rb', line 51
def model_datastream_keys
raise NotImplementedError
end
|
#process(user, opts = {}) ⇒ Object
55
56
57
|
# File 'app/models/ddr/batch/batch_object.rb', line 55
def process(user, opts = {})
raise NotImplementedError
end
|
#results_message ⇒ Object
59
60
61
|
# File 'app/models/ddr/batch/batch_object.rb', line 59
def results_message
raise NotImplementedError
end
|
#validate ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'app/models/ddr/batch/batch_object.rb', line 38
def validate
errors = []
errors += validate_model if model
errors += validate_datastreams if batch_object_datastreams
errors += validate_relationships if batch_object_relationships
errors += local_validations
return errors
end
|