active-fedora 5.0.0.rc3 → 5.0.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +1 -0
- data/Gemfile +0 -1
- data/active-fedora.gemspec +1 -1
- data/lib/active_fedora.rb +0 -1
- data/lib/active_fedora/base.rb +2 -40
- data/lib/active_fedora/datastreams.rb +4 -32
- data/lib/active_fedora/delegating.rb +2 -2
- data/lib/active_fedora/file_management.rb +6 -1
- data/lib/active_fedora/metadata_datastream_helper.rb +0 -1
- data/lib/active_fedora/named_relationships.rb +4 -0
- data/lib/active_fedora/nokogiri_datastream.rb +2 -4
- data/lib/active_fedora/qualified_dublin_core_datastream.rb +0 -2
- data/lib/active_fedora/relationships.rb +19 -2
- data/lib/active_fedora/rels_ext_datastream.rb +1 -1
- data/lib/active_fedora/simple_datastream.rb +1 -3
- data/lib/active_fedora/version.rb +1 -1
- data/spec/integration/base_spec.rb +1 -26
- data/spec/integration/metadata_datastream_helper_spec.rb +1 -1
- data/spec/unit/base_datastream_management_spec.rb +0 -9
- data/spec/unit/base_extra_spec.rb +3 -40
- data/spec/unit/base_spec.rb +0 -55
- metadata +4 -10
- data/lib/active_fedora/metadata_datastream.rb +0 -272
- data/lib/ruby-fedora.rb +0 -12
- data/spec/integration/metadata_datastream_spec.rb +0 -66
- data/spec/unit/metadata_datastream_spec.rb +0 -392
data/.gitmodules
CHANGED
data/Gemfile
CHANGED
data/active-fedora.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
|
18
18
|
s.add_dependency('rsolr')
|
19
19
|
s.add_dependency('om', '~> 1.8.0.rc1')
|
20
|
-
s.add_dependency('solrizer', '~>2.0.0.
|
20
|
+
s.add_dependency('solrizer', '~>2.0.0.rc7')
|
21
21
|
s.add_dependency("activeresource", '>= 3.0.0')
|
22
22
|
s.add_dependency("activesupport", '>= 3.0.0')
|
23
23
|
s.add_dependency("builder", '~> 3.0.0')
|
data/lib/active_fedora.rb
CHANGED
data/lib/active_fedora/base.rb
CHANGED
@@ -11,7 +11,7 @@ module ActiveFedora
|
|
11
11
|
#
|
12
12
|
# =The Basics
|
13
13
|
# class Oralhistory < ActiveFedora::Base
|
14
|
-
# has_metadata :name => "properties", :type => ActiveFedora::
|
14
|
+
# has_metadata :name => "properties", :type => ActiveFedora::SimpleDatastream do |m|
|
15
15
|
# m.field "narrator", :string
|
16
16
|
# m.field "narrator", :text
|
17
17
|
# end
|
@@ -42,16 +42,11 @@ module ActiveFedora
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
45
|
# Has this object been saved?
|
47
46
|
def new_object?
|
48
47
|
inner_object.new?
|
49
48
|
end
|
50
49
|
|
51
|
-
def new_object=(bool)
|
52
|
-
ActiveSupport::Deprecation.warn("ActiveFedora::Base.new_object= has been deprecated and nolonger has any effect. Will be removed in 5.0")
|
53
|
-
end
|
54
|
-
|
55
50
|
## Required by associations
|
56
51
|
def new_record?
|
57
52
|
self.new_object?
|
@@ -61,7 +56,6 @@ module ActiveFedora
|
|
61
56
|
!new_object?
|
62
57
|
end
|
63
58
|
|
64
|
-
|
65
59
|
# Constructor. You may supply a custom +:pid+, or we call the Fedora Rest API for the
|
66
60
|
# next available Fedora pid, and mark as new object.
|
67
61
|
# Also, if +attrs+ does not contain +:pid+ but does contain +:namespace+ it will pass the
|
@@ -84,7 +78,7 @@ module ActiveFedora
|
|
84
78
|
# example:
|
85
79
|
#
|
86
80
|
# class Post < ActiveFedora::Base
|
87
|
-
# has_metadata :name => "properties", :type => ActiveFedora::
|
81
|
+
# has_metadata :name => "properties", :type => ActiveFedora::SimpleDatastream
|
88
82
|
# end
|
89
83
|
#
|
90
84
|
# post = Post.allocate
|
@@ -248,37 +242,6 @@ module ActiveFedora
|
|
248
242
|
@inner_object.label = new_label
|
249
243
|
end
|
250
244
|
|
251
|
-
#Return a hash of all available metadata fields for all
|
252
|
-
#ActiveFedora::MetadataDatastream datastreams, as well as
|
253
|
-
#system_create_date, system_modified_date, active_fedora_model_field,
|
254
|
-
#and the object id.
|
255
|
-
def fields
|
256
|
-
# TODO this can likely be removed once find_by_fields_by_solr is removed
|
257
|
-
fields = {:id => {:values => [pid]}, :system_create_date => {:values => [self.create_date], :type=>:date}, :system_modified_date => {:values => [self.modified_date], :type=>:date}, :active_fedora_model => {:values => [self.class.inspect], :type=>:symbol}}
|
258
|
-
datastreams.values.each do |ds|
|
259
|
-
fields.merge!(ds.fields) if [ActiveFedora::MetadataDatastream, ActiveFedora::SimpleDatastream, ActiveFedora::QualifiedDublinCoreDatastream].include?(ds.class)
|
260
|
-
end
|
261
|
-
return fields
|
262
|
-
end
|
263
|
-
|
264
|
-
#Returns the xml version of this object as a string.
|
265
|
-
def to_xml(xml=Nokogiri::XML::Document.parse("<xml><fields/><content/></xml>"))
|
266
|
-
ActiveSupport::Deprecation.warn("ActiveFedora::Base#to_xml has been deprecated and will be removed in version 5.0")
|
267
|
-
fields_xml = xml.xpath('//fields').first
|
268
|
-
builder = Nokogiri::XML::Builder.with(fields_xml) do |fields_xml|
|
269
|
-
fields_xml.id_ pid
|
270
|
-
fields_xml.system_create_date self.create_date
|
271
|
-
fields_xml.system_modified_date self.modified_date
|
272
|
-
fields_xml.active_fedora_model self.class.inspect
|
273
|
-
end
|
274
|
-
|
275
|
-
datastreams.each_value do |ds|
|
276
|
-
ds.to_xml(fields_xml) if ds.class.included_modules.include?(ActiveFedora::MetadataDatastreamHelper)
|
277
|
-
ds.to_rels_ext if ds.kind_of?(ActiveFedora::RelsExtDatastream)
|
278
|
-
end
|
279
|
-
return xml.to_s
|
280
|
-
end
|
281
|
-
|
282
245
|
def ==(comparison_object)
|
283
246
|
comparison_object.equal?(self) ||
|
284
247
|
(comparison_object.instance_of?(self.class) &&
|
@@ -449,7 +412,6 @@ module ActiveFedora
|
|
449
412
|
include Associations
|
450
413
|
include NestedAttributes
|
451
414
|
include Reflection
|
452
|
-
include NamedRelationships ##TODO don't include by default
|
453
415
|
end
|
454
416
|
|
455
417
|
end
|
@@ -22,7 +22,7 @@ module ActiveFedora
|
|
22
22
|
def serialize_datastreams
|
23
23
|
datastreams.each {|k, ds| ds.serialize! }
|
24
24
|
self.metadata_is_dirty = datastreams.any? do |k,ds|
|
25
|
-
ds.changed? && (ds.
|
25
|
+
ds.changed? && (ds.kind_of?(ActiveFedora::NokogiriDatastream) || ds.instance_of?(ActiveFedora::RelsExtDatastream) || ds.kind_of?(ActiveFedora::RDFDatastream))
|
26
26
|
end
|
27
27
|
true
|
28
28
|
end
|
@@ -60,11 +60,6 @@ module ActiveFedora
|
|
60
60
|
@datastreams ||= DatastreamHash.new(self)
|
61
61
|
end
|
62
62
|
|
63
|
-
def datastreams_in_memory
|
64
|
-
ActiveSupport::Deprecation.warn("ActiveFedora::Base.datastreams_in_memory has been deprecated. Use #datastreams instead")
|
65
|
-
datastreams
|
66
|
-
end
|
67
|
-
|
68
63
|
def configure_datastream(ds, ds_spec=nil)
|
69
64
|
ds_spec ||= self.class.ds_specs[ds.instance_variable_get(:@dsid)]
|
70
65
|
if ds_spec
|
@@ -107,39 +102,17 @@ module ActiveFedora
|
|
107
102
|
return datastream.dsid
|
108
103
|
end
|
109
104
|
|
110
|
-
|
111
|
-
ActiveSupport::Deprecation.warn "Warning: ActiveFedora::Base.add has been deprecatedand will be removed in 5.0. Use add_datastream"
|
112
|
-
add_datastream(datastream)
|
113
|
-
end
|
114
|
-
|
115
|
-
#return all datastreams of type ActiveFedora::MetadataDatastream
|
105
|
+
#return all datastreams of type ActiveFedora::RDFDatastream or ActiveFedora::NokogiriDatastream
|
116
106
|
def metadata_streams
|
117
107
|
results = []
|
118
108
|
datastreams.each_value do |ds|
|
119
|
-
if ds.kind_of?(ActiveFedora::
|
109
|
+
if ds.kind_of?(ActiveFedora::RDFDatastream) || ds.kind_of?(ActiveFedora::NokogiriDatastream)
|
120
110
|
results << ds
|
121
111
|
end
|
122
112
|
end
|
123
113
|
return results
|
124
114
|
end
|
125
115
|
|
126
|
-
#return all datastreams not of type ActiveFedora::MetadataDatastream
|
127
|
-
#(that aren't Dublin Core or RELS-EXT streams either)
|
128
|
-
#@deprecated
|
129
|
-
def file_streams
|
130
|
-
ActiveSupport::Deprecation.warn("ActiveFedora::Base#file_streams has been deprecated and will be removed in 5.0")
|
131
|
-
results = []
|
132
|
-
datastreams.each_value do |ds|
|
133
|
-
if !ds.kind_of?(ActiveFedora::MetadataDatastream) && !ds.kind_of?(ActiveFedora::NokogiriDatastream)
|
134
|
-
dsid = ds.dsid
|
135
|
-
if dsid != "DC" && dsid != "RELS-EXT"
|
136
|
-
results << ds
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
return results
|
141
|
-
end
|
142
|
-
|
143
116
|
# return a valid dsid that is not currently in use. Uses a prefix (default "DS") and an auto-incrementing integer
|
144
117
|
# Example: if there are already datastreams with IDs DS1 and DS2, this method will return DS3. If you specify FOO as the prefix, it will return FOO1.
|
145
118
|
def generate_dsid(prefix="DS")
|
@@ -156,8 +129,7 @@ module ActiveFedora
|
|
156
129
|
# Return the Dublin Core (DC) Datastream. You can also get at this via
|
157
130
|
# the +datastreams["DC"]+.
|
158
131
|
def dc
|
159
|
-
|
160
|
-
return datastreams["DC"]
|
132
|
+
return datastreams["DC"]
|
161
133
|
end
|
162
134
|
|
163
135
|
# Returns the RELS-EXT Datastream
|
@@ -58,7 +58,7 @@ module ActiveFedora
|
|
58
58
|
def create_delegate_accessor(field, args)
|
59
59
|
define_method field do
|
60
60
|
ds = self.send(args[:to])
|
61
|
-
val = if ds.kind_of?(ActiveFedora::
|
61
|
+
val = if ds.kind_of?(ActiveFedora::RDFDatastream)
|
62
62
|
ds.send(:get_values, field)
|
63
63
|
else
|
64
64
|
terminology = args[:at] || [field]
|
@@ -71,7 +71,7 @@ module ActiveFedora
|
|
71
71
|
def create_delegate_setter(field, args)
|
72
72
|
define_method "#{field}=".to_sym do |v|
|
73
73
|
ds = self.send(args[:to])
|
74
|
-
if ds.kind_of?(ActiveFedora::
|
74
|
+
if ds.kind_of?(ActiveFedora::RDFDatastream)
|
75
75
|
ds.send(:set_value, field, v)
|
76
76
|
else
|
77
77
|
terminology = args[:at] || [field]
|
@@ -1,7 +1,9 @@
|
|
1
1
|
module ActiveFedora
|
2
2
|
module FileManagement
|
3
3
|
extend ActiveSupport::Concern
|
4
|
-
|
4
|
+
extend Deprecation
|
5
|
+
self.deprecation_horizon = 'active-fedora 6.0'
|
6
|
+
|
5
7
|
included do
|
6
8
|
include ActiveFedora::Relationships
|
7
9
|
has_relationship "collection_members", :has_collection_member
|
@@ -69,6 +71,9 @@ module ActiveFedora
|
|
69
71
|
# will rely on SemanticNode.remove_relationship once it is implemented
|
70
72
|
end
|
71
73
|
|
74
|
+
deprecation_deprecate :file_objects, :file_objects_append, :collection_members_append, :collection_members_remove
|
75
|
+
|
76
|
+
|
72
77
|
end
|
73
78
|
end
|
74
79
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module ActiveFedora
|
2
2
|
module NamedRelationships
|
3
3
|
extend ActiveSupport::Concern
|
4
|
+
extend Deprecation
|
5
|
+
self.deprecation_horizon = 'active-fedora 6.0'
|
6
|
+
|
4
7
|
included do
|
5
8
|
class_attribute :class_named_relationships_desc
|
6
9
|
self.class_named_relationships_desc = {}
|
@@ -91,5 +94,6 @@ module ActiveFedora
|
|
91
94
|
end
|
92
95
|
|
93
96
|
|
97
|
+
deprecation_deprecate :named_predicate_exists_with_different_name?, :named_relationships_desc, :register_named_subject, :register_named_relationship, :create_named_relationship_methods, :create_bidirectional_named_relationship_methods
|
94
98
|
end
|
95
99
|
end
|
@@ -2,7 +2,7 @@ require "nokogiri"
|
|
2
2
|
require "om"
|
3
3
|
require "solrizer/xml"
|
4
4
|
|
5
|
-
#this class represents a
|
5
|
+
#this class represents a xml metadata datastream
|
6
6
|
module ActiveFedora
|
7
7
|
class NokogiriDatastream < Datastream
|
8
8
|
|
@@ -10,8 +10,6 @@ module ActiveFedora
|
|
10
10
|
include OM::XML::Document
|
11
11
|
include Solrizer::XML::TerminologyBasedSolrizer # this adds support for calling .to_solr
|
12
12
|
|
13
|
-
# extend(OM::XML::Container::ClassMethods)
|
14
|
-
|
15
13
|
alias_method(:om_term_values, :term_values) unless method_defined?(:om_term_values)
|
16
14
|
alias_method(:om_update_values, :update_values) unless method_defined?(:om_update_values)
|
17
15
|
|
@@ -23,7 +21,7 @@ module ActiveFedora
|
|
23
21
|
|
24
22
|
# Create an instance of this class based on xml content
|
25
23
|
# @param [String, File, Nokogiri::XML::Node] xml the xml content to build from
|
26
|
-
# @param [ActiveFedora::
|
24
|
+
# @param [ActiveFedora::NokogiriDatastream] tmpl the Datastream object that you are building @default a new instance of this class
|
27
25
|
# Careful! If you call this from a constructor, be sure to provide something 'ie. self' as the @tmpl. Otherwise, you will get an infinite loop!
|
28
26
|
def self.from_xml(xml, tmpl=nil)
|
29
27
|
tmpl = self.new(nil, nil) if tmpl.nil? ## This path is used only for unit testing (e.g. MarpaDCDatastream.from_xml(fixture("data.xml")) )
|
@@ -9,7 +9,6 @@ module ActiveFedora
|
|
9
9
|
|
10
10
|
class_attribute :class_fields
|
11
11
|
self.class_fields = []
|
12
|
-
attr_accessor :fields # TODO this can be removed when Model.find_by_fields_by_solr has been removed.
|
13
12
|
|
14
13
|
|
15
14
|
set_terminology do |t|
|
@@ -56,7 +55,6 @@ module ActiveFedora
|
|
56
55
|
# :encoding=>foo, or encodings_scheme - causes an xsi:type attribute to be set to 'foo'
|
57
56
|
# :multiple=>true - mark this field as a multivalue field (on by default)
|
58
57
|
#
|
59
|
-
#At some point, these modifiers will be ported up to work for any +ActiveFedora::MetadataDatastream+.
|
60
58
|
#
|
61
59
|
#There is quite a good example of this class in use in spec/examples/oral_history.rb
|
62
60
|
#
|
@@ -1,11 +1,15 @@
|
|
1
1
|
module ActiveFedora
|
2
2
|
module Relationships
|
3
3
|
extend ActiveSupport::Concern
|
4
|
-
|
4
|
+
extend Deprecation
|
5
|
+
self.deprecation_horizon = 'active-fedora 6.0'
|
6
|
+
|
5
7
|
|
6
8
|
# Return array of objects for a given relationship name
|
7
9
|
# @param [String] Name of relationship to find
|
8
10
|
# @return [Array] Returns array of objects linked via the relationship name given
|
11
|
+
#
|
12
|
+
# @deprecated find_relationship_by_name will be removed in active-fedora 6.0
|
9
13
|
def find_relationship_by_name(name)
|
10
14
|
rels = nil
|
11
15
|
if inbound_relationship_names.include?(name)
|
@@ -129,7 +133,6 @@ module ActiveFedora
|
|
129
133
|
|
130
134
|
|
131
135
|
|
132
|
-
|
133
136
|
# Returns a Class symbol for the given string for the class name
|
134
137
|
# @param [String] the class name as a string
|
135
138
|
# @return [Class] the class as a Class object
|
@@ -262,6 +265,7 @@ module ActiveFedora
|
|
262
265
|
end
|
263
266
|
end
|
264
267
|
|
268
|
+
deprecation_deprecate :find_relationship_by_name, :inbound_relationship_names, :inbound_relationships_by_name, :relationship_query, :relationships_by_name, :relationships_by_name_from_class, :assert_conforms_to, :class_from_name, :outbound_relationship_names, :is_relationship_name?, :load_inbound_relationship, :load_bidirectional, :load_outbound_relationship, :relationship_has_solr_filter_query?, :add_relationship_by_name, :remove_relationship_by_name
|
265
269
|
|
266
270
|
module ClassMethods
|
267
271
|
# Tests if the relationship name passed is in bidirectional
|
@@ -487,7 +491,10 @@ module ActiveFedora
|
|
487
491
|
# similar_audio_query: Return solr query that can be used to retrieve related objects as solr documents
|
488
492
|
# similar_audio_append: Add an AudioRecord object to the similar_audio relationship
|
489
493
|
# similar_audio_remove: Remove an AudioRecord from the similar_audio relationship
|
494
|
+
#
|
495
|
+
# @deprecated use ActiveFedora::Base.has_many or ActiveFedora::Base.belongs_to. has_relationship will be removed in active-fedora 6.0
|
490
496
|
def has_relationship(name, predicate, opts = {})
|
497
|
+
ActiveSupport::Deprecation.warn("ActiveFedora::Relationships#has_relationship has been deprecated use ActiveFedora::Base.has_many or ActiveFedora::Base.belongs_to. has_relationship will be removed in active-fedora 6.0.")
|
491
498
|
opts = {:singular => nil, :inbound => false}.merge(opts)
|
492
499
|
if opts[:inbound] == true
|
493
500
|
register_relationship_desc(:inbound, name, predicate, opts)
|
@@ -512,6 +519,8 @@ module ActiveFedora
|
|
512
519
|
#
|
513
520
|
# Methods audio_records_append and audio_records_remove are created.
|
514
521
|
# Boths methods take an object that is kind_of? ActiveFedora::Base as a parameter
|
522
|
+
#
|
523
|
+
# @deprecated create_relationship_name_methods will be removed in active-fedora 6.0
|
515
524
|
def create_relationship_name_methods(name)
|
516
525
|
append_method_name = "#{name.to_s.downcase}_append"
|
517
526
|
remove_method_name = "#{name.to_s.downcase}_remove"
|
@@ -535,7 +544,10 @@ module ActiveFedora
|
|
535
544
|
# create_inbound_relationship_finders and create_outbound_relationship_finders
|
536
545
|
# The third method combines the results of both and handles generating appropriate
|
537
546
|
# solr queries where necessary.
|
547
|
+
#
|
548
|
+
# @deprecated use ActiveFedora::Base.has_and_belongs_to_many. has_bidirectional_relationship will be removed in active-fedora 6.0
|
538
549
|
def has_bidirectional_relationship(name, outbound_predicate, inbound_predicate, opts={})
|
550
|
+
ActiveSupport::Deprecation.warn("ActiveFedora::Relationships#has_bidirectional_relationship has been deprecated, reference ActiveFedora::Base.has_and_belongs_to_many. has_bidirectional_relationship will be removed in active-fedora 6.0.")
|
539
551
|
create_bidirectional_relationship_finders(name, outbound_predicate, inbound_predicate, opts)
|
540
552
|
end
|
541
553
|
|
@@ -582,7 +594,9 @@ module ActiveFedora
|
|
582
594
|
# @param [Symbol] outbound_predicate Predicate used in outbound relationships
|
583
595
|
# @param [Symbol] inbound_predicate Predicate used in inbound relationships
|
584
596
|
# @param [Hash] opts (optional)
|
597
|
+
# @deprecated create_bidirectional_relationship_finders will be removed in active-fedora 6.0
|
585
598
|
def create_bidirectional_relationship_finders(name, outbound_predicate, inbound_predicate, opts={})
|
599
|
+
ActiveSupport::Deprecation.warn("ActiveFedora::Relationships#create_bidirectional_relationship_finders has been deprecated and will be removed in active-fedora 6.0.")
|
586
600
|
inbound_method_name = name.to_s+"_inbound"
|
587
601
|
outbound_method_name = name.to_s+"_outbound"
|
588
602
|
has_relationship(outbound_method_name, outbound_predicate, opts)
|
@@ -617,7 +631,10 @@ module ActiveFedora
|
|
617
631
|
# Method members_outbound_append and members_outbound_remove added
|
618
632
|
# This method will create members_append which does same thing as members_outbound_append
|
619
633
|
# and will create members_remove which does same thing as members_outbound_remove
|
634
|
+
#
|
635
|
+
# @deprecated create_bidirectional_relationship_name_methods will be removed in active-fedora 6.0
|
620
636
|
def create_bidirectional_relationship_name_methods(name,outbound_name)
|
637
|
+
ActiveSupport::Deprecation.warn("ActiveFedora::Relationships#create_bidirectional_relationship_name_methods has been deprecated and will be removed in active-fedora 6.0.")
|
621
638
|
append_method_name = "#{name.to_s.downcase}_append"
|
622
639
|
remove_method_name = "#{name.to_s.downcase}_remove"
|
623
640
|
self.send(:define_method,:"#{append_method_name}") {|object| add_relationship_by_name(outbound_name,object)}
|
@@ -30,7 +30,7 @@ module ActiveFedora
|
|
30
30
|
|
31
31
|
# Populate a RelsExtDatastream object based on the "datastream" content
|
32
32
|
# Assumes that the datastream contains RDF XML from a Fedora RELS-EXT datastream
|
33
|
-
# @param [ActiveFedora::
|
33
|
+
# @param [ActiveFedora::Datastream] tmpl the Datastream object that you are populating
|
34
34
|
# @param [String] the "rdf" node
|
35
35
|
def self.from_xml(xml, tmpl)
|
36
36
|
if (xml.nil?)
|
@@ -4,7 +4,6 @@ module ActiveFedora
|
|
4
4
|
|
5
5
|
class_attribute :class_fields
|
6
6
|
self.class_fields = []
|
7
|
-
attr_accessor :fields # TODO this can be removed when Model.find_by_fields_by_solr has been removed.
|
8
7
|
|
9
8
|
|
10
9
|
set_terminology do |t|
|
@@ -29,13 +28,12 @@ module ActiveFedora
|
|
29
28
|
# opts is an options hash, which will affect the generation of the xml representation of this datastream.
|
30
29
|
#
|
31
30
|
# Currently supported modifiers:
|
32
|
-
# For +
|
31
|
+
# For +SimpleDatastream+:
|
33
32
|
# :element_attrs =>{:foo=>:bar} - hash of xml element attributes
|
34
33
|
# :xml_node => :nodename - The xml node to be used to represent this object (in dcterms namespace)
|
35
34
|
# :encoding=>foo, or encodings_scheme - causes an xsi:type attribute to be set to 'foo'
|
36
35
|
# :multiple=>true - mark this field as a multivalue field (on by default)
|
37
36
|
#
|
38
|
-
#At some point, these modifiers will be ported up to work for any +ActiveFedora::MetadataDatastream+.
|
39
37
|
#
|
40
38
|
#There is quite a good example of this class in use in spec/examples/oral_history.rb
|
41
39
|
#
|
@@ -32,7 +32,7 @@ describe "A base object with metadata" do
|
|
32
32
|
describe "and has been changed" do
|
33
33
|
before do
|
34
34
|
@release.foo.person = 'frank'
|
35
|
-
@release.save
|
35
|
+
@release.save!
|
36
36
|
end
|
37
37
|
it "should save the datastream." do
|
38
38
|
MockAFBaseRelationship.find(@release.pid).foo.person.should == ['frank']
|
@@ -273,31 +273,6 @@ describe ActiveFedora::Base do
|
|
273
273
|
end
|
274
274
|
end
|
275
275
|
|
276
|
-
describe ".file_streams" do
|
277
|
-
it "should return all of the datastreams from the object that are kinds of NokogiriDatastream" do
|
278
|
-
fds1 = ActiveFedora::Datastream.new(@test_object.inner_object, "fds1")
|
279
|
-
fds2 = ActiveFedora::Datastream.new(@test_object.inner_object, "fds2")
|
280
|
-
mds = ActiveFedora::SimpleDatastream.new(@test_object.inner_object, "mds")
|
281
|
-
@test_object.add_datastream(fds1)
|
282
|
-
@test_object.add_datastream(fds2)
|
283
|
-
@test_object.add_datastream(mds)
|
284
|
-
|
285
|
-
result = @test_object.file_streams
|
286
|
-
result.length.should == 2
|
287
|
-
result.should include(fds1)
|
288
|
-
result.should include(fds2)
|
289
|
-
end
|
290
|
-
it "should skip DC and RELS-EXT datastreams" do
|
291
|
-
fds1 = ActiveFedora::Datastream.new(@test_object.inner_object,"fds1")
|
292
|
-
dc = ActiveFedora::Datastream.new(@test_object.inner_object, "DC")
|
293
|
-
rels_ext = ActiveFedora::RelsExtDatastream.new(@test_object.inner_object, 'RELS-EXT')
|
294
|
-
@test_object.add_datastream(fds1)
|
295
|
-
@test_object.add_datastream(dc)
|
296
|
-
@test_object.add_datastream(rels_ext)
|
297
|
-
@test_object.file_streams.should == [fds1]
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
276
|
describe ".dc" do
|
302
277
|
it "should expose the DC datastream" do
|
303
278
|
dc = @test_object.dc
|