cul_scv_hydra 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OThmMDMzYmQxNWU0NTk2OGRlNDI0ZmUwNWZmYWZjYTViNzM2NmU3Yg==
5
+ data.tar.gz: !binary |-
6
+ ZGU4NTMxODQ0YTZkYjRhMzQ1MjFjYWQ2YzYzZTc5ZTk4NmU3N2ZhMQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NWU5NGE1MDcwY2VkOThmZGNlYTVjNjlhYjNjN2QyNDk3Y2UzODE1MjZhNzVi
10
+ NzdkMmM3ZDExNDdjZDA1YzNhYjgwYzRjNGY0ZDE1NmI5NDI4ZWQ5YjNkN2Y2
11
+ ZjlkMzU0OTk4MTZiNWRkZWMzZmY2OTZmNDRkMjUyMWE2Njc4ZTQ=
12
+ data.tar.gz: !binary |-
13
+ ZmFkY2VmOTQ5ODVjNzE5Y2M4MWM3OGM3N2NlMzI4YTkxYTdjNTE2MjBkMGE4
14
+ MTI5MDhhMDU3YjM2MjA1MzMwYTk3NzM4ZWRjZTY2MGQyYjdiNDQ3MDI3NmY2
15
+ ODQ2MTJmY2ZiODFhOGEwNGRjNzQxNzgyNWM2ZTNkOTVlYjI3Zjk=
@@ -1,5 +1,4 @@
1
- module Cul::Scv::Hydra::Models
2
- module Aggregator
1
+ module Cul::Scv::Hydra::Models::Aggregator
3
2
  extend ActiveSupport::Concern
4
3
 
5
4
  included do
@@ -56,7 +55,7 @@ module Aggregator
56
55
  def members(opts={})
57
56
  solr_members(opts)
58
57
  end
59
-
58
+
60
59
  def members_ids(opts={})
61
60
  opts = opts.merge({:response_format=>:id_array})
62
61
  solr_members(opts)
@@ -133,4 +132,3 @@ module Aggregator
133
132
  return obj
134
133
  end
135
134
  end
136
- end
@@ -1,17 +1,16 @@
1
1
  require 'active-fedora'
2
2
  require 'uri'
3
- module Cul::Scv::Hydra::Models
4
- module Common
3
+ module Cul::Scv::Hydra::Models::Common
5
4
  extend ActiveSupport::Concern
6
5
 
7
6
  included do
7
+ extend ActiveModel::Callbacks
8
8
  define_model_callbacks :create
9
9
  has_metadata :name => "DC", :type=>Cul::Scv::Hydra::Datastreams::DCMetadata, :versionable => true
10
10
  has_metadata :name => "descMetadata", :type=>Cul::Scv::Hydra::Datastreams::ModsDocument, :versionable => true
11
11
  has_metadata :name => "rightsMetadata", :type=>::Hydra::Datastream::RightsMetadata, :versionable => true
12
-
13
12
  end
14
-
13
+
15
14
  module ClassMethods
16
15
  def pid_namespace
17
16
  'ldpd'
@@ -21,20 +20,20 @@ module Common
21
20
 
22
21
  def rdf_type
23
22
  relationships[:rdf_type]
24
- end
25
-
23
+ end
24
+
26
25
  def initialize(attrs = nil)
27
26
  attrs = {} if attrs.nil?
28
27
  attrs[:namespace] = self.class.pid_namespace unless attrs[:namespace]
29
28
  super
30
29
  end
31
-
30
+
32
31
  def create
33
32
  run_callbacks :create do
34
33
  super
35
34
  end
36
35
  end
37
-
36
+
38
37
  def cmodel_pid(klass)
39
38
  klass.pid_namespace + ":" + klass.name.split("::")[-1]
40
39
  end
@@ -44,7 +43,7 @@ module Common
44
43
  self.datastreams_xml['datastream'].each do |ds|
45
44
  dsid = ds["dsid"]
46
45
  ds.merge!({:pid => self.pid, :dsID => dsid, :dsLabel => ds["label"]})
47
- if dsid == "RELS-EXT"
46
+ if dsid == "RELS-EXT"
48
47
  mds.merge!({dsid => ActiveFedora::RelsExtDatastream.new(ds)})
49
48
  else
50
49
  if self.class.ds_specs.has_key? dsid
@@ -61,7 +60,7 @@ module Common
61
60
  def route_as
62
61
  "default"
63
62
  end
64
-
63
+
65
64
  def has_desc?
66
65
  has_desc = false
67
66
  begin
@@ -106,7 +105,7 @@ module Common
106
105
  end
107
106
  solr_doc["format_ssi"] = [self.route_as]
108
107
  solr_doc["index_type_label_ssi"] = [self.index_type_label]
