# File vapor/persistable.rb, line 116 def make_persistent raise RepositoryOfflineError, "no PersistenceManager available" unless @@pmgr raise PersistableReadOnlyError if self.persistent_readonly? if self.state != TRANSIENT then raise ObjectAlreadyPersistentError end @@pmgr.try_change_state( self ){ @vapor_state = NEW @vapor_oid = @@pmgr.next_oid @vapor_revision = 0 @@pmgr.new_object( self ) ## search reference attributes and mark them persistent, too self.class.metadata.nil? or begin self.class.metadata.select{|m| m.type == ClassAttribute::Reference }.each{|md| attribute = eval "@#{md.name}" next if attribute.nil? if md.is_array then # this is supposed to be an array raise VaporTypeError, "non-array where Array of Persistables expected" unless attribute.is_a? Array attribute.each{|a| raise VaporTypeError, "non-Persistable found in Array of Persistables" unless a.kind_of? Persistable # make it persistent, if it's not yet if a.state == TRANSIENT then a.make_persistent end } else # normal Persistable raise VaporTypeError, "non-Persistable #{attribute.inspect} at #{md.name} here Persistable expected" unless attribute.kind_of? Persistable # make it persistent, if it's not yet if attribute.state == TRANSIENT then attribute.make_persistent end end } rescue VaporTypeError => e # some kind of type error, abort @vapor_state = TRANSIENT @vapor_oid = nil raise end } end