cul_scv_hydra 0.22.6 → 0.22.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/cul/hydra/controller.rb +22 -0
  3. data/app/controllers/concerns/cul/hydra/resolver.rb +69 -0
  4. data/app/controllers/concerns/cul/hydra/thumbnails.rb +62 -0
  5. data/app/controllers/concerns/cul/scv/hydra/controller.rb +3 -19
  6. data/app/controllers/concerns/cul/scv/hydra/resolver.rb +2 -65
  7. data/app/controllers/concerns/cul/scv/hydra/thumbnails.rb +3 -59
  8. data/app/models/concept.rb +1 -1
  9. data/app/models/concerns/cul/hydra/models.rb +24 -0
  10. data/app/models/concerns/cul/hydra/models/aggregator.rb +121 -0
  11. data/app/models/concerns/cul/hydra/models/common.rb +220 -0
  12. data/app/models/concerns/cul/hydra/models/image_resource.rb +78 -0
  13. data/app/models/concerns/cul/hydra/models/linkable_resources.rb +108 -0
  14. data/app/models/concerns/cul/hydra/models/resource.rb +87 -0
  15. data/app/models/concerns/cul/scv/hydra/models.rb +1 -13
  16. data/app/models/concerns/cul/scv/hydra/models/aggregator.rb +1 -116
  17. data/app/models/concerns/cul/scv/hydra/models/common.rb +1 -213
  18. data/app/models/concerns/cul/scv/hydra/models/image_resource.rb +3 -75
  19. data/app/models/concerns/cul/scv/hydra/models/linkable_resources.rb +3 -105
  20. data/app/models/concerns/cul/scv/hydra/models/resource.rb +2 -83
  21. data/app/models/cul/hydra/datastreams/dc_metadata.rb +107 -0
  22. data/app/models/cul/hydra/datastreams/mods_document.rb +195 -0
  23. data/app/models/cul/hydra/datastreams/struct_metadata.rb +176 -0
  24. data/app/models/cul/scv/hydra/datastreams/dc_metadata.rb +5 -104
  25. data/app/models/cul/scv/hydra/datastreams/mods_document.rb +5 -178
  26. data/app/models/cul/scv/hydra/datastreams/struct_metadata.rb +5 -174
  27. data/app/models/dc_document.rb +1 -1
  28. data/app/models/generic_aggregator.rb +5 -5
  29. data/app/models/generic_object.rb +2 -2
  30. data/app/models/generic_resource.rb +4 -4
  31. data/app/models/mets_structured_aggregator.rb +2 -2
  32. data/app/models/resource.rb +3 -3
  33. data/app/models/resource_aggregator.rb +3 -3
  34. data/fixtures/spec/CUL_MODS/mods-subjects.xml +24 -0
  35. data/lib/cul_hydra.rb +18 -0
  36. data/lib/cul_hydra/access_controls_enforcement.rb +53 -0
  37. data/lib/cul_hydra/controllers.rb +13 -0
  38. data/lib/cul_hydra/controllers/aggregates.rb +93 -0
  39. data/lib/cul_hydra/controllers/aggregator_controller_helper.rb +27 -0
  40. data/lib/cul_hydra/controllers/catalog.rb +12 -0
  41. data/lib/cul_hydra/controllers/content_aggregators.rb +81 -0
  42. data/lib/cul_hydra/controllers/datastreams.rb +145 -0
  43. data/lib/cul_hydra/controllers/helpers.rb +10 -0
  44. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/active_fedora_helper_behavior.rb +1 -1
  45. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/application_helper_behavior.rb +1 -1
  46. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/dc_metadata_helper_behavior.rb +1 -1
  47. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/hydra_assets_helper_behavior.rb +1 -1
  48. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/hydra_autocomplete_helper_behavior.rb +1 -1
  49. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/hydra_uploader_helper_behavior.rb +1 -1
  50. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/resources_helper_behavior.rb +1 -1
  51. data/lib/cul_hydra/controllers/resources.rb +161 -0
  52. data/lib/cul_hydra/controllers/static_image_aggregators.rb +105 -0
  53. data/lib/cul_hydra/controllers/suggestions.rb +126 -0
  54. data/lib/cul_hydra/controllers/terms.rb +205 -0
  55. data/lib/cul_hydra/engine.rb +31 -0
  56. data/lib/cul_hydra/fedora.rb +41 -0
  57. data/lib/cul_hydra/fedora/dummy_object.rb +37 -0
  58. data/lib/cul_hydra/fedora/rubydora_patch.rb +16 -0
  59. data/lib/cul_hydra/fedora/url_helper_behavior.rb +32 -0
  60. data/lib/cul_hydra/indexer.rb +84 -0
  61. data/lib/cul_hydra/om.rb +7 -0
  62. data/lib/cul_hydra/om/standard_mods.rb +115 -0
  63. data/lib/cul_hydra/risearch_members.rb +92 -0
  64. data/lib/cul_hydra/solrizer.rb +10 -0
  65. data/lib/cul_hydra/solrizer/extractor.rb +27 -0
  66. data/lib/cul_hydra/solrizer/mods_fieldable.rb +435 -0
  67. data/lib/cul_hydra/solrizer/terminology_based_solrizer.rb +35 -0
  68. data/lib/cul_hydra/solrizer/value_mapper.rb +46 -0
  69. data/lib/{cul_scv_hydra/solrizer/field_mapper.rb → cul_hydra/solrizer_patch.rb} +0 -0
  70. data/lib/cul_hydra/version.rb +8 -0
  71. data/lib/cul_hydra/version.rb~ +8 -0
  72. data/lib/cul_scv_fedora/dummy_object.rb +1 -30
  73. data/lib/cul_scv_fedora/rubydora_patch.rb +3 -7
  74. data/lib/cul_scv_fedora/url_helper_behavior.rb +3 -23
  75. data/lib/cul_scv_hydra.rb +5 -32
  76. data/lib/cul_scv_hydra/access_controls_enforcement.rb +3 -50
  77. data/lib/cul_scv_hydra/controllers.rb +10 -10
  78. data/lib/cul_scv_hydra/controllers/aggregates.rb +1 -86
  79. data/lib/cul_scv_hydra/controllers/aggregator_controller_helper.rb +4 -23
  80. data/lib/cul_scv_hydra/controllers/catalog.rb +5 -9
  81. data/lib/cul_scv_hydra/controllers/content_aggregators.rb +4 -77
  82. data/lib/cul_scv_hydra/controllers/datastreams.rb +3 -140
  83. data/lib/cul_scv_hydra/controllers/helpers.rb +44 -8
  84. data/lib/cul_scv_hydra/controllers/resources.rb +4 -157
  85. data/lib/cul_scv_hydra/controllers/static_image_aggregators.rb +4 -100
  86. data/lib/cul_scv_hydra/controllers/suggestions.rb +4 -122
  87. data/lib/cul_scv_hydra/controllers/terms.rb +4 -201
  88. data/lib/cul_scv_hydra/engine.rb +1 -1
  89. data/lib/cul_scv_hydra/indexer.rb +3 -82
  90. data/lib/cul_scv_hydra/om.rb +2 -2
  91. data/lib/cul_scv_hydra/om/standard_mods.rb +1 -108
  92. data/lib/cul_scv_hydra/risearch_members.rb +4 -89
  93. data/lib/cul_scv_hydra/solrizer.rb +5 -6
  94. data/lib/cul_scv_hydra/solrizer/extractor.rb +1 -25
  95. data/lib/cul_scv_hydra/solrizer/scv_mods_fieldable.rb +4 -429
  96. data/lib/cul_scv_hydra/solrizer/terminology_based_solrizer.rb +4 -32
  97. data/lib/cul_scv_hydra/solrizer/value_mapper.rb +1 -44
  98. data/lib/cul_scv_hydra/version.rb +5 -5
  99. data/lib/tasks/index.rake +2 -2
  100. data/lib/tasks/transform.rake +23 -0
  101. metadata +55 -12
