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)


14
15
16
# File 'lib/active_fedora/aggregation/list_source.rb', line 14

def changed?
  super || ordered_self.changed?
end

#ordered_selfObject

Ordered list representation of proxies in graph.



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

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:



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

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.



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

def serializable_hash(options=nil)
  options ||= {}
  options[:except] ||= []
  options[:except] += [:head, :tail, :nodes]
  super
end

#to_solr(solr_doc = {}) ⇒ Object



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

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