Groups | Blog | Home
all groups > flash data integration > january 2005 >

flash data integration : Relational Database Updates


knarfism
1/19/2005 11:07:46 PM
Hello!

I am building a fairly extensive relational database interface, and I am
toying with the idea of using Flash MX 2004's Form-Based programming. I tried
this a while ago, when "Flash Remoting" just barely got started, but there
wasn't enough help out for me to get answers to my questions. Maybe now, there
are enough of you genius programmer types to help me out! :)

As an example, I'll create a form for editing a Contact. This Contact will be
associated with a Client by a relational table (ContactClient), thus allowing
multiple contacts to belong to one client. The problem I am running into is
that many users will access this web service at once in a given day. One user
may find out that the contact, "Jane Doe", has a new phone number. At the same
time, another user may be instructed by management to remove the entire contact
record, as "Jane Doe" is no longer employed by Client (forgive the shakey
scenario--but you get the point). Both users will make changes on the Flash MX
2004 Form, the resolver will see the changes, and prepare a delta packet. If
the user who edits sends the packet AFTER the user who deletes the entire
Contact record, what will happen with the delta packet from the second user,
who merely issued an edit command?

It's a question of the stateless environment allowing for simultaneous, yet
disagreeable edit: who wins? Or, moreover, how does ColdFusion/Flash manage the
disagreement?

If my approach is entirely wrong, please let me know a better one--this
problem is plaguing me greatly. :(

Thanks!
Frank
denny1
1/21/2005 3:57:49 PM
First I would wrap your server-side business logic in <cftransaction> tags.
This would assure that the update/delete functionality would be locked down
for concurrent requests. One of the advantages of using Flash is that it is a
stateful environment. State can be maintained via some common design patterns
without trips to the server. I have built a similar architecture using
BusinessDelegate-ValueObject-ViewHelper design patterns. Personally, I have not
used the resolver components and I think to make this work you might have to
write your own classes.

Basically if one user would delete a record, then another user would try to
edit the record it would no longer exist in the database. You could then trap
an error message in your Fault handler that would notify the user that that
record no longer existed. Similarily, you could then update/refrsh the view
with a service call in your Result handler and bind the results to whatever
component you are using (list, datagrid, combo) etc.

Dennis
morksinaanab
1/25/2005 11:20:33 PM
Hi denny1, sounds like you know what you are talking about. I as well created
an app without using the delta packets, rather building my own objects in as,
mirroring the server side objects i needed (value objects). your error option
ofcourse is a good approach. I would do the same. One problem i had was with
inheritance in soap objects. the soap parser of flash apparently defines all
objects as it parent (if it inherits). Did you have the same trouble?
denny1
1/26/2005 4:16:46 PM
Hello morksinaanab,

Although Flash is capable of passing data between client and server as SOAP
calls, I prefer to use the AMF protocol. Serialization and deserialization is
handled behind the scenes by the Flash Gateway. AMF is designed to work with
Flash ActionScript (complex) datatypes. Client side objects (ActionScript) will
become the equivalent server side (JAVA, or whatever) objects via the Flash
Gateway (or visa-versa).

Using AMF, I have not found inheritance to be an issue.

Dennis
AddThis Social Bookmark Button