|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vodafone360.people.database.tables.ContactSummaryTable
public abstract class ContactSummaryTable
The ContactSummaryTable contains a summary of important contact details for each contact such as name, status and Avatar availability. This data is duplicated here to improve the performance of the main contact list in the UI (otherwise the a costly inner join between the contact and contact details table would be needed). This class is never instantiated hence all methods must be static.
Nested Class Summary | |
---|---|
static class |
ContactSummaryTable.Field
An enumeration of all the field names in the database. |
Field Summary | |
---|---|
private static int |
ALTDETAIL_TYPE
|
private static int |
ALTFIELD_TYPE
|
private static int |
FORMATTED_NAME
|
private static int |
FRIEND_MINE
|
private static int |
LOCALCONTACT_ID
|
private static int |
NATIVE_CONTACTID
|
private static int |
ONLINE_STATUS
Deprecated. |
private static int |
PICTURE_LOADED
|
private static int |
SNS
|
private static java.util.HashMap<java.lang.Long,java.lang.Integer> |
sPresenceMap
This holds the presence information for each contact in the ContactSummaryTable |
private static java.lang.String |
SQL_STRING_LOCAL_ID_EQUAL_QUESTION_MARK
LocalId = ? |
private static int |
STATUS_TEXT
|
private static int |
SUMMARY_ID
Column indices which match the query string returned by getFullQueryList() . |
private static int |
SYNCTOPHONE
|
static java.lang.String |
TABLE_INDEX_NAME
|
static java.lang.String |
TABLE_NAME
The name of the table as it appears in the database. |
Constructor Summary | |
---|---|
ContactSummaryTable()
|
Method Summary | |
---|---|
static ServiceStatus |
addContact(Contact contact,
SQLiteDatabase writableDb)
Adds contact summary information to the table for a new contact. |
private static void |
addToPresenceMap(java.lang.Long localContactID)
This API should be called whenever a contact is added. |
private static void |
clearPresenceMap()
Clears the Presence Map table. |
static void |
create(SQLiteDatabase writeableDb)
Creates ContactSummary Table. |
static ServiceStatus |
deleteContact(java.lang.Long localContactId,
SQLiteDatabase writableDb)
Deletes a contact summary record |
private static void |
deleteFromPresenceMap(java.lang.Long localContactId)
This API should be called whenever a contact is deleted from teh ContactSUmmaryTable. |
static boolean |
fetchNativeContactIdList(java.util.List<java.lang.Integer> summaryList,
SQLiteDatabase readableDb)
Fetches a list of native contact IDs from the summary table (in ascending order) |
static ServiceStatus |
fetchSummaryItem(long localContactId,
ContactSummary summary,
SQLiteDatabase readableDb)
Fetches the contact summary for a particular contact |
private static ContactDetail |
findAlternativeNameContactDetail(ContentValues values,
java.util.List<ContactDetail> details)
This method returns the most preferred contact detail to be displayed instead of the contact name when vcard.name is missing. |
private static boolean |
getContactValuesFromDetail(ContentValues contactValues,
ContactDetail newDetail)
Adds suitable entries to a ContentValues objects for inserting or updating the contact summary table, from a contact detail. |
private static java.lang.String |
getFullQueryList()
Fetches the list of table fields that can be injected into an SQL query statement. |
private static java.lang.String |
getGroupConstraint(java.lang.Long groupFilterId)
Get a group constraint for SQL query depending on the group type. |
private static java.lang.String |
getOnlineWhereClause()
This API creates the string to be used in the IN clause when getting the list of all online contacts. |
private static java.lang.String |
getOrderedQueryStringSql()
Returns a full SQL query statement to fetch the contact summary information. |
private static java.lang.String |
getOrderedQueryStringSql(java.lang.String whereClause)
Returns a full SQL query statement to fetch the contact summary information in alphabetical order of contact name. |
private static ContactSummary.OnlineStatus |
getPresence(java.lang.Long localContactID)
Fetches the presence of the contact with localContactID |
static ContactSummary |
getQueryData(Cursor c)
Fetches the contact summary data from the current record of the given cursor. |
private static java.lang.String |
getQueryStringSql(java.lang.String whereClause)
Returns a full SQL query statement to fetch the contact summary information. |
private static boolean |
isEmpty(java.lang.String string)
|
private static boolean |
isPreferredAltDetail(ContactDetail newDetail,
ContactDetail currentDetail)
Determines if a contact detail should be used in preference to the current alternative detail (the alternative detail is one that is shown when a contact has no name or no status). |
static ServiceStatus |
modifyContact(Contact contact,
SQLiteDatabase writableDb)
Modifies contact parameters. |
static ServiceStatus |
modifyPictureLoadedFlag(java.lang.Long localContactId,
java.lang.Boolean value,
SQLiteDatabase writeableDb)
Modifies the avatar loaded flag for a particular contact |
private static Cursor |
openContactSummaryCursor(java.lang.CharSequence constraint,
java.lang.Long meProfileId,
SQLiteDatabase readableDb)
Fetches a contact list cursor for a given search constraint |
static Cursor |
openContactSummaryCursor(java.lang.Long groupFilterId,
java.lang.CharSequence constraint,
java.lang.Long meProfileId,
SQLiteDatabase readableDb)
Fetches a contact list cursor for a given filter and search constraint |
private static Cursor |
openContactSummaryCursor(java.lang.Long groupFilterId,
java.lang.Long meProfileId,
SQLiteDatabase readableDb)
Fetches a contact list cursor for a given filter |
static boolean |
setNativeContactId(long localContactId,
long nativeContactId,
SQLiteDatabase writableDb)
|
static ServiceStatus |
setOfflineStatus()
|
static ServiceStatus |
setOfflineStatusExceptForMe(long localContactIdOfMe)
|
static ServiceStatus |
syncSetNativeIds(java.util.List<ContactsTable.ContactIdInfo> contactIdList,
SQLiteDatabase writableDb)
Updates the native IDs for a list of contacts. |
private static void |
updateAltValues(ContentValues values,
ContactDetail altDetail)
Processes a ContentValues object to handle a missing name or missing status. |
static ServiceStatus |
updateNameAndStatus(Contact contact,
SQLiteDatabase writableDb)
Updates the summary for a contact Replaces the complex logic of updating the summary with a new contactdetail. |
static ServiceStatus |
updateOnlineStatus(User user)
TODO: be careful |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TABLE_NAME
public static final java.lang.String TABLE_INDEX_NAME
private static java.util.HashMap<java.lang.Long,java.lang.Integer> sPresenceMap
private static final int SUMMARY_ID
getFullQueryList()
.
private static final int LOCALCONTACT_ID
private static final int FORMATTED_NAME
private static final int STATUS_TEXT
@Deprecated private static final int ONLINE_STATUS
private static final int NATIVE_CONTACTID
private static final int FRIEND_MINE
private static final int PICTURE_LOADED
private static final int SNS
private static final int SYNCTOPHONE
private static final int ALTFIELD_TYPE
private static final int ALTDETAIL_TYPE
private static final java.lang.String SQL_STRING_LOCAL_ID_EQUAL_QUESTION_MARK
Constructor Detail |
---|
public ContactSummaryTable()
Method Detail |
---|
public static void create(SQLiteDatabase writeableDb) throws SQLException
writeableDb
- A writable SQLite database
SQLException
- If an SQL compilation error occursprivate static java.lang.String getFullQueryList()
getQueryData(Cursor)
method can be used to obtain
the data from the query.
getQueryData(Cursor).
private static java.lang.String getOrderedQueryStringSql()
getQueryData(Cursor)
method can be used to
obtain the data from the query.
getQueryData(Cursor).
private static java.lang.String getQueryStringSql(java.lang.String whereClause)
getQueryData(Cursor)
method can be used to
obtain the data from the query.
whereClause
- An SQL where clause (without the "WHERE"). Cannot be
null.
getQueryData(Cursor).
private static java.lang.String getOrderedQueryStringSql(java.lang.String whereClause)
getQueryData(Cursor)
method can be used to obtain the data from
the query.
whereClause
- An SQL where clause (without the "WHERE"). Cannot be
null.
getQueryData(Cursor).
public static ContactSummary getQueryData(Cursor c)
c
- Cursor returned by one of the getFullQueryList()
based
query methods.
public static ServiceStatus fetchSummaryItem(long localContactId, ContactSummary summary, SQLiteDatabase readableDb)
localContactID
- The primary key ID of the contact to findsummary
- A new ContactSummary object to be filled inreadableDb
- Readable SQLite database
private static void updateAltValues(ContentValues values, ContactDetail altDetail)
ContactSummaryTable.Field.ALTFIELDTYPE
value will be updated to
reflect how the alternative detail is being used.
values
- The ContentValues object to be updatedaltDetail
- The must suitable alternative detail (see
#fetchNewAltDetail(long, ContactDetail, SQLiteDatabase)
public static ServiceStatus addContact(Contact contact, SQLiteDatabase writableDb)
contact
- The new contactwritableDb
- Writable SQLite database
private static ContactDetail findAlternativeNameContactDetail(ContentValues values, java.util.List<ContactDetail> details)
values
- - ContentValues to be stored in the DB for the added
contactdetails
- - the list of all contact details for the contact being
added
public static ServiceStatus deleteContact(java.lang.Long localContactId, SQLiteDatabase writableDb)
localContactID
- The primary key ID of the contact to deletewritableDb
- Writeable SQLite database
public static ServiceStatus modifyContact(Contact contact, SQLiteDatabase writableDb)
contact
- The modified contactwritableDb
- Writable SQLite database
private static boolean getContactValuesFromDetail(ContentValues contactValues, ContactDetail newDetail)
contactValues
- The content values object to updatenewDetail
- The new or modified detail
private static boolean isPreferredAltDetail(ContactDetail newDetail, ContactDetail currentDetail)
newDetail
- The new detailcurrentDetail
- The current alternative detail
public static boolean fetchNativeContactIdList(java.util.List<java.lang.Integer> summaryList, SQLiteDatabase readableDb)
summaryList
- A list that will be populated by this functionreadableDb
- Readable SQLite database
public static ServiceStatus modifyPictureLoadedFlag(java.lang.Long localContactId, java.lang.Boolean value, SQLiteDatabase writeableDb)
localContactID
- The primary key ID of the contactvalue
- Can be one of the following values:
writeableDb
- Writable SQLite database
private static java.lang.String getGroupConstraint(java.lang.Long groupFilterId)
groupFilterId
- the group id
public static Cursor openContactSummaryCursor(java.lang.Long groupFilterId, java.lang.CharSequence constraint, java.lang.Long meProfileId, SQLiteDatabase readableDb)
groupFilterId
- The server group ID or null to fetch all groupsconstraint
- A search string or null to fetch without constraintmeProfileId
- The current me profile Id which should be excluded
from the returned list.readableDb
- Readable SQLite database
getQueryData(Cursor)
private static Cursor openContactSummaryCursor(java.lang.Long groupFilterId, java.lang.Long meProfileId, SQLiteDatabase readableDb)
groupFilterId
- The server group ID or null to fetch all groupsmeProfileId
- The current me profile Id which should be excluded
from the returned list.readableDb
- Readable SQLite database
getQueryData(Cursor)
private static Cursor openContactSummaryCursor(java.lang.CharSequence constraint, java.lang.Long meProfileId, SQLiteDatabase readableDb)
constraint
- A search string or null to fetch without constraintmeProfileId
- The current me profile Id which should be excluded
from the returned list.readableDb
- Readable SQLite database
getQueryData(Cursor)
public static ServiceStatus updateOnlineStatus(User user)
user
- writableDb
-
public static ServiceStatus setOfflineStatus()
user
- writableDb
-
public static ServiceStatus setOfflineStatusExceptForMe(long localContactIdOfMe)
localContactIdOfMe
- writableDb
-
public static ServiceStatus syncSetNativeIds(java.util.List<ContactsTable.ContactIdInfo> contactIdList, SQLiteDatabase writableDb)
contactIdList
- A list of ContactIdInfo objects. For each object,
the local ID must match a local contact ID in the table. The
Native ID will be used for the update. Other fields are
unused.writeableDb
- Writable SQLite database
private static boolean isEmpty(java.lang.String string)
public static ServiceStatus updateNameAndStatus(Contact contact, SQLiteDatabase writableDb)
contact
- A Contact object that has been modifiedwriteableDb
- Writable SQLite database
public static boolean setNativeContactId(long localContactId, long nativeContactId, SQLiteDatabase writableDb)
localContactId
- writableDb
-
private static void clearPresenceMap()
private static ContactSummary.OnlineStatus getPresence(java.lang.Long localContactID)
localContactID
-
private static void addToPresenceMap(java.lang.Long localContactID)
localContactID
- private static void deleteFromPresenceMap(java.lang.Long localContactId)
localContactId
- private static java.lang.String getOnlineWhereClause()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc