def fetch_all
db = @database_context.database
nc = db.application.notification_center
objects = []
@adapter_channel.fetch_all.each do |row|
gid = @entity.gid row
snapshot = Snapshot.new
snapshot.update row
if registered = db.snapshot(gid) then
if refresh? then
userinfo = {:gid => gid, :snapshot => snapshot}
db.record_snapshot(gid, snapshot)
nc.post(ObjectStore::OBJECTS_CHANGED_IN_STORE_NOTIFICATION,
@database_context, userinfo)
else
snapshot = registered
end
else
db.record_snapshot(gid, snapshot)
end
if @database_context.own? gid then
object = @editing_context.object gid
end
if object then
if object.fault? then
@editing_context.initialize_object(object, gid)
object.update_from_snapshot snapshot
object.clear_fault
end
else
description = EntityClassDescription.new @entity
object = description.create(@editing_context, gid)
@editing_context.record(gid, object)
@editing_context.initialize_object(object, gid)
nc.add(@editing_context,
:handle_notification,
ObjectStore::OBJECTS_CHANGED_IN_STORE_NOTIFICATION,
@database_context)
end
if refresh? then
@editing_context.refault(object, gid)
end
objects << object
end
objects
end