Email Answering System
Version 1.0

com.ninecode.email.beans.slave.phone
Class PhoneBean

java.lang.Object
  |
  +--com.ninecode.email.beans.slave.phone.PhoneBean

public class PhoneBean
extends Object

Bean to handle phone requests.


Field Summary
protected  String mAreaCode
           
protected  String mCity
           
protected  Connection mConnection
          The connection to the database.
protected  String mExchange
           
protected  String mFirstName
           
protected  int mFuzzyThreshold
          The maximum Levenshtein distance allowed.
protected  String mLastName
           
protected  String mNumber
           
protected  String mPhone
           
protected  String mProvince
           
protected  String mQualifier
           
protected  int mRecordLimit
          The maximum number of records returned.
protected  String mStreet
           
 
Constructor Summary
PhoneBean()
           
 
Method Summary
 Listing[] approximateLookup()
          Perform an approximate query.
 Listing[] exactLookup()
          Perform an exact query.
protected  void field(StringBuffer query, String value, String column)
           
 Listing[] fuzzyLookup()
          Perform a fuzzy query.
 String getApproximateQuery()
           
 String getAreaCode()
           
 String getCity()
           
protected  Connection getConnection()
          Get the database connection.
 String getExactQuery()
           
 String getExchange()
           
 String getFirstName()
           
 String getFuzzyQuery()
           
 int getFuzzyThreshold()
          Get the maximum Levenshtein distance allowed.
 String getLastName()
           
 String getNumber()
           
 String getPhone()
           
 String getPhoneNumber()
           
 String getProvince()
           
 String getQualifier()
           
 int getRecordLimit()
          Get the upper limit on returned records.
 String getSoundexQuery()
           
 String getStreet()
           
 String getText()
          Output results in text form.
 String help()
           
protected  void limit(StringBuffer query, String value, String column)
           
protected  String parse(String body, String key)
          Parse out keyword phrase.
protected  void qualify(StringBuffer query, String value, String column)
           
 void setAreaCode(String areacode)
           
 void setCity(String city)
           
protected  void setConnection(Connection connection)
          Set the database connection.
 void setExchange(String exchange)
           
 void setFirstName(String firstname)
           
 void setFuzzyThreshold(int threshold)
          Set the maximum Levenshtein distance allowed.
 void setLastName(String lastname)
           
 void setNumber(String number)
           
 void setPhone(String phone)
           
 void setPhoneNumber(String phone_number)
           
 void setProvince(String province)
           
 void setQualifier(String qualifier)
           
 void setRecordLimit(int limit)
          Set the limit on returned records.
 void setStreet(String street)
           
 void setText(String text)
          Freeform text input.
protected  void soundex(StringBuffer query, String value, String column)
           
 Listing[] soundexLookup()
          Perform a soundex query.
 String toString()
          Generate a string representing the state of this bean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mConnection

protected Connection mConnection
The connection to the database.


mLastName

protected String mLastName

mFirstName

protected String mFirstName

mNumber

protected String mNumber

mQualifier

protected String mQualifier

mStreet

protected String mStreet

mCity

protected String mCity

mProvince

protected String mProvince

mAreaCode

protected String mAreaCode

mExchange

protected String mExchange

mPhone

protected String mPhone

mRecordLimit

protected int mRecordLimit
The maximum number of records returned.


mFuzzyThreshold

protected int mFuzzyThreshold
The maximum Levenshtein distance allowed.

Constructor Detail

PhoneBean

public PhoneBean()
Method Detail

getLastName

public String getLastName()

setLastName

public void setLastName(String lastname)

getFirstName

public String getFirstName()

setFirstName

public void setFirstName(String firstname)

getNumber

public String getNumber()

setNumber

public void setNumber(String number)

getQualifier

public String getQualifier()

setQualifier

public void setQualifier(String qualifier)

getStreet

public String getStreet()

setStreet

public void setStreet(String street)

getCity

public String getCity()

setCity

public void setCity(String city)

getProvince

public String getProvince()

setProvince

public void setProvince(String province)

getAreaCode

public String getAreaCode()

setAreaCode

public void setAreaCode(String areacode)

getExchange

public String getExchange()

setExchange

public void setExchange(String exchange)

getPhone

public String getPhone()

setPhone

public void setPhone(String phone)

getPhoneNumber

public String getPhoneNumber()

setPhoneNumber

public void setPhoneNumber(String phone_number)
                    throws IllegalArgumentException
IllegalArgumentException

getRecordLimit

public int getRecordLimit()
Get the upper limit on returned records.

Returns:
The maximum number of records that will be returned bay a query.

setRecordLimit

public void setRecordLimit(int limit)
Set the limit on returned records.

Parameters:
limit - The new value of property recordLimit.

getFuzzyThreshold

public int getFuzzyThreshold()
Get the maximum Levenshtein distance allowed.

Returns:
The maximum Levenshtein distance allowed.

setFuzzyThreshold

public void setFuzzyThreshold(int threshold)
Set the maximum Levenshtein distance allowed. Note that this applies to the sum of the distances of all specified terms.

Parameters:
threshold - The new value for property fuzzyThreshold.

getConnection

protected Connection getConnection()
Get the database connection.

Returns:
The connection to the phonebook database.

setConnection

protected void setConnection(Connection connection)
Set the database connection.

Parameters:
connection - The connection to use to query the phonebook database.

qualify

protected void qualify(StringBuffer query,
                       String value,
                       String column)

getExactQuery

public String getExactQuery()

exactLookup

public Listing[] exactLookup()
                      throws SQLException
Perform an exact query. Everything in uppercase.

SQLException

limit

protected void limit(StringBuffer query,
                     String value,
                     String column)

getApproximateQuery

public String getApproximateQuery()

approximateLookup

public Listing[] approximateLookup()
                            throws SQLException
Perform an approximate query. Everything in uppercase.

SQLException

field

protected void field(StringBuffer query,
                     String value,
                     String column)

getFuzzyQuery

public String getFuzzyQuery()

fuzzyLookup

public Listing[] fuzzyLookup()
                      throws SQLException
Perform a fuzzy query. Everything in uppercase.

SQLException

soundex

protected void soundex(StringBuffer query,
                       String value,
                       String column)

getSoundexQuery

public String getSoundexQuery()

soundexLookup

public Listing[] soundexLookup()
                        throws SQLException
Perform a soundex query. Everything in uppercase.

SQLException

help

public String help()

parse

protected String parse(String body,
                       String key)
Parse out keyword phrase.

Parameters:
body - The text to search in.
key - The keyword to search for.
Returns:
The contents of the line after the keyword, or null if not found.

setText

public void setText(String text)
Freeform text input.

Parameters:
text - Input in the form documented in help().

getText

public String getText()
Output results in text form. Performs exact, approximate and fuzzy lookup until some records fetched.

Returns:
Results of the query(ies).

toString

public String toString()
Generate a string representing the state of this bean.

Overrides:
toString in class Object
Returns:
A string of the form:
 lastname SMITH, firstname BOB
 

Email Answering System
Version 1.0

Copyright © 2003 Derrick Oswald. All rights reserved.