JML

net.sf.jml.impl
Class MsnContactImpl

java.lang.Object
  extended by net.sf.jml.impl.MsnUserImpl
      extended by net.sf.jml.impl.MsnContactImpl
All Implemented Interfaces:
MsnContact, MsnUser

public class MsnContactImpl
extends MsnUserImpl
implements MsnContact

This class implements the MsnContact interface.

Author:
Roger Chen, Angel Barragán Chacón

Constructor Summary
MsnContactImpl(MsnContactList contactList)
          Creates a new MsnContact instace.
 
Method Summary
 void addBelongGroup(String groupId)
          Add a new group to which this MsnContact belongs to.
 boolean belongGroup(MsnGroup group)
          Is belong the group.
 boolean equals(Object obj)
           
 MsnObject getAvatar()
          Retrieves the MsnObject for the avatar of this contact.
 MsnGroup[] getBelongGroups()
          Get the groups which the user belongs.
 MsnContactList getContactList()
          Get the contact list the contact belongs to.
 String getCurrentMedia()
          Retrieves the current media for this MsnContact.
 String getFriendlyName()
          The name that MsnOwner assigned to the user.
 String getId()
          MSNP10/MSNP11 protocol use a GUID to differentiate user, not use user's email.
 int getListNumber()
          Retrieves the location in the list for this MsnContact.
 String getPersonalMessage()
          The personal message assigned to the user.
 int hashCode()
           
 boolean isInList(MsnList list)
          Judge is in the MsnList.
 void removeBelongGroup(String groupId)
          Removes this MsnContact from the given group.
 void setAvatar(MsnObject avatar)
          Sets the new avatar for this MsnContact.
 void setCurrentMedia(String currentMedia)
          Sets the new current media for this MsnContact.
 void setEmail(Email email)
           
 void setFriendlyName(String friendlyName)
          Sets a new friendly name for this contact.
 void setId(String id)
          Sets the new Runtime identifier for this MsnContact.
 void setInList(MsnList list, boolean b)
          Set this MsnContact in the given list.
 void setListNumber(int listNumber)
          Sets the new location in the list.
 void setPersonalMessage(String msg)
          Sets a new personal message for this MsnContact.
 String toString()
           
 
Methods inherited from class net.sf.jml.impl.MsnUserImpl
getClientId, getDisplayName, getEmail, getOldDisplayName, getOldStatus, getProperties, getStatus, getTelephone, setClientId, setDisplayName, setStatus, setTelephone
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.jml.MsnUser
getClientId, getDisplayName, getEmail, getOldDisplayName, getOldStatus, getProperties, getStatus
 

Constructor Detail

MsnContactImpl

public MsnContactImpl(MsnContactList contactList)
Creates a new MsnContact instace.

Parameters:
contactList - MsnContactList to which this MsnContact belongs to.
Method Detail

getContactList

public MsnContactList getContactList()
Description copied from interface: MsnContact
Get the contact list the contact belongs to.

Specified by:
getContactList in interface MsnContact
Returns:
contact list
See Also:
MsnContact.getContactList()

getId

public String getId()
Description copied from interface: MsnContact
MSNP10/MSNP11 protocol use a GUID to differentiate user, not use user's email. If user not in FL, will use email instead.

When login with MSNP8/MSNP9, will use email instead.

Specified by:
getId in interface MsnContact
Returns:
id
See Also:
MsnContact.getId()

setId

public void setId(String id)
Sets the new Runtime identifier for this MsnContact.

Parameters:
id - New Runtime identifier for this MsnContact.

getFriendlyName

public String getFriendlyName()
Description copied from interface: MsnContact
The name that MsnOwner assigned to the user. If user not int FL, will use email instead.

Specified by:
getFriendlyName in interface MsnContact
Returns:
friendly name
See Also:
MsnContact.getFriendlyName()

setFriendlyName

public void setFriendlyName(String friendlyName)
Sets a new friendly name for this contact.

Parameters:
friendlyName - New friendly name for this contact.

getListNumber

public int getListNumber()
Retrieves the location in the list for this MsnContact.

Returns:
Integer with the location in the list.

setListNumber

public void setListNumber(int listNumber)
Sets the new location in the list.

Parameters:
listNumber - New location in the list.

setInList

public void setInList(MsnList list,
                      boolean b)
Set this MsnContact in the given list.

Parameters:
list - Instance of the list.
b - True to add to the list and false to remove from it.

isInList

public boolean isInList(MsnList list)
Description copied from interface: MsnContact
Judge is in the MsnList.

Specified by:
isInList in interface MsnContact
Parameters:
list - MsnList
Returns:
is in the list
See Also:
MsnContact.isInList(MsnList)

getBelongGroups

public MsnGroup[] getBelongGroups()
Description copied from interface: MsnContact
Get the groups which the user belongs.

Specified by:
getBelongGroups in interface MsnContact
Returns:
the groups which the user belongs to
See Also:
MsnContact.getBelongGroups()

belongGroup

public boolean belongGroup(MsnGroup group)
Description copied from interface: MsnContact
Is belong the group.

Specified by:
belongGroup in interface MsnContact
Parameters:
group - MsnGroup
Returns:
is belong the group
See Also:
MsnContact.belongGroup(MsnGroup)

addBelongGroup

public void addBelongGroup(String groupId)
Add a new group to which this MsnContact belongs to.

Parameters:
groupId - Identifier of the group.

removeBelongGroup

public void removeBelongGroup(String groupId)
Removes this MsnContact from the given group.

Parameters:
groupId - Group Identifier from which this MsnContact must be removed from.

getPersonalMessage

public String getPersonalMessage()
Description copied from interface: MsnContact
The personal message assigned to the user.

Specified by:
getPersonalMessage in interface MsnContact
Returns:
personal message
See Also:
MsnContact.getPersonalMessage()

setPersonalMessage

public void setPersonalMessage(String msg)
Sets a new personal message for this MsnContact.

Parameters:
msg - New personal Message.

getCurrentMedia

public String getCurrentMedia()
Retrieves the current media for this MsnContact.

Returns:
Current media for this MsnContact.

setCurrentMedia

public void setCurrentMedia(String currentMedia)
Sets the new current media for this MsnContact.

Parameters:
currentMedia - New Current media for this MsnContact.

getAvatar

public MsnObject getAvatar()
Description copied from interface: MsnContact
Retrieves the MsnObject for the avatar of this contact.

Specified by:
getAvatar in interface MsnContact
Returns:
Instance of MsnObject with the MSN object for this contact.
See Also:
MsnContact.getAvatar()

setAvatar

public void setAvatar(MsnObject avatar)
Sets the new avatar for this MsnContact.

Parameters:
avatar - Instance of the new Avatar.

setEmail

public void setEmail(Email email)
Overrides:
setEmail in class MsnUserImpl
See Also:
MsnUserImpl.setEmail(Email)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

JML