Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.googlecontacts
Class GoogleContactsQuery

java.lang.Object
  extended by net.java.sip.communicator.service.contactsource.AbstractContactQuery<T>
      extended by net.java.sip.communicator.service.contactsource.AsyncContactQuery<GoogleContactsSourceService>
          extended by net.java.sip.communicator.impl.googlecontacts.GoogleContactsQuery
All Implemented Interfaces:
ContactQuery

public class GoogleContactsQuery
extends AsyncContactQuery<GoogleContactsSourceService>

Implements ContactQuery for Google Contacts.

Author:
Sebastien Vincent

Field Summary
static int GOOGLECONTACTS_MAX_RESULTS
          Maximum results for Google Contacts query.
 
Fields inherited from class net.java.sip.communicator.service.contactsource.AsyncContactQuery
query
 
Fields inherited from interface net.java.sip.communicator.service.contactsource.ContactQuery
QUERY_CANCELED, QUERY_COMPLETED, QUERY_ERROR, QUERY_IN_PROGRESS
 
Constructor Summary
protected GoogleContactsQuery(GoogleContactsSourceService contactSource, Pattern query, int count)
          Initializes a new GoogleContactsQuery instance which is to perform a specific query on behalf of a specific contactSource.
 
Method Summary
 void cancel()
          Cancels this ContactQuery.
protected  String normalizePhoneNumber(String phoneNumber)
          Normalizes a String phone number by converting alpha characters to their respective digits on a keypad and then stripping non-digit characters.
protected  boolean phoneNumberMatches(String phoneNumber)
          Determines whether a specific String phone number matches the AsyncContactQuery.query of this AsyncContactQuery.
protected  void run()
          Performs this AsyncContactQuery in a background Thread.
protected  void stopped(boolean completed)
          Notifies this GoogleContactsQuery that it has stopped performing in the associated background Thread.
 
Methods inherited from class net.java.sip.communicator.service.contactsource.AsyncContactQuery
addQueryResult, getPhoneNumberQuery, getQueryResultCount, getQueryResults, getQueryString, start
 
Methods inherited from class net.java.sip.communicator.service.contactsource.AbstractContactQuery
addContactQueryListener, fireContactReceived, fireQueryStatusChanged, getContactSource, getStatus, removeContactQueryListener, setStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GOOGLECONTACTS_MAX_RESULTS

public static final int GOOGLECONTACTS_MAX_RESULTS
Maximum results for Google Contacts query.

See Also:
Constant Field Values
Constructor Detail

GoogleContactsQuery

protected GoogleContactsQuery(GoogleContactsSourceService contactSource,
                              Pattern query,
                              int count)
Initializes a new GoogleContactsQuery instance which is to perform a specific query on behalf of a specific contactSource.

Parameters:
contactSource - the ContactSourceService which is to perform the new ContactQuery instance
query - the Pattern for which contactSource is being queried
count - maximum number of results
Method Detail

normalizePhoneNumber

protected String normalizePhoneNumber(String phoneNumber)
Normalizes a String phone number by converting alpha characters to their respective digits on a keypad and then stripping non-digit characters.

Specified by:
normalizePhoneNumber in class AsyncContactQuery<GoogleContactsSourceService>
Parameters:
phoneNumber - a String which represents a phone number to normalize
Returns:
a String which is a normalized form of the specified phoneNumber

phoneNumberMatches

protected boolean phoneNumberMatches(String phoneNumber)
Determines whether a specific String phone number matches the AsyncContactQuery.query of this AsyncContactQuery.

Specified by:
phoneNumberMatches in class AsyncContactQuery<GoogleContactsSourceService>
Parameters:
phoneNumber - the String which represents the phone number to match to the query of this AsyncContactQuery
Returns:
true if the specified phoneNumber matches the query of this AsyncContactQuery; otherwise, false

run

protected void run()
Performs this AsyncContactQuery in a background Thread.

Specified by:
run in class AsyncContactQuery<GoogleContactsSourceService>
See Also:
AsyncContactQuery.run()

stopped

protected void stopped(boolean completed)
Notifies this GoogleContactsQuery that it has stopped performing in the associated background Thread.

Overrides:
stopped in class AsyncContactQuery<GoogleContactsSourceService>
Parameters:
completed - true if this ContactQuery has successfully completed, false if an error has been encountered during its execution
See Also:
AsyncContactQuery.stopped(boolean)

cancel

public void cancel()
Cancels this ContactQuery.

Specified by:
cancel in interface ContactQuery
Overrides:
cancel in class AbstractContactQuery<GoogleContactsSourceService>
See Also:
ContactQuery.cancel()

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.