cul_hydra 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/cul/hydra/application_id_behavior.rb +5 -6
- data/app/models/administrative_set.rb +0 -1
- data/app/models/concept.rb +0 -1
- data/app/models/concerns/cul/hydra/models.rb +1 -0
- data/app/models/concerns/cul/hydra/models/common.rb +8 -9
- data/app/models/concerns/cul/hydra/models/rels_int.rb +18 -0
- data/app/models/concerns/ore/proxy.rb +2 -3
- data/app/models/cul/hydra/datastreams/rels_int.rb +179 -0
- data/app/models/dc_document.rb +0 -1
- data/app/models/generic_aggregator.rb +0 -1
- data/app/models/generic_object.rb +0 -1
- data/app/models/generic_resource.rb +1 -3
- data/fixtures/spec/CUL_RELS_INT/rels_int_blank.xml +2 -0
- data/fixtures/spec/CUL_RELS_INT/rels_int_profile.xml +19 -0
- data/fixtures/spec/CUL_RELS_INT/rels_int_test.xml +12 -0
- data/fixtures/spec/FOXML/resource-thumb.xml +2 -1
- data/lib/cul_hydra.rb +1 -4
- data/lib/cul_hydra/rels_int.rb +9 -0
- data/lib/cul_hydra/rels_int/rdf_xml_writer.rb +33 -0
- data/lib/cul_hydra/version.rb +1 -1
- data/lib/tasks/cul_hydra_dev.rake +0 -28
- metadata +32 -58
- data/app/models/jp2_image_aggregator.rb +0 -34
- data/app/models/mets_structured_aggregator.rb +0 -18
- data/app/models/resource.rb +0 -78
- data/app/models/resource_aggregator.rb +0 -22
- data/app/models/static_audio_aggregator.rb +0 -12
- data/app/models/static_image_aggregator.rb +0 -32
- data/lib/cul_hydra/controllers.rb +0 -14
- data/lib/cul_hydra/controllers/aggregates.rb +0 -93
- data/lib/cul_hydra/controllers/aggregator_controller_helper.rb +0 -27
- data/lib/cul_hydra/controllers/catalog.rb +0 -12
- data/lib/cul_hydra/controllers/collections.rb +0 -81
- data/lib/cul_hydra/controllers/content_aggregators.rb +0 -81
- data/lib/cul_hydra/controllers/datastreams.rb +0 -145
- data/lib/cul_hydra/controllers/helpers.rb +0 -10
- data/lib/cul_hydra/controllers/helpers/active_fedora_helper_behavior.rb +0 -9
- data/lib/cul_hydra/controllers/helpers/application_helper_behavior.rb +0 -16
- data/lib/cul_hydra/controllers/helpers/dc_metadata_helper_behavior.rb +0 -9
- data/lib/cul_hydra/controllers/helpers/hydra_assets_helper_behavior.rb +0 -46
- data/lib/cul_hydra/controllers/helpers/hydra_autocomplete_helper_behavior.rb +0 -35
- data/lib/cul_hydra/controllers/helpers/hydra_uploader_helper_behavior.rb +0 -34
- data/lib/cul_hydra/controllers/helpers/resources_helper_behavior.rb +0 -159
- data/lib/cul_hydra/controllers/resources.rb +0 -161
- data/lib/cul_hydra/controllers/static_image_aggregators.rb +0 -105
- data/lib/cul_hydra/controllers/suggestions.rb +0 -126
- data/lib/cul_hydra/controllers/terms.rb +0 -205
@@ -20,8 +20,9 @@
|
|
20
20
|
<foxml:xmlContent>
|
21
21
|
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
22
22
|
<rdf:Description rdf:about="info:fedora/test:thumb_image">
|
23
|
-
<hasModel xmlns="info:fedora/fedora-system:def/model#" rdf:resource="info:fedora/ldpd:
|
23
|
+
<hasModel xmlns="info:fedora/fedora-system:def/model#" rdf:resource="info:fedora/ldpd:GenericResource"/>
|
24
24
|
<imageWidth xmlns="http://purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/" >72</imageWidth>
|
25
|
+
<memberOf xmlns="http://purl.oclc.org/NET/CUL/" rdf:resource="info:fedora/test:c_agg"/>
|
25
26
|
</rdf:Description>
|
26
27
|
</rdf:RDF>
|
27
28
|
</foxml:xmlContent>
|
data/lib/cul_hydra.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
require 'hydra/head'
|
2
|
-
require 'active_fedora_relsint'
|
3
1
|
require 'cul_hydra/exceptions'
|
4
2
|
require 'cul_hydra/solrizer_patch'
|
5
3
|
module Cul
|
6
4
|
module Hydra
|
7
|
-
autoload :Controllers, 'cul_hydra/controllers'
|
8
5
|
autoload :Fedora, 'cul_hydra/fedora'
|
9
6
|
autoload :Om, 'cul_hydra/om'
|
10
7
|
autoload :Solrizer, 'cul_hydra/solrizer'
|
@@ -13,10 +10,10 @@ module Cul
|
|
13
10
|
end
|
14
11
|
|
15
12
|
require "cul_hydra/access_controls_enforcement"
|
16
|
-
require "cul_hydra/controllers"
|
17
13
|
require "cul_hydra/om"
|
18
14
|
require "cul_hydra/indexer"
|
19
15
|
require "cul_hydra/risearch_members"
|
20
16
|
require "cul_hydra/solrizer"
|
17
|
+
require "cul_hydra/rels_int"
|
21
18
|
require "cul_hydra/version"
|
22
19
|
require "cul_hydra/engine" if defined? Rails
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'active_fedora/rdf_xml_writer'
|
3
|
+
module Cul
|
4
|
+
module Hydra
|
5
|
+
module RelsInt
|
6
|
+
class RDFXMLWriter < ActiveFedora::RDFXMLWriter
|
7
|
+
# Write a predicate with one or more values.
|
8
|
+
#
|
9
|
+
# Values may be a combination of Literal and Resource (Node or URI).
|
10
|
+
# @param [RDF::Resource] predicate
|
11
|
+
# Predicate to serialize
|
12
|
+
# @param [Array<RDF::Resource>] objects
|
13
|
+
# Objects to serialize
|
14
|
+
# @return [String]
|
15
|
+
def predicate(predicate, objects)
|
16
|
+
add_debug {"predicate: #{predicate.inspect}, objects: #{objects}"}
|
17
|
+
|
18
|
+
return if objects.to_a.empty?
|
19
|
+
|
20
|
+
add_debug {"predicate: #{get_curie(predicate)}"}
|
21
|
+
render_property(predicate, objects) do |o, inlist=nil|
|
22
|
+
# Yields each object, for potential recursive definition.
|
23
|
+
# If nil is returned, a leaf is produced
|
24
|
+
#depth {subject(o, :rel => get_curie(predicate), :inlist => inlist, :element => (:li if objects.length > 1 || inlist))} if !is_done?(o) && @subjects.include?(o)
|
25
|
+
# we don't ever want to recurse, so nil it all
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/cul_hydra/version.rb
CHANGED
@@ -1,34 +1,6 @@
|
|
1
1
|
APP_ROOT = File.expand_path("#{File.dirname(__FILE__)}/../../") unless defined?(APP_ROOT)
|
2
2
|
|
3
|
-
require 'jettywrapper'
|
4
|
-
JETTY_ZIP_BASENAME = 'fedora-3.8.1-with-risearch'
|
5
|
-
Jettywrapper.url = "https://github.com/cul/hydra-jetty/archive/#{JETTY_ZIP_BASENAME}.zip"
|
6
|
-
|
7
3
|
namespace :cul_hydra do
|
8
|
-
|
9
|
-
begin
|
10
|
-
# This code is in a begin/rescue block so that the Rakefile is usable
|
11
|
-
# in an environment where RSpec is unavailable (i.e. production).
|
12
|
-
|
13
|
-
require 'rspec/core/rake_task'
|
14
|
-
|
15
|
-
RSpec::Core::RakeTask.new(:rspec) do |spec|
|
16
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
17
|
-
spec.pattern += FileList['spec/*_spec.rb']
|
18
|
-
spec.rspec_opts = ['--backtrace'] if ENV['CI']
|
19
|
-
end
|
20
|
-
|
21
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
22
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
23
|
-
spec.pattern += FileList['spec/*_spec.rb']
|
24
|
-
spec.rcov = true
|
25
|
-
end
|
26
|
-
|
27
|
-
rescue LoadError => e
|
28
|
-
puts "[Warning] Exception creating rspec rake tasks. This message can be ignored in environments that intentionally do not pull in the RSpec gem (i.e. production)."
|
29
|
-
puts e
|
30
|
-
end
|
31
|
-
|
32
4
|
desc "CI build"
|
33
5
|
task :ci do
|
34
6
|
ENV['environment'] = "test"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cul_hydra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Armintor
|
@@ -9,50 +9,50 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-03-
|
12
|
+
date: 2020-03-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 4.2.10
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 4.2.10
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: bootstrap-sass
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 3.3.7
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 3.3.7
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: blacklight
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '6.0'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '6.0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: httpclient
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,28 +73,34 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: '8.0'
|
77
|
+
- - "<"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 8.7.0
|
77
80
|
type: :runtime
|
78
81
|
prerelease: false
|
79
82
|
version_requirements: !ruby/object:Gem::Requirement
|
80
83
|
requirements:
|
81
84
|
- - ">="
|
82
85
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
86
|
+
version: '8.0'
|
87
|
+
- - "<"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 8.7.0
|
84
90
|
- !ruby/object:Gem::Dependency
|
85
91
|
name: active-triples
|
86
92
|
requirement: !ruby/object:Gem::Requirement
|
87
93
|
requirements:
|
88
94
|
- - "~>"
|
89
95
|
- !ruby/object:Gem::Version
|
90
|
-
version: 0.
|
96
|
+
version: 0.4.0
|
91
97
|
type: :runtime
|
92
98
|
prerelease: false
|
93
99
|
version_requirements: !ruby/object:Gem::Requirement
|
94
100
|
requirements:
|
95
101
|
- - "~>"
|
96
102
|
- !ruby/object:Gem::Version
|
97
|
-
version: 0.
|
103
|
+
version: 0.4.0
|
98
104
|
- !ruby/object:Gem::Dependency
|
99
105
|
name: active_fedora_finders
|
100
106
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,20 +115,6 @@ dependencies:
|
|
109
115
|
- - ">="
|
110
116
|
- !ruby/object:Gem::Version
|
111
117
|
version: 0.5.0
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: active_fedora_relsint
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - "~>"
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '0.4'
|
119
|
-
type: :runtime
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - "~>"
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0.4'
|
126
118
|
- !ruby/object:Gem::Dependency
|
127
119
|
name: cul_image_props
|
128
120
|
requirement: !ruby/object:Gem::Requirement
|
@@ -269,14 +261,14 @@ dependencies:
|
|
269
261
|
requirements:
|
270
262
|
- - "~>"
|
271
263
|
- !ruby/object:Gem::Version
|
272
|
-
version: 3.
|
264
|
+
version: 3.5.0
|
273
265
|
type: :development
|
274
266
|
prerelease: false
|
275
267
|
version_requirements: !ruby/object:Gem::Requirement
|
276
268
|
requirements:
|
277
269
|
- - "~>"
|
278
270
|
- !ruby/object:Gem::Version
|
279
|
-
version: 3.
|
271
|
+
version: 3.5.0
|
280
272
|
- !ruby/object:Gem::Dependency
|
281
273
|
name: rspec-json_expectations
|
282
274
|
requirement: !ruby/object:Gem::Requirement
|
@@ -379,6 +371,7 @@ files:
|
|
379
371
|
- app/models/concerns/cul/hydra/models/common.rb
|
380
372
|
- app/models/concerns/cul/hydra/models/image_resource.rb
|
381
373
|
- app/models/concerns/cul/hydra/models/linkable_resources.rb
|
374
|
+
- app/models/concerns/cul/hydra/models/rels_int.rb
|
382
375
|
- app/models/concerns/cul/hydra/models/resource.rb
|
383
376
|
- app/models/concerns/nfo/common.rb
|
384
377
|
- app/models/concerns/nfo/file_data_object.rb
|
@@ -402,17 +395,12 @@ files:
|
|
402
395
|
- app/models/cul/hydra/datastreams/access_control_metadata.rb
|
403
396
|
- app/models/cul/hydra/datastreams/dc_metadata.rb
|
404
397
|
- app/models/cul/hydra/datastreams/mods_document.rb
|
398
|
+
- app/models/cul/hydra/datastreams/rels_int.rb
|
405
399
|
- app/models/cul/hydra/datastreams/struct_metadata.rb
|
406
400
|
- app/models/dc_document.rb
|
407
401
|
- app/models/generic_aggregator.rb
|
408
402
|
- app/models/generic_object.rb
|
409
403
|
- app/models/generic_resource.rb
|
410
|
-
- app/models/jp2_image_aggregator.rb
|
411
|
-
- app/models/mets_structured_aggregator.rb
|
412
|
-
- app/models/resource.rb
|
413
|
-
- app/models/resource_aggregator.rb
|
414
|
-
- app/models/static_audio_aggregator.rb
|
415
|
-
- app/models/static_image_aggregator.rb
|
416
404
|
- bin/rails
|
417
405
|
- config/fedora.yml
|
418
406
|
- config/jetty.yml
|
@@ -508,6 +496,9 @@ files:
|
|
508
496
|
- fixtures/spec/CUL_MODS/mods-titles.xml
|
509
497
|
- fixtures/spec/CUL_MODS/mods-top-level-location-vs-relateditem-location.xml
|
510
498
|
- fixtures/spec/CUL_MODS/mods-unmapped-project.xml
|
499
|
+
- fixtures/spec/CUL_RELS_INT/rels_int_blank.xml
|
500
|
+
- fixtures/spec/CUL_RELS_INT/rels_int_profile.xml
|
501
|
+
- fixtures/spec/CUL_RELS_INT/rels_int_test.xml
|
511
502
|
- fixtures/spec/CUL_SOLR/archival-context.json
|
512
503
|
- fixtures/spec/CUL_SOLR/mods-001.xml
|
513
504
|
- fixtures/spec/CUL_SOLR/mods-001.yml
|
@@ -530,25 +521,6 @@ files:
|
|
530
521
|
- lib/cul_hydra.rb
|
531
522
|
- lib/cul_hydra/access_controls_enforcement.rb
|
532
523
|
- lib/cul_hydra/access_levels.rb
|
533
|
-
- lib/cul_hydra/controllers.rb
|
534
|
-
- lib/cul_hydra/controllers/aggregates.rb
|
535
|
-
- lib/cul_hydra/controllers/aggregator_controller_helper.rb
|
536
|
-
- lib/cul_hydra/controllers/catalog.rb
|
537
|
-
- lib/cul_hydra/controllers/collections.rb
|
538
|
-
- lib/cul_hydra/controllers/content_aggregators.rb
|
539
|
-
- lib/cul_hydra/controllers/datastreams.rb
|
540
|
-
- lib/cul_hydra/controllers/helpers.rb
|
541
|
-
- lib/cul_hydra/controllers/helpers/active_fedora_helper_behavior.rb
|
542
|
-
- lib/cul_hydra/controllers/helpers/application_helper_behavior.rb
|
543
|
-
- lib/cul_hydra/controllers/helpers/dc_metadata_helper_behavior.rb
|
544
|
-
- lib/cul_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
|
545
|
-
- lib/cul_hydra/controllers/helpers/hydra_autocomplete_helper_behavior.rb
|
546
|
-
- lib/cul_hydra/controllers/helpers/hydra_uploader_helper_behavior.rb
|
547
|
-
- lib/cul_hydra/controllers/helpers/resources_helper_behavior.rb
|
548
|
-
- lib/cul_hydra/controllers/resources.rb
|
549
|
-
- lib/cul_hydra/controllers/static_image_aggregators.rb
|
550
|
-
- lib/cul_hydra/controllers/suggestions.rb
|
551
|
-
- lib/cul_hydra/controllers/terms.rb
|
552
524
|
- lib/cul_hydra/engine.rb
|
553
525
|
- lib/cul_hydra/exceptions.rb
|
554
526
|
- lib/cul_hydra/fedora.rb
|
@@ -558,6 +530,8 @@ files:
|
|
558
530
|
- lib/cul_hydra/indexer.rb
|
559
531
|
- lib/cul_hydra/om.rb
|
560
532
|
- lib/cul_hydra/om/standard_mods.rb
|
533
|
+
- lib/cul_hydra/rels_int.rb
|
534
|
+
- lib/cul_hydra/rels_int/rdf_xml_writer.rb
|
561
535
|
- lib/cul_hydra/risearch_members.rb
|
562
536
|
- lib/cul_hydra/solrizer.rb
|
563
537
|
- lib/cul_hydra/solrizer/access_control_metadata_fields.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require "active-fedora"
|
2
|
-
require "active_fedora_finders"
|
3
|
-
class JP2ImageAggregator < ResourceAggregator
|
4
|
-
|
5
|
-
has_datastream :name => "SOURCE", :type=>::ActiveFedora::Datastream, :mimeType=>"image/jp2", :controlGroup=>'E'
|
6
|
-
|
7
|
-
def route_as
|
8
|
-
"zoomingimage"
|
9
|
-
end
|
10
|
-
|
11
|
-
def index_type_label
|
12
|
-
"PART"
|
13
|
-
end
|
14
|
-
|
15
|
-
def to_solr(solr_doc = Hash.new, opts={})
|
16
|
-
solr_doc = super
|
17
|
-
source = self.datastreams["SOURCE"]
|
18
|
-
source.profile
|
19
|
-
if source.controlGroup == 'E'
|
20
|
-
solr_doc["rft_id_ss"] = source.dsLocation
|
21
|
-
else
|
22
|
-
rc = ActiveFedora::RubydoraConnection.instance.connection
|
23
|
-
url = rc.config["url"]
|
24
|
-
uri = URI::parse(url)
|
25
|
-
url = "#{uri.scheme}://#{uri.host}:#{uri.port}/fedora/objects/#{pid}/datastreams/SOURCE/content"
|
26
|
-
solr_doc["rft_id_ss"] = url
|
27
|
-
end
|
28
|
-
solr_doc
|
29
|
-
end
|
30
|
-
|
31
|
-
def thumbnail_info
|
32
|
-
{:url => "#{ActiveFedora.fedora_config[:url]}/objects/#{pid}/methods/ldpd:sdef.Image/getView?max=250", :mime => 'image/jpeg'}
|
33
|
-
end
|
34
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require "active-fedora"
|
2
|
-
require "active_fedora_finders"
|
3
|
-
class METSStructuredAggregator < ::ActiveFedora::Base
|
4
|
-
extend ActiveModel::Callbacks
|
5
|
-
include ::ActiveFedora::FinderMethods::RepositoryMethods
|
6
|
-
include ::ActiveFedora::DatastreamCollections
|
7
|
-
include ::Hydra::ModelMethods
|
8
|
-
include Cul::Hydra::Models::Common
|
9
|
-
include Cul::Hydra::Models::Aggregator
|
10
|
-
|
11
|
-
has_many :parts, :property => :cul_member_of, :class_name=>'ActiveFedora::Base'
|
12
|
-
|
13
|
-
#alias :file_objects :resources
|
14
|
-
|
15
|
-
def route_as
|
16
|
-
"multipartitem"
|
17
|
-
end
|
18
|
-
end
|
data/app/models/resource.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
require "active-fedora"
|
2
|
-
require "active_fedora_finders"
|
3
|
-
require "cul_image_props"
|
4
|
-
require "mime/types"
|
5
|
-
require "uri"
|
6
|
-
class Resource < ActiveFedora::Base
|
7
|
-
include ::ActiveFedora::FinderMethods::RepositoryMethods
|
8
|
-
include ::ActiveFedora::DatastreamCollections
|
9
|
-
# include ::Hydra::ModelMethods
|
10
|
-
include Cul::Hydra::Models::Common
|
11
|
-
include Cul::Hydra::Models::Resource
|
12
|
-
include Cul::Hydra::Models::ImageResource
|
13
|
-
|
14
|
-
belongs_to :container, :property=>:cul_member_of, :class_name=>'ActiveFedora::Base'
|
15
|
-
|
16
|
-
# CUL_WIDTH = "http://purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/imageWidth"
|
17
|
-
# CUL_LENGTH = "http://purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/imageLength"
|
18
|
-
# FORMAT = "http://purl.org/dc/elements/1.1/format"
|
19
|
-
# MEMBER_OF = "http://purl.oclc.org/NET/CUL/memberOf"
|
20
|
-
|
21
|
-
def route_as
|
22
|
-
"resource"
|
23
|
-
end
|
24
|
-
|
25
|
-
def index_type_label
|
26
|
-
"FILE RESOURCE"
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_solr(solr_doc = Hash.new, opts={})
|
30
|
-
super
|
31
|
-
unless solr_doc["extent_ssi"] || self.datastreams["CONTENT"].nil?
|
32
|
-
solr_doc["extent_ssi"] = [self.datastreams["CONTENT"].size]
|
33
|
-
end
|
34
|
-
solr_doc
|
35
|
-
end
|
36
|
-
|
37
|
-
def set_title_and_label(new_title, opts={})
|
38
|
-
if opts[:only_if_blank]
|
39
|
-
if self.label.nil? || self.label.empty?
|
40
|
-
self.label = new_title
|
41
|
-
self.set_title( new_title )
|
42
|
-
end
|
43
|
-
else
|
44
|
-
self.label = new_title
|
45
|
-
set_title( new_title )
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# Set the title and label on the current object
|
50
|
-
#
|
51
|
-
# @param [String] new_title
|
52
|
-
# @param [Hash] opts (optional) hash of configuration options
|
53
|
-
def set_title(new_title, opts={})
|
54
|
-
if has_desc?
|
55
|
-
desc_metadata_ds = self.datastreams["descMetadata"]
|
56
|
-
if desc_metadata_ds.respond_to?(:title_values)
|
57
|
-
desc_metadata_ds.title_values = new_title
|
58
|
-
else
|
59
|
-
desc_metadata_ds.title = new_title
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def thumbnail_info
|
65
|
-
# do the triples indicate this is a thumb? fetch
|
66
|
-
if long <= 251
|
67
|
-
mime = object_relations[FORMAT].first
|
68
|
-
url = {:url=>"#{ActiveFedora.fedora_config[:url]}/objects/#{self.pid}/datastreams/CONTENT/content", :mime=>mime}
|
69
|
-
else
|
70
|
-
if object_relations[MEMBER_OF].blank?
|
71
|
-
return {:url=>image_url("cul_hydra/crystal/file.png"),:mime=>'image/png'}
|
72
|
-
else
|
73
|
-
url = ActiveFedora::Base.find(parents.first, :cast => true).thumbnail_info
|
74
|
-
end
|
75
|
-
end
|
76
|
-
return url
|
77
|
-
end
|
78
|
-
end
|