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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d1dbe9ac23451faae6cff0a8249099b3f0a16fc
4
- data.tar.gz: 898c460e4a8a953f275af28566c31c81aaabc45e
3
+ metadata.gz: 811e1635bee37a6543927d878abe1969dfb06944
4
+ data.tar.gz: cc9024906ec0485aaf9d720a48f748321e5c0bd1
5
5
  SHA512:
6
- metadata.gz: 16db6ed94d16e66e200b6b50df6a828fcf939e85263bb7ac87acbd5831fb5324953b488c085a949c0235e2e29d59c1a21add23c2fb8eddf2ed766639b95c8f40
7
- data.tar.gz: 50dd60edc92c86eb29ff2a3cf1187637f8e0fcff844d0a6c7e56f0c96e8fe261f4fac63a6d4e406a11180fb6b718acfee48e978a2273b6b1e2092b5e277cd99f
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?
@@ -1,5 +1,5 @@
1
1
  module ActiveFedora
2
2
  module Aggregation
3
- VERSION = "0.7.0"
3
+ VERSION = "0.8.0"
4
4
  end
5
5
  end
@@ -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 = ActiveFedora::Base.id_to_uri(target_id)
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.7.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-30 00:00:00.000000000 Z
11
+ date: 2015-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport