com.vodafone360.people.database.tables
Class ConversationsTable

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

public abstract class ConversationsTable
extends java.lang.Object


Nested Class Summary
private static class ConversationsTable.Field
          An enumeration of all the field names in the database, containing ID, LOCAL_CONTACT_ID, USER_ID, NETWORK_ID, NETWORK_STATUS.
 
Field Summary
private static java.lang.String COLUMNS
           
private static int CONVERSATION_ID
           
private static java.lang.String DEFAULT_ERROR_MESSAGE
           
private static int LATEST_MESSAGE
           
private static java.lang.String TABLE_NAME
          The name of the table as it appears in the database.
private static long THIRTY_MINUTES
           
private static int USER_ID
           
 
Constructor Summary
ConversationsTable()
           
 
Method Summary
static void addNewConversationId(ChatMessage msg, SQLiteDatabase writableDb)
           
private static boolean conversationIdExists(java.lang.String conversationId, SQLiteDatabase readableDb)
           
static void create(SQLiteDatabase writableDb)
          This method creates the PresenceTable.
static void fillMessageInByLocalContactIdAndNetworkId(ChatMessage msg, SQLiteDatabase readableDb, SQLiteDatabase writableDb)
          TODO: this method might need redesign for performance: don't SELECT !!
static int removeConversation(long localContactId, int network, SQLiteDatabase writableDb)
          This method removes the conversation with this contact on this network
static int removeConversation(java.lang.String conversationId, SQLiteDatabase writableDb)
          This method removes the conversation with this id
private static int removeOldConversationByLocalContactIdAndNetworkId(long localContactId, int networkId, SQLiteDatabase writableDb)
           
 
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
The name of the table as it appears in the database. TODO: methods signatures might change

See Also:
Constant Field Values

DEFAULT_ERROR_MESSAGE

private static final java.lang.String DEFAULT_ERROR_MESSAGE
See Also:
Constant Field Values

THIRTY_MINUTES

private static final long THIRTY_MINUTES
See Also:
Constant Field Values

COLUMNS

private static final java.lang.String COLUMNS
See Also:
Constant Field Values

CONVERSATION_ID

private static final int CONVERSATION_ID
See Also:
Constant Field Values

USER_ID

private static final int USER_ID
See Also:
Constant Field Values

LATEST_MESSAGE

private static final int LATEST_MESSAGE
See Also:
Constant Field Values
Constructor Detail

ConversationsTable

public ConversationsTable()
Method Detail

create

public static void create(SQLiteDatabase writableDb)
                   throws SQLException,
                          java.lang.NullPointerException
This method creates the PresenceTable.

Parameters:
writableDb - - the writable database
Throws:
SQLException - is thrown when request to create a table fails with an SQLException
java.lang.NullPointerException - if the passed in database instance is null

addNewConversationId

public static void addNewConversationId(ChatMessage msg,
                                        SQLiteDatabase writableDb)
                                 throws SQLException,
                                        java.lang.NullPointerException
Throws:
SQLException
java.lang.NullPointerException

fillMessageInByLocalContactIdAndNetworkId

public static void fillMessageInByLocalContactIdAndNetworkId(ChatMessage msg,
                                                             SQLiteDatabase readableDb,
                                                             SQLiteDatabase writableDb)
                                                      throws SQLException,
                                                             java.lang.NullPointerException
TODO: this method might need redesign for performance: don't SELECT !!*

Parameters:
timeLineId -
readableDb -
Throws:
SQLException
java.lang.NullPointerException

removeOldConversationByLocalContactIdAndNetworkId

private static int removeOldConversationByLocalContactIdAndNetworkId(long localContactId,
                                                                     int networkId,
                                                                     SQLiteDatabase writableDb)
                                                              throws SQLException,
                                                                     java.lang.NullPointerException
Parameters:
localContactId -
networkId -
writableDb -
Returns:
Throws:
SQLException
java.lang.NullPointerException

conversationIdExists

private static boolean conversationIdExists(java.lang.String conversationId,
                                            SQLiteDatabase readableDb)
                                     throws SQLException,
                                            java.lang.NullPointerException
Parameters:
conversationId -
readableDb -
Returns:
Throws:
SQLException
java.lang.NullPointerException

removeConversation

public static int removeConversation(java.lang.String conversationId,
                                     SQLiteDatabase writableDb)
                              throws SQLException,
                                     java.lang.NullPointerException
This method removes the conversation with this id

Parameters:
conversationId - String - the conversation id to be removed
writableDb - DatabaseHelper - database
Returns:
the number of affected rows
Throws:
SQLException
java.lang.NullPointerException

removeConversation

public static int removeConversation(long localContactId,
                                     int network,
                                     SQLiteDatabase writableDb)
                              throws SQLException,
                                     java.lang.NullPointerException
This method removes the conversation with this contact on this network

Parameters:
localContactId - long - the contacts mLocalContactId
networkId - int - the network id, @see SocialNetwork
writableDb - DatabaseHelper - the database
Returns:
the number of affected rows
Throws:
SQLException
java.lang.NullPointerException


JavaDoc