Class: ActiveFedora::Container

Inherits:
Base
  • Object
show all
Defined in:
lib/active_fedora/containers/container.rb

Overview

This is the base class for ldp containers, it is not an ldp:BasicContainer

Direct Known Subclasses

DirectContainer, IndirectContainer

Constant Summary

Constants included from AttributeMethods

AttributeMethods::AttrNames

Constants included from AutosaveAssociation

AutosaveAssociation::ASSOCIATION_TYPES

Constants included from Callbacks

ActiveFedora::Callbacks::CALLBACKS

Instance Attribute Summary

Attributes included from Associations

#association_cache

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LdpCache::ClassMethods

#cache, #uncached

Methods included from Querying

#default_sort_params, extended

Methods included from LoadableFromJson

#init_with_json

Methods included from Versionable

#create_version, #has_versions?, #model_type, #restore_version, #versions

Methods included from Attributes

#[], #[]=, #attribute_names, #attributes, #attributes=, #inspect, #local_attributes, #mark_as_changed, #value_has_changed?

Methods included from AttributeMethods

#[], #[]=, #attribute_names, #attributes

Methods included from FedoraAttributes

#rdf_label, #resource, #set_value

Methods included from AttachedFiles

#add_datastream, #add_file, #add_file_datastream, #attach_file, #attached_files, #clear_attached_files, #clear_datastreams, #contains_assertions, #datastreams, #ds_specs, #load_attached_files, #metadata_streams, #serialize_attached_files, #undeclared_files

Methods included from Serialization

#serializable_hash

Methods included from NestedAttributes

#_destroy

Methods included from AutosaveAssociation

#changed_for_autosave?, #mark_for_destruction, #marked_for_destruction?, #reload

Methods included from Associations

#association, #clear_association_cache, #delete

Methods included from Validations

#required?, #save, #save!, #valid?

Methods included from Callbacks

#destroy

Methods included from Indexing

#indexing_service, #to_solr, #update_index

Methods included from Persistence

#delete, #destroy, #destroyed?, #eradicate, #new_record?, #persisted?, #save, #save!, #update

Methods included from Identifiable

#id, #id=, #pid, #uri

Methods included from Core

#==, #freeze, #frozen?, #init_with_resource, #initialize, #ldp_source, #readonly!, #readonly?, #reload

Class Method Details

.find_or_initialize(id) ⇒ Object



23
24
25
26
27
# File 'lib/active_fedora/containers/container.rb', line 23

def self.find_or_initialize(id)
  find(id)
rescue ActiveFedora::ObjectNotFoundError
  new(id)
end

Instance Method Details

#mint_idObject



19
20
21
# File 'lib/active_fedora/containers/container.rb', line 19

def mint_id
  "#{id}/#{SecureRandom.uuid}"
end

#parentObject



10
11
12
# File 'lib/active_fedora/containers/container.rb', line 10

def parent
  @parent || raise("Parent hasn't been set on #{self.class}")
end

#parent=(parent) ⇒ Object



14
15
16
17
# File 'lib/active_fedora/containers/container.rb', line 14

def parent=(parent)
  @parent = parent
  self.membership_resource = [::RDF::URI(parent.uri)]
end