@@ -0,0 +1,35 @@
1
+ require 'om'
2
+ module Cul::Hydra::Solrizer::TerminologyBasedSolrizer
3
+ # copied from Solrizer::XML::TerminologyBasedSolrizer
4
+
5
+ def self.included(klass)
6
+ klass.send(:extend, ClassMethods)
7
+ end
8
+
9
+ # Module Methods
10
+
11
+ module ClassMethods
12
+ # Populate a solr document with solr fields corresponding to the given xml node
13
+ # Field names are generated using settings from the term in the +doc+'s terminology corresponding to +term_pointer+
14
+ # @param [Nokogiri::XML::Node] node to solrize
15
+ # @param [OM::XML::Document] doc document the node came from
16
+ # @param [Array] term_pointer Array pointing to the term that should be used for solrization settings
17
+ # @param [Hash] (optional) solr_doc (values hash) to populate
18
+ def solrize_node(node_value, doc, term_pointer, term, solr_doc = Hash.new, field_mapper = nil, opts = {})
19
+ return solr_doc unless term.index_as && !term.index_as.empty?
20
+ generic_field_name_base = OM::XML::Terminology.term_generic_name(*term_pointer)
21
+ create_and_insert_terms(generic_field_name_base, node_value, term.index_as, solr_doc)
22
+ if term_pointer.length > 1
23
+ #hierarchical_field_name_base = OM::XML::Terminology.term_hierarchical_name(*term_pointer)
24
+ #create_and_insert_terms(hierarchical_field_name_base, node_value, term.index_as, solr_doc)
25
+ end
26
+ if term.variant_of and term.variant_of[:field_base]
27
+ #create_and_insert_terms(term.variant_of[:field_base], node_value, term.index_as, solr_doc)
28
+ create_and_insert_terms(term.variant_of[:field_base], node_value, term.index_as, solr_doc)
29
+ end
30
+ solr_doc
31
+ end
32
+
33
+ end
34
+
35
+ end # module
@@ -0,0 +1,46 @@
1
+ module Cul::Hydra::Solrizer
2
+ # This class uses a yaml map to translate field values for solr
3
+ class ValueMapper
4
+ def self.load_value_maps(config_path=nil)
5
+ if config_path.nil?
6
+ if defined?(Rails.root) && !Rails.root.nil?
7
+ config_path = File.join(Rails.root, "config", "solr_value_maps.yml")
8
+ end
9
+ # Default to using the config file within the gem
10
+ if !File.exist?(config_path.to_s)
11
+ config_path = File.join(File.dirname(__FILE__), "..", "..", "..", "config", "solr_value_maps.yml")
12
+ end
13
+ end
14
+ #logger.info("ValueMapper: loading field value maps from #{File.expand_path(config_path)}")
15
+ YAML::load(File.open(config_path))
16
+ end
17
+
18
+ def self.default_value_maps
19
+ @@value_maps ||= self.load_value_maps
20
+ end
21
+ # Instance methods
22
+
23
+ def initialize(value_maps=nil)
24
+ @value_maps = (value_maps || Cul::Hydra::Solrizer::ValueMapper.default_value_maps).with_indifferent_access
25
+ @mapped_fields = {}.with_indifferent_access
26
+ end
27
+
28
+ def maps_field?(field_key)
29
+ @mapped_fields.has_key? field_key
30
+ end
31
+
32
+ def map_field(field_key, map_key)
33
+ @mapped_fields[field_key] = map_key
34
+ end
35
+
36
+ def map_value(field_key, value_key)
37
+ map_key = @mapped_fields[field_key]
38
+ return value_key unless @mapped_fields.has_key? field_key and @value_maps.has_key? map_key
39
+ if value_key.is_a? Array
40
+ value_key.collect{ |val| @value_maps[map_key].fetch(val, val) }
41
+ else
42
+ @value_maps[map_key].fetch(value_key, value_key)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,8 @@
1
+ module Cul
2
+ module Hydra
3
+ VERSION = '0.22.7'
4
+ def self.version
5
+ VERSION
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Cul
2
+ module Hydra
3
+ VERSION = '0.22.6'
4
+ def self.version
5
+ VERSION
6
+ end
7
+ end
8
+ end
@@ -1,36 +1,7 @@
1
1
  module Cul
