[flexcoders] How do you auto-refresh LCDS?

2008-07-31 Thread Geoffrey
I'm not sure how you refresh clients when there's a change on the
server.  After I perform a _ds.fill(), the user can delete 1+ of the
items from the managed collection.  The ActionScript looks like:

private function deleteItems():void
{
  var selectedTasks:Array = taskList.getSelectedTasks();
  for each (var task:ExploitationTaskVO in selectedTasks)
  {
_ds.deleteItem(task);
  }

  // Commit the deletes to the server if needed
  if (__ds.commitRequired)
  {
__ds.commit();
  }
}

_ds.commit() has to be called to propagate changes to the server
because I have _ds.autoCommit = false.

The LCDS JavaDocs state that changes from a createItem() or
updateItem() call will propigate to all clients if auto-refresh=true.
 Is that true for deleteItem() calls too?  And where is this
auto-refresh property?  I don't see it under Java AbstractAssembler or
ActionScript DataService classes.

Also, what if I create, update, or delete a task on the server without
doing it through the DataService(like through a java delegate).  Can I
force the DataService to refresh it's clients on the java side?  Is
this what the DataServiceTransaction.refreshFill() method is for?

Thanks,
Geoff





RE: [flexcoders] How do you auto-refresh LCDS?

2008-07-31 Thread Jeff Vroom
When the autoSyncEnabled property of the DataService is true, the other 
client should be pushed the deleteItem message automatically if they have a 
managed copy of that item you are deleting.This does require that they both 
be using some type of channel which supports push (i.e. RTMP or polling).

When you remove an item from a collection, it is automatically removed from all 
fills which contained that collection and those changes are pushed to any 
clients that are currently managing those fills.

If you turn on the Message.* debug logging target on the server, you can see 
each message sent by the client and it contains messages for each client that 
is being routed a given message.

The autoRefresh setting is separate from autoSync (though requires that 
autoSyncEnabled be set to true).   AutoRefresh controls how the membership of 
filled collections is updated after an updateItem or createItem operation.   
The default is to re-execute the query once for each transaction that contains 
an update or create.   The old and new results are compared and any changes are 
pushed out to subscribed clients.

If you initiate a change on the server, you can notify clients of these changes 
but you have to use the DataServiceTransaction api to do so.   One of its 
methods is refreshFill which you can use to update a query.  In 2.5.1 that 
would only detect when items have been added or removed from the collection.  
In 2.6, there is an option now to look for property changes made to items as 
well.

Jeff

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Geoffrey
Sent: Thursday, July 31, 2008 1:48 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How do you auto-refresh LCDS?


I'm not sure how you refresh clients when there's a change on the
server. After I perform a _ds.fill(), the user can delete 1+ of the
items from the managed collection. The ActionScript looks like:

private function deleteItems():void
{
var selectedTasks:Array = taskList.getSelectedTasks();
for each (var task:ExploitationTaskVO in selectedTasks)
{
_ds.deleteItem(task);
}

// Commit the deletes to the server if needed
if (__ds.commitRequired)
{
__ds.commit();
}
}

_ds.commit() has to be called to propagate changes to the server
because I have _ds.autoCommit = false.

The LCDS JavaDocs state that changes from a createItem() or
updateItem() call will propigate to all clients if auto-refresh=true.
Is that true for deleteItem() calls too? And where is this
auto-refresh property? I don't see it under Java AbstractAssembler or
ActionScript DataService classes.

Also, what if I create, update, or delete a task on the server without
doing it through the DataService(like through a java delegate). Can I
force the DataService to refresh it's clients on the java side? Is
this what the DataServiceTransaction.refreshFill() method is for?

Thanks,
Geoff

inline: image001.jpginline: image002.jpg