Class: ActiveFedora::Orders::ListNode
- Inherits:
-
Object
- Object
- ActiveFedora::Orders::ListNode
- Defined in:
- lib/active_fedora/orders/list_node.rb
Defined Under Namespace
Classes: Builder, MaybeID, Resource
Instance Attribute Summary collapse
-
#next ⇒ ActiveFedora::Orders::ListNode
Returns the next proxy or a tail sentinel.
-
#next_uri ⇒ Object
writeonly
Sets the attribute next_uri.
-
#prev ⇒ ActiveFedora::Orders::ListNode
Returns the previous proxy or a head sentinel.
-
#prev_uri ⇒ Object
writeonly
Sets the attribute prev_uri.
-
#proxy_for ⇒ Object
Returns the value of attribute proxy_for.
-
#proxy_in ⇒ Object
Returns the value of attribute proxy_in.
-
#rdf_subject ⇒ Object
readonly
Returns the value of attribute rdf_subject.
-
#target ⇒ ActiveFedora::Base
Object representation of proxyFor.
Instance Method Summary collapse
- #changed_for_autosave? ⇒ Boolean
-
#destroyed? ⇒ Boolean
Methods necessary for association functionality.
-
#initialize(node_cache, rdf_subject, graph = RDF::Repository.new) ⇒ ListNode
constructor
A new instance of ListNode.
- #marked_for_destruction? ⇒ Boolean
- #new_record? ⇒ Boolean
- #proxy_in_id ⇒ Object
-
#save_target ⇒ Object
Persists target if it’s been accessed or set.
- #target_id ⇒ Object
- #target_uri ⇒ Object
-
#to_graph ⇒ ActiveFedora::Orders::ListNode::Resource
Graph representation of node.
- #valid? ⇒ Boolean
Constructor Details
#initialize(node_cache, rdf_subject, graph = RDF::Repository.new) ⇒ ListNode
Returns a new instance of ListNode.
7 8 9 10 11 12 |
# File 'lib/active_fedora/orders/list_node.rb', line 7 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 |
Instance Attribute Details
#next ⇒ ActiveFedora::Orders::ListNode
Returns the next proxy or a tail sentinel.
16 17 18 |
# File 'lib/active_fedora/orders/list_node.rb', line 16 def next @next end |
#next_uri=(value) ⇒ Object
Sets the attribute next_uri
5 6 7 |
# File 'lib/active_fedora/orders/list_node.rb', line 5 def next_uri=(value) @next_uri = value end |
#prev ⇒ ActiveFedora::Orders::ListNode
Returns the previous proxy or a head sentinel.
29 30 31 |
# File 'lib/active_fedora/orders/list_node.rb', line 29 def prev @prev end |
#prev_uri=(value) ⇒ Object
Sets the attribute prev_uri
5 6 7 |
# File 'lib/active_fedora/orders/list_node.rb', line 5 def prev_uri=(value) @prev_uri = value end |
#proxy_for ⇒ Object
Returns the value of attribute proxy_for.
6 7 8 |
# File 'lib/active_fedora/orders/list_node.rb', line 6 def proxy_for @proxy_for end |
#proxy_in ⇒ Object
Returns the value of attribute proxy_in.
6 7 8 |
# File 'lib/active_fedora/orders/list_node.rb', line 6 def proxy_in @proxy_in end |
#rdf_subject ⇒ Object (readonly)
Returns the value of attribute rdf_subject.
3 4 5 |
# File 'lib/active_fedora/orders/list_node.rb', line 3 def rdf_subject @rdf_subject end |
#target ⇒ ActiveFedora::Base
Object representation of proxyFor
53 54 55 |
# File 'lib/active_fedora/orders/list_node.rb', line 53 def target @target end |
Instance Method Details
#changed_for_autosave? ⇒ Boolean
118 119 120 |
# File 'lib/active_fedora/orders/list_node.rb', line 118 def changed_for_autosave? true end |
#destroyed? ⇒ Boolean
Methods necessary for association functionality
106 107 108 |
# File 'lib/active_fedora/orders/list_node.rb', line 106 def destroyed? false end |
#marked_for_destruction? ⇒ Boolean
110 111 112 |
# File 'lib/active_fedora/orders/list_node.rb', line 110 def marked_for_destruction? false end |
#new_record? ⇒ Boolean
122 123 124 |
# File 'lib/active_fedora/orders/list_node.rb', line 122 def new_record? @target && @target.new_record? end |
#proxy_in_id ⇒ Object
79 80 81 |
# File 'lib/active_fedora/orders/list_node.rb', line 79 def proxy_in_id MaybeID.new(@proxy_in.try(:id) || proxy_in).value end |
#save_target ⇒ Object
Persists target if it’s been accessed or set.
71 72 73 74 75 76 77 |
# File 'lib/active_fedora/orders/list_node.rb', line 71 def save_target if @target @target.save else true end end |
#target_id ⇒ Object
66 67 68 |
# File 'lib/active_fedora/orders/list_node.rb', line 66 def target_id MaybeID.new(@target.try(:id) || proxy_for).value end |
#target_uri ⇒ Object
62 63 64 |
# File 'lib/active_fedora/orders/list_node.rb', line 62 def target_uri RDF::URI(ActiveFedora::Base.id_to_uri(target_id)) if target_id end |
#to_graph ⇒ ActiveFedora::Orders::ListNode::Resource
Graph representation of node.
42 43 44 45 46 47 48 49 |
# 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 = prev.try(:rdf_subject) g end |
#valid? ⇒ Boolean
114 115 116 |
# File 'lib/active_fedora/orders/list_node.rb', line 114 def valid? true end |