2
2
  module Scv
3
3
  module Fedora
4
- class DummyObject
5
- attr_accessor :pid
6
- def initialize(pid, isNew=false)
7
- @pid = pid
8
- @isNew = isNew
9
- end
10
- def new_record?
11
- @isNew
12
- end
13
- def new_record=(val)
14
- @isNew = val
15
- end
16
- def internal_uri
17
- @uri ||= "info:fedora/#{@pid}"
18
- end
19
- def connection
20
- Cul::Scv::Fedora.connection
21
- end
22
- def repository
23
- Cul::Scv::Fedora.repository
24
- end
25
- def spawn(pid)
26
- s = DummyObject.new(pid, @isNew)
27
- s.connection= connection
28
- s.repository= repository
29
- s
30
- end
31
- protected
32
- def connection=(connection); @connection = connection; end
33
- def repository=(repo); @repository = repo; end
4
+ class DummyObject < Cul::Hydra::Fedora::DummyObject
34
5
  end
35
6
  end
36
7
  end
@@ -2,13 +2,9 @@ module Cul
2
2
  module Scv
3
3
  module Fedora
4
4
  module RubydoraPatch
5
- def find_by_itql query, options = {}
6
- begin
7
- self.risearch(query, {:lang => 'itql'}.merge(options))
8
- rescue Exception => e
9
- logger.error e if defined?(logger)
10
- "{\"results\":[]}"
11
- end
5
+ extend ActiveSupport::Concern
6
+ included do
7
+ include Cul::Hydra::Fedora::RubydoraPatch
12
8
  end
