Mobile Business Object States

A mobile business object can be in one of three states:

The Mobile Business Object class provides properties for querying the original state and the downloaded state:

public Customer getOriginalState();
public Customer getDownloadState();

The original state is valid only before the application synchronizes with the Unwired Server. After synchronization has completed successfully, the original state is cleared and set to null.

Customer cust = Customer.findById(101);        // state 1
cust.setFname(“firstName");
cust.setCompany_name("Sybase");
cust.setPhone("777-8888");
cust.save();                                   // state 2 
Customer org = cust.getOriginalState();        // state 1
//suppose there is new download for Customer 101 here
Customer download = cust.getDownloadState();   // state 3
cust.cancelPending();                          // state 3

Using all three states, the application can resolve most conflicts that may occur.