cul_hydra 1.0.2 → 1.0.3

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: add7cd1403a95f97a6b1ad05e3696b555ffae5be
4
- data.tar.gz: 4c2ff7a69468b565d1aff893ff455c9513d61f90
3
+ metadata.gz: efa13a7d8ec21a34f211463fb1026c640a2ca3bf
4
+ data.tar.gz: f3c5bff14e40684c60accd573b8c7bf0fb525cf0
5
5
  SHA512:
6
- metadata.gz: a0cd91ebf116b1dd412bf0f69789e826cd4bc38e2bcf2be757b3b36feaa8fc7c05d37349cf6b107257e7f743b852d5cd174e8d28adffe1072e4ca32c6fb5421d
7
- data.tar.gz: 39a9ae0bacf69f72f5e890021566442ea26d24216fa6301af9da7db37785cde412bf6790b0f2224cad8c1ed49cb9c9f23ae1df331cbaea801b9857f4c6f66155
6
+ metadata.gz: 5f44c97c75dce30861be5287f19da6c22d532e9c27f1fd8094a646218ece5f197cb751610ec7d1dfad6dba5257822a8bc288c4f573fc2bdbee95a73c5141f20c
7
+ data.tar.gz: 893c65d7a0f3ba682104882582f85593028cbe92c8ca1c2e81e5e3088b16c440b271212bf094c0e41a79c06a669df19ff71187dea018bf207c3273822d4800d6
@@ -135,9 +135,64 @@ module Cul::Hydra::Models::Common
135
135
  end
136
136
  }
137
137
  solr_doc[:structured_bsi] = 'false' unless solr_doc.has_key? :structured_bsi
138
+
139
+ representative_child = get_representative_generic_resource
140
+ solr_doc['representative_generic_resource_pid_ssi'] = representative_child.pid unless representative_child.nil?
138
141
 
139
142
  solr_doc
140
143
  end
144
+
145
+ def get_representative_generic_resource
146
+
147
+ return self if self.is_a?(GenericResource)
148
+ return nil unless self.is_a?(Cul::Hydra::Models::Aggregator) # Only Aggregators have struct metadata
149
+
150
+ # If we're here, then the object was not a Generic resource.
151
+ # Try to get child info from a structMat datastream, and fall back to
152
+ # the first :cul_member_of child if a structMap isn't present
153
+
154
+ # Check for the presence of a structMap and get first GenericResource in that structMap
155
+ if self.has_struct_metadata?
156
+ struct = Cul::Hydra::Datastreams::StructMetadata.from_xml(self.datastreams['structMetadata'].content)
157
+ ng_div = struct.first_ordered_content_div #Nokogiri node response
158
+ found_struct_div = (! ng_div.nil?)
159
+ else
160
+ found_struct_div = false
161
+ end
162
+
163
+ if found_struct_div
164
+ content_ids = ng_div.attr('CONTENTIDS').split(' ') # Get all space-delimited content ids
165
+ child_obj = nil
166
+ content_ids.each do |content_id|
167
+ child_obj ||= GenericAggregator.search_repo.find_by(identifier: content_id) # We don't know what type of aggregator we'll be getting back, but all we need is the pid
168
+ end
169
+ # If we didn't find the child object through an identifier search, we might be working with a PID instead.
170
+ # Do a pid-based search
171
+ if child_obj.nil?
172
+ content_ids.each do |content_id|
173
+ child_obj ||= ActiveFedora::Base.exists?(content_id) ? ActiveFedora::Base.find(content_id) : nil
174
+ end
175
+ end
176
+
177
+ if child_obj
178
+ # Recursion! Woo!
179
+ return child_obj.get_representative_generic_resource
180
+ else
181
+ #Rails.logger.error "No object for dc:identifier in #{content_ids.inspect}"
182
+ return nil
183
+ end
184
+ else
185
+ # If there isn't a structMap, just get the first child
186
+ member_pids = Cul::Hydra::RisearchMembers.get_direct_member_pids(self.pid)
187
+ if member_pids.first
188
+ child_obj = ActiveFedora::Base.find(member_pids.first)
189
+ return child_obj.get_representative_generic_resource
190
+ else
191
+ #Rails.logger.error "No child objects or resources for #{self.pid}"
192
+ return nil
193
+ end
194
+ end
195
+ end
141
196
 
142
197
  def update_datastream_attributes(params={}, opts={})
143
198
  logger.debug "Common.update_datastream_attributes"
@@ -1,6 +1,6 @@
1
1
  module Cul
2
2
  module Hydra
3
- VERSION = '1.0.2'
3
+ VERSION = '1.0.3'
4
4
  def self.version
5
5
  VERSION
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Cul
2
2
  module Hydra
3
- VERSION = '1.0.1'
3
+ VERSION = '1.0.2'
4
4
  def self.version
5
5
  VERSION
6
6
  end
@@ -1,8 +1,8 @@
1
1
  APP_ROOT = File.expand_path("#{File.dirname(__FILE__)}/../../") unless defined?(APP_ROOT)
2
2
 
3
3
  require 'jettywrapper'
4
- JETTY_ZIP_BASENAME = '7.x-stable'
5
- Jettywrapper.url = "https://github.com/projecthydra/hydra-jetty/archive/#{JETTY_ZIP_BASENAME}.zip"
4
+ JETTY_ZIP_BASENAME = 'fedora-3.7-with-risearch'
5
+ Jettywrapper.url = "https://github.com/cul/hydra-jetty/archive/#{JETTY_ZIP_BASENAME}.zip"
6
6
 
7
7
  namespace :cul_hydra do
8
8
 
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.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Armintor
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-15 00:00:00.000000000 Z
12
+ date: 2015-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight