O'Reilly logo

Agile Enterprise Application Development with Flex by Tony Hillerson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Deep Data Synchronization with BlazeDS

Due to space constraints, you’ve been presented with the simplified fragments of the DataCollection code to highlight its main features and give you a push in the right direction, should you want to create your own version of such a collection. Here are a few more possible approaches that may prove useful.

Note

You can find the complete and up-to-date source code of the DataCollection class (900+ lines of code) in the SourceForge repository.

Nested DataCollections

Previously, you learned about data synchronization between DataCollection and remote Java objects via the method sync(). But what if you have a situation with nested DataCollection objects that can be modified on the client side? How do you synchronize the changes in this case? Here’s the magic line of code that will perform deep synchronization of the DataCollection and all its nested children:

collection.sync(true);

If you don’t like manual coding, Clear Data Builder will perform deep synchronization of hierarchical DataCollections with the server, so that if an item of the collection contains child collections (Example 6-16, shown later), the entire tree of changes gets synchronized with the Java backend in one transaction.

Consider a sample order-processing application (Figure 6-7) that allows the user to navigate from order to order, editing the master information (order) as well as its details (order items).

Figure 6-7. The order-processing application

The user can modify either of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required