109
-
108
+
110
109
  solr_doc.each_pair {|key, value|
111
110
  if value.is_a? Array
112
111
  value.each {|v| v.strip! unless v.nil? }
@@ -117,11 +116,11 @@ module Common
117
116
  solr_doc[:structured_bsi] = 'false' unless solr_doc.has_key? :structured_bsi
118
117
  solr_doc
119
118
  end
120
-
119
+
121
120
  def update_datastream_attributes(params={}, opts={})
122
121
  logger.debug "Common.update_datastream_attributes"
123
122
  result = params.dup
124
- params.each_pair do |dsid, ds_params|
123
+ params.each_pair do |dsid, ds_params|
125
124
  if datastreams.include?(dsid)
126
125
  verify_params = ds_params.dup
127
126
  changed = false
@@ -141,7 +140,7 @@ module Common
141
140
  end
142
141
  return result
143
142
  end
144
-
143
+
145
144
  def thumbnail_info
146
145
  {:url=>image_url("cul_scv_hydra/crystal/kmultiple.png"),:mime_type=>"image/png"}
147
146
  end
@@ -167,7 +166,7 @@ module Common
167
166
  logger.debug "remaining values! #{values.inspect}" if values.length > 0
168
167
  changed || (values.length > 0)
169
168
  end
170
-
169
+
171
170
  def no_update(ds_params)
172
171
  response = {}
173
172
  ds_params.each{|pointer, values|
@@ -182,4 +181,3 @@ module Common
182
181
  }
183
182
  end
184
183
  end
185
- end
@@ -1,80 +1,78 @@
1
- module Cul::Scv::Hydra::Models
2
- module ImageResource
3
- IMAGE_EXT = {"image/bmp" => 'bmp', "image/gif" => 'gif', "image/jpeg" => 'jpg', "image/png" => 'png', "image/tiff" => 'tif', "image/x-windows-bmp" => 'bmp', 'image/jp2' => 'jp2'}
4
- WIDTH = RDF::URI(ActiveFedora::Predicates.find_graph_predicate(:image_width))
5
- LENGTH = RDF::URI(ActiveFedora::Predicates.find_graph_predicate(:image_length))
6
- WIDTH_PREDICATE = ActiveFedora::Predicates.short_predicate("http://www.w3.org/2003/12/exif/ns#imageWidth").to_s
7
- LENGTH_PREDICATE = ActiveFedora::Predicates.short_predicate("http://www.w3.org/2003/12/exif/ns#imageLength").to_s
8
- EXTENT_PREDICATE = ActiveFedora::Predicates.short_predicate("http://purl.org/dc/terms/extent").to_s
9
- FORMAT_OF_PREDICATE = ActiveFedora::Predicates.short_predicate("http://purl.org/dc/terms/isFormatOf").to_s
10
- FORMAT_URI = RDF::URI("http://purl.org/dc/terms/format")
1
+ module Cul::Scv::Hydra::Models::ImageResource
2
+ IMAGE_EXT = {"image/bmp" => 'bmp', "image/gif" => 'gif', "image/jpeg" => 'jpg', "image/png" => 'png', "image/tiff" => 'tif', "image/x-windows-bmp" => 'bmp', 'image/jp2' => 'jp2'}
3
+ WIDTH = RDF::URI(ActiveFedora::Predicates.find_graph_predicate(:image_width))
4
+ LENGTH = RDF::URI(ActiveFedora::Predicates.find_graph_predicate(:image_length))
5
+ WIDTH_PREDICATE = ActiveFedora::Predicates.short_predicate("http://www.w3.org/2003/12/exif/ns#imageWidth").to_s
6
+ LENGTH_PREDICATE = ActiveFedora::Predicates.short_predicate("http://www.w3.org/2003/12/exif/ns#imageLength").to_s
7
+ EXTENT_PREDICATE = ActiveFedora::Predicates.short_predicate("http://purl.org/dc/terms/extent").to_s
8
+ FORMAT_OF_PREDICATE = ActiveFedora::Predicates.short_predicate("http://purl.org/dc/terms/isFormatOf").to_s
9
+ FORMAT_URI = RDF::URI("http://purl.org/dc/terms/format")
11
10
 
12
- DJATOKA_THUMBNAIL_PARMS = {
13
- "url_ver" => "Z39.88-2004",
14
- "svc_id" => "info:lanl-repo/svc/getRegion",
15
- "svc_val_fmt" => "info:ofi/fmt:kev:mtx:jpeg2000",
16
- "svc.format" => "image/jpeg",
17
- "svc.level" => "",
18
- "svc.rotate" => "0",
19
- "svc.scale" => "200",
20
- "svc.clayers" => ""
21
- }
11
+ DJATOKA_THUMBNAIL_PARMS = {
12
+ "url_ver" => "Z39.88-2004",
13
+ "svc_id" => "info:lanl-repo/svc/getRegion",
14
+ "svc_val_fmt" => "info:ofi/fmt:kev:mtx:jpeg2000",
15
+ "svc.format" => "image/jpeg",
16
+ "svc.level" => "",
17
+ "svc.rotate" => "0",
18
+ "svc.scale" => "200",
19
+ "svc.clayers" => ""
20
+ }
22
21
 
23
- DJATOKA_BASE_URL = "http://iris.cul.columbia.edu:8888/resolve"
22
+ DJATOKA_BASE_URL = "http://iris.cul.columbia.edu:8888/resolve"
24
23
 
25
- def long
26
- @long_side ||= max(width(), length())
27
- end
24
+ def long
25
+ @long_side ||= max(width(), length())
26
+ end
28
27
 
29
- def width
30
- @width ||= begin
31
- ds = datastreams["content"]
32
- width = 0
33
- unless ds.nil? or rels_int.relationships(ds,:exif_image_width).blank?
34
- width = rels_int.relationships(ds,:exif_image_width).first.object.to_s.to_i
35
- end
36
- width = relationships(:image_width).first.to_s.to_i if width == 0
37
- width
28
+ def width
29
+ @width ||= begin
30
+ ds = datastreams["content"]
31
+ width = 0
32
+ unless ds.nil? or rels_int.relationships(ds,:exif_image_width).blank?
33
+ width = rels_int.relationships(ds,:exif_image_width).first.object.to_s.to_i
38
34
  end
35
+ width = relationships(:image_width).first.to_s.to_i if width == 0
36
+ width
39
37
  end
38
+ end
40
39
 
41
- def length
42
- @length ||= begin
43
- ds = datastreams["content"]
44
- length = 0
45
- unless ds.nil? or rels_int.relationships(ds,:exif_image_length).blank?
46
- length = rels_int.relationships(ds,:exif_image_length).first.object.to_s.to_i
47
- end
48
- length = relationships(:image_length).first.to_s.to_i if length == 0
49
- length
40
+ def length
41
+ @length ||= begin
42
+ ds = datastreams["content"]
43
+ length = 0
44
+ unless ds.nil? or rels_int.relationships(ds,:exif_image_length).blank?
45
+ length = rels_int.relationships(ds,:exif_image_length).first.object.to_s.to_i
50
46
  end
47
+ length = relationships(:image_length).first.to_s.to_i if length == 0
48
+ length
51
49
  end
50
+ end
52
51
 
53
- def zooming?
54
- zoom = rels_int.relationships(datastreams['content'],:foaf_zooming).first
55
- return zoom.object.to_s if zoom
56
- datastreams.each do |k,v|
57
- if v.mimeType =~ /image\/jp2$/i
58
- zoom = "info:fedora/#{k.dsid}"
59
- end
52
+ def zooming?
53
+ zoom = rels_int.relationships(datastreams['content'],:foaf_zooming).first
54
+ return zoom.object.to_s if zoom
55
+ datastreams.each do |k,v|
56
+ if v.mimeType =~ /image\/jp2$/i
57
+ zoom = "info:fedora/#{k.dsid}"
60
58
  end
61
- return zoom
62
59
  end
60
+ return zoom
61
+ end
63
62
 
64
- def thumbnail_info
65
- thumb = rels_int.relationships(datastreams['content'],:foaf_thumbnail).first
66
- if thumb
67
- t_dsid = thumb.object.to_s.split('/')[-1]
68
- t_url = "#{ActiveFedora.fedora_config.credentials[:url]}/objects/#{pid}/datastreams/#{t_dsid}/content"
69
- return {:url=>t_url,:mime=>datastreams[t_dsid].mimeType}
70
- elsif (zoom = self.zooming?)
71
- t_dsid = zoom.split('/')[-1]
72
- t_parms = DJATOKA_THUMBNAIL_PARMS.merge({"rft_id" => datastreams[t_dsid].dsLocation})
73
- url = "#{DJATOKA_BASE_URL}?#{options.map { |key, value| "#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}"}.join("&") }"
74
- {:url => url, :mime => t_parms["svc.format"]}
75
- else
76
- return {:asset=>"cul_scv_hydra/crystal/file.png",:mime=>'image/png'}
77
- end
63
+ def thumbnail_info
64
+ thumb = rels_int.relationships(datastreams['content'],:foaf_thumbnail).first
65
+ if thumb
66
+ t_dsid = thumb.object.to_s.split('/')[-1]
67
+ t_url = "#{ActiveFedora.fedora_config.credentials[:url]}/objects/#{pid}/datastreams/#{t_dsid}/content"
68
+ return {:url=>t_url,:mime=>datastreams[t_dsid].mimeType}
69
+ elsif (zoom = self.zooming?)
70
+ t_dsid = zoom.split('/')[-1]
71
+ t_parms = DJATOKA_THUMBNAIL_PARMS.merge({"rft_id" => datastreams[t_dsid].dsLocation})
72
+ url = "#{DJATOKA_BASE_URL}?#{options.map { |key, value| "#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}"}.join("&") }"
73
+ {:url => url, :mime => t_parms["svc.format"]}
74
+ else
75
+ return {:asset=>"cul_scv_hydra/crystal/file.png",:mime=>'image/png'}
78
76
  end
79
77
  end
80
- end
78
+ end
@@ -1,111 +1,108 @@
1
- module Cul::Scv::Hydra::Models
2
- module LinkableResources
3
- include Cul::Scv::Fedora::UrlHelperBehavior
4
- # so as to avoid including all the url hepers via:
5
- ## include Rails.application.routes.url_helpers
6
- # we are just going to delegate
7
- delegate :fedora_content_path, :to => 'Rails.application.routes.url_helpers'
8
- delegate :cache_path, :to => 'Rails.application.routes.url_helpers'
1
+ module Cul::Scv::Hydra::Models::LinkableResources
2
+ include Cul::Scv::Fedora::UrlHelperBehavior
3
+ # so as to avoid including all the url hepers via:
4
+ ## include Rails.application.routes.url_helpers
5
+ # we are just going to delegate
6
+ delegate :fedora_content_path, :to => 'Rails.application.routes.url_helpers'
7
+ delegate :cache_path, :to => 'Rails.application.routes.url_helpers'
9
8
 
10
- def http_client
11
- unless @http_client
12
- @http_client ||= HTTPClient.new
13
- @http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
14
- uname = Cul::Scv::Fedora.repository.config[:user]
15
- pwd = Cul::Scv::Fedora.repository.config[:password]
16
- @http_client.set_auth(nil, uname, pwd)
17
- end
18
- @http_client
9
+ def http_client
10
+ unless @http_client
11
+ @http_client ||= HTTPClient.new
12
+ @http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
13
+ uname = Cul::Scv::Fedora.repository.config[:user]
14
+ pwd = Cul::Scv::Fedora.repository.config[:password]
15
+ @http_client.set_auth(nil, uname, pwd)
19
16
  end
17
+ @http_client
18
+ end
20
19
 
21
- def linkable_resources
22
- r = self.parts(:response_format => :solr)
23
- return [] if r.blank?
24
- members = r.collect {|hit|
25
- SolrDocument.new(hit)
26
- }
27
- members.delete_if { |sd| (sd[:has_model_ssim] & ["info:fedora/ldpd:Resource"]).blank? }
28
- case self.route_as
29
- when "zoomingimage"
30
- results = members.collect {|doc| image_resource(doc)}
31
- base_id = self.pid
32
- url = fedora_ds_url(base_id, 'SOURCE') + '/content'
33
- head_req = http_client().head(url)
34
- file_size = head_req.header["Content-Length"].first.to_i
35
- results << {
36
- :dimensions => "Original",
37
- :mime_type => "image/jp2",
38
- :uri=>base_id, :block=>"SOURCE", :filename=>base_id + "_source.jp2",
39
- :content_models=>[]}
40
- when "audio"
41
- results = members.collect {|doc| audio_resource(doc)}
42
- when "image"
43
- results = members.collect {|doc| image_resource(doc)}
44
- else
45
- raise "Unknown format #{self.route_as}"
46
- end
47
- return results
48
- end
49
-
50
- def basic_resource(document)
51
- res = {}
52
- res[:pid] = document["id"]
53
- res[:dsid] = "CONTENT"
54
- res[:mime_type] = document["dc_format_ssm"] ? document["dc_format_ssm"].first : "application/octect-stream"
55
- res[:content_models] = document["has_model_ssim"]
56
- res[:file_size] = document["extent_ssim"].first.to_i
57
- res[:size] = (document["extent_ssim"].first.to_i / 1024).to_s + " Kb"
58
- res
20
+ def linkable_resources
21
+ r = self.parts(:response_format => :solr)
22
+ return [] if r.blank?
23
+ members = r.collect {|hit|
24
+ SolrDocument.new(hit)
25
+ }
26
+ members.delete_if { |sd| (sd[:has_model_ssim] & ["info:fedora/ldpd:Resource"]).blank? }
27
+ case self.route_as
28
+ when "zoomingimage"
29
+ results = members.collect {|doc| image_resource(doc)}
30
+ base_id = self.pid
31
+ url = fedora_ds_url(base_id, 'SOURCE') + '/content'
32
+ head_req = http_client().head(url)
33
+ file_size = head_req.header["Content-Length"].first.to_i
34
+ results << {
35
+ :dimensions => "Original",
36
+ :mime_type => "image/jp2",
37
+ :uri=>base_id, :block=>"SOURCE", :filename=>base_id + "_source.jp2",
38
+ :content_models=>[]}
39
+ when "audio"
40
+ results = members.collect {|doc| audio_resource(doc)}
41
+ when "image"
42
+ results = members.collect {|doc| image_resource(doc)}
43
+ else
44
+ raise "Unknown format #{self.route_as}"
59
45
  end
46
+ return results
47
+ end
60
48
 
61
- def image_resource(document)
62
- res = basic_resource(document)
63
- if document["image_width_ssim"]
64
- res[:dimensions] = document["image_width_ssim"].first + " x " + document["image_length_ssim"].first
65
- res[:width] = document["image_width_ssim"].first
66
- res[:height] = document["image_length_ssim"].first
67
- else
68
- res[:dimensions] = "? x ?"
69
- res[:width] = "0"
70
- res[:height] = "0"
71
- end
72
- base_id = document["id"]
73
- base_filename = base_id.gsub(/\:/,"")
74
- img_filename = base_filename + "." + document["dc_format_ssm"].first.gsub(/^[^\/]+\//,"")
75
- res[:filename] = img_filename
76
- res[:block] = "CONTENT"
77
- res[:mime_type] = document["dc_format_ssm"] ? document["dc_format_ssm"].first : "application/octect-stream"
78
- res[:content_models] = document["has_model_ssim"]
79
- res[:file_size] = document["extent_ssim"].first.to_i
80
- res[:size] = (document["extent_ssim"].first.to_i / 1024).to_s + " Kb"
81
- res[:uri] = base_id
82
- res
49
+ def basic_resource(document)
50
+ res = {}
51
+ res[:pid] = document["id"]
52
+ res[:dsid] = "CONTENT"
53
+ res[:mime_type] = document["dc_format_ssm"] ? document["dc_format_ssm"].first : "application/octect-stream"
54
+ res[:content_models] = document["has_model_ssim"]
55
+ res[:file_size] = document["extent_ssim"].first.to_i
56
+ res[:size] = (document["extent_ssim"].first.to_i / 1024).to_s + " Kb"
57
+ res
58
+ end
59
+
60
+ def image_resource(document)
61
+ res = basic_resource(document)
62
+ if document["image_width_ssim"]
63
+ res[:dimensions] = document["image_width_ssim"].first + " x " + document["image_length_ssim"].first
64
+ res[:width] = document["image_width_ssim"].first
65
+ res[:height] = document["image_length_ssim"].first
66
+ else
67
+ res[:dimensions] = "? x ?"
68
+ res[:width] = "0"
69
+ res[:height] = "0"
83
70
  end
71
+ base_id = document["id"]
72
+ base_filename = base_id.gsub(/\:/,"")
73
+ img_filename = base_filename + "." + document["dc_format_ssm"].first.gsub(/^[^\/]+\//,"")
74
+ res[:filename] = img_filename
75
+ res[:block] = "CONTENT"
76
+ res[:mime_type] = document["dc_format_ssm"] ? document["dc_format_ssm"].first : "application/octect-stream"
77
+ res[:content_models] = document["has_model_ssim"]
78
+ res[:file_size] = document["extent_ssim"].first.to_i
79
+ res[:size] = (document["extent_ssim"].first.to_i / 1024).to_s + " Kb"
80
+ res[:uri] = base_id
81
+ res
82
+ end
84
83
 
85
- def audio_resource(document)
86
- res = basic_resource(document)
87
- base_id = document["id"]
88
- base_filename = base_id.gsub(/\:/,"")
89
- if res[:mime_type] =~ /wav/
90
- ext = 'wav'
91
- elsif res[:mime_type] =~ /mpeg/
92
- ext = 'mp3'
93
- else
94
- ext = 'bin'
95
- end
96
- filename = base_filename + "." + ext
97
- dc_filename = base_filename + "_dc.xml"
98
- res[:uri] = base_id
99
- res[:block] = "CONTENT"
100
- res[:filename] = filename
101
- res[:dc_path] = fedora_content_path(:download_method=>"show_pretty", :uri=>base_id, :block=>"DC", :filename=>dc_filename)
102
- res[:mime_type] = document["dc_format_ssm"] ? document["dc_format_ssm"].first : "application/octect-stream"
103
- res[:content_models] = document["has_model_ssim"]
104
- res[:file_size] = document["extent_ssim"].first.to_i
105
- res[:size] = (document["extent_ssim"].first.to_i / 1024).to_s + " Kb"
106
- res
84
+ def audio_resource(document)
85
+ res = basic_resource(document)
86
+ base_id = document["id"]
87
+ base_filename = base_id.gsub(/\:/,"")
88
+ if res[:mime_type] =~ /wav/
89
+ ext = 'wav'
90
+ elsif res[:mime_type] =~ /mpeg/
91
+ ext = 'mp3'
92
+ else
93
+ ext = 'bin'
107
94
  end
108
-
95
+ filename = base_filename + "." + ext
96
+ dc_filename = base_filename + "_dc.xml"
97
+ res[:uri] = base_id
98
+ res[:block] = "CONTENT"
99
+ res[:filename] = filename
100
+ res[:dc_path] = fedora_content_path(:download_method=>"show_pretty", :uri=>base_id, :block=>"DC", :filename=>dc_filename)
101
+ res[:mime_type] = document["dc_format_ssm"] ? document["dc_format_ssm"].first : "application/octect-stream"
102
+ res[:content_models] = document["has_model_ssim"]
103
+ res[:file_size] = document["extent_ssim"].first.to_i
104
+ res[:size] = (document["extent_ssim"].first.to_i / 1024).to_s + " Kb"
105
+ res
109
106
  end
110
107
 
111
- end
108
+ end
@@ -1,5 +1,4 @@
1
- module Cul::Scv::Hydra::Models
2
- module Resource
1
+ module Cul::Scv::Hydra::Models::Resource
3
2
  extend ActiveSupport::Concern
4
3
  # constants #
5
4
  IMAGE_MIME_TYPES = [
@@ -26,8 +25,8 @@ module Resource
26
25
  return relationships[:#{y.to_s}]
27
26
  }
28
27
  }
29
-
30
- after_create :resource!
28
+
29
+ after_create :resource!
31
30
  end
32
31
  if self.respond_to? :has_datastream
33
32
  has_datastream :name => "CONTENT", :type=>::ActiveFedora::Datastream, :versionable => true
@@ -86,4 +85,3 @@ module Resource
86
85
  mime_type = mime_types.empty? ? "application/octet-stream" : mime_types.first.content_type
87
86
  end
88
87
  end
89
- end
@@ -6,8 +6,8 @@ class DcDocument < ActiveFedora::Base
6
6
  include ::ActiveFedora::DatastreamCollections
7
7
  include Hydra::ModelMethods
8
8
  include Cul::Scv::Hydra::Models::Common
9
- alias :file_objects :resources
10
-
9
+ #alias :file_objects :resources
10
+
11
11
  has_and_belongs_to_many :parts, :property => :cul_member_of, :class_name=>'ActiveFedora::Base'
12
12
 
13
13
  def self.load_instance_from_solr(pid,solr_doc=nil)
@@ -20,7 +20,7 @@ class DcDocument < ActiveFedora::Base
20
20
  else
21
21
  raise "Solr document record id and pid do not match" unless pid == solr_doc[SOLR_DOCUMENT_ID]
22
22
  end
23
-
23
+
24
24
  create_date = solr_doc[::ActiveFedora::SolrService.solr_name(:system_create, :date)].nil? ? solr_doc[::ActiveFedora::SolrService.solr_name(:system_create, :date).to_s] : solr_doc[::ActiveFedora::SolrService.solr_name(:system_create, :date)]
25
25
  modified_date = solr_doc[::ActiveFedora::SolrService.solr_name(:system_create, :date)].nil? ? solr_doc[::ActiveFedora::SolrService.solr_name(:system_modified, :date).to_s] : solr_doc[::ActiveFedora::SolrService.solr_name(:system_modified, :date)]
26
26
  obj = DcDocument.new({:pid=>solr_doc[SOLR_DOCUMENT_ID],:create_date=>create_date,:modified_date=>modified_date})
@@ -10,7 +10,7 @@ class GenericObject < ::ActiveFedora::Base
10
10
 
11
11
  has_many :parts, :property => :cul_member_of, :class_name=>'ActiveFedora::Base'
12
12
 
13
- alias :file_objects :resources
13
+ #alias :file_objects :resources
14
14
 
15
15
  def route_as
16
16
  "multipartitem"
@@ -10,7 +10,7 @@ class METSStructuredAggregator < ::ActiveFedora::Base
10
10
 
11
11
  has_many :parts, :property => :cul_member_of, :class_name=>'ActiveFedora::Base'
12
12
 
13
- alias :file_objects :resources
13
+ #alias :file_objects :resources
14
14
 
15
15
  def route_as
16
16
  "multipartitem"
@@ -1,10 +1,10 @@
1
1
  module Cul
2
2
  module Scv
3
3
  module Hydra
4
- VERSION = '0.12.0'
4
+ VERSION = '0.12.1'
5
5
  def self.version
6
6
  VERSION
7
7
  end
8
8
  end
9
9
  end
10
- end
10
+ end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cul_scv_hydra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
5
- prerelease:
4
+ version: 0.12.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Benjamin Armintor
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-04-18 00:00:00.000000000 Z
11
+ date: 2014-05-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: blacklight
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: hydra-head
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: active-fedora
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: active_fedora_finders
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: active_fedora_relsint
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: cul_image_props
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: mods
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ! '>='
124
109
  - !ruby/object:Gem::Version
@@ -126,7 +111,6 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: sqlite3
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ! '>='
132
116
  - !ruby/object:Gem::Version
@@ -134,7 +118,6 @@ dependencies:
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ! '>='
140
123
  - !ruby/object:Gem::Version
@@ -142,7 +125,6 @@ dependencies:
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: rspec
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
129
  - - ~>
148
130
  - !ruby/object:Gem::Version
@@ -150,7 +132,6 @@ dependencies:
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
136
  - - ~>
156
137
  - !ruby/object:Gem::Version
@@ -158,7 +139,6 @@ dependencies:
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: rspec-rails
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
143
  - - ~>
164
144
  - !ruby/object:Gem::Version
@@ -166,7 +146,6 @@ dependencies:
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
150
  - - ~>
172
151
  - !ruby/object:Gem::Version
@@ -174,7 +153,6 @@ dependencies:
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: equivalent-xml
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
157
  - - ! '>='
180
158
  - !ruby/object:Gem::Version
@@ -182,7 +160,6 @@ dependencies:
182
160
  type: :development
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
163
  requirements:
187
164
  - - ! '>='
188
165
  - !ruby/object:Gem::Version
@@ -190,7 +167,6 @@ dependencies:
190
167
  - !ruby/object:Gem::Dependency
191
168
  name: rbx-require-relative
192
169
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
170
  requirements:
195
171
  - - ! '>='
196
172
  - !ruby/object:Gem::Version
@@ -198,7 +174,6 @@ dependencies:
198
174
  type: :development
199
175
  prerelease: false
200
176
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
177
  requirements:
203
178
  - - ! '>='
204
179
  - !ruby/object:Gem::Version
@@ -209,41 +184,6 @@ executables: []
209
184
  extensions: []
210
185
  extra_rdoc_files: []
211
186
  files:
212
- - bin/rails
213
- - lib/cul_scv_fedora/dummy_object.rb
214
- - lib/cul_scv_fedora/rubydora_patch.rb
215
- - lib/cul_scv_fedora/url_helper_behavior.rb
216
- - lib/cul_scv_hydra/access_controls_enforcement.rb
217
- - lib/cul_scv_hydra/controllers/aggregates.rb
218
- - lib/cul_scv_hydra/controllers/aggregator_controller_helper.rb
219
- - lib/cul_scv_hydra/controllers/catalog.rb
220
- - lib/cul_scv_hydra/controllers/content_aggregators.rb
221
- - lib/cul_scv_hydra/controllers/datastreams.rb
222
- - lib/cul_scv_hydra/controllers/helpers/active_fedora_helper_behavior.rb
223
- - lib/cul_scv_hydra/controllers/helpers/application_helper_behavior.rb
224
- - lib/cul_scv_hydra/controllers/helpers/dc_metadata_helper_behavior.rb
225
- - lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
226
- - lib/cul_scv_hydra/controllers/helpers/hydra_autocomplete_helper_behavior.rb
227
- - lib/cul_scv_hydra/controllers/helpers/hydra_uploader_helper_behavior.rb
228
- - lib/cul_scv_hydra/controllers/helpers/resources_helper_behavior.rb
229
- - lib/cul_scv_hydra/controllers/helpers.rb
230
- - lib/cul_scv_hydra/controllers/resources.rb
231
- - lib/cul_scv_hydra/controllers/static_image_aggregators.rb
232
- - lib/cul_scv_hydra/controllers/suggestions.rb
233
- - lib/cul_scv_hydra/controllers/terms.rb
234
- - lib/cul_scv_hydra/controllers.rb
235
- - lib/cul_scv_hydra/engine.rb
236
- - lib/cul_scv_hydra/om/standard_mods.rb
237
- - lib/cul_scv_hydra/om.rb
238
- - lib/cul_scv_hydra/solrizer/extractor.rb
239
- - lib/cul_scv_hydra/solrizer/field_mapper.rb
240
- - lib/cul_scv_hydra/solrizer/scv_mods_fieldable.rb
241
- - lib/cul_scv_hydra/solrizer/terminology_based_solrizer.rb
242
- - lib/cul_scv_hydra/solrizer/value_mapper.rb
243
- - lib/cul_scv_hydra/solrizer.rb
244
- - lib/cul_scv_hydra/version.rb
245
- - lib/cul_scv_hydra.rb
246
- - lib/tasks/cmodel.rake
247
187
  - app/assets/images/cul_scv_hydra/crystal/binary.png
248
188
  - app/assets/images/cul_scv_hydra/crystal/document.png
249
189
  - app/assets/images/cul_scv_hydra/crystal/file.png
@@ -259,18 +199,17 @@ files:
259
199
  - app/assets/images/cul_scv_hydra/crystal/multimedia2.png
260
200
  - app/assets/images/cul_scv_hydra/crystal/video.png
261
201
  - app/models/bag_aggregator.rb
202
+ - app/models/concerns/cul/scv/hydra/models.rb
262
203
  - app/models/concerns/cul/scv/hydra/models/aggregator.rb
263
204
  - app/models/concerns/cul/scv/hydra/models/common.rb
264
205
  - app/models/concerns/cul/scv/hydra/models/image_resource.rb
265
206
  - app/models/concerns/cul/scv/hydra/models/linkable_resources.rb
266
207
  - app/models/concerns/cul/scv/hydra/models/resource.rb
267
- - app/models/concerns/cul/scv/hydra/models.rb
268
- - app/models/concerns/cul.rb
269
208
  - app/models/content_aggregator.rb
270
209
  - app/models/cul/scv/hydra/datastreams/dc_metadata.rb
271
210
  - app/models/cul/scv/hydra/datastreams/mods_document.rb
272
211
  - app/models/cul/scv/hydra/datastreams/struct_metadata.rb
273
- - app/models/dcdocument.rb
212
+ - app/models/dc_document.rb
274
213
  - app/models/generic_aggregator.rb
275
214
  - app/models/generic_object.rb
276
215
  - app/models/generic_resource.rb
@@ -280,13 +219,49 @@ files:
280
219
  - app/models/resource_aggregator.rb
281
220
  - app/models/static_audio_aggregator.rb
282
221
  - app/models/static_image_aggregator.rb
222
+ - bin/rails
283
223
  - config/fedora.yml
284
224
  - config/predicate_mappings.yml
285
225
  - config/solr_mappings.yml
286
226
  - config/solr_value_maps.yml
287
227
  - config/subs.yml
228
+ - lib/cul_scv_fedora/dummy_object.rb
229
+ - lib/cul_scv_fedora/rubydora_patch.rb
230
+ - lib/cul_scv_fedora/url_helper_behavior.rb
231
+ - lib/cul_scv_hydra.rb
232
+ - lib/cul_scv_hydra/access_controls_enforcement.rb
233
+ - lib/cul_scv_hydra/controllers.rb
234
+ - lib/cul_scv_hydra/controllers/aggregates.rb
235
+ - lib/cul_scv_hydra/controllers/aggregator_controller_helper.rb
236
+ - lib/cul_scv_hydra/controllers/catalog.rb
237
+ - lib/cul_scv_hydra/controllers/content_aggregators.rb
238
+ - lib/cul_scv_hydra/controllers/datastreams.rb
239
+ - lib/cul_scv_hydra/controllers/helpers.rb
240
+ - lib/cul_scv_hydra/controllers/helpers/active_fedora_helper_behavior.rb
241
+ - lib/cul_scv_hydra/controllers/helpers/application_helper_behavior.rb
242
+ - lib/cul_scv_hydra/controllers/helpers/dc_metadata_helper_behavior.rb
243
+ - lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
244
+ - lib/cul_scv_hydra/controllers/helpers/hydra_autocomplete_helper_behavior.rb
245
+ - lib/cul_scv_hydra/controllers/helpers/hydra_uploader_helper_behavior.rb
246
+ - lib/cul_scv_hydra/controllers/helpers/resources_helper_behavior.rb
247
+ - lib/cul_scv_hydra/controllers/resources.rb
248
+ - lib/cul_scv_hydra/controllers/static_image_aggregators.rb
249
+ - lib/cul_scv_hydra/controllers/suggestions.rb
250
+ - lib/cul_scv_hydra/controllers/terms.rb
251
+ - lib/cul_scv_hydra/engine.rb
252
+ - lib/cul_scv_hydra/om.rb
253
+ - lib/cul_scv_hydra/om/standard_mods.rb
254
+ - lib/cul_scv_hydra/solrizer.rb
255
+ - lib/cul_scv_hydra/solrizer/extractor.rb
256
+ - lib/cul_scv_hydra/solrizer/field_mapper.rb
257
+ - lib/cul_scv_hydra/solrizer/scv_mods_fieldable.rb
258
+ - lib/cul_scv_hydra/solrizer/terminology_based_solrizer.rb
259
+ - lib/cul_scv_hydra/solrizer/value_mapper.rb
260
+ - lib/cul_scv_hydra/version.rb
261
+ - lib/tasks/cmodel.rake
288
262
  homepage: https://github.com/cul/cul_scv_hydra
289
263
  licenses: []
264
+ metadata: {}
290
265
  post_install_message:
291
266
  rdoc_options: []
292
267
  require_paths:
@@ -295,21 +270,19 @@ require_paths:
295
270
  - lib
296
271
  - fixtures
297
272
  required_ruby_version: !ruby/object:Gem::Requirement
298
- none: false
299
273
  requirements:
300
274
  - - ! '>='
301
275
  - !ruby/object:Gem::Version
302
276
  version: 1.9.3
303
277
  required_rubygems_version: !ruby/object:Gem::Requirement
304
- none: false
305
278
  requirements:
306
279
  - - ! '>='
307
280
  - !ruby/object:Gem::Version
308
281
  version: '0'
309
282
  requirements: []
310
283
  rubyforge_project:
311
- rubygems_version: 1.8.24
284
+ rubygems_version: 2.2.2
312
285
  signing_key:
313
- specification_version: 3
286
+ specification_version: 4
314
287
  summary: ActiveFedora, OM, and Solrizer implementations for CUL Staff Collection Viewer
315
288
  test_files: []
@@ -1,7 +0,0 @@
1
- module Cul
2
- extend ActiveSupport::Autoload
3
- autoload :'Scv::Hydra::Models', 'cul/scv/hydra/models'
4
- autoload :'Scv::Hydra::Models::Common', 'cul/scv/hydra/models/common'
5
- autoload :'Scv::Hydra::Models::Aggregator', 'cul/scv/hydra/models/aggregator'
6
- autoload :'Scv::Hydra::Models::Resource', 'cul/scv/hydra/models/resource'
7
- end