|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vodafone360.people.engine.contactsync.PeopleContactsApi
public class PeopleContactsApi
The PeopleContactsApi wrapper class of the People contacts database. Modifying the People database by adding, modifying and deleting contacts should be done via this class to ensure that the database remain consistent across all the tables. Note: this class is an attempt to separate the internal People contacts persistence from other components that need to access it (i.e. hiding its database, SQL tables and internals). It is not yet used by all the code base that would need to.
Field Summary | |
---|---|
private java.util.ArrayList<ContactDetail> |
mAddedDetails
Array of added ContactDetail. |
private java.util.List<ContactsTable.ContactIdInfo> |
mContactIdInfoList
Array of ContactIdInfo. |
private DatabaseHelper |
mDbh
Handler to the DatabaseHelper class. |
private java.util.ArrayList<ContactDetail> |
mDeletedDetails
Array of deleted ContactDetail. |
private java.util.ArrayList<ContactDetail> |
mUpdatedDetails
Array of updated ContactDetail. |
Constructor Summary | |
---|---|
PeopleContactsApi(DatabaseHelper dbh)
Constructor. |
Method Summary | |
---|---|
boolean |
addNativeContact(ContactChange[] contact)
Adds a native contact to the people database. |
boolean |
deleteNativeContact(long nativeId,
boolean syncToNative)
Deletes a Contact in the people database from its native id. |
ContactChange[] |
getContact(long nativeId)
Gets a contact from its native id. |
long[] |
getNativeContactsIds()
Gets the list of native contacts ids stored in the people database. |
ContactChange[] |
getNativeSyncableContactChanges(long localId)
Gets the syncable changes for a contact (i.e. the details not synced yet to native). |
long[] |
getNativeSyncableContactIds()
Gets an array of contacts people ids that need to be synced back to native. |
private long[] |
mergeSortedArrays(long[] array1,
long[] array2)
Merges two sorted arrays in one sorted array. |
private void |
setNativeContactId(ContactChange[] changes,
long nativeContactId)
Sets the native contact id to the new details. |
boolean |
syncBackDeletedNativeContact(ContactChange deletedContact)
Acknowledges the people database that the native side deleted the contact as requested. |
boolean |
syncBackNewNativeContact(ContactChange[] contact,
ContactChange[] nativeIds)
Sets the native ids to the people database since the contact has been added to native. |
boolean |
syncBackUpdatedNativeContact(ContactChange[] contact,
ContactChange[] nativeIds)
Sets the native ids to the people database for the added details on native side and removes the deleted details from the people database. |
void |
updateNativeContact(ContactChange[] contact)
Updates a native contact in the people database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private DatabaseHelper mDbh
private java.util.List<ContactsTable.ContactIdInfo> mContactIdInfoList
DatabaseHelper.syncDeleteContactList(List, boolean, boolean)
private java.util.ArrayList<ContactDetail> mAddedDetails
DatabaseHelper.syncAddContactDetailList(List, boolean, boolean)
private java.util.ArrayList<ContactDetail> mUpdatedDetails
DatabaseHelper.syncModifyContactDetailList(List, boolean, boolean)
private java.util.ArrayList<ContactDetail> mDeletedDetails
DatabaseHelper#syncDeletedContactDetailList(List, boolean, boolean)
Constructor Detail |
---|
public PeopleContactsApi(DatabaseHelper dbh)
dbh
- the DatabaseHelper to access the people databaseMethod Detail |
---|
public long[] getNativeContactsIds()
public long[] getNativeSyncableContactIds()
public boolean deleteNativeContact(long nativeId, boolean syncToNative)
nativeId
- the native id of the contact to deletesyncToNative
- true if the deletion has to be propagated to native, false otherwisepublic boolean addNativeContact(ContactChange[] contact)
contact
- the ContactChange array representing the contact to add
public void updateNativeContact(ContactChange[] contact)
contact
- the contact changes to apply to the contactpublic ContactChange[] getContact(long nativeId)
nativeId
- the native id of the contact
public ContactChange[] getNativeSyncableContactChanges(long localId)
localId
- the localId of the contact
private void setNativeContactId(ContactChange[] changes, long nativeContactId)
changes
- the array of changes where to set missing native contact idnativeContactId
- the native contact id to setpublic boolean syncBackNewNativeContact(ContactChange[] contact, ContactChange[] nativeIds)
contact
- the array of ContactChange representing the new contact the contactnativeIds
- the array of ContactChange containing the native ids for the added contact
public boolean syncBackDeletedNativeContact(ContactChange deletedContact)
deletedContact
- the ContactChange of the deleted contactpublic boolean syncBackUpdatedNativeContact(ContactChange[] contact, ContactChange[] nativeIds)
contact
- the array of ContactChange representing the updates that where performed on the contactnativeIds
- the array of ContactChange containing the native ids for the added details
private long[] mergeSortedArrays(long[] array1, long[] array2)
array1
- the first sorted arrayarray2
- the second sorted array
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc