com.vodafone360.people.database.tables
Class ContactSourceTable

java.lang.Object
  extended by com.vodafone360.people.database.tables.ContactSourceTable

public abstract class ContactSourceTable
extends java.lang.Object

Contains all the functionality related to the contact source database table. This table stores a list of source information for each contact. This class is never instantiated hence all methods must be static.

Version:
%I%, %G%

Nested Class Summary
private static class ContactSourceTable.ContactSource
          Represents the data stored in a record
private static class ContactSourceTable.Field
          An enumeration of all the field names in the database.
 
Field Summary
private static java.lang.String TABLE_NAME
          Name of the table as it appears in the database
 
Constructor Summary
ContactSourceTable()
           
 
Method Summary
static boolean addContactSource(long localContactId, java.lang.String source, SQLiteDatabase writableDb)
          Add contact source to contact
static void create(SQLiteDatabase writeableDb)
          Create Contact Source Table.
static boolean deleteAllContactSources(long localContactId, SQLiteDatabase writableDb)
          Removes all sources associated with a specific contact.
static boolean fetchContactSources(long localContactId, java.util.List<java.lang.String> sourceList, SQLiteDatabase readableDb)
          Fetches all the sources for the specified contact
private static ContentValues fillUpdateData(ContactSourceTable.ContactSource contactSource)
          Returns a ContentValues object that can be used to insert or update a contact source in the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_NAME

private static final java.lang.String TABLE_NAME
Name of the table as it appears in the database

See Also:
Constant Field Values
Constructor Detail

ContactSourceTable

public ContactSourceTable()
Method Detail

create

public static void create(SQLiteDatabase writeableDb)
                   throws SQLException
Create Contact Source Table.

Parameters:
writeableDb - A writable SQLite database
Throws:
SQLException - If an SQL compilation error occurs

fillUpdateData

private static ContentValues fillUpdateData(ContactSourceTable.ContactSource contactSource)
Returns a ContentValues object that can be used to insert or update a contact source in the table.

Parameters:
contactSource - A ContactSource object with the local Contact ID and source set appropriately.
Returns:
The ContactValues object

addContactSource

public static boolean addContactSource(long localContactId,
                                       java.lang.String source,
                                       SQLiteDatabase writableDb)
Add contact source to contact

Parameters:
localContactId - The local Contact ID from Contacts table
source - The source string from the server
writeableDb - A writable SQLite database
Returns:
true if successful, false otherwise

deleteAllContactSources

public static boolean deleteAllContactSources(long localContactId,
                                              SQLiteDatabase writableDb)
Removes all sources associated with a specific contact.

Parameters:
localContactId - The local Contact ID from Contacts table
writeableDb - A writable SQLite database
Returns:
true if successful, false otherwise

fetchContactSources

public static boolean fetchContactSources(long localContactId,
                                          java.util.List<java.lang.String> sourceList,
                                          SQLiteDatabase readableDb)
Fetches all the sources for the specified contact

Parameters:
localContactId - The local Contact ID from Contacts table
sourceList - A list that will be populated with the source strings
readableDb - A readable SQLite database
Returns:
true if successful, false otherwise


JavaDoc