MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Guia do Utilizador Página 240

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 256
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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;
}
Vista de página 239
1 2 ... 235 236 237 238 239 240 241 242 243 244 245 ... 255 256

Comentários a estes Manuais

Sem comentários