|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vodafone360.people.engine.contactsync.BaseSyncProcessor com.vodafone360.people.engine.contactsync.UploadServerContacts
public class UploadServerContacts
Processor handling upload of contacts to the People server.
Nested Class Summary | |
---|---|
protected static class |
UploadServerContacts.InternalState
Internal states supported by the processor. |
Field Summary | |
---|---|
private java.lang.Long |
mActiveGroupId
Contains the server ID of the group being associated with a contact. |
private static int |
MAX_PROGESS
Maximum progress percentage value. |
protected static int |
MAX_UP_PAGE_SIZE
Maximum number of contacts to send to the server in a request. |
private java.util.List<ContactChangeLogTable.ContactChangeInfo> |
mContactChangeInfoList
Contains the next page of changes from the server change log. |
private java.util.List<Contact> |
mContactChangeList
Contains the next page of contacts being sent to the server which have either been added or changed. |
private java.util.List<java.lang.Long> |
mContactIdList
List of server IDs which is sent to the server by the DeleteContacts API. |
private Cursor |
mContactsCursor
Cursor used for fetching new/modified contacts from the NowPlus database. |
private long |
mDbSyncTime
Used for debug to monitor the database read/write time during a sync. |
private Contact |
mDeleteDetailContact
Contains the main contact during the contact detail deletion process. |
private java.util.List<GroupItem> |
mGroupList
Current list of groups being added to the contacts listed in the mContactIdList . |
private UploadServerContacts.InternalState |
mInternalState
Current internal state of the processor. |
private int |
mItemsDone
Total number of contacts sync'ed so far. |
private long |
mNoOfItemsSent
No of items which were sent in the current batch, used for updating the progress bar once a particular call is complete. |
private int |
mTotalNoOfItems
Total number of items which need to be sync'ed to the server (includes all types of updates). |
private static long |
NANOSECONDS_IN_MS
Used for converting between nanoseconds and milliseconds. |
Fields inherited from class com.vodafone360.people.engine.contactsync.BaseSyncProcessor |
---|
mCallback, mDb, mFailureList |
Constructor Summary | |
---|---|
UploadServerContacts(IContactSyncCallback callback,
DatabaseHelper db)
Processor constructor. |
Method Summary | |
---|---|
protected void |
doCancel()
Called by framework to cancel contact sync. |
protected void |
doStart()
Called by framework to start the processor running. |
java.lang.Long |
getActiveGroupId()
Returns the server ID of the group being associated with a contact (for testing only). |
java.util.List<Contact> |
getContactChangeList()
Returns the next page of contacts being sent to the server which have either been added or changed (for testing only). |
java.util.List<java.lang.Long> |
getContactIdList()
Returns a list of server IDs which is sent to the server by the DeleteContacts API (for testing only). |
Contact |
getDeleteDetailContact()
Returns the main contact during the contact detail deletion process (for testing only). |
java.util.List<GroupItem> |
getGroupList()
Return the current list of groups being added to the contacts listed in the mContactIdList . |
UploadServerContacts.InternalState |
getInternalState()
Returns the current internal state of the processor (for testing only). |
private ServiceStatus |
handleUploadDetailChanges(Contact contactSrc,
Contact contactDest,
java.util.List<DatabaseHelper.ServerIdInfo> detailServerIdList)
Called when handling the server response from a new contact or modify contact sync. |
private void |
moveToNextState()
Changes the state of the processor to the next internal state. |
void |
processCommsResponse(ResponseQueue.Response resp)
Called by framework when a response to a server request is received. |
private void |
processDeletedContactsResp(ResponseQueue.Response resp)
Called when a server response is received during a deleted contact sync. |
private void |
processDeletedDetailsResp(ResponseQueue.Response resp)
Called when a server response is received during a deleted contact detail sync. |
private void |
processGroupAdditionsResp(ResponseQueue.Response resp)
Called when a server response is received during a group/contact add relation sync. |
private void |
processGroupDeletionsResp(ResponseQueue.Response resp)
Called when a server response is received during a group/contact delete relation sync. |
private void |
processModifiedDetailsResp(ResponseQueue.Response resp)
Called when a server response is received during a modified contact sync. |
private void |
processNewContactsResp(ResponseQueue.Response resp)
Called when a server response is received during a new contact sync. |
private void |
sendNextAddGroupRelationsPage()
Sends next add contact/group relation request to the server. |
private void |
sendNextContactAdditionsPage()
Sends the next page of new contacts to the server. |
private void |
sendNextDeleteContactsPage()
Sends the next page of deleted contacts to the server. |
private void |
sendNextDeleteDetailsPage()
Sends the next deleted details to the server. |
private void |
sendNextDelGroupRelationsPage()
Sends next delete contact/group relation request to the server. |
private void |
sendNextDetailChangesPage()
Sends the next page of new/modified details to the server. |
private void |
startProcessDeletedContacts()
Sends the first page of deleted contacts to the server. |
private void |
startProcessDeletedDetails()
Sends the deleted details of the first contact to the server. |
private void |
startProcessGroupAdditions()
Sends the first contact/group relation addition request to the server. |
private void |
startProcessGroupDeletions()
Sends the first contact/group relation deletion request to the server. |
private void |
startProcessModifiedDetails()
Sends the first page of contact modifications (includes new and modified details) to the server. |
private void |
startProcessNewContacts()
Sends the first page of new contacts to the server. |
private void |
updateProgress()
Helper method to update the progress UI. |
Methods inherited from class com.vodafone360.people.engine.contactsync.BaseSyncProcessor |
---|
cancel, complete, getEngine, markDbChanged, onComplete, onTimeoutEvent, setReqId, setSyncStatus, setTimeout, start |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int MAX_PROGESS
private static final long NANOSECONDS_IN_MS
protected static final int MAX_UP_PAGE_SIZE
private long mNoOfItemsSent
private int mTotalNoOfItems
private int mItemsDone
private final java.util.List<ContactChangeLogTable.ContactChangeInfo> mContactChangeInfoList
private final java.util.List<Contact> mContactChangeList
private UploadServerContacts.InternalState mInternalState
private long mDbSyncTime
private Cursor mContactsCursor
private final java.util.List<java.lang.Long> mContactIdList
DeleteContacts
API.
private final java.util.List<GroupItem> mGroupList
mContactIdList
. Will only contain a single group (list is needed
for the
GroupPrivacy.addContactGroupRelations(BaseEngine, List, List)
API).
private Contact mDeleteDetailContact
private java.lang.Long mActiveGroupId
Constructor Detail |
---|
public UploadServerContacts(IContactSyncCallback callback, DatabaseHelper db)
callback
- Provides access to contact sync engine callback
functions.db
- NowPlus Database needed for reading contact and group
informationMethod Detail |
---|
protected final void doStart()
doStart
in class BaseSyncProcessor
private void startProcessNewContacts()
private void startProcessModifiedDetails()
private void startProcessDeletedContacts()
private void startProcessDeletedDetails()
private void startProcessGroupAdditions()
private void startProcessGroupDeletions()
private void sendNextContactAdditionsPage()
private void sendNextDetailChangesPage()
private void sendNextDeleteContactsPage()
private void sendNextDeleteDetailsPage()
private void sendNextAddGroupRelationsPage()
private void sendNextDelGroupRelationsPage()
private void moveToNextState()
protected void doCancel()
doCancel
in class BaseSyncProcessor
public final void processCommsResponse(ResponseQueue.Response resp)
processCommsResponse
in class BaseSyncProcessor
resp
- Response dataprivate void processNewContactsResp(ResponseQueue.Response resp)
resp
- Response from server.private void processModifiedDetailsResp(ResponseQueue.Response resp)
resp
- Response from server.private void processDeletedContactsResp(ResponseQueue.Response resp)
resp
- Response from server.private void processDeletedDetailsResp(ResponseQueue.Response resp)
resp
- Response from server.private void processGroupAdditionsResp(ResponseQueue.Response resp)
resp
- Response from server.private void processGroupDeletionsResp(ResponseQueue.Response resp)
resp
- Response from server.private ServiceStatus handleUploadDetailChanges(Contact contactSrc, Contact contactDest, java.util.List<DatabaseHelper.ServerIdInfo> detailServerIdList)
contactSrc
- Contact received from server.contactDest
- Contact from database.detailServerIdList
- List of contact details with updated unique id.
private void updateProgress()
public final UploadServerContacts.InternalState getInternalState()
public final java.util.List<java.lang.Long> getContactIdList()
DeleteContacts
API (for testing only).
public final java.util.List<GroupItem> getGroupList()
mContactIdList
. Will only contain a single group (list is
needed for the
GroupPrivacy.addContactGroupRelations(BaseEngine, List, List)
API) (for testing only).
public final java.util.List<Contact> getContactChangeList()
public final Contact getDeleteDetailContact()
public final java.lang.Long getActiveGroupId()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc