Class: ActiveFedora::Aggregation::ListSource

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

Instance Method Summary collapse

Instance Method Details

#changed?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/active_fedora/aggregation/list_source.rb', line 20

def changed?
  super || ordered_self.changed?
end

#clear_changed_attributesObject

Overriding so that we don’t track previously_changed, which was rather expensive.



16
17
18
# File 'lib/active_fedora/aggregation/list_source.rb', line 16

def clear_changed_attributes
  @changed_attributes.clear
end

#create_dateObject

Not useful and slows down indexing.



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

def create_date
  nil
end

#has_modelObject

Not useful, slows down indexing.



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

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

#modified_dateObject

Not useful, slows down indexing.



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

def modified_date
  nil
end

#ordered_selfArray<ListNode>

Ordered list representation of proxies in graph.

Returns:

  • (Array<ListNode>)


26
27
28
# File 'lib/active_fedora/aggregation/list_source.rb', line 26

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

#ordered_self=(new_ordered_self) ⇒ Object

Allow this to be set so that -=, += will work.

Parameters:



33
34
35
# File 'lib/active_fedora/aggregation/list_source.rb', line 33

def ordered_self=(new_ordered_self)
  @ordered_self = new_ordered_self
end

#save(*args) ⇒ Object



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

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/projecthydra/active_fedora/blob/master/lib/active_fedora/profile_indexing_service.rb.

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



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

def serializable_hash(options=nil)
  {}
end

#to_solr(solr_doc = {}) ⇒ Object



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

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