com.bea.apps.groupspace.notification
Class GroupSpaceNotificationHelper

java.lang.Object
  extended by com.bea.apps.groupspace.notification.GroupSpaceNotificationHelper

public class GroupSpaceNotificationHelper
extends Object

This class is the entry point for all notification handling within the groupspace application.


Constructor Summary
GroupSpaceNotificationHelper()
           
 
Method Summary
static void clearAllNotificationsForUser(String username, String webAppName)
          This method consumes all active notifications for the specified user.
static void clearSelectedNotifications(Collection<NotificationId> ids)
          Convenience method to consume the provided collection of NotificationIds.
static GroupSpaceNotification createGroupSpaceNotification(String namespace, String name)
          Creates a brand new GroupSpaceNotification type class based on the provided namespace and name.
static Collection<GroupSpaceNotification> filterGroupSpaceNotifications(Collection<Notification> notifications)
          Filters (reduces) a collection of notifications down to a collection of notifications supported by GroupSpace.
static Collection<AnnouncementNotification> getAnnouncementNotifications(Collection<GroupSpaceNotification> notifications)
          Returns a collection of announcement notifications based on a collection of GroupSpaceNotifications.
static Collection<CalendarNotification> getCalendarNotifications(Collection<GroupSpaceNotification> notifications)
          Returns a collection of calendar notifications based on a collection of GroupSpaceNotifications.
static Collection<EmailNotification> getEmailNotifications(Collection<GroupSpaceNotification> notifications)
          Returns a collection of email notifications based on a collection of GroupSpaceNotifications.
static Collection<GroupSpaceNotification> getGroupSpaceNotifications(String username, String webAppName)
          Returns notifications that are understood by groupspace.
static Collection<InvitationNotification> getInvitationNotifications(Collection<GroupSpaceNotification> notifications)
          Returns a collection of invitation notifications based on a collection of GroupSpaceNotifications.
static Collection<TaskNotification> getTaskNotifications(Collection<GroupSpaceNotification> notifications)
          Returns a collection of task notifications based on a collection of GroupSpaceNotifications.
static void sendNotification(CommunityDefinitionId communityDefId, GroupSpaceNotification notification)
          Sends the notification to all active members of the provided community.
static void sendNotification(CommunityDefinitionId communityDefId, MembershipCapability msc, GroupSpaceNotification notification)
          Sends a notification to all active users of a particular membership capability.
static void sendNotification(CommunityDefinitionId communityDefId, String username, GroupSpaceNotification notification)
          Sends a notification to a specific domain username.
static void sendNotification(String webAppName, String username, GroupSpaceNotification notification)
          Sends a notification to a specific domain username.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupSpaceNotificationHelper

public GroupSpaceNotificationHelper()
Method Detail

getGroupSpaceNotifications

public static Collection<GroupSpaceNotification> getGroupSpaceNotifications(String username,
                                                                            String webAppName)
                                                                     throws IllegalOperationException,
                                                                            Exception
Returns notifications that are understood by groupspace.

This method uses the NotificationManager ejb to retrieve notifications for a user, which is not as efficient as going through the NotificationContext. If you have access to the NotificationContext, use that and filter the results using the filterGroupSpaceNotifications().

 Example:
 
 NotificationContext context = NotificationContext.getNotificationContext(request);
 Collection  notifications = context.getNotifications();
 Collection gsNotifications = GroupSpaceNotificationHelper.filterGroupSpaceNotifications(notifications);
 

Parameters
username - - The currently logged in user. ** Required **
webAppName - - The webapp name to retrieve notifications for. If null, all active notifications for all webapps are returned.
Returns
the collection of groupspace notifications.
Throws
IllegalOperationException
Exception

filterGroupSpaceNotifications

public static Collection<GroupSpaceNotification> filterGroupSpaceNotifications(Collection<Notification> notifications)
                                                                        throws IllegalOperationException
Filters (reduces) a collection of notifications down to a collection of notifications supported by GroupSpace.

This is a convenience method to reduce a collection of notifications retrieved by utilities other than the NotificationContext (i.e. INotificationManager). The NotificationContext is more efficient than going through the INotificationManager because it caches results.

 Example:
 
 NotificationContext context = NotificationContext.getNotificationContext(request);
 Collection  notifications = context.getNotifications();
 Collection gsNotifications = GroupSpaceNotificationHelper.filterGroupSpaceNotifications(notifications);
 

Parameters
notifications - - The collection of notifications to reduce/transform.
Returns
the collection of groupspace notifications.
Throws
IllegalOperationException

createGroupSpaceNotification

