com.stratelia.silverpeas.notificationManager
Class NotificationManager

java.lang.Object
  extended by com.stratelia.silverpeas.notificationManager.AbstractNotification
      extended by com.stratelia.silverpeas.notificationManager.NotificationManager
All Implemented Interfaces:
NotificationParameterNames

public class NotificationManager
extends AbstractNotification
implements NotificationParameterNames

Class declaration

Version:
%I%, %G%
Author:

Field Summary
static String FROM_EMAIL
           
static String FROM_NAME
           
static String FROM_NO
           
static String FROM_UID
           
 
Fields inherited from interface com.stratelia.silverpeas.notificationManager.NotificationParameterNames
ATTACHMENTID, COMMUNICATION, DATE, FROM, HIDESMTPHEADERFOOTER, LANGUAGE, LINKLABEL, SERVERURL, SESSIONID, SOURCE, SUBJECT, URL
 
Constructor Summary
NotificationManager(String language)
           
 
Method Summary
 void addAddress(int aNotificationAddressId, int aUserId)
           
protected  void closeSchema(NotifSchema schema)
           
protected  List<DelayedNotificationData> createAllDelayedNotificationData(NotificationParameters params, String aUserId, NotifSchema schema)
           
protected  NotificationData createNotificationData(NotificationParameters params, String aUserId, NotifSchema schema)
          Method declaration
 void deleteAllAddress(int userId)
          Method declaration
 void deleteNotifAddress(int aNotificationAddressId)
          Method declaration
 void deletePreference(int aPreferenceId)
          Method declaration
protected  List<NotifAddressRow> getAllNotifAddressRow(NotificationParameters params, int aUserId, NotifSchema schema)
           
 String getComponentFullName(String compInst)
          Method declaration
 String getComponentFullName(String compInst, String separator, boolean isPathToComponent)
          Method declaration
 int getDefaultAddress(int aUserId)
          Method declaration
 ArrayList<Properties> getDefaultAddresses(int aUserId)
           
protected  List<Integer> getDefaultNotificationAddresses()
           
protected  NotifAddressRow getNotifAddressRow(NotificationParameters params, int aUserId, NotifSchema schema)
          Method declaration
 ArrayList<Properties> getNotifChannels()
          get All the channel types from the database.
 Properties getNotificationAddress(int aNotificationAddressId, int aUserId)
          Method declaration
 ArrayList<Properties> getNotificationAddresses(int aUserId)
          get the notifications addresses of a user
 Properties getNotifPreference(int aPrefId, int aUserId)
          Method declaration
 ArrayList<Properties> getNotifPreferences(int aUserId)
          get the notifications preferences of a user
 ArrayList<Properties> getNotifPriorities()
          get All the priorities types
 ArrayList<Properties> getNotifUsages()
          get All the usage types
protected  String getSureString(String s)
           
protected  UserAccessLevel getUserAccessLevel(int userId)
           
protected  String getUserEmail(int userId)
           
protected  String getUserFullName(int userId)
           
 Collection<UserRecipient> getUsersFromGroup(String groupId)
          Gets the user recipients from a group specified by a given identifier.
protected  boolean isDefaultAddress(int aDefaultAddressId, int aUserId, NotifSchema schema, boolean isMultiChannelNotification)
           
 boolean isMultiChannelNotification()
           
protected  Properties notifAddressRowToProperties(NotifAddressRow nar, boolean canEdit, boolean canDelete, boolean canTest, boolean isDefault, NotifSchema schema)
          Method declaration
protected  Properties notifPreferencesRowToProperties(int aUserId, NotifPreferenceRow npr, boolean canEdit, boolean canDelete, boolean canTest, boolean isDefault, NotifSchema schema)
          Method declaration
 void notifyExternals(NotificationParameters params, Collection<ExternalRecipient> externals)
           
 void notifyUsers(NotificationParameters params, String[] userIds)
          Method declaration
 void saveNotifAddress(int aNotificationAddressId, int aUserId, String aNotifName, int aChannelId, String aAddress, String aUsage)
          Method declaration
 void savePreferences(int aUserId, int aInstanceId, int aMessageType, int aDestinationId)
          Method declaration
 void setDefaultAddress(int aNotificationAddressId, int aUserId)
          Method declaration
 void testNotifAddress(int aNotificationAddressId, int aUserId)
          Send a test message to the given notification address Id
 
