etd_model 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Stanford University Library
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ == etd_model
2
+
3
+ This gem provides the ActiveFedora::MetadataDatastream declarations for Etd and its corresponding Part object, enabling the hydra_etd webapp
4
+ and the etd-robots to share code. The projects should derive their own local versions of Etd.
5
+
6
+ Common methods should be added to the EtdModel::EtdHelper.
7
+
8
+ == Releases
9
+ - 1.1.0 Added embargoMetadata and events datastreams to the Etd model
10
+ - 1.0.0 Gem built without Jeweler. Using bundler and rvm.
11
+ - 0.0.3.1 Handle term element with Active Fedora 1.2.6
12
+ - 0.0.3 Updated to use Active Fedora 1.2.6
13
+ - 0.0.2.1 Handle term element. Last version compatible with active_fedora 1.1.13
14
+ - 0.0.2 Moved #get_embargo_date method from the hydra_etd app to the EtdModel::EtdHelper module
15
+ - 0.0.1 Initial release
16
+
17
+ == Copyright
18
+
19
+ Copyright (c) 2011 Stanford University Library. See LICENSE for details.
@@ -0,0 +1,80 @@
1
+ require 'active_fedora'
2
+ require 'datastreams/embargo_metadata_ds'
3
+ require 'datastreams/events_ds'
4
+
5
+ module EtdModel
6
+
7
+ class Etd < ActiveFedora::Base
8
+ include EtdHelper
9
+
10
+ has_relationship "parts", :is_part_of, :inbound => true
11
+ has_relationship "supplemental_files", :is_constituent_of, :inbound => true
12
+ has_relationship "permission_files", :is_dependent_of, :inbound => true
13
+
14
+ has_metadata :name => "properties", :type => ActiveFedora::MetadataDatastream do |m|
15
+ m.field "name", :string # PS:name
16
+ m.field "prefix", :string # PS:prefix
17
+ m.field "suffix", :string # PS:suffix
18
+ m.field "major", :string # PS:plan
19
+ m.field "degree", :string # PS:degree
20
+ m.field "advisor", :string # one of the readers?
21
+ m.field "etd_type", :string # PS:type
22
+ m.field "title", :string # PS:title
23
+ m.field "abstract", :text
24
+ m.field "containscopyright", :string
25
+ m.field "copyrightclearance", :string
26
+ m.field "sulicense", :string
27
+ m.field "cclicense", :string
28
+ m.field "cclicensetype", :string
29
+ m.field "embargo", :string
30
+ m.field "external_visibility", :string
31
+
32
+ m.field "term", :string
33
+ m.field "sub", :string
34
+
35
+ m.field "univid", :string # PS:univid
36
+ m.field "sunetid", :string # PS:sunetid
37
+ m.field "ps_career", :string # PS:career
38
+ m.field "ps_program", :string # PS:program
39
+ m.field "ps_plan", :string # PS:plan
40
+ m.field "ps_subplan", :string # PS:subplan
41
+ m.field "dissertation_id", :string # PS:dissertationid
42
+ m.field "provost", :string # PS:vpname
43
+
44
+ # from latest ps revision
45
+ m.field "degreeconfyr", :string
46
+ m.field "schoolname", :string # Display value derived from ps_career
47
+ m.field "department", :string # Display value derived from ps_program
48
+ m.field "readerapproval", :string # Possible Values: Not Submitted, Not Approved, Approved, Rejected, Reject with Modification
49
+ m.field "readercomment", :string
50
+ m.field "readeractiondttm", :string # date?
51
+ m.field "regapproval", :string # Possible Values: Not Submitted, Not Approved, Approved, Rejected, Reject with Modification
52
+ m.field "regcomment", :string
53
+ m.field "regactiondttm", :string
54
+ m.field "documentaccess", :string
55
+
56
+ m.field "submit_date", :string
57
+ m.field "symphonyStatus", :string
58
+ end
59
+
60
+ has_metadata :name => "workflow", :type => ActiveFedora::MetadataDatastream do |m|
61
+ m.field "citation_verified", :string
62
+ m.field "abstract_provided", :string
63
+ m.field "dissertation_uploaded", :string
64
+ m.field "supplemental_files_uploaded", :string
65
+ m.field "permissions_provided", :string
66
+ m.field "permission_files_uploaded", :string
67
+ m.field "rights_selected", :string
68
+ m.field "cc_license_selected", :string
69
+ m.field "submitted_to_registrar", :string
70
+ end
71
+
72
+ has_metadata :name => "DC", :type => ActiveFedora::QualifiedDublinCoreDatastream do |m|
73
+ end
74
+
75
+ has_metadata :name => "embargoMetadata", :type => EmbargoMetadataDS
76
+ has_metadata :name => 'events', :type => EventsDS
77
+ end
78
+
79
+ end
80
+
@@ -0,0 +1,29 @@
1
+
2
+
3
+ module EtdModel
4
+ module EtdHelper
5
+
6
+ def get_embargo_date
7
+ props_ds = datastreams['properties']
8
+ regaction = props_ds.regactiondttm_values.first
9
+ embargo = props_ds.embargo_values.first
10
+ if(props_ds.regapproval_values.first =~ /^approved$/i &&
11
+ embargo != nil && embargo != '' &&
12
+ regaction != nil && regaction != '')
13
+ case embargo
14
+ when /6 months/i
15
+ embargo_months = 6
16
+ when /1 year/i
17
+ embargo_months = 12
18
+ when /2 years/i
19
+ embargo_months = 24
20
+ else
21
+ embargo_months = 0
22
+ end
23
+ return Time.parse(regaction).months_since(embargo_months)
24
+ end
25
+ nil
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ require 'active_fedora'
2
+
3
+ module EtdModel
4
+
5
+ class Part < ActiveFedora::Base
6
+
7
+ has_relationship "parents", :is_part_of # relationship between main pdf and parent etd
8
+ has_relationship "supplemental_file_for", :is_constituent_of # relationship between supplemental file and parent etd
9
+ has_relationship "permission_file_for", :is_dependent_of # relationsihip between permission file and parent etd
10
+
11
+ has_metadata :name => "properties", :type => ActiveFedora::MetadataDatastream do |m|
12
+ m.field "file_name", :string
13
+ m.field "size", :string
14
+ m.field "label", :string
15
+ end
16
+
17
+ has_metadata :name => "DC", :type => ActiveFedora::QualifiedDublinCoreDatastream do |m|
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+
data/lib/etd_model.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'etd_model/etd_helper'
2
+ require 'etd_model/etd'
3
+ require 'etd_model/part'
4
+
metadata ADDED
@@ -0,0 +1,211 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: etd_model
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 1
10
+ version: 1.1.1
11
+ platform: ruby
12
+ authors:
13
+ - Douglas Kim
14
+ - Willy Mene
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2011-10-24 00:00:00 -07:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - <
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 3
31
+ - 0
32
+ - 0
33
+ version: 3.0.0
34
+ name: active-fedora
35
+ prerelease: false
36
+ type: :runtime
37
+ requirement: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 5
45
+ segments:
46
+ - 2
47
+ - 2
48
+ - 1
49
+ version: 2.2.1
50
+ name: dor-services
51
+ prerelease: false
52
+ type: :runtime
53
+ requirement: *id002
54
+ - !ruby/object:Gem::Dependency
55
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 25
61
+ segments:
62
+ - 0
63
+ - 1
64
+ - 1
65
+ version: 0.1.1
66
+ name: lyberteam-devel
67
+ prerelease: false
68
+ type: :development
69
+ requirement: *id003
70
+ - !ruby/object:Gem::Dependency
71
+ version_requirements: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - "="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ - 4
80
+ version: "0.4"
81
+ name: mediashelf-loggable
82
+ prerelease: false
83
+ type: :development
84
+ requirement: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ version_requirements: &id005 !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 49
92
+ segments:
93
+ - 0
94
+ - 8
95
+ - 7
96
+ version: 0.8.7
97
+ name: rake
98
+ prerelease: false
99
+ type: :development
100
+ requirement: *id005
101
+ - !ruby/object:Gem::Dependency
102
+ version_requirements: &id006 !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ hash: 3
108
+ segments:
109
+ - 0
110
+ version: "0"
111
+ name: rcov
112
+ prerelease: false
113
+ type: :development
114
+ requirement: *id006
115
+ - !ruby/object:Gem::Dependency
116
+ version_requirements: &id007 !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ hash: 3
122
+ segments:
123
+ - 0
124
+ version: "0"
125
+ name: rdoc
126
+ prerelease: false
127
+ type: :development
128
+ requirement: *id007
129
+ - !ruby/object:Gem::Dependency
130
+ version_requirements: &id008 !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - <
134
+ - !ruby/object:Gem::Version
135
+ hash: 3
136
+ segments:
137
+ - 2
138
+ - 0
139
+ version: "2.0"
140
+ name: rspec
141
+ prerelease: false
142
+ type: :development
143
+ requirement: *id008
144
+ - !ruby/object:Gem::Dependency
145
+ version_requirements: &id009 !ruby/object:Gem::Requirement
146
+ none: false
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ hash: 3
151
+ segments:
152
+ - 0
153
+ version: "0"
154
+ name: ruby-debug
155
+ prerelease: false
156
+ type: :development
157
+ requirement: *id009
158
+ description: Contains classes that define the Fedora content model for electronic theses and dissertations.
159
+ email:
160
+ - wmene@stanford.edu
161
+ executables: []
162
+
163
+ extensions: []
164
+
165
+ extra_rdoc_files: []
166
+
167
+ files:
168
+ - lib/etd_model/etd.rb
169
+ - lib/etd_model/etd_helper.rb
170
+ - lib/etd_model/part.rb
171
+ - lib/etd_model.rb
172
+ - LICENSE
173
+ - README.rdoc
174
+ has_rdoc: true
175
+ homepage:
176
+ licenses: []
177
+
178
+ post_install_message:
179
+ rdoc_options: []
180
+
181
+ require_paths:
182
+ - lib
183
+ required_ruby_version: !ruby/object:Gem::Requirement
184
+ none: false
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ hash: 3
189
+ segments:
190
+ - 0
191
+ version: "0"
192
+ required_rubygems_version: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ hash: 23
198
+ segments:
199
+ - 1
200
+ - 3
201
+ - 6
202
+ version: 1.3.6
203
+ requirements: []
204
+
205
+ rubyforge_project:
206
+ rubygems_version: 1.5.2
207
+ signing_key:
208
+ specification_version: 3
209
+ summary: ETD content model used by the SULAIR Digital Library
210
+ test_files: []
211
+