class ActiveFedora::Orders::ListNode
Attributes
graph[R]
next[W]
next_uri[RW]
node_cache[R]
prev[W]
prev_uri[RW]
proxy_for[RW]
proxy_in[RW]
rdf_subject[R]
target[W]
Public Class Methods
new(node_cache, rdf_subject, graph = RDF::Repository.new)
click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 6 def initialize(node_cache, rdf_subject, graph = RDF::Repository.new) @rdf_subject = rdf_subject @graph = graph @node_cache = node_cache Builder.new(rdf_subject, graph).populate(self) end
Public Instance Methods
changed_for_autosave?()
click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 117 def changed_for_autosave? true end
destroyed?()
click to toggle source
Methods necessary for association functionality
# File lib/active_fedora/orders/list_node.rb, line 105 def destroyed? false end
marked_for_destruction?()
click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 109 def marked_for_destruction? false end
new_record?()
click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 121 def new_record? @target&.new_record? end
next()
click to toggle source
Returns the next proxy or a tail sentinel. @return [ActiveFedora::Orders::ListNode]
# File lib/active_fedora/orders/list_node.rb, line 15 def next @next ||= if next_uri node_cache.fetch(next_uri) do node = self.class.new(node_cache, next_uri, graph) node.prev = self node end end end
prev()
click to toggle source
Returns the previous proxy or a head sentinel. @return [ActiveFedora::Orders::ListNode]
# File lib/active_fedora/orders/list_node.rb, line 28 def prev @prev ||= if prev_uri node_cache.fetch(prev_uri) do node = self.class.new(node_cache, prev_uri, graph) node.next = self node end end end
proxy_in_id()
click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 78 def proxy_in_id MaybeID.new(@proxy_in.try(:id) || proxy_in).value end
save_target()
click to toggle source
Persists target if it’s been accessed or set.
# File lib/active_fedora/orders/list_node.rb, line 70 def save_target if @target @target.save else true end end
target()
click to toggle source
Object
representation of proxyFor @return [ActiveFedora::Base]
# File lib/active_fedora/orders/list_node.rb, line 52 def target @target ||= if proxy_for.present? node_cache.fetch(proxy_for) do ActiveFedora::Base.from_uri(proxy_for, nil) end end end
target_id()
click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 65 def target_id MaybeID.new(@target.try(:id) || proxy_for).value end
target_uri()
click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 61 def target_uri RDF::URI(ActiveFedora::Base.id_to_uri(target_id)) if target_id end
to_graph()
click to toggle source
Graph representation of node. @return [ActiveFedora::Orders::ListNode::Resource]
# File lib/active_fedora/orders/list_node.rb, line 41 def to_graph g = Resource.new(rdf_subject) g.proxy_for = target_uri g.proxy_in = proxy_in.try(:uri) g.next = self.next.try(:rdf_subject) g.prev = prev.try(:rdf_subject) g end
valid?()
click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 113 def valid? true end