sufia-models 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.md +177 -0
  5. data/README.md +29 -0
  6. data/Rakefile +1 -0
  7. data/app/models/batch.rb +46 -0
  8. data/app/models/checksum_audit_log.rb +35 -0
  9. data/app/models/contact_form.rb +42 -0
  10. data/app/models/datastreams/batch_rdf_datastream.rb +23 -0
  11. data/app/models/datastreams/file_content_datastream.rb +18 -0
  12. data/app/models/datastreams/fits_datastream.rb +188 -0
  13. data/app/models/datastreams/generic_file_rdf_datastream.rb +75 -0
  14. data/app/models/datastreams/paranoid_rights_datastream.rb +37 -0
  15. data/app/models/datastreams/properties_datastream.rb +33 -0
  16. data/app/models/domain_term.rb +18 -0
  17. data/app/models/follow.rb +28 -0
  18. data/app/models/generic_file.rb +16 -0
  19. data/app/models/geo_names_resource.rb +34 -0
  20. data/app/models/group.rb +8 -0
  21. data/app/models/local_authority.rb +93 -0
  22. data/app/models/local_authority_entry.rb +18 -0
  23. data/app/models/single_use_link.rb +26 -0
  24. data/app/models/subject_local_authority_entry.rb +16 -0
  25. data/app/models/trophy.rb +12 -0
  26. data/app/models/version_committer.rb +17 -0
  27. data/lib/sufia/models.rb +11 -0
  28. data/lib/sufia/models/active_fedora/redis.rb +49 -0
  29. data/lib/sufia/models/active_record/redis.rb +56 -0
  30. data/lib/sufia/models/engine.rb +34 -0
  31. data/lib/sufia/models/file_content.rb +9 -0
  32. data/lib/sufia/models/file_content/extract_metadata.rb +60 -0
  33. data/lib/sufia/models/file_content/versions.rb +23 -0
  34. data/lib/sufia/models/generic_file.rb +183 -0
  35. data/lib/sufia/models/generic_file/actions.rb +39 -0
  36. data/lib/sufia/models/generic_file/audit.rb +119 -0
  37. data/lib/sufia/models/generic_file/characterization.rb +81 -0
  38. data/lib/sufia/models/generic_file/export.rb +339 -0
  39. data/lib/sufia/models/generic_file/permissions.rb +64 -0
  40. data/lib/sufia/models/generic_file/thumbnail.rb +91 -0
  41. data/lib/sufia/models/id_service.rb +57 -0
  42. data/lib/sufia/models/jobs/audit_job.rb +65 -0
  43. data/lib/sufia/models/jobs/batch_update_job.rb +86 -0
  44. data/lib/sufia/models/jobs/characterize_job.rb +43 -0
  45. data/lib/sufia/models/jobs/content_delete_event_job.rb +31 -0
  46. data/lib/sufia/models/jobs/content_deposit_event_job.rb +32 -0
  47. data/lib/sufia/models/jobs/content_new_version_event_job.rb +32 -0
  48. data/lib/sufia/models/jobs/content_restored_version_event_job.rb +40 -0
  49. data/lib/sufia/models/jobs/content_update_event_job.rb +32 -0
  50. data/lib/sufia/models/jobs/event_job.rb +33 -0
  51. data/lib/sufia/models/jobs/ffmpeg_transcode_job.rb +61 -0
  52. data/lib/sufia/models/jobs/resolrize_job.rb +23 -0
  53. data/lib/sufia/models/jobs/transcode_audio_job.rb +40 -0
  54. data/lib/sufia/models/jobs/transcode_video_job.rb +39 -0
  55. data/lib/sufia/models/jobs/unzip_job.rb +54 -0
  56. data/lib/sufia/models/jobs/user_edit_profile_event_job.rb +35 -0
  57. data/lib/sufia/models/jobs/user_follow_event_job.rb +37 -0
  58. data/lib/sufia/models/jobs/user_unfollow_event_job.rb +38 -0
  59. data/lib/sufia/models/model_methods.rb +39 -0
  60. data/lib/sufia/models/noid.rb +42 -0
  61. data/lib/sufia/models/solr_document_behavior.rb +125 -0
  62. data/lib/sufia/models/user.rb +126 -0
  63. data/lib/sufia/models/utils.rb +36 -0
  64. data/lib/sufia/models/version.rb +5 -0
  65. data/lib/tasks/sufia-models_tasks.rake +4 -0
  66. data/sufia-models.gemspec +28 -0
  67. metadata +151 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d5544ce4ac7eb5a42a923e2a6f087bd2c37d383e