public static GroupSpaceNotification createGroupSpaceNotification(String namespace,
                                                                  String name)
                                                           throws IllegalArgumentException,
                                                                  IllegalOperationException
Creates a brand new GroupSpaceNotification type class based on the provided namespace and name.

The supportedNotificationName must be a supported type (declared in the com.bea.apps.groupspace.notification.SupportedNotifications.properties.

Example: createGroupSpaceNotification(InvitationNotification.INVITATION_NAMESPACE, InvitationNotification.INVITATION_NAME);

Parameters
namespace - The namespace of the notification.
name - The name of the notification.
Returns
An instance of GroupSpaceNotification that can be casted to the implementation.
Throws
IllegalArgumentException - if the provided notification name is not supported.
IllegalOperationException - if unable to construct the GroupSpaceNotification

getAnnouncementNotifications

public static Collection<AnnouncementNotification> getAnnouncementNotifications(Collection<GroupSpaceNotification> notifications)
Returns a collection of announcement notifications based on a collection of GroupSpaceNotifications.

This method is most useful for filtering out a collection of GroupSpaceNotifications

Parameters
notifications - The collection of abstract GroupSpaceNotifications
Returns

getInvitationNotifications

public static Collection<InvitationNotification> getInvitationNotifications(Collection<GroupSpaceNotification> notifications)
Returns a collection of invitation notifications based on a collection of GroupSpaceNotifications.

This method is most useful for filtering out a collection of GroupSpaceNotifications

Parameters
notifications - The collection of abstract GroupSpaceNotifications
Returns

getEmailNotifications

public static Collection<EmailNotification> getEmailNotifications(Collection<GroupSpaceNotification> notifications)
Returns a collection of email notifications based on a collection of GroupSpaceNotifications.

This method is most useful for filtering out a collection of GroupSpaceNotifications

Parameters
notifications - The collection of abstract GroupSpaceNotifications
Returns

getTaskNotifications

public static Collection<TaskNotification> getTaskNotifications(Collection<GroupSpaceNotification> notifications)
Returns a collection of task notifications based on a collection of GroupSpaceNotifications.

This method is most useful for filtering out a collection of GroupSpaceNotifications

Parameters
notifications - The collection of abstract GroupSpaceNotifications
Returns

getCalendarNotifications

public static Collection<CalendarNotification> getCalendarNotifications(Collection<GroupSpaceNotification> notifications)
Returns a collection of calendar notifications based on a collection of GroupSpaceNotifications.

This method is most useful for filtering out a collection of GroupSpaceNotifications

Parameters
notifications - The collection of abstract GroupSpaceNotifications
Returns

sendNotification

public static void sendNotification(CommunityDefinitionId communityDefId,
                                    MembershipCapability msc,
                                    GroupSpaceNotification notification)
                             throws IllegalOperationException
Sends a notification to all active users of a particular membership capability.

Parameters
communityDefId - - The selected community definition Id.
msc - - The membership capability to send to.
notification - The groupspace notification instance to send.
Throws
IllegalOperationException

clearAllNotificationsForUser

public static void clearAllNotificationsForUser(String username,
                                                String webAppName)
                                         throws IllegalOperationException
This method consumes all active notifications for the specified user.

Please use caution when executing this method because all notifications will be marked for consumption.

Parameters
username - The wls domain username. *Required*
webAppName - The optional web application name.
Throws
IllegalOperationException

clearSelectedNotifications

public static void clearSelectedNotifications(Collection<NotificationId> ids)
                                       throws Exception
Convenience method to consume the provided collection of NotificationIds.

Parameters
ids - The collection of NotificationIds
Throws
Exception

sendNotification

public static void sendNotification(CommunityDefinitionId communityDefId,
                                    GroupSpaceNotification notification)
                             throws IllegalOperationException
Sends the notification to all active members of the provided community.

Parameters
communityDefId - - The selected community definition Id.
notification - The groupspace notification instance to send.
Throws
IllegalOperationException

sendNotification

public static void sendNotification(CommunityDefinitionId communityDefId,
                                    String username,
                                    GroupSpaceNotification notification)
                             throws IllegalOperationException
Sends a notification to a specific domain username.

Parameters
username - The username to send the notification to.
notification - The groupspace notification instance to send.
Throws
IllegalOperationException

sendNotification

public static void sendNotification(String webAppName,
                                    String username,
                                    GroupSpaceNotification notification)
                             throws IllegalOperationException
Sends a notification to a specific domain username.

Parameters
webAppName - The source/target webapp name.
username - The username to send the notification to.
notification - The groupspace notification instance to send.
Throws
IllegalOperationException


Copyright © 2006 BEA Systems, Inc. All Rights Reserved