class ActiveFedora::Aggregation::ListSource
def changed?
def changed? super || ordered_self.changed? end
def clear_changed_attributes
- use #changes_applied instead
def clear_changed_attributes Deprecation.warn self.class, "#clear_changed_attributes is deprecated, use ActiveModel::Dirty#changes_applied instead." clear_changes_information end
def create_date
def create_date nil end
def has_model
def has_model ["ActiveFedora::Aggregation::ListSource"] end
def has_unpersisted_proxy_for?
def has_unpersisted_proxy_for? ordered_self.select(&:new_record?).map(&:target).find { |x| x.respond_to?(:uri) } end
def head_subject
def head_subject head_id.first end
def modified_date
def modified_date nil end
def ordered_list_factory
def ordered_list_factory ActiveFedora::Orders::OrderedList end
def ordered_self
-
(Array
-)
def ordered_self @ordered_self ||= ordered_list_factory.new(resource, head_subject, tail_subject) end
def persist_ordered_self
def persist_ordered_self nodes_will_change! # Delete old statements subj = resource.subjects.to_a.select { |x| x.to_s.split("/").last.to_s.include?("#g") } subj.each do |s| resource.delete [s, nil, nil] end # Assert head and tail self.head = ordered_self.head.next.rdf_subject self.tail = ordered_self.tail.prev.rdf_subject head_will_change! tail_will_change! graph = ordered_self.to_graph resource << graph # Set node subjects to a term in AF JUST so that AF will persist the # sub-graphs. # TODO: Find a way to fix this. # See https://github.com/samvera/active_fedora/issues/1337 resource.set_value(:nodes, []) self.nodes += graph.subjects.to_a ordered_self.changes_committed! end
def save(*args)
def save(*args) return true if has_unpersisted_proxy_for? || !changed? persist_ordered_self if ordered_self.changed? super end
def serializable_hash(_options = nil)
- Note: - This method is used by ActiveFedora::Base upstream for indexing,
def serializable_hash(_options = nil) {} end
def tail_subject
def tail_subject tail_id.first end
def to_solr(solr_doc = {})
def to_solr(solr_doc = {}) super.merge(ordered_targets_ssim: ordered_self.target_ids, proxy_in_ssi: ordered_self.proxy_in.to_s) end