Methods inherited from class com.stratelia.silverpeas.notificationManager.AbstractNotification
computeURL, computeURL, getApplicationURL, getUserAutoRedirectSilverpeasServerURL, getUserAutoRedirectURL, getUserAutoRedirectURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FROM_NO

public static final String FROM_NO
See Also:
Constant Field Values

FROM_UID

public static final String FROM_UID
See Also:
Constant Field Values

FROM_EMAIL

public static final String FROM_EMAIL
See Also:
Constant Field Values

FROM_NAME

public static final String FROM_NAME
See Also:
Constant Field Values
Constructor Detail

NotificationManager

public NotificationManager(String language)
Method Detail

getNotificationAddresses

public ArrayList<Properties> getNotificationAddresses(int aUserId)
                                               throws NotificationManagerException
get the notifications addresses of a user

Parameters:
aUserId - : id of the user as in the "id" field of "ST_USER" table.
Returns:
an ArrayList of properties containing "name", "type", "usage" and "address" keys
Throws:
NotificationManagerException

getNotificationAddress

public Properties getNotificationAddress(int aNotificationAddressId,
                                         int aUserId)
                                  throws NotificationManagerException
Method declaration

Parameters:
aNotificationAddressId -
Returns:
Throws:
NotificationManagerException
See Also:

getDefaultAddresses

public ArrayList<Properties> getDefaultAddresses(int aUserId)
                                          throws NotificationManagerException
Throws:
NotificationManagerException

getDefaultAddress

public int getDefaultAddress(int aUserId)
                      throws NotificationManagerException
Method declaration

Parameters:
aUserId -
Returns:
The user's default address Id
Throws:
NotificationManagerException
See Also:

getNotifPriorities

public ArrayList<Properties> getNotifPriorities()
get All the priorities types

Returns:
an ArrayList of properties containing "id" and "name" keys

getNotifUsages

public ArrayList<Properties> getNotifUsages()
get All the usage types

Returns:
an ArrayList of properties containing "id" and "name" keys

getNotifChannels

public ArrayList<Properties> getNotifChannels()
                                       throws NotificationManagerException
get All the channel types from the database.

Returns:
an ArrayList of properties containing "id" and "name" keys
Throws:
NotificationManagerException

getNotifPreferences

public ArrayList<Properties> getNotifPreferences(int aUserId)
                                          throws NotificationManagerException
get the notifications preferences of a user

Parameters:
aUserId - : id of the user as in the "id" field of "ST_USER" table.
Returns:
an ArrayList of properties containing "name", "type", "usage" and "address" keys
Throws:
NotificationManagerException

getNotifPreference

public Properties getNotifPreference(int aPrefId,
                                     int aUserId)
                              throws NotificationManagerException
Method declaration

Parameters:
aUserId -
Returns:
Throws:
NotificationManagerException
See Also:

setDefaultAddress

public void setDefaultAddress(int aNotificationAddressId,
                              int aUserId)
                       throws NotificationManagerException
Method declaration

Parameters:
aNotificationAddressId -
aUserId -
Throws:
NotificationManagerException
See Also:

addAddress

public void addAddress(int aNotificationAddressId,
                       int aUserId)
                throws NotificationManagerException
Throws:
NotificationManagerException

savePreferences

public void savePreferences(int aUserId,
                            int aInstanceId,
                            int aMessageType,
                            int aDestinationId)
                     throws NotificationManagerException
Method declaration

Parameters:
aUserId -
aInstanceId -
aMessageType -
aDestinationId -
Throws:
NotificationManagerException
See Also:

saveNotifAddress

public void saveNotifAddress(int aNotificationAddressId,
                             int aUserId,
                             String aNotifName,
                             int aChannelId,
                             String aAddress,
                             String aUsage)
                      throws NotificationManagerException
Method declaration

Parameters:
aNotificationAddressId -
aUserId -
aNotifName -
aChannelId -
aAddress -
aUsage -
Throws:
NotificationManagerException
See Also:

deletePreference

public void deletePreference(int aPreferenceId)
                      throws NotificationManagerException
Method declaration

Parameters:
aPreferenceId -
Throws:
NotificationManagerException
See Also:

deleteNotifAddress

public void deleteNotifAddress(int aNotificationAddressId)
                        throws NotificationManagerException
Method declaration

Parameters:
aNotificationAddressId -
Throws:
NotificationManagerException
See Also:

deleteAllAddress

public void deleteAllAddress(int userId)
                      throws NotificationManagerException
Method declaration

Parameters:
userId -
Throws:
NotificationManagerException
See Also:

