com.sapportals.wcm.util.channels

Interface IRecipient


public interface IRecipient

Recipients are objects, where messages can be sent to via a channel.
A recipient represents an (addressable) person or a distribution list. A recipient has adresses, one for each of the several channels it can receive messages from. For example, recipient A has an email address for the email channel and a mobile phone number for the sms-channel.
For the moment, a recipient is a simple mapping of users, groups and roles to recipients and distrubtion lists.

See Also:
RecipientFactory, IChannel

Method Summary
 boolean contains(IRecipient recipient)
          Test if a given recipient is a member of a group.
 IChannel getChannel(String id)
          Get the recipient's channel for a given channel id.
 IChannelList getChannels()
          Get all available channels.
 IChannel getDefaultChannel()
          Get the default channel.
 String getDescription()
          Get the recipient's displayable name.
 String getDescription(Locale locale)
          Get the recipient's displayable name for a specific locale.
 IRecipientList getGroupMembers()
          Get all the members of a group or role.
 String getID()
          Get the recipient's unique system id.
 Locale getLocale()
          Get the recipient's locale.
 int getType()
          Get the recipient's type.
 com.sapportals.portal.security.usermanagement.IUMPrincipal getUserManagementObject()
          Get the associated user object (IUser , IGroup or IRole ).
 boolean isGroup()
          Test if the recipient is a group and contains other recipients.
 void sendTo(IChannel channel, String from, MimeMessage mimemessage)
          Send a mime message via the specified channel.
 void sendTo(IChannel channel, String from, String title, String messagetext, String type)
          Send a message text via the specified channel.
 

Method Detail

getType

public int getType()
Get the recipient's type.

Returns:
a int with the recipient's type (for example IUMPrincipal.IUSER ).
See Also:
RecipientFactory.getRecipient(String, int)

getID

public String getID()
Get the recipient's unique system id.

Returns:
a String with the recipient's unique system id.

getDescription

public String getDescription()
Get the recipient's displayable name.

Returns:
a String with a displayable name.

getDescription

public String getDescription(Locale locale)
Get the recipient's displayable name for a specific locale.

Parameters:
locale - a Locale defining the language to get the name for.
Returns:
a String with a displayable name for the given locale.

getLocale

public Locale getLocale()
                 throws WcmException
Get the recipient's locale.

Returns:
a Locale with the recipient's locale.
Throws:
WcmException - if the locale data cannot be retrieved.

getUserManagementObject

public com.sapportals.portal.security.usermanagement.IUMPrincipal getUserManagementObject()
                                                                                   throws WcmException
Get the associated user object (IUser , IGroup or IRole ).

Returns:
an IUMPrincipal as the user-/group-/role-object associated to this recipient, or null if this recipient has no user/group/role associated.
Throws:
WcmException - if the operation failed (if there was an error while obtaining the recipient's userobject).

isGroup

public boolean isGroup()
                throws WcmException
Test if the recipient is a group and contains other recipients.

Returns:
a boolean true , if the recipient is a distribution list (user group or user role), false if it's a single person (user).
Throws:
WcmException - if the type for this recipient can not be resolved.

getGroupMembers

public IRecipientList getGroupMembers()
                               throws WcmException
Get all the members of a group or role.

Returns:
a IRecipientList with the members for this group, null if this recipient is not a group or role.
Throws:
WcmException - if the members can not be retrieved.

contains

public boolean contains(IRecipient recipient)
                 throws WcmException
Test if a given recipient is a member of a group.

Parameters:
recipient - TBD: Description of the incoming method parameter
Returns:
a boolean true if the given recipient is a member of this group or role, false if this recipient is not a group, the given recipient is a role or the given recipient is not a member of this group or role.
Throws:
WcmException - if the members can not be checked.

getChannel

public IChannel getChannel(String id)
                    throws WcmException
Get the recipient's channel for a given channel id.

Parameters:
id - a String with the desired channel's system id.
Returns:
an IChannel for the recipient with the given id, null if the channel is not available for this recipient.
Throws:
WcmException - if the operation failed (if there was an error while resolving the recipients address).

getChannels

public IChannelList getChannels()
                         throws WcmException
Get all available channels.

Returns:
a IChannelList with all available channels (may be empty) for this recipient.
Throws:
WcmException - if the list cannot be retrieved.

getDefaultChannel

public IChannel getDefaultChannel()
                           throws WcmException
Get the default channel.

Returns:
an IChannel with the default channel, null if there is no default channel defined for this recipient.
Throws:
WcmException - if the operation failed (an error occured while obtaining the recipients data).

sendTo

public void sendTo(IChannel channel,
                   String from,
                   String title,
                   String messagetext,
                   String type)
            throws WcmException
Send a message text via the specified channel.

Parameters:
channel - an IChannel with the channel to use.
from - a String with the sender's address in the proper format for the channel.
title - a String with the title for the message.
messagetext - a String with the messagetext to send.
type - a String with the type of message, for example text/plain .
Throws:
WcmException - if the message cannot be sent.

sendTo

public void sendTo(IChannel channel,
                   String from,
                   MimeMessage mimemessage)
            throws WcmException
Send a mime message via the specified channel.

Parameters:
channel - an IChannel with the channel to use.
from - a String with the sender's address in the appropiate format for the channel.
mimemessage - a MimeMessage with the mimemessage to send.
Throws:
WcmException - if the message cannot be sent.


Copyright 2006 SAP AG Complete Copyright Notice