4
+ data.tar.gz: f2cada4f830018fd3b7eb94ec8be21aa755da733
5
+ SHA512:
6
+ metadata.gz: 6c0498bd2ec92d52c45b7d558b431f7ba51a3e0ee718b56a3524a792485732796c51e41b3476fc278388a725350007e8ba30b29efcb52141f903c36c3a961497
7
+ data.tar.gz: e40f77a08d2241d03b9c4b562d717e2ee62954a8e0799737827478cb1a37a40c7dcfe2e31a383de2e532740f6558daa22d40b6f4201f6780a437d2fe21a1b594
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sufia-models.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Sufia::Models
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'sufia-models'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install sufia-models
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,46 @@
1
+ # Copyright © 2012 The Pennsylvania State University
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'datastreams/batch_rdf_datastream'
16
+
17
+ class Batch < ActiveFedora::Base
18
+ include Hydra::ModelMixins::CommonMetadata
19
+ include Hydra::ModelMixins::RightsMetadata
20
+ include Sufia::ModelMethods
21
+ include Sufia::Noid
22
+
23
+ has_metadata :name => "descMetadata", :type => BatchRdfDatastream
24
+
25
+ belongs_to :user, :property => "creator"
26
+ has_many :generic_files, :property => :is_part_of
27
+
28
+ delegate :title, :to => :descMetadata
29
+ delegate :creator, :to => :descMetadata
30
+ delegate :part, :to => :descMetadata
31
+ delegate :status, :to => :descMetadata
32
+
33
+ def self.find_or_create(pid)
34
+ begin
35
+ @batch = Batch.find(pid)
36
+ rescue ActiveFedora::ObjectNotFoundError
37
+ @batch = Batch.create({pid: pid})
38
+ end
39
+ end
40
+
41
+ def to_solr(solr_doc={}, opts={})
42
+ super(solr_doc, opts)
43
+ solr_doc[Solrizer.solr_name('noid', Sufia::GenericFile.noid_indexer)] = noid
44
+ return solr_doc
45
+ end
46
+ end
@@ -0,0 +1,35 @@
1
+ # Copyright © 2012 The Pennsylvania State University
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ class ChecksumAuditLog < ActiveRecord::Base
16
+ attr_accessible :pass, :pid, :dsid, :version, :created_at
17
+
18
+ def ChecksumAuditLog.get_audit_log(version)
19
+ log = ChecksumAuditLog.find_or_create_by_pid_and_dsid_and_version(:pid => version.pid,
20
+ :dsid => version.dsid,
21
+ :version => version.versionID)
22
+ log
23
+ end
24
+
25
+ def ChecksumAuditLog.prune_history(version)
26
+ ## Check to see if there are previous passing logs that we can delete
27
+ # we want to keep the first passing event after a failure, the most current passing event, and all failures so that this table doesn't grow too large
28
+ # Simple way (a little naieve): if the last 2 were passing, delete the first one
29
+ logs = GenericFile.load_instance_from_solr(version.pid).logs(version.dsid)
30
+ list = logs.limit(2)
31
+ if list.size > 1 && (list[0].pass == 1) && (list[1].pass == 1)
32
+ list[0].destroy
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,42 @@
1
+ # Copyright © 2012 The Pennsylvania State University
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'mail_form'
16
+
17
+ class ContactForm < MailForm::Base
18
+ ISSUE_TYPES = [
19
+ ["Depositing content", "Depositing content"],
20
+ ["Making changes to my content", "Making changes to my content"],
21
+ ["Browsing and searching", "Browsing and searching"],
22
+ ["Reporting a problem", "Reporting a problem"],
23
+ ["General inquiry or request", "General inquiry or request"]
24
+ ]
25
+ attribute :contact_method, :captcha => true
26
+ attribute :category, :validate => true
27
+ attribute :name, :validate => true
28
+ attribute :email, :validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
29
+ attribute :subject, :validate => true
30
+ attribute :message, :validate => true
31
+ # - can't use this without ActiveRecord::Base validates_inclusion_of :issue_type, :in => ISSUE_TYPES
32
+
33
+ # Declare the e-mail headers. It accepts anything the mail method
34
+ # in ActionMailer accepts.
35
+ def headers
36
+ {
37
+ :subject => "Contact Form:#{subject}",
38
+ :to => Sufia::Engine.config.contact_email,
39
+ :from => Sufia::Engine.config.from_email
40
+ }
41
+ end
42
+ end
@@ -0,0 +1,23 @@
1
+ # Copyright © 2012 The Pennsylvania State University
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ class BatchRdfDatastream < ActiveFedora::NtriplesRDFDatastream
16
+ map_predicates do |map|
17
+ map.part(:to => "hasPart", :in => RDF::DC)
18
+ map.creator(:to => "creator", :in => RDF::DC)
19
+ map.title(:to => "title", :in => RDF::DC)
20
+ map.status(:to => "type", :in => RDF::DC)
21
+ end
22
+ end
23
+
@@ -0,0 +1,18 @@
1
+ # Copyright © 2012 The Pennsylvania State University
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ class FileContentDatastream < ActiveFedora::Datastream
16
+ include Sufia::FileContent::ExtractMetadata
17
+ include Sufia::FileContent::Versions
18
+ end
@@ -0,0 +1,188 @@
1
+ # Copyright © 2012 The Pennsylvania State University
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ class FitsDatastream < ActiveFedora::OmDatastream
16
+ include OM::XML::Document
17
+
18
+ set_terminology do |t|
19
+ t.root(:path => "fits",
20
+ :xmlns => "http://hul.harvard.edu/ois/xml/ns/fits/fits_output",
21
+ :schema => "http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd")
22
+ t.identification {
23
+ t.identity {
24
+ t.format_label(:path=>{:attribute=>"format"})
25
+ t.mime_type(:path=>{:attribute=>"mimetype"}, index_as: [:stored_searchable])
26
+ }
27
+ }
28
+ t.fileinfo {
29
+ t.file_size(:path=>"size")
30
+ t.last_modified(:path=>"lastmodified")
31
+ t.filename(:path=>"filename")
32
+ t.original_checksum(:path=>"md5checksum")
33
+ t.rights_basis(:path=>"rightsBasis")
34
+ t.copyright_basis(:path=>"copyrightBasis")
35
+ t.copyright_note(:path=>"copyrightNote")
36
+ }
37
+ t.filestatus {
38
+ t.well_formed(:path=>"well-formed")
39
+ t.valid(:path=>"valid")
40
+ t.status_message(:path=>"message")
41
+ }
42
+ t.metadata {
43
+ t.document {
44
+ t.file_title(:path=>"title")
45
+ t.file_author(:path=>"author")
46
+ t.file_language(:path=>"language")
47
+ t.page_count(:path=>"pageCount")
48
+ t.word_count(:path=>"wordCount")
49
+ t.character_count(:path=>"characterCount")
50
+ t.paragraph_count(:path=>"paragraphCount")
51
+ t.line_count(:path=>"lineCount")
52
+ t.table_count(:path=>"tableCount")
53
+ t.graphics_count(:path=>"graphicsCount")
54
+ }
55
+ t.image {
56
+ t.byte_order(:path=>"byteOrder")
57
+ t.compression(:path=>"compressionScheme")
58
+ t.width(:path=>"imageWidth")
59
+ t.height(:path=>"imageHeight")
60
+ t.color_space(:path=>"colorSpace")
61
+ t.profile_name(:path=>"iccProfileName")
62
+ t.profile_version(:path=>"iccProfileVersion")
63
+ t.orientation(:path=>"orientation")
64
+ t.color_map(:path=>"colorMap")
65
+ t.image_producer(:path=>"imageProducer")
66
+ t.capture_device(:path=>"captureDevice")
67
+ t.scanning_software(:path=>"scanningSoftwareName")
68
+ t.exif_version(:path=>"exifVersion")
69
+ t.gps_timestamp(:path=>"gpsTimeStamp")
70
+ t.latitude(:path=>"gpsDestLatitude")
71
+ t.longitude(:path=>"gpsDestLongitude")
72
+ }
73
+ t.text {
74
+ t.character_set(:path=>"charset")
75
+ t.markup_basis(:path=>"markupBasis")
76
+ t.markup_language(:path=>"markupLanguage")
77
+ }
78
+ t.audio {
79
+ t.duration(:path=>"duration")
80
+ t.bit_depth(:path=>"bitDepth")
81
+ t.sample_rate(:path=>"sampleRate")
82
+ t.channels(:path=>"channels")
83
+ t.data_format(:path=>"dataFormatType")
84
+ t.offset(:path=>"offset")
85
+ }
86
+ t.video {
87
+ # Not yet implemented in FITS
88
+ }
89
+ }
90
+ t.format_label(:proxy=>[:identification, :identity, :format_label])
91
+ t.mime_type(:proxy=>[:identification, :identity, :mime_type])
92
+ t.file_size(:proxy=>[:fileinfo, :file_size])
93
+ t.last_modified(:proxy=>[:fileinfo, :last_modified])
94
+ t.filename(:proxy=>[:fileinfo, :filename])
95
+ t.original_checksum(:proxy=>[:fileinfo, :original_checksum])
96
+ t.rights_basis(:proxy=>[:fileinfo, :rights_basis])
97
+ t.copyright_basis(:proxy=>[:fileinfo, :copyright_basis])
98
+ t.copyright_note(:proxy=>[:fileinfo, :copyright_note])
99
+ t.well_formed(:proxy=>[:filestatus, :well_formed])
100
+ t.valid(:proxy=>[:filestatus, :valid])
101
+ t.status_message(:proxy=>[:filestatus, :status_message])
102
+ t.file_title(:proxy=>[:metadata, :document, :file_title])
103
+ t.file_author(:proxy=>[:metadata, :document, :file_author])
104
+ t.page_count(:proxy=>[:metadata, :document, :page_count])
105
+ t.file_language(:proxy=>[:metadata, :document, :file_language])
106
+ t.word_count(:proxy=>[:metadata, :document, :word_count])
107
+ t.character_count(:proxy=>[:metadata, :document, :character_count])
108
+ t.paragraph_count(:proxy=>[:metadata, :document, :paragraph_count])
109
+ t.line_count(:proxy=>[:metadata, :document, :line_count])
110
+ t.table_count(:proxy=>[:metadata, :document, :table_count])
111
+ t.graphics_count(:proxy=>[:metadata, :document, :graphics_count])
112
+ t.byte_order(:proxy=>[:metadata, :image, :byte_order])
113
+ t.compression(:proxy=>[:metadata, :image, :compression])
114
+ t.width(:proxy=>[:metadata, :image, :width])
115
+ t.height(:proxy=>[:metadata, :image, :height])
116
+ t.color_space(:proxy=>[:metadata, :image, :color_space])
117
+ t.profile_name(:proxy=>[:metadata, :image, :profile_name])
118
+ t.profile_version(:proxy=>[:metadata, :image, :profile_version])
119
+ t.orientation(:proxy=>[:metadata, :image, :orientation])
120
+ t.color_map(:proxy=>[:metadata, :image, :color_map])
121
+ t.image_producer(:proxy=>[:metadata, :image, :image_producer])
122
+ t.capture_device(:proxy=>[:metadata, :image, :capture_device])
123
+ t.scanning_software(:proxy=>[:metadata, :image, :scanning_software])
124
+ t.exif_version(:proxy=>[:metadata, :image, :exif_version])
125
+ t.gps_timestamp(:proxy=>[:metadata, :image, :gps_timestamp])
126
+ t.latitude(:proxy=>[:metadata, :image, :latitude])
127
+ t.longitude(:proxy=>[:metadata, :image, :longitude])
128
+ t.character_set(:proxy=>[:metadata, :text, :character_set])
129
+ t.markup_basis(:proxy=>[:metadata, :text, :markup_basis])
130
+ t.markup_language(:proxy=>[:metadata, :text, :markup_language])
131
+ t.duration(:proxy=>[:metadata, :audio, :duration])
132
+ t.bit_depth(:proxy=>[:metadata, :audio, :bit_depth])
133
+ t.sample_rate(:proxy=>[:metadata, :audio, :sample_rate])
134
+ t.channels(:proxy=>[:metadata, :audio, :channels])
135
+ t.data_format(:proxy=>[:metadata, :audio, :data_format])
136
+ t.offset(:proxy=>[:metadata, :audio, :offset])
137
+ end
138
+
139
+ def self.xml_template
140
+ builder = Nokogiri::XML::Builder.new do |xml|
141
+ xml.fits(:xmlns => 'http://hul.harvard.edu/ois/xml/ns/fits/fits_output',
142
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
143
+ 'xsi:schemaLocation' =>
144
+ "http://hul.harvard.edu/ois/xml/ns/fits/fits_output
145
+ http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd",
146
+ :version => "0.6.0",
147
+ :timestamp => "1/25/12 11:04 AM") {
148
+ xml.identification {
149
+ xml.identity(:format => '', :mimetype => '',
150
+ :toolname => 'FITS', :toolversion => '') {
151
+ xml.tool(:toolname => '', :toolversion => '')
152
+ xml.version(:toolname => '', :toolversion => '')
153
+ xml.externalIdentifier(:toolname => '', :toolversion => '')
154
+ }
155
+ }
156
+ xml.fileinfo {
157
+ xml.size(:toolname => '', :toolversion => '')
158
+ xml.creatingApplicatioName(:toolname => '', :toolversion => '',
159
+ :status => '')
160
+ xml.lastmodified(:toolname => '', :toolversion => '', :status => '')
161
+ xml.filepath(:toolname => '', :toolversion => '', :status => '')
162
+ xml.filename(:toolname => '', :toolversion => '', :status => '')
163
+ xml.md5checksum(:toolname => '', :toolversion => '', :status => '')
164
+ xml.fslastmodified(:toolname => '', :toolversion => '', :status => '')
165
+ }
166
+ xml.filestatus {
167
+ xml.tag! "well-formed", :toolname => '', :toolversion => '', :status => ''
168
+ xml.valid(:toolname => '', :toolversion => '', :status => '')
169
+ }
170
+ xml.metadata {
171
+ xml.document {
172
+ xml.title(:toolname => '', :toolversion => '', :status => '')
173
+ xml.author(:toolname => '', :toolversion => '', :status => '')
174
+ xml.pageCount(:toolname => '', :toolversion => '')
175
+ xml.isTagged(:toolname => '', :toolversion => '')
176
+ xml.hasOutline(:toolname => '', :toolversion => '')
177
+ xml.hasAnnotations(:toolname => '', :toolversion => '')
178
+ xml.isRightsManaged(:toolname => '', :toolversion => '',
179
+ :status => '')
180
+ xml.isProtected(:toolname => '', :toolversion => '')
181
+ xml.hasForms(:toolname => '', :toolversion => '', :status => '')
182
+ }
183
+ }
184
+ }
185
+ end
186
+ builder.doc
187
+ end
188
+ end