testNotifAddress

public void testNotifAddress(int aNotificationAddressId,
                             int aUserId)
                      throws NotificationManagerException
Send a test message to the given notification address Id

Parameters:
aNotificationAddressId - of the table ST_NotifAddress row to send notification to.
Throws:
NotificationManagerException

notifyUsers

public void notifyUsers(NotificationParameters params,
                        String[] userIds)
                 throws NotificationManagerException
Method declaration

Parameters:
params -
Throws:
NotificationManagerException
See Also:

notifyExternals

public void notifyExternals(NotificationParameters params,
                            Collection<ExternalRecipient> externals)
                     throws NotificationManagerException
Throws:
NotificationManagerException

getUsersFromGroup

public Collection<UserRecipient> getUsersFromGroup(String groupId)
                                            throws NotificationManagerException
Gets the user recipients from a group specified by a given identifier. User that has not an activated state is not taken into account, so this kind of user is not included into the returned container.

Throws:
NotificationManagerException

getComponentFullName

public String getComponentFullName(String compInst)
                            throws NotificationManagerException
Method declaration

Parameters:
compInst -
Returns:
Throws:
NotificationManagerException
See Also:

getComponentFullName

public String getComponentFullName(String compInst,
                                   String separator,
                                   boolean isPathToComponent)
                            throws NotificationManagerException
Method declaration

Parameters:
compInst -
separator -
isPathToComponent -
Returns:
Throws:
NotificationManagerException
See Also:

getUserEmail

protected String getUserEmail(int userId)

getUserAccessLevel

protected UserAccessLevel getUserAccessLevel(int userId)

getUserFullName

protected String getUserFullName(int userId)

notifPreferencesRowToProperties

protected Properties notifPreferencesRowToProperties(int aUserId,
                                                     NotifPreferenceRow npr,
                                                     boolean canEdit,
                                                     boolean canDelete,
                                                     boolean canTest,
                                                     boolean isDefault,
                                                     NotifSchema schema)
                                              throws UtilException,
                                                     NotificationManagerException
Method declaration

Parameters:
aUserId -
npr -
canEdit -
canDelete -
canTest -
isDefault -
schema -
Returns:
Throws:
UtilException
NotificationManagerException
See Also:

notifAddressRowToProperties

protected Properties notifAddressRowToProperties(NotifAddressRow nar,
                                                 boolean canEdit,
                                                 boolean canDelete,
                                                 boolean canTest,
                                                 boolean isDefault,
                                                 NotifSchema schema)
                                          throws UtilException
Method declaration

Parameters:
nar -
canEdit -
canDelete -
canTest -
isDefault -
schema -
Returns:
Throws:
UtilException
See Also:

getNotifAddressRow

protected NotifAddressRow getNotifAddressRow(NotificationParameters params,
                                             int aUserId,
                                             NotifSchema schema)
                                      throws UtilException
Method declaration

Parameters:
params -
aUserId -
schema -
Returns:
Throws:
UtilException
See Also:

getAllNotifAddressRow

protected List<NotifAddressRow> getAllNotifAddressRow(NotificationParameters params,
                                                      int aUserId,
                                                      NotifSchema schema)
                                               throws UtilException
Throws:
UtilException

createNotificationData

protected NotificationData createNotificationData(NotificationParameters params,
                                                  String aUserId,
                                                  NotifSchema schema)
                                           throws UtilException
Method declaration

Parameters:
params -
aUserId -
schema -
Returns:
Throws:
UtilException
See Also:

createAllDelayedNotificationData

protected List<DelayedNotificationData> createAllDelayedNotificationData(NotificationParameters params,
                                                                         String aUserId,
                                                                         NotifSchema schema)
                                                                  throws UtilException
Throws:
UtilException

isDefaultAddress

protected boolean isDefaultAddress(int aDefaultAddressId,
                                   int aUserId,
                                   NotifSchema schema,
                                   boolean isMultiChannelNotification)
                            throws UtilException
Throws:
UtilException

getSureString

protected String getSureString(String s)

closeSchema

protected void closeSchema(NotifSchema schema)

isMultiChannelNotification

public boolean isMultiChannelNotification()
See Also:
NotificationManagerSettings.isMultiChannelNotificationEnabled()

getDefaultNotificationAddresses

protected List<Integer> getDefaultNotificationAddresses()
See Also:
NotificationManagerSettings.getDefaultChannels()


Copyright © 2016 Silverpeas. All Rights Reserved.