MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Guida Utente Pagina 240

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 256
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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;
}
Vedere la pagina 239
1 2 ... 235 236 237 238 239 240 241 242 243 244 245 ... 255 256

Commenti su questo manuale

Nessun commento