com.vodafone360.people.engine.contactsync
Class FetchNativeContacts

java.lang.Object
  extended by com.vodafone360.people.engine.contactsync.BaseSyncProcessor
      extended by com.vodafone360.people.engine.contactsync.FetchNativeContacts

public class FetchNativeContacts
extends BaseSyncProcessor

Processor handling retrieval of contacts from the native database. These contacts will be synced to the People server if necessary.


Field Summary
private  NativeImporter mNativeImporter
          The NativeImporter instance that will take care of fetching contacts from the native address book.
 
Fields inherited from class com.vodafone360.people.engine.contactsync.BaseSyncProcessor
mCallback, mDb, mFailureList
 
Constructor Summary
protected FetchNativeContacts(IContactSyncCallback callback, DatabaseHelper db, Context context, ContentResolver cr)
          Processor constructor.
 
Method Summary
protected  void doCancel()
          Can be called anytime when the processor is active, to cancel the sync.
protected  void doStart()
          Implemented by all contact sync processors to initiate the sync.
 void onTimeoutEvent()
          Can be overriden by processors which are interested in timeout events.
 void processCommsResponse(ResponseQueue.Response resp)
          Called when a comms response is received from the server.
 void setProgress(java.lang.String contactName, int progress, int processed, int total)
          Helper function to report progress to the engine.
 
Methods inherited from class com.vodafone360.people.engine.contactsync.BaseSyncProcessor
cancel, complete, getEngine, markDbChanged, onComplete, setReqId, setSyncStatus, setTimeout, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mNativeImporter

private NativeImporter mNativeImporter
The NativeImporter instance that will take care of fetching contacts from the native address book.

Constructor Detail

FetchNativeContacts

protected FetchNativeContacts(IContactSyncCallback callback,
                              DatabaseHelper db,
                              Context context,
                              ContentResolver cr)
Processor constructor.

Parameters:
callback - Provides access to contact sync engine callback functions
db - Provides access to People database
context - Context needed for accessing native database
cr - ContentResolver used throughout people service
Method Detail

doStart

protected void doStart()
Description copied from class: BaseSyncProcessor
Implemented by all contact sync processors to initiate the sync. Once called, the processor needs to call the IContactSyncCallback.onProcessorComplete(ServiceStatus, String, Object) method when the sync is finished (the usual way to do this is by calling BaseSyncProcessor.complete(ServiceStatus)).

Specified by:
doStart in class BaseSyncProcessor

doCancel

protected void doCancel()
Description copied from class: BaseSyncProcessor
Can be called anytime when the processor is active, to cancel the sync. Should not complete the sync here because the above method BaseSyncProcessor.cancel() will take care of this.

Specified by:
doCancel in class BaseSyncProcessor

processCommsResponse

public void processCommsResponse(ResponseQueue.Response resp)
Description copied from class: BaseSyncProcessor
Called when a comms response is received from the server. This may be a response from a request issued by the processor or a push message.

Specified by:
processCommsResponse in class BaseSyncProcessor
Parameters:
resp - The response data

onTimeoutEvent

public void onTimeoutEvent()
Description copied from class: BaseSyncProcessor
Can be overriden by processors which are interested in timeout events. A processor will only receive timeout events while it is active.

Overrides:
onTimeoutEvent in class BaseSyncProcessor

setProgress

public void setProgress(java.lang.String contactName,
                        int progress,
                        int processed,
                        int total)
Helper function to report progress to the engine.

Parameters:
contactName - the name of the last contact
progress - the progression as a percentage
processed - the number of processed contacts
totla - the total count of contacts to process


JavaDoc