Class: ActiveFedora::Aggregation::ListSource

Inherits:
Base
  • Object
show all
Defined in:
lib/active_fedora/aggregation/list_source.rb

Constant Summary

Constants included from ActiveFedora::AttributeMethods

ActiveFedora::AttributeMethods::AttrNames, ActiveFedora::AttributeMethods::RESTRICTED_CLASS_METHODS

Constants included from ActiveFedora::AutosaveAssociation

ActiveFedora::AutosaveAssociation::ASSOCIATION_TYPES

Constants included from Callbacks

Callbacks::CALLBACKS

Instance Attribute Summary collapse

Attributes included from ActiveFedora::Associations

#association_cache

Instance Method Summary collapse

Methods included from LdpCache::ClassMethods

#cache, #uncached

Methods included from Querying

#default_sort_params, extended

Methods included from 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 ActiveFedora::Attributes

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

Methods included from ActiveFedora::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 ActiveFedora::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 NestedAttributes

#_destroy

Methods included from ActiveFedora::AutosaveAssociation

#changed_for_autosave?, #destroyed_by_association, #destroyed_by_association=, #mark_for_destruction, #marked_for_destruction?, #reload

Methods included from ActiveFedora::Associations

#association, #clear_association_cache, #delete

Methods included from Validations

#required?, #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, #update_index

Methods included from Persistence

#base_path_for_resource=, #delete, #destroy, #destroy!, #destroyed?, #eradicate, #new_record?, #persisted?, #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 ActiveFedora::AttributeAssignment

#assign_attributes, #attributes=

Instance Attribute Details

#ordered_selfArray<ListNode>

Ordered list representation of proxies in graph.

Returns:

  • (Array<ListNode>)


29
30
31
# File 'lib/active_fedora/aggregation/list_source.rb', line 29

def ordered_self
  @ordered_self ||= ordered_list_factory.new(resource, head_subject, tail_subject)
end

Instance Method Details

#changed?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/active_fedora/aggregation/list_source.rb', line 23

def changed?
  super || ordered_self.changed?
end

#clear_changed_attributesObject

Deprecated.

use #changes_applied instead



17
18
19
20
21
# File 'lib/active_fedora/aggregation/list_source.rb', line 17

def clear_changed_attributes
  Deprecation.warn self.class, "#clear_changed_attributes is deprecated, use ActiveModel::Dirty#changes_applied instead."

  clear_changes_information
end

#create_dateObject

Not useful and slows down indexing.



52
53
54
# File 'lib/active_fedora/aggregation/list_source.rb', line 52

def create_date
  nil
end

#has_modelObject

Not useful, slows down indexing.



62
63
64
# File 'lib/active_fedora/aggregation/list_source.rb', line 62

def has_model
  ["ActiveFedora::Aggregation::ListSource"]
end

#modified_dateObject

Not useful, slows down indexing.



57
58
59
# File 'lib/active_fedora/aggregation/list_source.rb', line 57

def modified_date
  nil
end

#save(*args) ⇒ Object



9
10
11
12
13
# File 'lib/active_fedora/aggregation/list_source.rb', line 9

def save(*args)
  return true if has_unpersisted_proxy_for? || !changed?
  persist_ordered_self if ordered_self.changed?
  super
end

#serializable_hash(_options = nil) ⇒ Object

Note:

This method is used by ActiveFedora::Base upstream for indexing, at github.com/samvera/active_fedora/blob/master/lib/active_fedora/indexing_service.rb.

Serializing head/tail/nodes slows things down CONSIDERABLY, and is not useful.



42
43
44
# File 'lib/active_fedora/aggregation/list_source.rb', line 42

def serializable_hash(_options = nil)
  {}
end

#to_solr(solr_doc = {}) ⇒ Object



46
47
48
49
# File 'lib/active_fedora/aggregation/list_source.rb', line 46

def to_solr(solr_doc = {})
  super.merge(ordered_targets_ssim: ordered_self.target_ids,
              proxy_in_ssi: ordered_self.proxy_in.to_s)
end