Class: Hyrax::PcdmCollection

Inherits:
Resource
  • Object
show all
Defined in:
app/models/hyrax/pcdm_collection.rb

Overview

Note:

Some collection types limit a work to belong to one and only one collection of that type.

Valkyrie model for Collection domain objects in the Hydra Works model.

Relationships

Collection and Collection (TBA)

Collection and Work

  • Defined: The relationship is defined by the inverse relationship stored in the work's :member_of_collection_ids attribute.

  • Tested: The work tests the relationship.

  • Collection to Work: (0..m) A collection can have many works.

  • Work to Collection: (0..m) A work can be in many collections.

    • See Hyrax::Work for code to get and set collections for the work.

All children

  • There are additional methods for finding all children without respect to the child's type.

Examples:

Get works in a collection:

works = Hyrax.custom_queries.find_child_works(resource: collection)

Get works and child collections in a collection using:

members = Hyrax.custom_queries.find_members_of(resource: collection)

See Also:

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#==, acts_as_flexible_resource, collection?, #collection?, #file?, file?, #file_set?, file_set?, #flexible?, flexible?, human_readable_type, inherited, #pcdm_collection?, #pcdm_object?, pcdm_object?, to_rdf_representation, #to_rdf_representation, #wings?, work?, #work?

Methods included from WithEmbargoesAndLeases

#embargo, #embargo=, #lease, #lease=

Methods included from WithEvents

#event_class, #events, #log_event, #stream

Class Method Details

._hyrax_default_name_classClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns an ActiveModel::Name compatible class.

Returns:

  • (Class)

    an ActiveModel::Name compatible class



53
54
55
# File 'app/models/hyrax/pcdm_collection.rb', line 53

def self._hyrax_default_name_class
  Hyrax::CollectionName
end

.pcdm_collection?Boolean

Returns true.

Returns:

  • (Boolean)

    true



59
60
61
# File 'app/models/hyrax/pcdm_collection.rb', line 59

def self.pcdm_collection?
  true
end

Instance Method Details

#permission_managerObject



63
64
65
# File 'app/models/hyrax/pcdm_collection.rb', line 63

def permission_manager
  @permission_manager ||= Hyrax::PermissionManager.new(resource: self)
end

#visibilityObject



71
72
73
# File 'app/models/hyrax/pcdm_collection.rb', line 71

def visibility
  visibility_reader.read
end

#visibility=(value) ⇒ Object



67
68
69
# File 'app/models/hyrax/pcdm_collection.rb', line 67

def visibility=(value)
  visibility_writer.assign_access_for(visibility: value)
end