Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.collab.im
Interface IFriend

All Superinterfaces:
  IItem, java.io.Serializable

All Known Subinterfaces:
  ILcsFriend, ISametimeFriend, IYahooFriend

public interface IFriend
extends IItem

Provides the interface to the `Friend` item.
Friends are obtained either by getting the items in the `Friends` container (under the root container) or by getting the items in the containers underneath the `Friends` container (the friend groups).

The following sample code prints all friend groups and friends to standard output

        // friendsContainer is the <code>Friends</code> container underneath the root container
        IContainer[] friendGroups = friendsContainer.getSubcontainers();
        System.out.println("Dumping friend groups:");
        for (int i = 0; i < friendGroups.length; i++)
            {
            System.out.println(i + ": " + friendGroups[i]);

            IItem[] friends = friendGroups[i].getItems();
            if (null != friends)
                for (int j = 0; j < friends.length; j++)
                    {
                    System.out.println("    " + j + ": " + friends[j]);
                    }
            }

To add a friend, add an item to the appropriate friend group container. This item will be an instance of `IFriend`. Call `setUsername(String)` on the friend then call `IItem.commit()`. The following sample code adds a new friend to a friend group

        IRootContainer rootContainer = session.getDefaultRootContainer ();
        IContainer friendsContainer = rootContainer.getSubcontainer ("Friends");
        IContainer group = friendsContainer.getSubcontainer("mygroup");
        IFriend friend = (IFriend) group.add ();
        friend.setUsername ("frienduser");
        friend.commit ();

Field Summary
`static ItemClass` | `CLASS` The ItemClass that represents a collab message.
`static Key` | `STATUS` Key that represents the instant messaging friend 'status' property.
`static Key` | `URI` Key that represents the instant messaging friend 'uri' property.
`static Key` | `USERNAME` Key that represents the instant messaging friend 'username' property.

Fields inherited from interface com.compoze.collab.IItem
`ID, ITEM_CLASS, KEYID_ID, KEYID_ITEM_CLASS, KEYID_PARENT_ID, MINIMUM_ITEM_KEYS, PARENT_ID`

Method Summary
`FriendStatus` | `getStatus()` Gets the user's current status.
`java.lang.String` | `getUri()` Gets URI value for this user
`java.lang.String` | `getUsername()` Gets the username of the user.
`boolean` | `isTyping()` Indicates whether this friend is currently typing
`void` | `sendTypingStatus(boolean flag)` Sets the typing state for this friend.
`void` | `setUri(java.lang.String sUri)` Sets the URI value for this user.
`void` | `setUsername(java.lang.String sUsername)` Sets the username of the user (used when adding a new friend).

Methods inherited from interface com.compoze.collab.IItem
`commit, containsKey, containsKey, copyProperties, copyTo, delete, fetchProperties, getAttribute, getEnum, getID, getInputStream, getItemClass, getOutputStream, getParent, getParent, getParentID, getProperties, getProperties, getProperties, getProperty, getProperty, getProperty, getReader, getRootContainer, getSession, getWriter, isMissing, moveTo, removeAttribute, removeProperty, setAttribute, setProperties, setProperty, setProperty, setProperty`

Field Detail

### USERNAME

    public static final Key USERNAME

  Key that represents the instant messaging friend 'username' property.

### URI

    public static final Key URI

  Key that represents the instant messaging friend 'uri' property.

### STATUS

    public static final Key STATUS

  Key that represents the instant messaging friend 'status' property.

### CLASS

    public static final ItemClass CLASS

  The ItemClass that represents a collab message.

Method Detail

### setUsername

    public void setUsername(java.lang.String sUsername)
                     throws CollaborationException

  Sets the username of the user (used when adding a new friend).
  Parameters:
    `sUsername` - the username (not `null`)
  See Also:
    `USERNAME`

### getUsername

    public java.lang.String getUsername()
                                 throws CollaborationException

  Gets the username of the user.
  Returns:
    the user's name (or `null` if it has not yet been set)
  See Also:
    `USERNAME`

### getUri

    public java.lang.String getUri()
                            throws CollaborationException

  Gets URI value for this user
  Returns:
    URI value. Cannot be `null`
  Throws:
    `CollaborationException` - if an error occurs

### setUri

    public void setUri(java.lang.String sUri)
                throws CollaborationException

  Sets the URI value for this user. This method should only be used when creating a new friend. Setting a URI on an existing friend will result in possible failure to communicate with the friend.
  Parameters:
    `sUri` - URI value. Cannot be `null`
  Throws:
    `CollaborationException` - if an error occurs

### getStatus

    public FriendStatus getStatus()
                           throws CollaborationException

  Gets the user's current status.
  Returns:
    the friend status
  See Also:
    `STATUS`

### isTyping

    public boolean isTyping()
                     throws CollaborationException

  Indicates whether this friend is currently typing
  Returns:
    `true` if typing, `false` if not typing

### sendTypingStatus

    public void sendTypingStatus(boolean flag)
                          throws CollaborationException

  Sets the typing state for this friend.
  Parameters:
    `flag` - `true` if typing, `false` if not

Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright ©1999-2005 Compoze Software, Inc. All rights reserved.