13
9
  end
14
10
  end
@@ -2,29 +2,9 @@ module Cul
2
2
  module Scv
3
3
  module Fedora
4
4
  module UrlHelperBehavior
5
-
6
- def fedora_url
7
- @fedora_url ||= ActiveFedora.config.credentials[:url]
8
- end
9
-
10
- def pid_for_url(pid)
11
- pid.gsub(/^\//,'').gsub(/info:fedora\//,'')
12
- end
13
-
14
- def fedora_object_url(pid)
15
- fedora_url + '/objects/' + pid_for_url(pid)
16
- end
17
-
18
- def fedora_ds_url(pid, dsid)
19
- fedora_object_url(pid) + '/datastreams/' + dsid
20
- end
21
-
22
- def fedora_method_url(pid, method)
23
- fedora_object_url(pid) + '/methods/' + method
24
- end
25
-
26
- def fedora_risearch_url
27
- fedora_url + '/risearch'
5
+ extend ActiveSupport::Concern
6
+ included do
7
+ include Cul::Hydra::Fedora::UrlHelperBehavior
28
8
  end
29
9
  end
30
10
  end
data/lib/cul_scv_hydra.rb CHANGED
@@ -1,42 +1,15 @@
1
1
  require 'hydra/head'
2
2
  require 'active_fedora_relsint'
3
+ require 'cul_hydra'
3
4
  module Cul
4
5
  module Scv
5
6
  module Hydra
6
7
  end
7
8
  module Fedora
8
- require 'cul_scv_fedora/url_helper_behavior'
9
- require 'cul_scv_fedora/dummy_object'
10
- require 'cul_scv_fedora/rubydora_patch'
11
- def self.config_path
12
- File.join(Rails.root.to_s, 'config', 'fedora.yml')
13
- end
14
- def self.config
15
- ActiveFedora.fedora_config.credentials
16
- end
17
- def self.connection
18
- @connection ||= ActiveFedora::RubydoraConnection.new(ActiveFedora.fedora_config.credentials)
19
- end
20
-
21
- def self.repository
22
- @repository ||= begin
23
- repo = connection.connection
24
- repo.extend(RubydoraPatch)
25
- repo
26
- end
27
- end
28
-
29
- def self.ds_for_uri(fedora_uri, fake_obj=nil)
30
- return nil unless fedora_uri =~ /info\:fedora\/.*/
31
- p = fedora_uri.split('/')
32
- return ds_for_opts({pid: p[1], dsid: p[2]})
33
- end
34
-
35
- def self.ds_for_opts(opts={}, fake_obj=nil)
36
- return nil unless opts[:pid] and opts[:dsid]
37
- fake_obj = fake_obj.nil? ? DummyObject.new(opts[:pid]) : fake_obj.spawn(opts[:pid])
38
- return (opts[:class] || ::Rubydora::Datastream).new(fake_obj, opts[:dsid])
39
- end
9
+ extend Cul::Hydra::Fedora::ClassMethods
10
+ autoload :DummyObject, 'cul_scv_fedora/dummy_object'
11
+ autoload :RubydoraPatch, 'cul_scv_fedora/rubydora_patch'
12
+ autoload :UrlHelperBehavior, 'cul_scv_fedora/url_helper_behavior'
40
13
  end
41
14
  end
42
15
  end
@@ -1,53 +1,6 @@
1
1
  module Cul::Scv::Hydra::AccessControlsEnforcement
2
-
3
- private
4
-
5
- def build_lucene_query(user_query)
6
- q = ""
7
- # start query of with user supplied query term
8
- q << "_query_:\"{!dismax qf=$qf_dismax pf=$pf_dismax}#{user_query}\""
9
-
10
- # Append the exclusion of Resources
11
- q << " AND NOT _query_:\"info\\\\:fedora/ldpd\\\\:Resource\""
12
-
13
- # Append the query responsible for adding the users discovery level
14
- permission_types = ["edit","discover","read"]
15
- field_queries = []
16
- embargo_query = ""
17
- permission_types.each do |type|
18
- field_queries << "_query_:\"#{type}_access_group_t:public\""
19
- end
20
-
21
- unless current_user.nil?
22
- # for roles
23
- RoleMapper.roles(current_user.login).each do |role|
24
- permission_types.each do |type|
25
- field_queries << "_query_:\"#{type}_access_group_t:#{role}\""
26
- end
27
- end
28
- # for individual person access
29
- permission_types.each do |type|
30
- field_queries << "_query_:\"#{type}_access_person_t:#{current_user.login}\""
31
- end
32
- if current_user.is_being_superuser?(session)
33
- permission_types.each do |type|
34
- field_queries << "_query_:\"#{type}_access_person_t:[* TO *]\""
35
- end
36
- end
37
-
38
- # if it is the depositor and it is under embargo, that is ok
39
- # otherwise if it not the depositor and it is under embargo, don't show it
40
- embargo_query = " OR ((_query_:\"embargo_release_date_dt:[NOW TO *]\" AND _query_:\"depositor_t:#{current_user.login}\") AND NOT (NOT _query_:\"depositor_t:#{current_user.login}\" AND _query_:\"embargo_release_date_dt:[NOW TO *]\"))"
41
- end
42
-
43
- # remove anything with an embargo release date in the future
44
- #embargo_query = " AND NOT _query_:\"embargo_release_date_dt:[NOW TO *]\"" if embargo_query.blank?
45
- field_queries << " NOT _query_:\"embargo_release_date_dt:[NOW TO *]\"" if embargo_query.blank?
46
-
47
- q << " AND (#{field_queries.join(" OR ")})"
48
- q << embargo_query
49
- return q
2
+ extend ActiveSupport::Concern
3
+ included do
4
+ include Cul::Hydra::AccessControlsEnforcement
50
5
  end
51
-
52
-
53
6
  end
@@ -1,13 +1,13 @@
1
1
  module Cul::Scv::Hydra
2
2
  module Controllers
3
+ autoload :Aggregates, 'cul_scv_hydra/controllers/aggregates'
4
+ autoload :Catalog, 'cul_scv_hydra/controllers/catalog'
5
+ autoload :ContentAggregators, 'cul_scv_hydra/controllers/content_aggregators'
6
+ autoload :Datastreams, 'cul_scv_hydra/controllers/datastreams'
7
+ autoload :Helpers, 'cul_scv_hydra/controllers/helpers'
8
+ autoload :Resources, 'cul_scv_hydra/controllers/resources'
9
+ autoload :StaticImageAggregators, 'cul_scv_hydra/controllers/static_image_aggregators'
10
+ autoload :Suggestions, 'cul_scv_hydra/controllers/suggestions'
11
+ autoload :Terms, 'cul_scv_hydra/controllers/terms'
3
12
  end
4
- end
5
- require 'cul_scv_hydra/controllers/aggregates'
6
- require 'cul_scv_hydra/controllers/catalog'
7
- require 'cul_scv_hydra/controllers/content_aggregators'
8
- require 'cul_scv_hydra/controllers/datastreams'
9
- require 'cul_scv_hydra/controllers/helpers'
10
- require 'cul_scv_hydra/controllers/resources'
11
- require 'cul_scv_hydra/controllers/static_image_aggregators'
12
- require 'cul_scv_hydra/controllers/suggestions'
13
- require 'cul_scv_hydra/controllers/terms'
13
+ end
@@ -1,93 +1,8 @@
1
- require 'cul_scv_hydra/controllers/aggregator_controller_helper'
2
- require 'cul_scv_hydra/controllers/helpers/resources_helper_behavior'
3
1
  module Cul::Scv::Hydra::Controllers
4
2
  module Aggregates
5
3
  extend ActiveSupport::Concern
6
4
  included do
7
- include Hydra::AssetsControllerHelper
8
- include Cul::Scv::Hydra::Controllers::AggregatorControllerHelper
9
- include Cul::Scv::Hydra::Controllers::Helpers::ResourcesHelperBehavior
10
- include Hydra::RepositoryController
11
- include MediaShelf::ActiveFedoraHelper
12
- include Blacklight::SolrHelper
13
- before_filter :load_resources, :only=>[:index]
14
- prepend_before_filter :sanitize_update_params
15
- end
16
-
17
- def index
18
-
19
- if params[:layout] == "false"
20
- layout = false
21
- end
22
- container_uri = "info:fedora/#{params[:asset_id]}"
23
- escaped_uri = container_uri.gsub(/(:)/, '\\:')
24
- extra_controller_params = {:q=>"cul_member_of_s:#{escaped_uri}"}
25
- @response, @document_list = get_search_results( extra_controller_params )
26
-
27
- # Including this line so permissions tests can be run against the container
28
- @container_response, @document = get_solr_response_for_doc_id(params[:asset_id])
29
-
30
- render :action=>params[:action], :layout=>layout
31
- end
32
-
33
- def load_aggregate
34
- if params.has_key? :aggregate_id
35
- af_base = ActiveFedora::Base.load_instance(params[:aggregate_id])
36
- else
37
- af_base = ActiveFedora::Base.load_instance(params[:id])
38
- end
39
- the_model = ActiveFedora::ContentModel.known_models_for( af_base ).first
40
- if the_model.nil? or the_model == ActiveFedora::Base
41
- the_model = DcDocument
42
- end
43
-
44
- @resource = the_model.load_instance(af_base.pid)
45
- end
46
-
47
- # Creates and Saves a Parent - Child relationship in the Child's RELS-EXT
48
- # If container_id is provided:
49
- # * the File Asset will use RELS-EXT to assert that it's a part of the specified container
50
- # * the method will redirect to the container object's edit view after saving
51
- def create
52
- if params.has_key?(:aggregate_id)
53
- @resource = load_aggregate
54
- logger.debug @resource.class
55
- logger.debug @resource.datastreams["RELS-EXT"].content
56
- logger.debug @resource.to_rels_ext(@resource.pid)
57
- if !params[:asset_id].nil?
58
- associate_resource_with_container(@resource, params[:asset_id])
59
- @resource.save
60
- flash[:notice] = "Aggregated #{@resource.pid} under #{params[:asset_id]}."
61
- else
62
- flash[:notice] = "You must specify a container for the aggregate."
63
- end
64
- else
65
- flash[:notice] = "You must specify a resource to aggregate."
66
- end
67
-
68
- if !params[:asset_id].nil?
69
- redirect_params = {:controller=>"aggregates", :id=>params[:asset_id], :action=>:index}
70
- end
71
-
72
- redirect_params ||= {:action=>:index}
73
-
74
- redirect_to redirect_params
75
- end
76
-
77
- # Common destroy method for all AssetsControllers
78
- def destroy
79
- @resource = load_aggregate
80
- remove_resource_from_container(@resource, params[:asset_id])
81
- @resource.save
82
-
83
- flash[:notice] = "Deleted #{params[:id]} from #{params[:asset_id]}."
84
- if !params[:asset_id].nil?
85
- redirect_params = {:controller=>"aggregates", :id=>params[:asset_id], :action=>:index}
86
- end
87
-
88
- redirect_params ||= {:action=>:index}
89
-
90
- redirect_to redirect_params
5
+ include Cul::Hydra::Controllers::Aggregates
91
6
  end
92
7
  end
93
8
  end
@@ -1,27 +1,8 @@
1
- require 'active-fedora'
2
1
  module Cul::Scv::Hydra::Controllers
3
- module AggregatorControllerHelper
4
- def load_fedora_document
5
- if params.has_key? :asset_id
6
- af_base = ActiveFedora::Base.load_instance(params[:asset_id])
7
- else
8
- af_base = ActiveFedora::Base.load_instance(params[:id])
2
+ module AggregatorControllerHelper
3
+ extend ActiveSupport::Concern
4
+ included do
5
+ include Cul::Hydra::Controllers::AggregatorControllerHelper
9
6
  end
10
- the_model = ActiveFedora::ContentModel.known_models_for( af_base ).first
11
- if the_model.nil? or the_model == ActiveFedora::Base
12
- the_model = DcDocument
13
- end
14
-
15
- @document_fedora = af_base.adapt_to the_model
16
- end
17
- def load_resources
18
- @document_fedora ||= load_fedora_document
19
- if @document_fedora.is_a? Cul::Scv::Hydra::ActiveFedora::Model::Aggregator
20
- @resources = @document_fedora.resources
21
- else
22
- logger.debug "Only aggregators have parts!"
23
- end
24
- @resources
25
7
  end
26
8
  end
27
- end