Class: ActiveFedora::DigitalObject
- Inherits:
-
Rubydora::DigitalObject
- Object
- Rubydora::DigitalObject
- ActiveFedora::DigitalObject
- Includes:
- DatastreamBootstrap
- Defined in:
- lib/active_fedora/digital_object.rb
Overview
Helps Rubydora create datastreams of the type defined by the ActiveFedora::Base#datastream_class_for_name
Defined Under Namespace
Modules: DatastreamBootstrap
Instance Attribute Summary collapse
-
#original_class ⇒ Object
Returns the value of attribute original_class.
Class Method Summary collapse
Methods included from DatastreamBootstrap
Instance Attribute Details
#original_class ⇒ Object
Returns the value of attribute original_class.
4 5 6 |
# File 'lib/active_fedora/digital_object.rb', line 4 def original_class @original_class end |
Class Method Details
.find(original_class, pid) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/active_fedora/digital_object.rb', line 33 def self.find(original_class, pid) raise ActiveFedora::ObjectNotFoundError.new("Unable to find #{pid.inspect} in fedora. ") unless pid.present? conn = original_class.connection_for_pid(pid) obj = begin super(pid, conn) rescue Rubydora::RecordNotFound raise ActiveFedora::ObjectNotFoundError, "Unable to find '#{pid}' in fedora. See logger for details." end obj.original_class = original_class # PID is not found, but was "well-formed" for its Fedora request. So # an object is instantiated with that PID. raise ActiveFedora::ObjectNotFoundError, "Unable to find '#{pid}' in fedora" if obj.new? obj end |
.find_or_initialize(original_class, pid) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/active_fedora/digital_object.rb', line 48 def self.find_or_initialize(original_class, pid) conn = original_class.connection_for_pid(pid) obj = super(pid, conn) obj.original_class = original_class obj end |