| 
 |   | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.vodafone360.people.database.tables.ContactChangeLogTable
public abstract class ContactChangeLogTable
Contains all the functionality related to the contact change log database table. This table is used to persist database changes that have not yet been synced to the server. This class is never instantiated hence all methods must be static.
| Nested Class Summary | |
|---|---|
| static class | ContactChangeLogTable.ContactChangeInfoWraps up the data present in the change log table | 
| static class | ContactChangeLogTable.ContactChangeTypeEnumerates the type of changes supported by this table, including: DELETE_CONTACT: A contact has been deleted from the database and needs to be deleted on the server. | 
| private static class | ContactChangeLogTable.FieldAn enumeration of all the field names in the database. | 
| Field Summary | |
|---|---|
| private static int | CONTACTCHANGEIDColumn indices for database queries | 
| private static int | GROUPORRELID | 
| private static int | LOCALCONTACTID | 
| private static int | LOCALDETAILID | 
| private static int | SERVERCONTACTID | 
| private static int | SERVERDETAILID | 
| private static int | SERVERDETAILKEY | 
| private static java.lang.String | TABLE_NAMEName of the table as it appears in the database | 
| private static java.lang.String | TEMP_CONTACT_CHANGE_LOG_IDSecondary key which links to the primary key of the change log table | 
| private static java.lang.String | TEMP_CONTACT_CHANGE_TABLEName of a temporary table created and used to batch the deletion of sync data from the change log table. | 
| private static java.lang.String | TEMP_CONTACT_CHANGE_TABLE_IDPrimary key for the temporary table | 
| private static int | TYPE | 
| Constructor Summary | |
|---|---|
| ContactChangeLogTable() | |
| Method Summary | |
|---|---|
| private static boolean | addContactChange(ContactChangeLogTable.ContactChangeInfo info,
                 SQLiteDatabase writableDb)Inserts a contact change into the table. | 
| static boolean | addDeletedContactChange(java.lang.Long localContactId,
                        java.lang.Long serverContactId,
                        boolean addToLog,
                        SQLiteDatabase writableDb)Inserts "Delete Contact" operation into the change log. | 
| static boolean | addDeletedContactDetailChange(ContactDetail detail,
                              boolean addToLog,
                              SQLiteDatabase writableDb)Inserts "Delete Contact Detail" operation into the change log. | 
| static boolean | addGroupRel(long localContactId,
            java.lang.Long serverContactId,
            java.lang.Long groupId,
            SQLiteDatabase writableDb)Inserts "Add contact to group" operation into the change log. | 
| static void | create(SQLiteDatabase writableDb)Create Server Change Log Table. | 
| static boolean | deleteContactChanges(java.util.List<ContactChangeLogTable.ContactChangeInfo> changeInfoList,
                     SQLiteDatabase writableDb)Removes a list of changes from the change log table. | 
| static boolean | deleteGroupRel(long localContactId,
               java.lang.Long serverContactId,
               java.lang.Long groupId,
               SQLiteDatabase writableDb)Inserts "Remove contact from group" operation into the change log. | 
| static boolean | fetchContactChangeLog(java.util.List<ContactChangeLogTable.ContactChangeInfo> contactChangeList,
                      ContactChangeLogTable.ContactChangeType type,
                      long firstIndex,
                      long count,
                      SQLiteDatabase readableDb)Fetches a list of changes from the table for a specific type. | 
| static boolean | fetchMeProfileChangeLog(java.util.List<ContactChangeLogTable.ContactChangeInfo> changeList,
                        ContactChangeLogTable.ContactChangeType type,
                        SQLiteDatabase readableDb,
                        java.lang.Long meProfileServerId)Fetches a list of changes on the contact details for the me-profile. | 
| static int | fetchNoOfContactDetailChanges(ContactChangeLogTable.ContactChangeType type,
                              SQLiteDatabase readableDb)Fetches the number of changes listed in the table. | 
| private static java.lang.Long | findContactGroup(long localContactId,
                 long groupId,
                 SQLiteDatabase readableDb)Searches the change log for an association between contact and group | 
| private static ContactChangeLogTable.ContactChangeInfo | getQueryData(Cursor c)Fetches change log information from a cursor at the current position. | 
| private static java.lang.String | getQueryStringSql(java.lang.String whereClause)Fetches a comma separated list of table fields which can be used in an SQL SELECT statement as the query projection. | 
| private static boolean | isContactChangeInList(java.lang.Long localContactId,
                      ContactChangeLogTable.ContactChangeType type,
                      SQLiteDatabase readableDb)Determines if a specific contact and change type exists in the change log. | 
| private static boolean | isContactDetailChangeInList(java.lang.Long localDetailId,
                            ContactChangeLogTable.ContactChangeType type,
                            SQLiteDatabase readableDb)Determines if a specific contact detail and change type exists in the change log. | 
| private static boolean | removeContactChange(long ContactChangeId,
                    SQLiteDatabase writableDb)Deletes a specific contact change record from the table | 
| private static boolean | removeContactChanges(java.lang.Long localContactId,
                     SQLiteDatabase writableDb)Removes all changes from the change log associated with a particular contact. | 
| private static boolean | removeContactDetailChanges(java.lang.Long localDetailId,
                           SQLiteDatabase writableDb)Removes all changes from the change log associated with a particular contact detail. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
private static final java.lang.String TABLE_NAME
private static final java.lang.String TEMP_CONTACT_CHANGE_TABLE
private static final java.lang.String TEMP_CONTACT_CHANGE_TABLE_ID
private static final java.lang.String TEMP_CONTACT_CHANGE_LOG_ID
private static final int CONTACTCHANGEID
private static final int TYPE
private static final int LOCALCONTACTID
private static final int SERVERCONTACTID
private static final int LOCALDETAILID
private static final int SERVERDETAILID
private static final int SERVERDETAILKEY
private static final int GROUPORRELID
| Constructor Detail | 
|---|
public ContactChangeLogTable()
| Method Detail | 
|---|
public static void create(SQLiteDatabase writableDb)
                   throws SQLException
