activefedora-aggregation 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_fedora/aggregation/list_source.rb +1 -1
- data/lib/active_fedora/aggregation/version.rb +1 -1
- data/lib/active_fedora/orders/association.rb +6 -0
- data/lib/active_fedora/orders/list_node.rb +8 -2
- data/lib/active_fedora/orders/ordered_list.rb +9 -2
- data/lib/active_fedora/orders/target_proxy.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 811e1635bee37a6543927d878abe1969dfb06944
|
4
|
+
data.tar.gz: cc9024906ec0485aaf9d720a48f748321e5c0bd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45cddf68bddf30d69eabc7c871dabd88e04985d88668985dcfafd3e05d818b345f9b8a94302ec9cd5a4a767aeb9e1849dfebccbcdb1d092ca417c7918a9b67c7
|
7
|
+
data.tar.gz: 8d3f76cb84ae5bda149e458cdc00b306c4167e1638706d6c61f8783daee0472124c310e58c770981ecdbd9aa123e3a7b314799013cfca8460f937ef94d766771
|
@@ -4,7 +4,7 @@ module ActiveFedora
|
|
4
4
|
delegate :order_will_change!, to: :ordered_self
|
5
5
|
property :head, predicate: ::RDF::Vocab::IANA['first'], multiple: false
|
6
6
|
property :tail, predicate: ::RDF::Vocab::IANA.last, multiple: false
|
7
|
-
property :nodes, predicate: ::RDF::DC::hasPart
|
7
|
+
property :nodes, predicate: ::RDF::Vocab::DC::hasPart
|
8
8
|
|
9
9
|
def save(*args)
|
10
10
|
return true if has_unpersisted_proxy_for? || !changed?
|
@@ -82,6 +82,12 @@ module ActiveFedora::Orders
|
|
82
82
|
target.delete_at(loc)
|
83
83
|
end
|
84
84
|
|
85
|
+
# Delete all occurences of the specified target
|
86
|
+
# @param obj object to delete
|
87
|
+
def delete_target(obj)
|
88
|
+
target.delete_target(obj)
|
89
|
+
end
|
90
|
+
|
85
91
|
# Delete multiple list nodes.
|
86
92
|
# @param [Array<ActiveFedora::Orders::ListNode>] records
|
87
93
|
def delete_records(records, _method=nil)
|
@@ -41,7 +41,7 @@ module ActiveFedora::Orders
|
|
41
41
|
# @return [ActiveFedora::Orders::ListNode::Resource]
|
42
42
|
def to_graph
|
43
43
|
g = Resource.new(rdf_subject)
|
44
|
-
g.proxy_for =
|
44
|
+
g.proxy_for = target_uri
|
45
45
|
g.proxy_in = proxy_in.try(:uri)
|
46
46
|
g.next = self.next.try(:rdf_subject)
|
47
47
|
g.prev = self.prev.try(:rdf_subject)
|
@@ -51,7 +51,7 @@ module ActiveFedora::Orders
|
|
51
51
|
# Object representation of proxyFor
|
52
52
|
# @return [ActiveFedora::Base]
|
53
53
|
def target
|
54
|
-
@target ||=
|
54
|
+
@target ||=
|
55
55
|
if proxy_for.present?
|
56
56
|
node_cache.fetch(proxy_for) do
|
57
57
|
ActiveFedora::Base.from_uri(proxy_for, nil)
|
@@ -59,6 +59,12 @@ module ActiveFedora::Orders
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
def target_uri
|
63
|
+
if target_id
|
64
|
+
ActiveFedora::Base.id_to_uri(target_id)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
62
68
|
def target_id
|
63
69
|
MaybeID.new(@target.try(:id) || proxy_for).value
|
64
70
|
end
|
@@ -30,7 +30,7 @@ module ActiveFedora
|
|
30
30
|
# @return [TailSentinel] Sentinel for the bottom of the list. If not
|
31
31
|
# empty, tail.prev is the first element.
|
32
32
|
def tail
|
33
|
-
@tail ||=
|
33
|
+
@tail ||=
|
34
34
|
begin
|
35
35
|
if tail_subject
|
36
36
|
TailSentinel.new(self, prev_node: build_node(tail_subject))
|
@@ -71,7 +71,7 @@ module ActiveFedora
|
|
71
71
|
end
|
72
72
|
|
73
73
|
# @param [ActiveFedora::Base] target Target to append to list.
|
74
|
-
# @option [::RDF::URI, ActiveFedora::Base] :proxy_in Proxy in to
|
74
|
+
# @option [::RDF::URI, ActiveFedora::Base] :proxy_in Proxy in to
|
75
75
|
# assert on the created node.
|
76
76
|
def append_target(target, proxy_in: nil)
|
77
77
|
node = build_node(new_node_subject)
|
@@ -132,6 +132,13 @@ module ActiveFedora
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
+
# @param obj target of node to delete.
|
136
|
+
def delete_target(obj)
|
137
|
+
nodes_to_remove = ordered_reader.select { |list_node| obj.id == list_node.target_id }
|
138
|
+
nodes_to_remove.each { |list_node| delete_node(list_node) }
|
139
|
+
nodes_to_remove.last.try(:target)
|
140
|
+
end
|
141
|
+
|
135
142
|
# @return [Boolean] Whether this list was changed since instantiation.
|
136
143
|
def changed?
|
137
144
|
@changed
|
@@ -24,6 +24,8 @@ module ActiveFedora
|
|
24
24
|
self
|
25
25
|
end
|
26
26
|
|
27
|
+
# Deletes the element at the specified index, returning that element, or nil if
|
28
|
+
# the index is out of range.
|
27
29
|
def delete_at(loc)
|
28
30
|
result = association.delete_at(loc)
|
29
31
|
if result
|
@@ -31,6 +33,13 @@ module ActiveFedora
|
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
36
|
+
# Deletes all items from self that are equal to obj.
|
37
|
+
# @param obj the object to remove from the list
|
38
|
+
# @return the last deleted item, or nil if no matching item is found
|
39
|
+
def delete(obj)
|
40
|
+
association.delete_target(obj)
|
41
|
+
end
|
42
|
+
|
34
43
|
def clear
|
35
44
|
while to_ary.present?
|
36
45
|
association.delete_at(0)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activefedora-aggregation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|