def save( editing_context )
if @cooperating_object_stores.empty? then
objects = editing_context.inserted_objects
objects.concat editing_context.deleted_objects
objects.concat editing_context.updated_objects
@userinfo[:object] = objects.first
@notification_center.post(COS_NEEDED_NOTIFICATION, self, @userinfo)
end
each do |store|
store.prepare_for_save(self, editing_context)
store.record_changes
end
failed = false
begin
each { |store| store.perform_changes }
rescue Exception => e
failed = true
each { |store| store.rollback }
else
begin
each { |store| store.commit }
rescue Exception => e
failed = true
each { |store| store.rollback }
else
each { |store| store.finalize_commit_changes }
end
end
if failed then
raise RuntimeError, "commit failed - #{e.message}"
end
end