active-fedora 12.0.3 → 12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -7
- data/.rubocop_todo.yml +10 -100
- data/.travis.yml +21 -0
- data/CODE_OF_CONDUCT.md +36 -0
- data/CONTRIBUTING.md +23 -21
- data/Gemfile +1 -2
- data/History.txt +29 -29
- data/LICENSE +16 -14
- data/README.md +40 -29
- data/SUPPORT.md +5 -0
- data/active-fedora.gemspec +7 -7
- data/lib/active_fedora.rb +1 -1
- data/lib/active_fedora/aggregation/list_source.rb +3 -2
- data/lib/active_fedora/associations/builder/collection_association.rb +1 -0
- data/lib/active_fedora/associations/collection_association.rb +3 -0
- data/lib/active_fedora/associations/collection_proxy.rb +2 -0
- data/lib/active_fedora/associations/directly_contains_one_association.rb +1 -0
- data/lib/active_fedora/associations/indirectly_contains_association.rb +2 -0
- data/lib/active_fedora/associations/singular_association.rb +1 -0
- data/lib/active_fedora/attribute_methods.rb +1 -1
- data/lib/active_fedora/attribute_methods/read.rb +1 -1
- data/lib/active_fedora/attribute_methods/write.rb +1 -1
- data/lib/active_fedora/attributes.rb +1 -1
- data/lib/active_fedora/attributes/property_builder.rb +1 -0
- data/lib/active_fedora/callbacks.rb +7 -2
- data/lib/active_fedora/fedora.rb +8 -0
- data/lib/active_fedora/file.rb +7 -5
- data/lib/active_fedora/indexing/descendant_fetcher.rb +1 -1
- data/lib/active_fedora/indexing/field_mapper.rb +2 -0
- data/lib/active_fedora/indexing/suffix.rb +3 -1
- data/lib/active_fedora/inheritable_accessors.rb +1 -0
- data/lib/active_fedora/loadable_from_json.rb +1 -0
- data/lib/active_fedora/nested_attributes.rb +1 -0
- data/lib/active_fedora/persistence.rb +14 -1
- data/lib/active_fedora/persistence/null_identifier_service.rb +11 -0
- data/lib/active_fedora/reflection.rb +1 -1
- data/lib/active_fedora/relation.rb +14 -0
- data/lib/active_fedora/relation/delegation.rb +2 -1
- data/lib/active_fedora/relation/finder_methods.rb +1 -0
- data/lib/active_fedora/relation/merger.rb +1 -0
- data/lib/active_fedora/validations.rb +7 -0
- data/lib/active_fedora/version.rb +1 -1
- data/lib/active_fedora/with_metadata.rb +1 -0
- data/lib/active_fedora/with_metadata/metadata_node.rb +2 -1
- data/lib/generators/active_fedora/config/solr/templates/solr/config/schema.xml +64 -51
- data/lib/generators/active_fedora/config/solr/templates/solr/config/solrconfig.xml +4 -1
- data/lib/generators/active_fedora/model/templates/datastream.rb.erb +1 -1
- data/spec/integration/file_spec.rb +1 -1
- data/spec/integration/relation_spec.rb +43 -0
- data/spec/spec_helper.rb +11 -9
- data/spec/support/an_active_model.rb +4 -0
- data/spec/unit/callback_spec.rb +8 -1
- data/spec/unit/file_spec.rb +0 -17
- data/spec/unit/validations_spec.rb +18 -0
- metadata +28 -25
- data/.circleci/config.yml +0 -47
data/LICENSE
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
Copyright 2011 Stanford University Libraries (SULAIR) and MediaShelf, LLC
|
2
|
+
Copyright 2011 The Pennsylvania State University
|
3
|
+
Copyright 2012 University of Notre Dame
|
4
|
+
Additional copyright may be held by others, as reflected in the commit history.
|
5
|
+
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
you may not use this file except in compliance with the License.
|
8
|
+
You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -1,40 +1,54 @@
|
|
1
|
-
|
2
|
-
-----------
|
1
|
+
# ActiveFedora
|
3
2
|
|
4
|
-
[![
|
5
|
-
[![
|
6
|
-
[![
|
7
|
-
|
3
|
+
Code: [![Version](https://badge.fury.io/rb/active-fedora.png)](http://badge.fury.io/rb/active-fedora)
|
4
|
+
[![Build Status](https://travis-ci.org/samvera/active_fedora.png?branch=master)](https://travis-ci.org/samvera/active_fedora)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/github/samvera/active_fedora/badge.svg?branch=master)](https://coveralls.io/github/samvera/active_fedora?branch=master)
|
6
|
+
|
7
|
+
Docs: [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
|
8
|
+
[![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
|
9
|
+
|
10
|
+
Jump in: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samvera.org/)
|
11
|
+
|
12
|
+
# What is ActiveFedora?
|
8
13
|
|
9
14
|
ActiveFedora is a Ruby gem for creating and
|
10
15
|
managing objects in the Fedora Repository Architecture
|
11
16
|
([http://fedora-commons.org](http://fedora-commons.org)). ActiveFedora
|
12
17
|
is loosely based on “ActiveRecord” in Rails. Version 9.0+ works with Fedora 4 and prior versions work on Fedora 3. Version 9.2+ works with Solr 4.10. Version 10.0+ works with Fedora >= 4.5.1.
|
13
18
|
|
14
|
-
|
15
|
-
|
19
|
+
## Product Owner & Maintenance
|
20
|
+
ActiveFedora is a Core Component of the Samvera community. The documentation for
|
21
|
+
what this means can be found
|
22
|
+
[here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
|
16
23
|
|
17
|
-
|
18
|
-
[http://groups.google.com/group/samvera-tech](http://groups.google.com/group/samvera-tech)
|
19
|
-
- Developers hang out on [slack.samvera.org](http://slack.samvera.org/)
|
24
|
+
### Product Owner
|
20
25
|
|
21
|
-
|
22
|
-
------------
|
26
|
+
[no-reply](https://github.com/no-reply)
|
23
27
|
|
24
|
-
|
28
|
+
# Help
|
25
29
|
|
26
|
-
|
27
|
-
gem install active-fedora
|
28
|
-
```
|
30
|
+
The Samvera community is here to help. Please see our [support guide](./SUPPORT.md).
|
29
31
|
|
30
|
-
Getting Started
|
31
|
-
---------------
|
32
|
+
# Getting Started
|
32
33
|
|
33
34
|
The [Dive into Hydra](https://github.com/samvera/hydra/wiki/Dive-into-Hydra)
|
34
35
|
gives you a brief tour through ActiveFedora’s features on the command line.
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
## Prerequisites
|
38
|
+
|
39
|
+
- A Fedora Commons Repository installation (configured by URL in fedora.yml)
|
40
|
+
- A Solr index (configured by URL in solr.yml)
|
41
|
+
- A JDK8+ installation (if running the test suite)
|
42
|
+
|
43
|
+
## Installation
|
44
|
+
|
45
|
+
The gem is hosted on rubygems.
|
46
|
+
|
47
|
+
```bash
|
48
|
+
gem install active-fedora
|
49
|
+
```
|
50
|
+
|
51
|
+
## Generators
|
38
52
|
|
39
53
|
You can generate a model inheriting from ActiveFedora::Base.
|
40
54
|
|
@@ -42,8 +56,7 @@ You can generate a model inheriting from ActiveFedora::Base.
|
|
42
56
|
rails generate active_fedora:model Book
|
43
57
|
```
|
44
58
|
|
45
|
-
Testing (this Gem)
|
46
|
-
------------------
|
59
|
+
## Testing (this Gem)
|
47
60
|
|
48
61
|
In order to run the RSpec tests, you need to have a copy of the
|
49
62
|
ActiveFedora source code, and then run bundle install in the source
|
@@ -88,11 +101,9 @@ is installed, run:
|
|
88
101
|
rake spec
|
89
102
|
```
|
90
103
|
|
91
|
-
|
92
|
-
----------------
|
104
|
+
# Acknowledgments
|
93
105
|
|
94
|
-
|
106
|
+
This software has been developed by and is brought to you by the Samvera community. Learn more at the
|
107
|
+
[Samvera website](http://samvera.org/).
|
95
108
|
|
96
|
-
|
97
|
-
Justin Coyne, McClain Looney & Eddie Shin
|
98
|
-
([MediaShelf](http://yourmediashelf.com)), Rick Johnson (Notre Dame)
|
109
|
+
![Samvera Logo](https://wiki.duraspace.org/download/thumbnails/87459292/samvera-fall-font2-200w.png?version=1&modificationDate=1498550535816&api=v2)
|
data/SUPPORT.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
If you would like to report an issue, first search [the list of issues](https://github.com/samvera/active_fedora/issues/) to see if someone else has already reported it, and then feel free to [create a new issue](https://github.com/samvera/active_fedora/issues/new).
|
2
|
+
|
3
|
+
If you have questions or need help, please email [the Samvera community tech list](https://groups.google.com/forum/#!forum/samvera-tech) or stop by the #dev channel in [the Samvera community Slack team](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391#Getintouch!-Slack).
|
4
|
+
|
5
|
+
You can learn more about the various Samvera communication channels on the [Get in touch!](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391) wiki page.
|
data/active-fedora.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Matt Zumwalt", "McClain Looney", "Justin Coyne"]
|
10
10
|
s.email = ["samvera-tech@googlegroups.com"]
|
11
|
-
s.homepage = %q{https://github.com/
|
11
|
+
s.homepage = %q{https://github.com/samvera/active_fedora}
|
12
12
|
s.summary = %q{A convenience libary for manipulating documents in the Fedora Repository.}
|
13
13
|
s.description = %q{ActiveFedora provides for creating and managing objects in the Fedora Repository Architecture.}
|
14
14
|
s.license = "Apache-2.0"
|
@@ -16,16 +16,16 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.add_dependency 'rsolr', '>= 1.1.2', '< 3'
|
18
18
|
s.add_dependency 'solrizer', '>= 3.4', '< 5'
|
19
|
-
s.add_dependency "activesupport", '>= 4.2.4', '< 5.
|
20
|
-
s.add_dependency "activemodel", '>= 4.2', '< 5.
|
19
|
+
s.add_dependency "activesupport", '>= 4.2.4', '< 5.3'
|
20
|
+
s.add_dependency "activemodel", '>= 4.2.10', '< 5.3'
|
21
21
|
s.add_dependency "active-triples", '>= 0.11.0', '< 2.0.0'
|
22
22
|
s.add_dependency "deprecation"
|
23
|
-
s.add_dependency "ldp", '
|
23
|
+
s.add_dependency "ldp", '>= 0.7.0', '< 2'
|
24
24
|
s.add_dependency "ruby-progressbar", '~> 1.0'
|
25
|
-
s.add_dependency 'faraday', '~> 0.12
|
25
|
+
s.add_dependency 'faraday', '~> 0.12'
|
26
26
|
s.add_dependency 'faraday-encoding', '0.0.4'
|
27
27
|
|
28
|
-
s.add_development_dependency "rails"
|
28
|
+
s.add_development_dependency "rails"
|
29
29
|
s.add_development_dependency "rdoc"
|
30
30
|
s.add_development_dependency "yard"
|
31
31
|
s.add_development_dependency "rake"
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.add_development_dependency "rspec-its"
|
36
36
|
s.add_development_dependency "equivalent-xml"
|
37
37
|
s.add_development_dependency "simplecov", '~> 0.8'
|
38
|
-
s.add_development_dependency "rubocop", '~> 0.
|
38
|
+
s.add_development_dependency "rubocop", '~> 0.56.0'
|
39
39
|
s.add_development_dependency "rubocop-rspec", '~> 1.12.0'
|
40
40
|
|
41
41
|
s.files = `git ls-files`.split("\n")
|
data/lib/active_fedora.rb
CHANGED
@@ -9,7 +9,7 @@ require 'active_support/core_ext/hash/except'
|
|
9
9
|
require 'active_triples'
|
10
10
|
|
11
11
|
# Monkey patching RDF::Literal::DateTime to support fractional seconds.
|
12
|
-
# See https://github.com/
|
12
|
+
# See https://github.com/samvera/active_fedora/issues/497
|
13
13
|
# Also monkey patches in a fix for timezones to be stored properly.
|
14
14
|
module RDF
|
15
15
|
class Literal
|
@@ -15,7 +15,7 @@ module ActiveFedora
|
|
15
15
|
# Overriding so that we don't track previously_changed, which was
|
16
16
|
# rather expensive.
|
17
17
|
def clear_changed_attributes
|
18
|
-
|
18
|
+
clear_changes_information
|
19
19
|
end
|
20
20
|
|
21
21
|
def changed?
|
@@ -36,7 +36,7 @@ module ActiveFedora
|
|
36
36
|
# Serializing head/tail/nodes slows things down CONSIDERABLY, and is not
|
37
37
|
# useful.
|
38
38
|
# @note This method is used by ActiveFedora::Base upstream for indexing,
|
39
|
-
# at https://github.com/
|
39
|
+
# at https://github.com/samvera/active_fedora/blob/master/lib/active_fedora/indexing_service.rb.
|
40
40
|
def serializable_hash(_options = nil)
|
41
41
|
{}
|
42
42
|
end
|
@@ -80,6 +80,7 @@ module ActiveFedora
|
|
80
80
|
# Set node subjects to a term in AF JUST so that AF will persist the
|
81
81
|
# sub-graphs.
|
82
82
|
# TODO: Find a way to fix this.
|
83
|
+
# See https://github.com/samvera/active_fedora/issues/1337
|
83
84
|
resource.set_value(:nodes, [])
|
84
85
|
self.nodes += graph.subjects.to_a
|
85
86
|
ordered_self.changes_committed!
|
@@ -26,6 +26,7 @@ module ActiveFedora::Associations::Builder
|
|
26
26
|
full_callback_name = "#{callback_name}_for_#{name}"
|
27
27
|
|
28
28
|
# TODO : why do i need method_defined? I think its because of the inheritance chain
|
29
|
+
# See https://github.com/samvera/active_fedora/issues/1333
|
29
30
|
model.class_attribute full_callback_name.to_sym unless model.method_defined?(full_callback_name)
|
30
31
|
|
31
32
|
callbacks = Array(options[callback_name.to_sym]).map do |callback|
|
@@ -43,6 +43,7 @@ module ActiveFedora
|
|
43
43
|
ids = Array(ids).reject(&:blank?)
|
44
44
|
replace(klass.find(ids)) # .index_by { |r| r.id }.values_at(*ids))
|
45
45
|
# TODO, like this when find() can return multiple records
|
46
|
+
# See https://github.com/samvera/active_fedora/issues/1340
|
46
47
|
# send("#{reflection.name}=", reflection.klass.find(ids))
|
47
48
|
# send("#{reflection.name}=", ids.collect { |id| reflection.klass.find(id)})
|
48
49
|
end
|
@@ -171,6 +172,7 @@ module ActiveFedora
|
|
171
172
|
# See delete for more info.
|
172
173
|
def delete_all
|
173
174
|
# TODO: load_target causes extra loads. Can't we just send delete requests?
|
175
|
+
# See https://github.com/samvera/active_fedora/issues/1341
|
174
176
|
delete(load_target).tap do
|
175
177
|
reset
|
176
178
|
loaded!
|
@@ -301,6 +303,7 @@ module ActiveFedora
|
|
301
303
|
def find_target
|
302
304
|
# TODO: don't reify, just store the solr results and lazily reify.
|
303
305
|
# For now, we set a hard limit of 1000 results.
|
306
|
+
# See https://github.com/samvera/active_fedora/issues/1358
|
304
307
|
records = ActiveFedora::QueryResultBuilder.reify_solr_results(load_from_solr(rows: SolrService::MAX_ROWS))
|
305
308
|
records.each { |record| set_inverse_instance(record) }
|
306
309
|
records
|
@@ -4,6 +4,7 @@ module ActiveFedora
|
|
4
4
|
class DirectlyContainsOneAssociation < SingularAssociation #:nodoc:
|
5
5
|
# Finds objects contained by the container predicate (either the configured has_member_relation or ldp:contains)
|
6
6
|
# TODO: Refactor this to use solr (for efficiency) instead of parsing the RDF graph. Requires indexing ActiveFedora::File objects into solr, including their RDF.type and, if possible, the id of their container
|
7
|
+
# See https://github.com/samvera/active_fedora/issues/1335
|
7
8
|
def find_target
|
8
9
|
# filtered_objects = container_association_proxy.to_a.select { |o| o.metadata_node.type.include?(options[:type]) }
|
9
10
|
query_node = if container_predicate = options[:has_member_relation]
|
@@ -2,6 +2,7 @@ module ActiveFedora
|
|
2
2
|
module Associations
|
3
3
|
# TODO: we may want to split this into two subclasses, one for has_member_relation
|
4
4
|
# and the other for is_member_of_relation
|
5
|
+
# See https://github.com/samvera/active_fedora/issues/1332
|
5
6
|
class IndirectlyContainsAssociation < ContainsAssociation #:nodoc:
|
6
7
|
# Add +records+ to this association. Returns +self+ so method calls may be chained.
|
7
8
|
# Since << flattens its argument list and inserts each record, +push+ and +concat+ behave identically.
|
@@ -40,6 +41,7 @@ module ActiveFedora
|
|
40
41
|
uris.map { |object_uri| klass.find(klass.uri_to_id(object_uri)) }
|
41
42
|
else # is_member_of_relation
|
42
43
|
# TODO this is a lot of reads. Avoid this path
|
44
|
+
# See https://github.com/samvera/active_fedora/issues/1345
|
43
45
|
container_predicate = ::RDF::Vocab::LDP.contains
|
44
46
|
proxy_uris = container.resource.query(predicate: container_predicate).map { |r| r.object.to_s }
|
45
47
|
proxy_uris.map { |uri| proxy_class.find(proxy_class.uri_to_id(uri))[options[:foreign_key]] }
|
@@ -33,6 +33,7 @@ module ActiveFedora
|
|
33
33
|
|
34
34
|
def find_target
|
35
35
|
# TODO: this forces a solr query, but I think it's likely we can just lookup from Fedora.
|
36
|
+
# See https://github.com/samvera/active_fedora/issues/1330
|
36
37
|
rec = scope.take
|
37
38
|
rec.tap { |record| set_inverse_instance(record) }
|
38
39
|
end
|
@@ -136,7 +136,7 @@ module ActiveFedora
|
|
136
136
|
# person.attribute_names
|
137
137
|
# # => ["id", "created_at", "updated_at", "name", "age"]
|
138
138
|
def attribute_names
|
139
|
-
@
|
139
|
+
@local_attributes.keys
|
140
140
|
end
|
141
141
|
|
142
142
|
# Returns a hash of all the attributes with their names as keys and the values of the attributes as values.
|
@@ -28,7 +28,7 @@ module ActiveFedora
|
|
28
28
|
|
29
29
|
def write_attribute(attribute_name, value)
|
30
30
|
if self.class.properties.key?(attribute_name)
|
31
|
-
|
31
|
+
attributes[attribute_name] = value
|
32
32
|
else
|
33
33
|
raise ActiveModel::MissingAttributeError, "can't write unknown attribute `#{attribute_name}'"
|
34
34
|
end
|
@@ -57,6 +57,7 @@ module ActiveFedora::Attributes
|
|
57
57
|
|
58
58
|
def build(&block)
|
59
59
|
# TODO: remove this block stuff
|
60
|
+
# See https://github.com/samvera/active_fedora/issues/1336
|
60
61
|
NodeConfig.new(name, options[:predicate], options.except(:predicate)) do |config|
|
61
62
|
config.with_index(&block) if block_given?
|
62
63
|
end
|
@@ -215,7 +215,8 @@ module ActiveFedora
|
|
215
215
|
:after_initialize, :after_find, :before_validation, :after_validation,
|
216
216
|
:before_save, :around_save, :after_save, :before_create, :around_create,
|
217
217
|
:after_create, :before_update, :around_update, :after_update,
|
218
|
-
:before_destroy, :around_destroy, :after_destroy
|
218
|
+
:before_destroy, :around_destroy, :after_destroy,
|
219
|
+
:before_update_index, :around_update_index, :after_update_index
|
219
220
|
].freeze
|
220
221
|
|
221
222
|
included do
|
@@ -223,13 +224,17 @@ module ActiveFedora
|
|
223
224
|
include ActiveModel::Validations::Callbacks
|
224
225
|
|
225
226
|
define_model_callbacks :initialize, :find, only: :after
|
226
|
-
define_model_callbacks :save, :create, :update, :destroy
|
227
|
+
define_model_callbacks :save, :create, :update, :destroy, :update_index
|
227
228
|
end
|
228
229
|
|
229
230
|
def destroy(*) #:nodoc:
|
230
231
|
_run_destroy_callbacks { super }
|
231
232
|
end
|
232
233
|
|
234
|
+
def update_index(*args)
|
235
|
+
_run_update_index_callbacks { super(*args) }
|
236
|
+
end
|
237
|
+
|
233
238
|
private
|
234
239
|
|
235
240
|
def create_or_update(*)
|
data/lib/active_fedora/fedora.rb
CHANGED
@@ -103,5 +103,13 @@ module ActiveFedora
|
|
103
103
|
ActiveFedora::Base.logger.warn "Fedora URL (#{host}) does not end with /rest. This could be a problem. Check your fedora.yml config"
|
104
104
|
end
|
105
105
|
end
|
106
|
+
|
107
|
+
def ntriples_connection
|
108
|
+
authorized_connection.tap { |conn| conn.headers['Accept'] = 'application/n-triples' }
|
109
|
+
end
|
110
|
+
|
111
|
+
def build_ntriples_connection
|
112
|
+
ActiveFedora::InitializingConnection.new(ActiveFedora::CachingConnection.new(ntriples_connection, omit_ldpr_interaction_model: true), root_resource_path)
|
113
|
+
end
|
106
114
|
end
|
107
115
|
end
|
data/lib/active_fedora/file.rb
CHANGED
@@ -43,7 +43,7 @@ module ActiveFedora
|
|
43
43
|
raise "The first argument to #{self} must be a Hash, String or RDF::URI. You provided a #{identifier.class}"
|
44
44
|
end
|
45
45
|
|
46
|
-
@
|
46
|
+
@local_attributes = {}.with_indifferent_access
|
47
47
|
@readonly = false
|
48
48
|
yield self if block_given?
|
49
49
|
end
|
@@ -86,7 +86,7 @@ module ActiveFedora
|
|
86
86
|
@content = nil
|
87
87
|
@metadata = nil
|
88
88
|
@ds_content = nil
|
89
|
-
|
89
|
+
clear_attribute_changes(changes.keys)
|
90
90
|
end
|
91
91
|
|
92
92
|
def check_fixity
|
@@ -94,12 +94,12 @@ module ActiveFedora
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def datastream_will_change!
|
97
|
-
attribute_will_change! :
|
97
|
+
attribute_will_change! :ldp_source
|
98
98
|
end
|
99
99
|
|
100
100
|
def attribute_will_change!(attr)
|
101
101
|
return super unless attr == 'content'
|
102
|
-
|
102
|
+
attributes_changed_by_setter[:content] = true
|
103
103
|
end
|
104
104
|
|
105
105
|
def remote_content
|
@@ -196,7 +196,9 @@ module ActiveFedora
|
|
196
196
|
end
|
197
197
|
|
198
198
|
def local_or_remote_content(ensure_fetch = true)
|
199
|
-
@content
|
199
|
+
return @content if new_record?
|
200
|
+
|
201
|
+
@content ||= ensure_fetch ? remote_content : @ds_content
|
200
202
|
@content.rewind if behaves_like_io?(@content)
|
201
203
|
@content
|
202
204
|
end
|
@@ -77,7 +77,7 @@ module ActiveFedora
|
|
77
77
|
protected
|
78
78
|
|
79
79
|
def rdf_resource
|
80
|
-
@rdf_resource ||= Ldp::Resource::RdfSource.new(ActiveFedora.fedora.
|
80
|
+
@rdf_resource ||= Ldp::Resource::RdfSource.new(ActiveFedora.fedora.build_ntriples_connection, uri)
|
81
81
|
end
|
82
82
|
|
83
83
|
def rdf_graph
|
@@ -22,6 +22,7 @@ module ActiveFedora
|
|
22
22
|
# @api
|
23
23
|
# Given a field name, index_type, etc., returns the corresponding Solr name.
|
24
24
|
# TODO field type is the input format, maybe we could just detect that?
|
25
|
+
# See https://github.com/samvera/active_fedora/issues/1338
|
25
26
|
# @param [String] field_name the ruby (term) name which will get a suffix appended to become a Solr field name
|
26
27
|
# @param opts - index_type is only needed if the FieldDescriptor requires it (e.g. :searcahble)
|
27
28
|
# @return [String] name of the solr field, based on the params
|
@@ -69,6 +70,7 @@ module ActiveFedora
|
|
69
70
|
|
70
71
|
# Is there a custom converter?
|
71
72
|
# TODO instead of a custom converter, look for input data type and output data type. Create a few methods that can do that cast.
|
73
|
+
# See https://github.com/samvera/active_fedora/issues/1339
|
72
74
|
|
73
75
|
value = if converter
|
74
76
|
if converter.arity == 1
|