cul_hydra 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/helpers/cul/hydra/ore_proxies_helper_behavior.rb +3 -3
- data/app/models/administrative_set.rb +68 -0
- data/app/models/bag_aggregator.rb +2 -1
- data/app/models/collection.rb +6 -0
- data/app/models/concerns/cul/hydra/models/aggregator.rb +0 -8
- data/app/models/concerns/cul/hydra/models/common.rb +16 -0
- data/app/models/concerns/cul/hydra/models/resource.rb +2 -1
- data/app/models/concerns/pcdm/models.rb +8 -0
- data/app/models/concerns/rdf/pcdm.rb +86 -0
- data/app/models/content_aggregator.rb +15 -1
- data/app/models/generic_resource.rb +3 -0
- data/config/predicate_mappings.yml +10 -1
- data/fixtures/cmodels/pcdm_Collection.xml +52 -0
- data/lib/cul_hydra/controllers/collections.rb +81 -0
- data/lib/cul_hydra/controllers.rb +1 -0
- data/lib/cul_hydra/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e93016ff878ffcdab88ad5374d953567918e752d
|
4
|
+
data.tar.gz: d5362d736b702b63cdd1acd7209d4750bd13bb9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd584cc04096b3c7ced9222d4e0ca298bfb0d520e73e6628e556afc76e2e6cf3435aa71dde46d13762f4cc3199bbf0595d1bad21aa6ec890cdaa5c5f64d4efe9
|
7
|
+
data.tar.gz: a841140424e4cdf0d2fdb3def6aeed6c41cba7462259c4129a67c8a463f088e86e195b9c6ac995e98a37a8d20fad722d7cfb3f8c513a15b263f95d81a83348f3
|
@@ -24,10 +24,10 @@ module Cul::Hydra::OreProxiesHelperBehavior
|
|
24
24
|
proxy_in = opts[:id]
|
25
25
|
proxy_uri = "info:fedora/#{proxy_in}"
|
26
26
|
proxy_id = opts[:proxy_id]
|
27
|
-
proxy_in_query = "proxyIn_ssi:#{RSolr.
|
27
|
+
proxy_in_query = "proxyIn_ssi:#{RSolr.solr_escape(proxy_uri)}"
|
28
28
|
f = [proxy_in_query]
|
29
29
|
if proxy_id
|
30
|
-
f << "belongsToContainer_ssi:#{RSolr.
|
30
|
+
f << "belongsToContainer_ssi:#{RSolr.solr_escape(proxy_id)}"
|
31
31
|
else
|
32
32
|
f << "-belongsToContainer_ssi:*"
|
33
33
|
end
|
@@ -112,7 +112,7 @@ module Cul::Hydra::OreProxiesHelperBehavior
|
|
112
112
|
# the first three parts are proxied graph prefixes "info:fedora/PID/DSID/..."
|
113
113
|
3.upto(parts.size - 2).each do |ix|
|
114
114
|
f_id = parts[0..ix].join('/')
|
115
|
-
yield( {id: id, proxy_id:
|
115
|
+
yield( {id: id, proxy_id: (f_id), label: parts[ix]})
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require "active-fedora"
|
2
|
+
require "active_fedora_finders"
|
3
|
+
class AdministrativeSet < ::ActiveFedora::Base
|
4
|
+
include ::ActiveFedora::FinderMethods::RepositoryMethods
|
5
|
+
include ::ActiveFedora::DatastreamCollections
|
6
|
+
include Hydra::ModelMethods
|
7
|
+
include Cul::Hydra::Models::Common
|
8
|
+
include Pcdm::Models
|
9
|
+
|
10
|
+
has_and_belongs_to_many :members, :property => :ldp_contains, :class_name=>'ActiveFedora::Base'
|
11
|
+
|
12
|
+
rdf_types(RDF::CUL.Aggregator)
|
13
|
+
rdf_types(RDF::PCDM.AdministrativeSet)
|
14
|
+
|
15
|
+
def route_as
|
16
|
+
"administrative_set"
|
17
|
+
end
|
18
|
+
|
19
|
+
def has_struct_metadata?
|
20
|
+
false
|
21
|
+
end
|
22
|
+
|
23
|
+
def solr_members(opts={})
|
24
|
+
opts = {:rows=>25,:response_format=>:solr}.merge(opts)
|
25
|
+
r = self.parts(opts)
|
26
|
+
members = []
|
27
|
+
r.collect {|hit| members << SolrDocument.new(hit) } unless r.blank?
|
28
|
+
members
|
29
|
+
end
|
30
|
+
|
31
|
+
def thumbnail_info
|
32
|
+
members = solr_members
|
33
|
+
if members.length == 0
|
34
|
+
thumb = {:asset=>"cul_hydra/crystal/file.png",:mime=>'image/png'}
|
35
|
+
else
|
36
|
+
thumb = thumb_from_members(members)
|
37
|
+
end
|
38
|
+
return thumb || {:asset=>"cul_hydra/crystal/file.png",:mime=>'image/png'}
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
def thumb_from_members(members)
|
43
|
+
sorted = members.sort do |a,b|
|
44
|
+
c = a['title_si'] <=> b['title_si']
|
45
|
+
if c == 0 && a['identifier_ssim']
|
46
|
+
if b['identifier_ssim']
|
47
|
+
a['identifier_ssim'].delete(a.id) unless a['identifier_ssim'].length == 1
|
48
|
+
b['identifier_ssim'].delete(a.id) unless b['identifier_ssim'].length == 1
|
49
|
+
a['identifier_ssim'][0] <=> b['identifier_ssim'][0]
|
50
|
+
else
|
51
|
+
-1
|
52
|
+
end
|
53
|
+
else
|
54
|
+
c
|
55
|
+
end
|
56
|
+
end
|
57
|
+
thumb_from_solr_doc(sorted[0])
|
58
|
+
end
|
59
|
+
|
60
|
+
def thumb_from_solr_doc(solr_doc)
|
61
|
+
if solr_doc and (member = ActiveFedora::Base.find(solr_doc.id, :cast=>true)).respond_to? :thumbnail_info
|
62
|
+
member.thumbnail_info
|
63
|
+
else
|
64
|
+
return nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -1,16 +1,8 @@
|
|
1
1
|
module Cul::Hydra::Models::Aggregator
|
2
2
|
extend ActiveSupport::Concern
|
3
|
-
|
4
3
|
included do
|
5
4
|
has_and_belongs_to_many :containers, :property=>:cul_member_of, :class_name=>'ActiveFedora::Base'
|
6
5
|
has_metadata :name => "structMetadata", :type=>Cul::Hydra::Datastreams::StructMetadata, :versionable => true, :controlGroup => 'M'
|
7
|
-
after_create :aggregator!
|
8
|
-
end
|
9
|
-
|
10
|
-
def aggregator!
|
11
|
-
add_relationship(:rdf_type, Cul::Hydra::Models::AGGREGATOR_TYPE.to_s)
|
12
|
-
@metadata_is_dirty = true
|
13
|
-
self.save
|
14
6
|
end
|
15
7
|
|
16
8
|
def add_member(member, container=self)
|
@@ -10,15 +10,31 @@ module Cul::Hydra::Models::Common
|
|
10
10
|
has_metadata :name => "descMetadata", :type=>Cul::Hydra::Datastreams::ModsDocument, :versionable => true
|
11
11
|
has_metadata :name => "rightsMetadata", :type=>::Hydra::Datastream::RightsMetadata, :versionable => true
|
12
12
|
has_many :publishers, :property => :publisher, :class_name=>'ActiveFedora::Base'
|
13
|
+
after_create :rdf_types!
|
13
14
|
end
|
14
15
|
|
15
16
|
module ClassMethods
|
16
17
|
def pid_namespace
|
17
18
|
'ldpd'
|
18
19
|
end
|
20
|
+
def rdf_types(type=nil)
|
21
|
+
@rdf_types ||= []
|
22
|
+
if type
|
23
|
+
@rdf_types << type unless @rdf_types.include? type
|
24
|
+
end
|
25
|
+
@rdf_types
|
26
|
+
end
|
27
|
+
end
|
19
28
|
|
29
|
+
def rdf_types!
|
30
|
+
self.class.rdf_types.each do |type|
|
31
|
+
add_relationship(:rdf_type, type.to_s)
|
32
|
+
end
|
33
|
+
@metadata_is_dirty = true
|
34
|
+
self.save
|
20
35
|
end
|
21
36
|
|
37
|
+
|
22
38
|
# A Fedora object label can only contain a string value of up to 255 characters. If we try to
|
23
39
|
# set a longer value, it causes errors upon object save. Truncate labels to 255 characters.
|
24
40
|
# Note: this method maps to a method_missing hanlder that converts input into a String, so
|
@@ -34,7 +34,8 @@ module Cul::Hydra::Models::Resource
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def resource!
|
37
|
-
add_relationship(:rdf_type,
|
37
|
+
add_relationship(:rdf_type, RDF::CUL.Resource.to_s)
|
38
|
+
add_relationship(:rdf_type, RDF::PCDM.Object.to_s)
|
38
39
|
@metadata_is_dirty = true
|
39
40
|
update
|
40
41
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# This file generated automatically using vocab-fetch from https://raw.githubusercontent.com/duraspace/pcdm/master/models.rdf
|
3
|
+
require 'rdf'
|
4
|
+
module RDF
|
5
|
+
class PCDM < RDF::StrictVocabulary('http://pcdm.org/models#')
|
6
|
+
# Class definitions
|
7
|
+
term :AdministrativeSet,
|
8
|
+
comment: %(
|
9
|
+
An Administrative Set is a grouping of resources that an administrative unit is ultimately
|
10
|
+
responsible for managing. The set itself helps to manage the items within it. An Object
|
11
|
+
or Collection may be contained by only one AdministrativeSet.
|
12
|
+
).freeze,
|
13
|
+
label: 'Administrative Set'.freeze,
|
14
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
15
|
+
subClassOf: 'http://www.w3.org/ns/ldp#Container'.freeze,
|
16
|
+
type: 'rdfs:Class'.freeze
|
17
|
+
term :Collection,
|
18
|
+
comment: %(
|
19
|
+
A Collection is a group of resources. Collections have descriptive metadata, access metadata,
|
20
|
+
and may links to works and/or collections. By default, member works and collections are an
|
21
|
+
unordered set, but can be ordered using the ORE Proxy class.
|
22
|
+
).freeze,
|
23
|
+
label: 'Collection'.freeze,
|
24
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
25
|
+
subClassOf: 'http://www.openarchives.org/ore/terms/Aggregation'.freeze,
|
26
|
+
type: 'rdfs:Class'.freeze
|
27
|
+
term :File,
|
28
|
+
comment: %(
|
29
|
+
A File is a sequence of binary data and is described by some accompanying metadata.
|
30
|
+
The metadata typically includes at least basic technical metadata \(size, content type,
|
31
|
+
modification date, etc.\), but can also include properties related to preservation,
|
32
|
+
digitization process, provenance, etc. Files MUST be contained by exactly one Object.
|
33
|
+
).freeze,
|
34
|
+
label: 'File'.freeze,
|
35
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
36
|
+
type: 'rdfs:Class'.freeze
|
37
|
+
term :Object,
|
38
|
+
comment: %(
|
39
|
+
An Object is an intellectual entity, sometimes called a "work", "digital object", etc.
|
40
|
+
Objects have descriptive metadata, access metadata, may contain files and other Objects as
|
41
|
+
member "components". Each level of a work is therefore represented by an Object instance,
|
42
|
+
and is capable of standing on its own, being linked to from Collections and other Objects.
|
43
|
+
Member Objects can be ordered using the ORE Proxy class.
|
44
|
+
).freeze,
|
45
|
+
label: 'Object'.freeze,
|
46
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
47
|
+
subClassOf: 'http://www.openarchives.org/ore/terms/Aggregation'.freeze,
|
48
|
+
type: 'rdfs:Class'.freeze
|
49
|
+
|
50
|
+
# Property definitions
|
51
|
+
property :hasFile,
|
52
|
+
comment: %(Links to a File contained by this Object.).freeze,
|
53
|
+
domain: 'http://pcdm.org/models#Object'.freeze,
|
54
|
+
label: 'has file'.freeze,
|
55
|
+
range: 'http://pcdm.org/models#File'.freeze,
|
56
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
57
|
+
subPropertyOf: 'http://www.w3.org/ns/ldp#contains'.freeze,
|
58
|
+
type: 'rdf:Property'.freeze
|
59
|
+
property :hasMember,
|
60
|
+
comment: %(Links to a related Object. Typically used to link to component parts, such as a book linking to a page.).freeze,
|
61
|
+
domain: 'http://www.openarchives.org/ore/terms/Aggregation'.freeze,
|
62
|
+
label: 'has member'.freeze,
|
63
|
+
range: 'http://www.openarchives.org/ore/terms/Aggregation'.freeze,
|
64
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
65
|
+
subPropertyOf: 'http://www.openarchives.org/ore/terms/aggregates'.freeze,
|
66
|
+
type: 'rdf:Property'.freeze
|
67
|
+
property :hasRelatedFile,
|
68
|
+
comment: %(Links to a File which is related to this Object but doesn't directly describe or represent it, such as technical metadata about other files.).freeze,
|
69
|
+
domain: 'http://pcdm.org/models#Object'.freeze,
|
70
|
+
label: 'has related file'.freeze,
|
71
|
+
range: 'http://pcdm.org/models#File'.freeze,
|
72
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
73
|
+
subPropertyOf: 'http://www.w3.org/ns/ldp#contains'.freeze,
|
74
|
+
type: 'rdf:Property'.freeze
|
75
|
+
|
76
|
+
# Extra definitions
|
77
|
+
term :"",
|
78
|
+
comment: %(Ontology for the Portland Common Data Model, intended to underlie a wide array of repository and DAMS applications.).freeze,
|
79
|
+
'dc:modified' => %(2015-03-16).freeze,
|
80
|
+
'dc:publisher' => %(http://www.duraspace.org/).freeze,
|
81
|
+
'dc:title' => %(Portland Common Data Model).freeze,
|
82
|
+
label: ''.freeze,
|
83
|
+
'owl:versionInfo' => %(2015/03/16).freeze,
|
84
|
+
'rdfs:seeAlso' => %(https://github.com/duraspace/pcdm/wiki).freeze
|
85
|
+
end
|
86
|
+
end
|
@@ -1,3 +1,17 @@
|
|
1
1
|
class ContentAggregator < GenericAggregator
|
2
|
-
|
2
|
+
rdf_types(RDF::CUL.Aggregator)
|
3
|
+
rdf_types(RDF::PCDM.Object)
|
4
|
+
def to_solr(solr_doc = Hash.new, opts={})
|
5
|
+
solr_doc = super
|
6
|
+
self.members.each do |member_doc|
|
7
|
+
member = ActiveFedora::Base.find(member_doc['id'])
|
8
|
+
if member.is_a? GenericResource
|
9
|
+
member_doc = member.to_solr
|
10
|
+
unless member_doc["fulltext_tesim"].blank?
|
11
|
+
solr_doc["fulltext_tesim"] = solr_doc.fetch("fulltext_tesim",[]) + member_doc["fulltext_tesim"]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
solr_doc
|
16
|
+
end
|
3
17
|
end
|
@@ -23,6 +23,9 @@ class GenericResource < ::ActiveFedora::Base
|
|
23
23
|
has_datastream :name => "content", :type=>::ActiveFedora::Datastream, :versionable => true
|
24
24
|
has_metadata :name=>"RELS-INT", :type=>ActiveFedora::RelsInt::Datastream
|
25
25
|
|
26
|
+
rdf_types(RDF::CUL.Resource)
|
27
|
+
rdf_types(RDF::PCDM.Object)
|
28
|
+
|
26
29
|
def assert_content_model
|
27
30
|
super
|
28
31
|
add_relationship(:rdf_type, RDF::CUL.Resource.to_s)
|
@@ -76,4 +76,13 @@
|
|
76
76
|
http://www.w3.org/1999/02/22-rdf-syntax-ns#:
|
77
77
|
:rdf_type: type
|
78
78
|
http://www.loc.gov/premis/rdf/v1#:
|
79
|
-
:original_name: hasOriginalName
|
79
|
+
:original_name: hasOriginalName
|
80
|
+
http://pcdm.org/models#:
|
81
|
+
:pcdm_has_file: hasFile
|
82
|
+
:pcdm_file_of: fileOf
|
83
|
+
:pcdm_has_member: hasMember
|
84
|
+
:pcdm_member_of: memberOf
|
85
|
+
:pcdm_has_related_file: hasRelatedFile
|
86
|
+
:pcdm_related_file_of: relatedFileOf
|
87
|
+
:pcdm_has_related_object: hasRelatedObject
|
88
|
+
:pcdm_related_object_of: relatedObjectOf
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<foxml:digitalObject VERSION="1.1" PID="pcdm:Collection"
|
3
|
+
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
|
4
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
5
|
+
xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
|
6
|
+
<foxml:objectProperties>
|
7
|
+
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
|
8
|
+
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="CModel for PCDM Collections"/>
|
9
|
+
</foxml:objectProperties>
|
10
|
+
<foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
|
11
|
+
<foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for CModel for PCDM Collections" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/">
|
12
|
+
<foxml:xmlContent>
|
13
|
+
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
14
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
15
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
16
|
+
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
|
17
|
+
<dc:title>CModel for PCDM Collections</dc:title>
|
18
|
+
<dc:creator>DuraSpace</dc:creator>
|
19
|
+
<dc:creator>ProjectHydra</dc:creator>
|
20
|
+
<dc:creator>Islandora</dc:creator>
|
21
|
+
<dc:contributor>NNC</dc:contributor>
|
22
|
+
<dc:identifier>http://pcdm.org/models#Collection</dc:identifier>
|
23
|
+
</oai_dc:dc>
|
24
|
+
</foxml:xmlContent>
|
25
|
+
</foxml:datastreamVersion>
|
26
|
+
</foxml:datastream>
|
27
|
+
<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
|
28
|
+
<foxml:datastreamVersion ID="RELS-EXT1.0" LABEL="RDF Statements about this object" MIMETYPE="application/rdf+xml" FORMAT_URI="info:fedora/fedora-system:FedoraRELSExt-1.0">
|
29
|
+
<foxml:xmlContent>
|
30
|
+
<rdf:RDF xmlns:fedora-model="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
31
|
+
<rdf:Description rdf:about="info:fedora/pcdm:Collection">
|
32
|
+
<fedora-model:hasModel rdf:resource="info:fedora/fedora-system:ContentModel-3.0"></fedora-model:hasModel>
|
33
|
+
</rdf:Description>
|
34
|
+
</rdf:RDF>
|
35
|
+
</foxml:xmlContent>
|
36
|
+
</foxml:datastreamVersion>
|
37
|
+
</foxml:datastream>
|
38
|
+
<foxml:datastream ID="DS-COMPOSITE-MODEL" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
|
39
|
+
<foxml:datastreamVersion ID="DS-COMPOSITE-MODEL1.0" LABEL="Datastream Composite Model" MIMETYPE="text/xml" FORMAT_URI="info:fedora/fedora-system:FedoraDSCompositeModel-1.0">
|
40
|
+
<foxml:xmlContent>
|
41
|
+
<dsCompositeModel xmlns="info:fedora/fedora-system:def/dsCompositeModel#">
|
42
|
+
<dsTypeModel ID="DC">
|
43
|
+
<form FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" MIME="text/xml"></form>
|
44
|
+
</dsTypeModel>
|
45
|
+
<dsTypeModel ID="RELS-EXT">
|
46
|
+
<form FORMAT_URI="info:fedora/fedora-system:FedoraRELSExt-1.0" MIME="application/rdf+xml"></form>
|
47
|
+
</dsTypeModel>
|
48
|
+
</dsCompositeModel>
|
49
|
+
</foxml:xmlContent>
|
50
|
+
</foxml:datastreamVersion>
|
51
|
+
</foxml:datastream>
|
52
|
+
</foxml:digitalObject>
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'cul_hydra/controllers/helpers/resources_helper_behavior'
|
2
|
+
module Cul::Hydra::Controllers
|
3
|
+
module Collections
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
included do
|
6
|
+
include Hydra::AssetsControllerHelper
|
7
|
+
include Cul::Hydra::Controllers::Helpers::ResourcesHelperBehavior
|
8
|
+
include Hydra::RepositoryController
|
9
|
+
include MediaShelf::ActiveFedoraHelper
|
10
|
+
include Blacklight::SolrHelper
|
11
|
+
prepend_before_filter :sanitize_update_params
|
12
|
+
end
|
13
|
+
|
14
|
+
def index
|
15
|
+
if params[:layout] == "false"
|
16
|
+
# action = "index_embedded"
|
17
|
+
layout = false
|
18
|
+
end
|
19
|
+
if !params[:container_id].nil?
|
20
|
+
container_uri = "info:fedora/#{params[:container_id]}"
|
21
|
+
escaped_uri = container_uri.gsub(/(:)/, '\\:')
|
22
|
+
extra_controller_params = {:q=>"cul_member_of_s:#{escaped_uri}"}
|
23
|
+
@response, @document_list = get_search_results( extra_controller_params )
|
24
|
+
|
25
|
+
# Including this line so permissions tests can be run against the container
|
26
|
+
@container_response, @document = get_solr_response_for_doc_id(params[:container_id])
|
27
|
+
|
28
|
+
# Including these lines for backwards compatibility (until we can use Rails3 callbacks)
|
29
|
+
@container = ActiveFedora::Base.load_instance(params[:container_id])
|
30
|
+
@solr_result = @container.file_objects(:response_format=>:solr)
|
31
|
+
else
|
32
|
+
# @solr_result = ActiveFedora::SolrService.instance.conn.query('has_model_field:info\:fedora/ldpd\:Resource', @search_params)
|
33
|
+
@solr_result = Resource.find_by_solr(:all)
|
34
|
+
end
|
35
|
+
render :action=>params[:action], :layout=>layout
|
36
|
+
end
|
37
|
+
|
38
|
+
def new
|
39
|
+
@asset = Collection.new
|
40
|
+
apply_depositor_metadata(@asset)
|
41
|
+
set_collection_type(@asset, params[:content_type])
|
42
|
+
if !params[:container_id].nil?
|
43
|
+
associate_resource_with_container(@asset, params[:container_id])
|
44
|
+
end
|
45
|
+
@asset.save
|
46
|
+
msg = "Created a Content Aggregator with pid #{@asset.pid}. Now it's ready to be edited."
|
47
|
+
flash[:notice]= msg
|
48
|
+
|
49
|
+
session[:scripts] = params[:combined] == "true"
|
50
|
+
redirect_to url_for(:action=>"edit", :id=>@asset.pid, :new_asset=>true, :controller=>'catalog')
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
# Common destroy method for all AssetsControllers
|
55
|
+
def destroy
|
56
|
+
# The correct implementation, with garbage collection:
|
57
|
+
# if params.has_key?(:container_id)
|
58
|
+
# container = ActiveFedora::Base.load_instance(params[:container_id])
|
59
|
+
# container.file_objects_remove(params[:id])
|
60
|
+
# FileAsset.garbage_collect(params[:id])
|
61
|
+
# else
|
62
|
+
|
63
|
+
# The dirty implementation (leaves relationship in container object, deletes regardless of whether the file object has other containers)
|
64
|
+
ActiveFedora::Base.load_instance(params[:id]).delete
|
65
|
+
render :text => "Deleted #{params[:id]} from #{params[:container_id]}."
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
def show
|
70
|
+
@image_agg = Collection.find(params[:id])
|
71
|
+
if (@image_agg.nil?)
|
72
|
+
logger.warn("No such object: " + params[:id])
|
73
|
+
flash[:notice]= "No such object."
|
74
|
+
redirect_to(:action => 'index', :q => nil , :f => nil)
|
75
|
+
else
|
76
|
+
@id_array = @image_agg.containers(:response_format => :id_array)
|
77
|
+
end
|
78
|
+
render :action=>params[:action], :layout=>(params[:layout]=="false")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -2,6 +2,7 @@ module Cul::Hydra
|
|
2
2
|
module Controllers
|
3
3
|
autoload :Aggregates, 'cul_hydra/controllers/aggregates'
|
4
4
|
autoload :Catalog, 'cul_hydra/controllers/catalog'
|
5
|
+
autoload :Collections, 'cul_hydra/controllers/collections'
|
5
6
|
autoload :ContentAggregators, 'cul_hydra/controllers/content_aggregators'
|
6
7
|
autoload :Datastreams, 'cul_hydra/controllers/datastreams'
|
7
8
|
autoload :Helpers, 'cul_hydra/controllers/helpers'
|
data/lib/cul_hydra/version.rb
CHANGED
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.2.0
|
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-
|
12
|
+
date: 2015-09-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: blacklight
|
@@ -314,7 +314,9 @@ files:
|
|
314
314
|
- app/controllers/concerns/cul/hydra/thumbnails.rb
|
315
315
|
- app/helpers/cul/hydra/ore_proxies_helper_behavior.rb
|
316
316
|
- app/helpers/cul/hydra/struct_metadata_helper_behavior.rb
|
317
|
+
- app/models/administrative_set.rb
|
317
318
|
- app/models/bag_aggregator.rb
|
319
|
+
- app/models/collection.rb
|
318
320
|
- app/models/concept.rb
|
319
321
|
- app/models/concerns/cul/hydra/models.rb
|
320
322
|
- app/models/concerns/cul/hydra/models/aggregator.rb
|
@@ -327,12 +329,14 @@ files:
|
|
327
329
|
- app/models/concerns/nfo/folder.rb
|
328
330
|
- app/models/concerns/nie/information_element.rb
|
329
331
|
- app/models/concerns/ore/proxy.rb
|
332
|
+
- app/models/concerns/pcdm/models.rb
|
330
333
|
- app/models/concerns/rdf/cul.rb
|
331
334
|
- app/models/concerns/rdf/fcrepo3.rb
|
332
335
|
- app/models/concerns/rdf/nfo.rb
|
333
336
|
- app/models/concerns/rdf/nie.rb
|
334
337
|
- app/models/concerns/rdf/olo.rb
|
335
338
|
- app/models/concerns/rdf/ore.rb
|
339
|
+
- app/models/concerns/rdf/pcdm.rb
|
336
340
|
- app/models/concerns/rdf/pimo.rb
|
337
341
|
- app/models/concerns/rdf/sc.rb
|
338
342
|
- app/models/concerns/sc/canvas.rb
|
@@ -399,6 +403,7 @@ files:
|
|
399
403
|
- fixtures/cmodels/ldpd_sdep.StaticImageAggregator.xml
|
400
404
|
- fixtures/cmodels/ldpd_sdep.StaticImageCore.xml
|
401
405
|
- fixtures/cmodels/ore_Proxy.xml
|
406
|
+
- fixtures/cmodels/pcdm_Collection.xml
|
402
407
|
- fixtures/spec/BLOB/test001.jpg
|
403
408
|
- fixtures/spec/CUL_DC/dc.xml
|
404
409
|
- fixtures/spec/CUL_MODS/mods-001.xml
|
@@ -451,6 +456,7 @@ files:
|
|
451
456
|
- lib/cul_hydra/controllers/aggregates.rb
|
452
457
|
- lib/cul_hydra/controllers/aggregator_controller_helper.rb
|
453
458
|
- lib/cul_hydra/controllers/catalog.rb
|
459
|
+
- lib/cul_hydra/controllers/collections.rb
|
454
460
|
- lib/cul_hydra/controllers/content_aggregators.rb
|
455
461
|
- lib/cul_hydra/controllers/datastreams.rb
|
456
462
|
- lib/cul_hydra/controllers/helpers.rb
|