com.cisco.ipphone.sdk
Class User

java.lang.Object
  extended by com.cisco.ipphone.sdk.User

public class User
extends java.lang.Object

This class encapsulates the attributes and functions of a Cisco IP Telephony User. The primary purpose of this class is to provide a convenient mechanism for finding relationships between IP Telephony Users and other system components such as Phones, Extensions, and PCs. Methods implemented in this class allow simple, efficient access to that information using service Providers, such as an LDAP Directory Provider.


Method Summary
 PC getAssociatedPC(LDAPProviderIF lp)
          Queries the specified LDAP Provider for the PC Associated to this User
 Phone[] getControlledPhones(LDAPProvider lp, java.lang.String beginsWith)
          Queries the specified LDAP Provider for a list of Phones controlled by this User
 Phone getCurrentExtMobPhone(EMProvider ep)
          Queries the specified Extension Mobility Provider for the Phone that this User is currently logged into
 java.lang.String getDefaultDeviceProfile(LDAPProviderIF lp)
           
 java.lang.String getDepartment()
          Returns this User's Department The loadAtributes method MUST be called first to populate the User information or this method will always return null.
 java.lang.String[] getDeviceProfiles(LDAPProviderIF lp)
           
 java.lang.String getFirstName()
          Returns the First Name of this User The loadAtributes method MUST be called first to populate the User information or this method will always return null.
 java.lang.String getLastName()
          Returns the Last Name of this User The loadAtributes method MUST be called first to populate the User information or this method will always return null.
 java.lang.String getMail()
          Returns this User's Mail address The loadAtributes method MUST be called first to populate the User information or this method will always return null.
 java.lang.String getManager()
          Returns this User's Department The loadAtributes method MUST be called first to populate the User information or this method will always return null.
 Extension getPrimaryExtension(LDAPProviderIF lp)
          Queries the specified LDAP Provider for the Primary Extension of this User
 java.lang.String getTelephoneNumber()
          Returns this User's Telephone Number
static User getUser(java.lang.String userId)
          The getUser method is used to obtain a reference to a User object which has the specified, unique userId.
 java.lang.String getUserId()
           
 boolean loadAttributes(LDAPProvider lp)
          This method queries the specified LDAP Provider for all of the basic attributes of this User.
 boolean login(EMProvider ep, Phone loginPhone)
          Logs this User into the specified Phone using the given Extension Mobility Provider
static User[] searchUsers(java.lang.String firstName, java.lang.String lastName, java.lang.String telephoneNumber, LDAPProviderIF lp)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getUser

public static User getUser(java.lang.String userId)
The getUser method is used to obtain a reference to a User object which has the specified, unique userId. User objects cannot be directly instantiated with a new command since there are no public constructors - instead a reference is obtained to a given User by calling this method. This architecture has the added benefit of being able to directly compare User objects for equality - since there is guaranteed to be only one object in existence with a given, unique userId. This also has the effect of minimizing memory utilization since only a single instance of a given User object exists within the JVM.

Parameters:
userId - the unique UserId of the requested User
Returns:
the User object with the given UserId. If the User with this UserId does not exist, it is created and returned.

searchUsers

public static User[] searchUsers(java.lang.String firstName,
                                 java.lang.String lastName,
                                 java.lang.String telephoneNumber,
                                 LDAPProviderIF lp)

getUserId

public java.lang.String getUserId()
Returns:
the String UserId of this User

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
the String UserId of this User

getControlledPhones

public Phone[] getControlledPhones(LDAPProvider lp,
                                   java.lang.String beginsWith)
Queries the specified LDAP Provider for a list of Phones controlled by this User

Parameters:
lp - the LDAPProvider
beginsWith - a String used to filter the Phones by matching it against the beginning of the deviceName. If beginsWith is null or an empty String, all Controlled Phones will be returned.
Returns:
an Array of Phones controlled by this User. If no Phones were found or the query fails, an empty Array (length=0) will be returned.

getAssociatedPC

public PC getAssociatedPC(LDAPProviderIF lp)
Queries the specified LDAP Provider for the PC Associated to this User

Parameters:
lp - the LDAPProvider
Returns:
the associated PC. Returns null if this User does not have an Associated PC defined, or if the query fails.

getDefaultDeviceProfile

public java.lang.String getDefaultDeviceProfile(LDAPProviderIF lp)

getDeviceProfiles

public java.lang.String[] getDeviceProfiles(LDAPProviderIF lp)

getPrimaryExtension

public Extension getPrimaryExtension(LDAPProviderIF lp)
Queries the specified LDAP Provider for the Primary Extension of this User

Parameters:
lp - the LDAPProvider
Returns:
the Primary Extension for this used. Returns null if this User does not have a Primary Extension defined or if the query fails.

getCurrentExtMobPhone

public Phone getCurrentExtMobPhone(EMProvider ep)
Queries the specified Extension Mobility Provider for the Phone that this User is currently logged into

Parameters:
ep - the EMProvider
Returns:
the login Phone. Returns null if the User is not currently logged in via Extension Mobility or if the query fails

loadAttributes

public boolean loadAttributes(LDAPProvider lp)
This method queries the specified LDAP Provider for all of the basic attributes of this User. These attributes include first name, last name, telephone number (not the same as Primary Extension), department, and mail. This method MUST be called prior to calling the corresponding get methods for those attributes - otherwise they will simply return null.

Parameters:
lp - the LDAPProvider
Returns:
boolean value indicating whether or not the query was successful. Successful = true, failed = false.

getFirstName

public java.lang.String getFirstName()
Returns the First Name of this User The loadAtributes method MUST be called first to populate the User information or this method will always return null.

Returns:
a String containing the First Name of the User (LDAP attribute: givenName), or null if it does not exist.

getLastName

public java.lang.String getLastName()
Returns the Last Name of this User The loadAtributes method MUST be called first to populate the User information or this method will always return null.

Returns:
a String containing the Last Name of the User (LDAP attribute: sn), or null if it does not exist.

getDepartment

public java.lang.String getDepartment()
Returns this User's Department The loadAtributes method MUST be called first to populate the User information or this method will always return null.

Returns:
a String containing the Department of the User (LDAP attribute: departmentNumber), or null if it does not exist.

getManager

public java.lang.String getManager()
Returns this User's Department The loadAtributes method MUST be called first to populate the User information or this method will always return null.

Returns:
a String containing the Department of the User (LDAP attribute: departmentNumber), or null if it does not exist.

getMail

public java.lang.String getMail()
Returns this User's Mail address The loadAtributes method MUST be called first to populate the User information or this method will always return null.

Returns:
a String containing the Mail address of the User (LDAP attribute: mail), or null if it does not exist.

getTelephoneNumber

public java.lang.String getTelephoneNumber()
Returns this User's Telephone Number

NOTE: This is NOT the same as a User's Primary Extension !!!

The Primary Extension is a Cisco-specific attribute stored in the User's CCN profile (ou=profiles, ou=CCN) which is tied directly to the User's Controlled Phone and tightly integrated with the CallManager database. This Telephone Number is a standard User attribute (ou=Users) and not linkedb to the CallManager database. The loadAtributes method MUST be called first to populate the User information or this method will always return null.

Returns:
a String containing the Telephone Number of the User (LDAP attribute: telephoneNumber), or null if it does not exist.

login

public boolean login(EMProvider ep,
                     Phone loginPhone)
Logs this User into the specified Phone using the given Extension Mobility Provider

Parameters:
ep - the EMProvider
loginPhone - the Phone to be used by this User
Returns:
boolean return value indicates whether or not the login was successful