writeableDb - A writable SQLite database
SQLException - If an SQL compilation error occursprivate static java.lang.String getQueryStringSql(java.lang.String whereClause)
getQueryData(Cursor) method can used to fetch data from the
 cursor.
whereClause - A where clause (without the where) to filter the
            result. Cannot be null.
private static ContactChangeLogTable.ContactChangeInfo getQueryData(Cursor c)
getQueryStringSql(String) method should be used to make the
 query.
c - The cursor from the query
public static boolean addGroupRel(long localContactId,
                                  java.lang.Long serverContactId,
                                  java.lang.Long groupId,
                                  SQLiteDatabase writableDb)
localContactId - Local contact ID from the Contacts tableserverContactId - Server contact ID or null if the contact has not
            yet been synced.groupId - server group IDwritableDb - Writable SQLite database
public static boolean deleteGroupRel(long localContactId,
                                     java.lang.Long serverContactId,
                                     java.lang.Long groupId,
                                     SQLiteDatabase writableDb)
localContactId - Local contact ID from the Contacts tableserverContactId - Server contact ID or null if the contact has not
            yet been synced.groupId - server group IDwritableDb - Writable SQLite database
public static boolean addDeletedContactChange(java.lang.Long localContactId,
                                              java.lang.Long serverContactId,
                                              boolean addToLog,
                                              SQLiteDatabase writableDb)
localContactId - Local contact ID from the Contacts tableserverContactId - Server contact ID. If this is null it is assumed
            that the contact hasn't yet been synced with the server, so
            the new contact change is removed from the log and the
            function returns.addToLog - False - removes all changes associated with the contact
            from the change log True - to also insert deletion in change
            log.writableDb - Writable SQLite database
public static boolean addDeletedContactDetailChange(ContactDetail detail,
                                                    boolean addToLog,
                                                    SQLiteDatabase writableDb)
detail - Must have a valid local contact ID, local detail ID and
            key. Will not be added to the change log if the contact server
            ID is null.addToLog - False - removes all changes associated with the detail
            from the change log True - to also insert deletion in change
            log.writableDb - Writable SQLite database
private static boolean addContactChange(ContactChangeLogTable.ContactChangeInfo info,
                                        SQLiteDatabase writableDb)
info - contact change info. This must have a valid type field and
            depending on type other fields may also be required (see
            ContactChangeLogTable.ContactChangeType).writableDb - Writable SQLite database
private static boolean isContactChangeInList(java.lang.Long localContactId,
                                             ContactChangeLogTable.ContactChangeType type,
                                             SQLiteDatabase readableDb)
localContactId - Local contact ID from the Contacts tabletype - The change type to findreadableDb - Readable SQLite database
private static boolean isContactDetailChangeInList(java.lang.Long localDetailId,
                                                   ContactChangeLogTable.ContactChangeType type,
                                                   SQLiteDatabase readableDb)
localDetailId - Local contact detail ID from ContactDetail tabletype - The change type to findreadableDb - Readable SQLite database
private static java.lang.Long findContactGroup(long localContactId,
                                               long groupId,
                                               SQLiteDatabase readableDb)
localContactId - Local contact ID from the Contacts tablegroupId - Server group IDreadableDb - Readable SQLite database
private static boolean removeContactChanges(java.lang.Long localContactId,
                                            SQLiteDatabase writableDb)
localContactId - Local contact ID from the Contacts tablewritableDb - Writable SQLite database
private static boolean removeContactChange(long ContactChangeId,
                                           SQLiteDatabase writableDb)
ContactChangeId - The primary ID identifying the recordwritableDb - Writable SQLite database
private static boolean removeContactDetailChanges(java.lang.Long localDetailId,
                                                  SQLiteDatabase writableDb)
localDetailId - Local contact detail ID from the Contact details
            tablewritableDb - Writable SQLite database
public static int fetchNoOfContactDetailChanges(ContactChangeLogTable.ContactChangeType type,
                                                SQLiteDatabase readableDb)
type - The ContactChangeType to count, if NULL then all change types
            are included.readableDb - Readable SQLite database
public static boolean deleteContactChanges(java.util.List<ContactChangeLogTable.ContactChangeInfo> changeInfoList,
                                           SQLiteDatabase writableDb)
changeInfoList - A list of ContactChangeLogTable.ContactChangeInfo objects. Note
            that only the mContactChangeId field of this object is
            actually used. The object is passed in as a convenience.writableDb - Writable SQLite database
public static boolean fetchContactChangeLog(java.util.List<ContactChangeLogTable.ContactChangeInfo> contactChangeList,
                                            ContactChangeLogTable.ContactChangeType type,
                                            long firstIndex,
                                            long count,
                                            SQLiteDatabase readableDb)
contactChangeList - The list to be populatedtype - The type of change to returnfirstIndex - An index of the first record to return (0 based)count - The number of records to return (or -1 to return all)readableDb - Readable SQLite database
public static boolean fetchMeProfileChangeLog(java.util.List<ContactChangeLogTable.ContactChangeInfo> changeList,
                                              ContactChangeLogTable.ContactChangeType type,
                                              SQLiteDatabase readableDb,
                                              java.lang.Long meProfileServerId)
changeList - The list to populate with contact changes.type - The type of change to fetch from the contact.readableDb - The database to read from.meProfileServerId - The server id of the me-profile.
| 
 |   | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
				
				JavaDoc