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)


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

def changed?
  super || ordered_self.changed?
end

#clear_changed_attributesObject

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



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

def clear_changed_attributes
  @changed_attributes.clear
end

#create_dateObject

Not useful and slows down indexing.



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

def create_date
  nil
end

#has_modelObject

Not useful, slows down indexing.



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

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

#modified_dateObject

Not useful, slows down indexing.



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

def modified_date
  nil
end

#ordered_selfArray<ListNode>

Ordered list representation of proxies in graph.

Returns:

  • (Array<ListNode>)


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

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:



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

def ordered_self=(new_ordered_self)
  @ordered_self = new_ordered_self
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/projecthydra/active_fedora/blob/master/lib/active_fedora/profile_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
50
51
# 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