active-fedora 10.3.0 → 11.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +24 -0
- data/README.md +3 -1
- data/active-fedora.gemspec +4 -4
- data/lib/active_fedora.rb +0 -2
- data/lib/active_fedora/aggregation/list_source.rb +2 -0
- data/lib/active_fedora/associations/association_scope.rb +1 -1
- data/lib/active_fedora/associations/builder/aggregation.rb +1 -1
- data/lib/active_fedora/associations/builder/association.rb +1 -1
- data/lib/active_fedora/associations/builder/orders.rb +11 -3
- data/lib/active_fedora/associations/collection_association.rb +2 -2
- data/lib/active_fedora/associations/has_many_association.rb +2 -2
- data/lib/active_fedora/associations/has_subresource_association.rb +2 -2
- data/lib/active_fedora/associations/orders_association.rb +4 -0
- data/lib/active_fedora/associations/rdf.rb +2 -0
- data/lib/active_fedora/attribute_methods/dirty.rb +1 -1
- data/lib/active_fedora/base.rb +1 -1
- data/lib/active_fedora/containers/container.rb +1 -1
- data/lib/active_fedora/core.rb +7 -9
- data/lib/active_fedora/fedora.rb +2 -6
- data/lib/active_fedora/fedora_attributes.rb +1 -1
- data/lib/active_fedora/file.rb +1 -1
- data/lib/active_fedora/file/streaming.rb +1 -1
- data/lib/active_fedora/indexing.rb +1 -18
- data/lib/active_fedora/indexing_service.rb +0 -5
- data/lib/active_fedora/loadable_from_json.rb +12 -1
- data/lib/active_fedora/nested_attributes.rb +2 -2
- data/lib/active_fedora/orders/list_node.rb +2 -2
- data/lib/active_fedora/orders/ordered_list.rb +7 -3
- data/lib/active_fedora/orders/target_proxy.rb +4 -0
- data/lib/active_fedora/rake_support.rb +1 -1
- data/lib/active_fedora/rdf/persistence.rb +1 -0
- data/lib/active_fedora/rdf/rdf_datastream.rb +7 -1
- data/lib/active_fedora/solr_hit.rb +0 -9
- data/lib/active_fedora/solr_query_builder.rb +1 -1
- data/lib/active_fedora/version.rb +1 -1
- data/lib/generators/active_fedora/config/solr/templates/solr/config/solrconfig.xml +0 -11
- data/lib/generators/active_fedora/config/solr/templates/solr_wrapper_test.yml +1 -1
- data/lib/generators/active_fedora/model/model_generator.rb +1 -1
- data/lib/generators/active_fedora/model/templates/model.rb.erb +4 -4
- data/lib/tasks/active_fedora_dev.rake +1 -1
- data/solr/config/_rest_managed.json +3 -0
- data/solr/config/admin-extra.html +31 -0
- data/solr/config/elevate.xml +36 -0
- data/solr/config/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/config/protwords.txt +21 -0
- data/solr/config/schema.xml +372 -0
- data/solr/config/scripts.conf +24 -0
- data/solr/config/solrconfig.xml +311 -0
- data/solr/config/spellings.txt +2 -0
- data/solr/config/stopwords.txt +58 -0
- data/solr/config/stopwords_en.txt +58 -0
- data/solr/config/synonyms.txt +31 -0
- data/solr/config/xslt/example.xsl +132 -0
- data/solr/config/xslt/example_atom.xsl +67 -0
- data/solr/config/xslt/example_rss.xsl +66 -0
- data/solr/config/xslt/luke.xsl +337 -0
- data/spec/integration/associations_spec.rb +6 -6
- data/spec/integration/basic_contains_association_spec.rb +1 -1
- data/spec/integration/clean_connection_spec.rb +1 -1
- data/spec/integration/complex_rdf_datastream_spec.rb +4 -5
- data/spec/integration/datastream_rdf_nested_attributes_spec.rb +15 -14
- data/spec/integration/date_time_properties_spec.rb +0 -15
- data/spec/integration/direct_container_spec.rb +4 -4
- data/spec/integration/directly_contains_one_association_spec.rb +1 -1
- data/spec/integration/eradicate_spec.rb +1 -1
- data/spec/integration/generators/solr_generator_spec.rb +10 -7
- data/spec/integration/has_and_belongs_to_many_associations_spec.rb +5 -5
- data/spec/integration/has_many_associations_spec.rb +4 -4
- data/spec/integration/indexing_spec.rb +1 -1
- data/spec/integration/indirect_container_spec.rb +3 -3
- data/spec/integration/ntriples_datastream_spec.rb +35 -23
- data/spec/integration/rdf_nested_attributes_spec.rb +3 -3
- data/spec/integration/relation_delegation_spec.rb +2 -2
- data/spec/integration/scoped_query_spec.rb +3 -3
- data/spec/integration/solr_hit_spec.rb +0 -11
- data/spec/integration/versionable_spec.rb +6 -6
- data/spec/integration/with_metadata_spec.rb +1 -1
- data/spec/samples/hydra-mods_article_datastream.rb +2 -4
- data/spec/unit/base_spec.rb +3 -4
- data/spec/unit/core/fedora_id_translator_spec.rb +2 -2
- data/spec/unit/core/fedora_uri_translator_spec.rb +2 -2
- data/spec/unit/core_spec.rb +5 -5
- data/spec/unit/fedora_spec.rb +1 -2
- data/spec/unit/file_spec.rb +2 -2
- data/spec/unit/filter_spec.rb +3 -3
- data/spec/unit/forbidden_attributes_protection_spec.rb +2 -2
- data/spec/unit/has_and_belongs_to_many_association_spec.rb +2 -2
- data/spec/unit/has_many_association_spec.rb +11 -26
- data/spec/unit/ntriples_datastream_spec.rb +6 -9
- data/spec/unit/ordered_spec.rb +8 -11
- data/spec/unit/orders/list_node_spec.rb +2 -2
- data/spec/unit/orders/ordered_list_spec.rb +1 -1
- data/spec/unit/query_spec.rb +4 -4
- data/spec/unit/rdf/indexing_service_spec.rb +5 -5
- data/spec/unit/rdf_resource_datastream_spec.rb +4 -0
- metadata +44 -17
- data/.solr_wrapper +0 -6
- data/lib/active_fedora/profile_indexing_service.rb +0 -11
- data/lib/active_fedora/solr_instance_loader.rb +0 -47
- data/spec/integration/solr_instance_loader_spec.rb +0 -156
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e30d9865f03aa8fde7431fa449c1fd1b0fa8a3c5
|
4
|
+
data.tar.gz: ad33f54129ac32831e5917b980d2607e2fd6bc1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edf50b69bdd72334819f4470868936646752c79da2091413721ea35410ce45ec00e14445f8853df15f36fa18fff89dfe443b3171985395b910237f7de54531e7
|
7
|
+
data.tar.gz: 09720448439264991177243424a6f9bf1d133c62ad916b00d9075d22ab04625b6548d6a166883ae229c1509e7cf5c4fd85ee1466b7b2d05bbc45ba8a76a3ccb4
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- .rubocop_todo.yml
|
3
|
+
|
1
4
|
AllCops:
|
2
5
|
TargetRubyVersion: 2.2
|
3
6
|
DisplayCopNames: true
|
@@ -89,6 +92,7 @@ Metrics/ClassLength:
|
|
89
92
|
- 'lib/active_fedora/reflection.rb'
|
90
93
|
- 'lib/active_fedora/orders/ordered_list.rb'
|
91
94
|
- 'lib/active_fedora/solr_service.rb'
|
95
|
+
- 'lib/active_fedora/associations/orders_association.rb'
|
92
96
|
|
93
97
|
Metrics/MethodLength:
|
94
98
|
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
# This configuration was generated by
|
3
|
+
# `rubocop --auto-gen-config`
|
4
|
+
# on 2016-07-29 08:55:51 -0500 using RuboCop version 0.42.0.
|
5
|
+
# The point is for the user to remove these configuration records
|
6
|
+
# one by one as the offenses are removed from the code base.
|
7
|
+
# Note that changes in the inspected code, or installation of new
|
8
|
+
# versions of RuboCop, may require this file to be generated again.
|
9
|
+
|
10
|
+
# Offense count: 133
|
11
|
+
# Configuration parameters: Max.
|
12
|
+
RSpec/ExampleLength:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
# Offense count: 58
|
16
|
+
# Configuration parameters: IgnoreSymbolicNames.
|
17
|
+
RSpec/VerifiedDoubles:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
# Offense count: 2
|
21
|
+
Style/MethodMissing:
|
22
|
+
Exclude:
|
23
|
+
- 'lib/active_fedora/nom_datastream.rb'
|
24
|
+
- 'lib/active_fedora/relation/delegation.rb'
|
data/README.md
CHANGED
@@ -75,9 +75,11 @@ rake active_fedora:ci
|
|
75
75
|
If you want to run the tests manually, follow these instructions:
|
76
76
|
|
77
77
|
```bash
|
78
|
-
solr_wrapper
|
78
|
+
solr_wrapper -d solr/config/ --collection_name hydra-test
|
79
79
|
```
|
80
80
|
|
81
|
+
You can switch `hydra-test` to `hydra-dev` if you want to create a collection for development.
|
82
|
+
|
81
83
|
To start FCRepo, open another shell and run:
|
82
84
|
|
83
85
|
```bash
|
data/active-fedora.gemspec
CHANGED
@@ -20,8 +20,9 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency 'nom-xml', '>= 0.5.1'
|
21
21
|
s.add_dependency "activesupport", '>= 4.2.4', '< 6'
|
22
22
|
s.add_dependency "activemodel", '>= 4.2', '< 6'
|
23
|
-
s.add_dependency "active-triples", '~> 0.
|
24
|
-
s.add_dependency "rdf-rdfxml"
|
23
|
+
s.add_dependency "active-triples", '~> 0.10.0'
|
24
|
+
s.add_dependency "rdf-rdfxml"
|
25
|
+
s.add_dependency "linkeddata"
|
25
26
|
s.add_dependency "deprecation"
|
26
27
|
s.add_dependency "ldp", '~> 0.5.0'
|
27
28
|
|
@@ -36,8 +37,7 @@ Gem::Specification.new do |s|
|
|
36
37
|
s.add_development_dependency "rspec-its"
|
37
38
|
s.add_development_dependency "equivalent-xml"
|
38
39
|
s.add_development_dependency "simplecov", '~> 0.8'
|
39
|
-
|
40
|
-
s.add_development_dependency "rubocop", '~> 0.38.0'
|
40
|
+
s.add_development_dependency "rubocop", '~> 0.42.0'
|
41
41
|
s.add_development_dependency "rubocop-rspec", '~> 1.4'
|
42
42
|
|
43
43
|
s.files = `git ls-files`.split("\n")
|
data/lib/active_fedora.rb
CHANGED
@@ -95,7 +95,6 @@ module ActiveFedora #:nodoc:
|
|
95
95
|
autoload :Orders
|
96
96
|
autoload :Pathing
|
97
97
|
autoload :Persistence
|
98
|
-
autoload :ProfileIndexingService
|
99
98
|
autoload :Property
|
100
99
|
autoload :QualifiedDublinCoreDatastream
|
101
100
|
autoload :Querying
|
@@ -124,7 +123,6 @@ module ActiveFedora #:nodoc:
|
|
124
123
|
autoload :Serialization
|
125
124
|
autoload :SchemaIndexingStrategy
|
126
125
|
autoload :SolrHit
|
127
|
-
autoload :SolrInstanceLoader
|
128
126
|
autoload :SolrQueryBuilder
|
129
127
|
autoload :SolrService
|
130
128
|
autoload :SparqlInsert
|
@@ -73,6 +73,8 @@ module ActiveFedora
|
|
73
73
|
# Assert head and tail
|
74
74
|
self.head = ordered_self.head.next.rdf_subject
|
75
75
|
self.tail = ordered_self.tail.prev.rdf_subject
|
76
|
+
head_will_change!
|
77
|
+
tail_will_change!
|
76
78
|
graph = ordered_self.to_graph
|
77
79
|
resource << graph
|
78
80
|
# Set node subjects to a term in AF JUST so that AF will persist the
|
@@ -31,7 +31,7 @@ module ActiveFedora
|
|
31
31
|
scope = scope.where(ActiveFedora::SolrQueryBuilder.construct_query_for_rel(association.send(:find_reflection) => owner.id))
|
32
32
|
end
|
33
33
|
|
34
|
-
is_first_chain = i
|
34
|
+
is_first_chain = i.zero?
|
35
35
|
is_first_chain ? klass : reflection.klass
|
36
36
|
end
|
37
37
|
|
@@ -19,7 +19,7 @@ module ActiveFedora::Associations::Builder
|
|
19
19
|
private_class_method :indirect_options
|
20
20
|
|
21
21
|
def self.has_member_relation(options)
|
22
|
-
options[:has_member_relation] || ::RDF::DC.hasPart
|
22
|
+
options[:has_member_relation] || ::RDF::Vocab::DC.hasPart
|
23
23
|
end
|
24
24
|
private_class_method :has_member_relation
|
25
25
|
|
@@ -36,7 +36,7 @@ module ActiveFedora::Associations::Builder
|
|
36
36
|
def self.build_scope(scope, extension)
|
37
37
|
new_scope = scope
|
38
38
|
|
39
|
-
new_scope = proc { instance_exec(&scope) } if scope && scope.arity
|
39
|
+
new_scope = proc { instance_exec(&scope) } if scope && scope.arity.zero?
|
40
40
|
|
41
41
|
new_scope = wrap_scope new_scope, extension if extension
|
42
42
|
|
@@ -14,6 +14,9 @@ module ActiveFedora::Associations::Builder
|
|
14
14
|
mixin.redefine_method(target_accessor(name)) do
|
15
15
|
association(name).target_reader
|
16
16
|
end
|
17
|
+
mixin.redefine_method("#{target_accessor(name, pluralize: false)}_ids") do
|
18
|
+
association(name).target_ids_reader
|
19
|
+
end
|
17
20
|
mixin.redefine_method("#{target_accessor(name)}=") do |nodes|
|
18
21
|
association(name).target_writer(nodes)
|
19
22
|
end
|
@@ -27,7 +30,7 @@ module ActiveFedora::Associations::Builder
|
|
27
30
|
model.send(:define_method, :apply_first_and_last) do
|
28
31
|
source = send(options[:through])
|
29
32
|
source.save
|
30
|
-
return if
|
33
|
+
return if head_ids == source.head_id && tail_ids == source.tail_id
|
31
34
|
self.head = source.head_id
|
32
35
|
self.tail = source.tail_id
|
33
36
|
save! if changed?
|
@@ -50,8 +53,13 @@ module ActiveFedora::Associations::Builder
|
|
50
53
|
end
|
51
54
|
end
|
52
55
|
|
53
|
-
def self.target_accessor(name)
|
54
|
-
name.to_s.gsub("_proxies", "")
|
56
|
+
def self.target_accessor(name, pluralize: true)
|
57
|
+
name = name.to_s.gsub("_proxies", "")
|
58
|
+
if pluralize
|
59
|
+
name.pluralize
|
60
|
+
else
|
61
|
+
name
|
62
|
+
end
|
55
63
|
end
|
56
64
|
private_class_method :target_accessor
|
57
65
|
|
@@ -94,7 +94,7 @@ module ActiveFedora
|
|
94
94
|
if loaded?
|
95
95
|
size.zero?
|
96
96
|
else
|
97
|
-
@target.blank? && count_records
|
97
|
+
@target.blank? && count_records.zero?
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -250,7 +250,7 @@ module ActiveFedora
|
|
250
250
|
finder_query = construct_query
|
251
251
|
return [] if finder_query.empty?
|
252
252
|
rows = opts.delete(:rows) { count }
|
253
|
-
return [] if rows
|
253
|
+
return [] if rows.zero?
|
254
254
|
SolrService.query(finder_query, { rows: rows }.merge(opts))
|
255
255
|
end
|
256
256
|
|
@@ -19,7 +19,7 @@ module ActiveFedora
|
|
19
19
|
# If there's nothing in the database and @target has no new records
|
20
20
|
# we are certain the current target is an empty array. This is a
|
21
21
|
# documented side-effect of the method that may avoid an extra SELECT.
|
22
|
-
@target ||= [] and loaded! if count
|
22
|
+
@target ||= [] and loaded! if count.zero?
|
23
23
|
|
24
24
|
count
|
25
25
|
end
|
@@ -83,7 +83,7 @@ module ActiveFedora
|
|
83
83
|
protected
|
84
84
|
|
85
85
|
def find_polymorphic_inverse(record)
|
86
|
-
record.reflections.values.find { |r| !r.has_many? && r.
|
86
|
+
record.reflections.values.find { |r| !r.has_many? && r.options[:property] == reflection.options[:property] }
|
87
87
|
end
|
88
88
|
|
89
89
|
# Deletes the records according to the <tt>:dependent</tt> option.
|
@@ -25,12 +25,12 @@ module ActiveFedora
|
|
25
25
|
|
26
26
|
def find_or_initialize_target(&block)
|
27
27
|
if reflection.klass < ActiveFedora::File
|
28
|
-
reflection.build_association(
|
28
|
+
reflection.build_association(target_uri, &block)
|
29
29
|
else
|
30
30
|
reflection.klass.find(target_uri)
|
31
31
|
end
|
32
32
|
rescue ActiveFedora::ObjectNotFoundError
|
33
|
-
reflection.build_association(
|
33
|
+
reflection.build_association(target_uri, &block)
|
34
34
|
end
|
35
35
|
|
36
36
|
def replace(record)
|
@@ -10,6 +10,7 @@ module ActiveFedora
|
|
10
10
|
additions = incoming_objects - current_objects
|
11
11
|
deletions.each { |object| owner.resource.delete([owner.rdf_subject, reflection.predicate, object]) }
|
12
12
|
additions.each { |object| owner.resource.insert([owner.rdf_subject, reflection.predicate, object]) }
|
13
|
+
owner.resource.persist!
|
13
14
|
owner.send(:attribute_will_change!, reflection.name)
|
14
15
|
end
|
15
16
|
|
@@ -21,6 +22,7 @@ module ActiveFedora
|
|
21
22
|
filtered_results.each do |candidate|
|
22
23
|
owner.resource.delete([owner.rdf_subject, reflection.predicate, candidate])
|
23
24
|
end
|
25
|
+
owner.resource.persist!
|
24
26
|
end
|
25
27
|
|
26
28
|
private
|
@@ -6,7 +6,7 @@ module ActiveFedora
|
|
6
6
|
def set_value(*val)
|
7
7
|
attribute = val.first
|
8
8
|
unless [:has_model, :modified_date].include? attribute
|
9
|
-
attribute_will_change!(attribute) unless self[val.first] == val.last
|
9
|
+
attribute_will_change!(attribute) unless Array(self[val.first]).to_set == Array(val.last).to_set
|
10
10
|
end
|
11
11
|
super
|
12
12
|
end
|
data/lib/active_fedora/base.rb
CHANGED
@@ -40,11 +40,11 @@ module ActiveFedora
|
|
40
40
|
include Associations
|
41
41
|
include AutosaveAssociation
|
42
42
|
include NestedAttributes
|
43
|
-
include Reflection
|
44
43
|
include Serialization
|
45
44
|
|
46
45
|
include AttachedFiles
|
47
46
|
include FedoraAttributes
|
47
|
+
include Reflection
|
48
48
|
include AttributeMethods
|
49
49
|
include Attributes
|
50
50
|
include Versionable
|
data/lib/active_fedora/core.rb
CHANGED
@@ -2,7 +2,6 @@ module ActiveFedora
|
|
2
2
|
module Core
|
3
3
|
extend ActiveSupport::Autoload
|
4
4
|
extend ActiveSupport::Concern
|
5
|
-
extend Deprecation
|
6
5
|
include ActiveFedora::Common
|
7
6
|
|
8
7
|
autoload :FedoraIdTranslator
|
@@ -26,7 +25,7 @@ module ActiveFedora
|
|
26
25
|
def initialize(attributes_or_id = nil, &_block)
|
27
26
|
init_internals
|
28
27
|
attributes = initialize_attributes(attributes_or_id)
|
29
|
-
@ldp_source = build_ldp_resource(attributes.delete(
|
28
|
+
@ldp_source = build_ldp_resource(attributes.delete(:id))
|
30
29
|
raise IllegalOperation, "Attempting to recreate existing ldp_source: `#{ldp_source.subject}'" unless ldp_source.new?
|
31
30
|
assert_content_model
|
32
31
|
load_attached_files
|
@@ -149,16 +148,15 @@ module ActiveFedora
|
|
149
148
|
def initialize_attributes(attributes_or_id)
|
150
149
|
case attributes_or_id
|
151
150
|
when String
|
152
|
-
|
153
|
-
|
151
|
+
attributes = { id: attributes_or_id }.with_indifferent_access
|
152
|
+
when Hash
|
153
|
+
attributes = attributes_or_id.with_indifferent_access
|
154
154
|
when NilClass
|
155
|
-
{}
|
155
|
+
attributes = {}.with_indifferent_access
|
156
156
|
else
|
157
|
-
|
158
|
-
raise ArgumentError, "#{attributes_or_id.class} is not acceptable"
|
159
|
-
end
|
160
|
-
attributes_or_id.stringify_keys
|
157
|
+
raise ArgumentError, "#{attributes_or_id.class} is not acceptable"
|
161
158
|
end
|
159
|
+
attributes
|
162
160
|
end
|
163
161
|
end
|
164
162
|
end
|
data/lib/active_fedora/fedora.rb
CHANGED
@@ -23,15 +23,11 @@ module ActiveFedora
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def host
|
26
|
-
@config[:url]
|
26
|
+
@config[:url]
|
27
27
|
end
|
28
28
|
|
29
29
|
def base_path
|
30
|
-
@config[:base_path] ||
|
31
|
-
end
|
32
|
-
|
33
|
-
def base_uri
|
34
|
-
host + base_path.sub(/\/$/, BLANK)
|
30
|
+
@config[:base_path] || '/'
|
35
31
|
end
|
36
32
|
|
37
33
|
def user
|
@@ -43,7 +43,7 @@ module ActiveFedora
|
|
43
43
|
# Appending the graph at the end is necessary because adding it as the
|
44
44
|
# parent leaves behind triples not related to the ldp_source's rdf
|
45
45
|
# subject.
|
46
|
-
@resource ||= self.class.resource_class.new(@ldp_source.graph.rdf_subject, @ldp_source.graph)
|
46
|
+
@resource ||= self.class.resource_class.new(@ldp_source.graph.rdf_subject, data: @ldp_source.graph.send(:graph).data)
|
47
47
|
end
|
48
48
|
|
49
49
|
# You can set the URI to use for the rdf_label on ClassMethods.rdf_label, then on
|
data/lib/active_fedora/file.rb
CHANGED
@@ -30,7 +30,7 @@ module ActiveFedora
|
|
30
30
|
# @yield [self] Yields self
|
31
31
|
# @yieldparam [File] self the newly created file
|
32
32
|
def initialize(identifier = nil, &_block)
|
33
|
-
identifier =
|
33
|
+
identifier = nil if identifier.is_a? Hash
|
34
34
|
run_callbacks(:initialize) do
|
35
35
|
case identifier
|
36
36
|
when nil, ::RDF::URI
|
@@ -23,7 +23,7 @@ module ActiveFedora::File::Streaming
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def each(no_of_requests_limit = 3, &block)
|
26
|
-
raise ArgumentError, 'HTTP redirect too deep' if no_of_requests_limit
|
26
|
+
raise ArgumentError, 'HTTP redirect too deep' if no_of_requests_limit.zero?
|
27
27
|
Net::HTTP.start(uri.host, uri.port, use_ssl: (uri.scheme == 'https')) do |http|
|
28
28
|
request = Net::HTTP::Get.new uri, headers
|
29
29
|
http.request request do |response|
|
@@ -10,7 +10,6 @@ module ActiveFedora
|
|
10
10
|
module Indexing
|
11
11
|
extend ActiveSupport::Concern
|
12
12
|
extend ActiveSupport::Autoload
|
13
|
-
extend Deprecation
|
14
13
|
|
15
14
|
eager_autoload do
|
16
15
|
autoload :Map
|
@@ -84,7 +83,7 @@ module ActiveFedora
|
|
84
83
|
end
|
85
84
|
|
86
85
|
def reindex_everything
|
87
|
-
descendants = descendant_uris(ActiveFedora.
|
86
|
+
descendants = descendant_uris(ActiveFedora::Base.id_to_uri(''))
|
88
87
|
descendants.shift # Discard the root uri
|
89
88
|
descendants.each do |uri|
|
90
89
|
logger.debug "Re-index everything ... #{uri}"
|
@@ -92,22 +91,6 @@ module ActiveFedora
|
|
92
91
|
end
|
93
92
|
end
|
94
93
|
|
95
|
-
# This method can be used instead of ActiveFedora::Model::ClassMethods.find.
|
96
|
-
# It works similarly except it populates an object from Solr instead of Fedora.
|
97
|
-
# It is most useful for objects used in read-only displays in order to speed up loading time. If only
|
98
|
-
# a id is passed in it will query solr for a corresponding solr document and then use it
|
99
|
-
# to populate this object.
|
100
|
-
#
|
101
|
-
# If a value is passed in for optional parameter solr_doc it will not query solr again and just use the
|
102
|
-
# one passed to populate the object.
|
103
|
-
#
|
104
|
-
# It will anything stored within solr such as metadata and relationships. Non-metadata attached files will not
|
105
|
-
# be loaded and if needed you should use find instead.
|
106
|
-
def load_instance_from_solr(id, solr_doc = nil)
|
107
|
-
SolrInstanceLoader.new(self, id, solr_doc).object
|
108
|
-
end
|
109
|
-
deprecation_deprecate :load_instance_from_solr
|
110
|
-
|
111
94
|
def descendant_uris(uri)
|
112
95
|
resource = Ldp::Resource::RdfSource.new(ActiveFedora.fedora.connection, uri)
|
113
96
|
# GET could be slow if it's a big resource, we're using HEAD to avoid this problem,
|
@@ -40,7 +40,6 @@ module ActiveFedora
|
|
40
40
|
Solrizer.set_field(solr_doc, 'system_modified', m_time, :stored_sortable)
|
41
41
|
solr_doc[QueryResultBuilder::HAS_MODEL_SOLR_FIELD] = object.has_model
|
42
42
|
solr_doc[ActiveFedora.id_field.to_sym] = object.id
|
43
|
-
solr_doc[self.class.profile_solr_name] = profile_service.new(object).export
|
44
43
|
object.declared_attached_files.each do |name, file|
|
45
44
|
solr_doc.merge! file.to_solr(solr_doc, name: name.to_s)
|
46
45
|
end
|
@@ -51,10 +50,6 @@ module ActiveFedora
|
|
51
50
|
|
52
51
|
protected
|
53
52
|
|
54
|
-
def profile_service
|
55
|
-
ProfileIndexingService
|
56
|
-
end
|
57
|
-
|
58
53
|
def c_time
|
59
54
|
c_time = object.create_date.present? ? object.create_date : DateTime.now
|
60
55
|
c_time = DateTime.parse(c_time) unless c_time.is_a?(DateTime)
|
@@ -50,6 +50,10 @@ module ActiveFedora
|
|
50
50
|
@hash[k]
|
51
51
|
end
|
52
52
|
|
53
|
+
def persist!(*)
|
54
|
+
true
|
55
|
+
end
|
56
|
+
|
53
57
|
# FakeQuery exists to adapt the hash to the RDF interface used by RDF associations in ActiveFedora
|
54
58
|
class FakeQuery
|
55
59
|
include ::Enumerable
|
@@ -153,7 +157,7 @@ module ActiveFedora
|
|
153
157
|
# @param attribute_name [String] the name of the attribute to adapt
|
154
158
|
# @return [Object] the adapted value
|
155
159
|
def adapt_attribute_value(attrs, attribute_name)
|
156
|
-
reflection =
|
160
|
+
reflection = property_reflection(attribute_name)
|
157
161
|
# if this isn't a property, copy value verbatim
|
158
162
|
return attrs[attribute_name] unless reflection
|
159
163
|
multiple = reflection.multiple?
|
@@ -169,6 +173,13 @@ module ActiveFedora
|
|
169
173
|
end
|
170
174
|
end
|
171
175
|
|
176
|
+
def property_reflection(attribute_name)
|
177
|
+
self.class.reflect_on_property(attribute_name)
|
178
|
+
rescue ActiveTriples::UndefinedPropertyError
|
179
|
+
ActiveFedora::Base.logger.info "Undefined property #{attribute_name} reflected."
|
180
|
+
nil
|
181
|
+
end
|
182
|
+
|
172
183
|
def date_attribute?(attribute_name)
|
173
184
|
reflection = self.class.reflect_on_property(attribute_name)
|
174
185
|
return false unless reflection
|