MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Guide de l'utilisateur Page 240

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 256
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 239
240 Use the Data Management Service
View the sync method
The sync method of an assembler class lets you handle data changes sent from client-side
DataService components. A sync method accepts one input parameter, which is a java.util.List
object that contains a list of data changes of type flex.data.ChangeObject. The list of changes
can include new data items, updates, and deletions.
Depending on whether a change is an add, update, or delete, the sync method calls the classs
doCreate(), doUpdate(), or doDelete() method. The doCreate(), doUpdate(), and
doDelete() methods are implementations of methods in the flex.data.ChangeObject
interface. These methods call methods on the ContactDAO object, which interacts with a
SQL database.
The following example shows the Java source code for the ContactAssember classs sync
method:
...
import flex.data.ChangeObject;
...
public class ContactAssembler {
...
public List syncContacts(List changes) {
Iterator iterator = changes.iterator();
ChangeObject co;
while (iterator.hasNext()) {
co = (ChangeObject) iterator.next();
if (co.isCreate()) {
co = doCreate(co);
}
else if (co.isUpdate()) {
doUpdate(co);
}
else if (co.isDelete()) {
doDelete(co);
}
}
return changes;
}
Vue de la page 239
1 2 ... 235 236 237 238 239 240 241 242 243 244 245 ... 255 256

Commentaires sur ces manuels

Pas de commentaire