class ActiveFedora::Orders::ListNode

Attributes

graph[R]
next[RW]
next_uri[RW]
node_cache[R]
prev[RW]
prev_uri[RW]
proxy_for[RW]
proxy_in[RW]
rdf_subject[R]
target[RW]

Public Class Methods

new(node_cache, rdf_subject, graph=RDF::Graph.new) click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 7
def initialize(node_cache, rdf_subject, graph=RDF::Graph.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 120
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 108
def destroyed?
  false
end
marked_for_destruction?() click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 112
def marked_for_destruction?
  false
end
new_record?() click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 124
def new_record?
  @target && @target.new_record?
end
proxy_in_id() click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 81
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 73
def save_target
  if @target
    @target.save
  else
    true
  end
end
target_id() click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 68
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 62
def target_uri
  if target_id
    RDF::URI(ActiveFedora::Base.id_to_uri(target_id))
  end
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 42
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 = self.prev.try(:rdf_subject)
  g
end
valid?() click to toggle source
# File lib/active_fedora/orders/list_node.rb, line 116
def valid?
  true
end