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, AttributeMethods::RESTRICTED_CLASS_METHODS

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 Aggregation::BaseExtension

#ordered_by

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, #local_attributes

Methods included from AttributeMethods

#[], #[]=, #attribute_for_inspect, #attribute_names, #attribute_present?, #attributes, #has_attribute?

Methods included from Reflection

add_reflection, create, #reflections

Methods included from FedoraAttributes

#resource, #set_value

Methods included from AttachedFiles

#add_file, #attach_file, #attached_files, #clear_attached_files, #contains_assertions, #declared_attached_files, #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?, #destroyed_by_association, #destroyed_by_association=, #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, #update_index

Methods included from Scoping

#initialize_internals_callback, #populate_with_current_scope_attributes

Methods included from Indexing

#indexing_service, #to_solr, #update_index

Methods included from Persistence

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

Methods included from Identifiable

#id, #id=, #uri

Methods included from Core

#freeze, #init_with_resource, #initialize, #inspect, #reload, #uri=

Methods included from Common

#<=>, #==, #etag, #freeze, #frozen?, #ldp_source, #readonly!, #readonly?

Methods included from AttributeAssignment

#assign_attributes, #attributes=

Class Method Details

.find_or_initialize(id) ⇒ Object



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

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

Instance Method Details

#mint_idObject



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

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

#parentObject



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

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

#parent=(parent) ⇒ Object



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

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