@AccessLevel(value=EXTERNAL) public class NotificationDeliveryStrategy extends DefaultNotificationDeliveryAdapter
NotificationDelivery
. This class contains
the functions required to deliver notifications. The delivery of
notifications is based on the allocation targets (i.e. users, organization
units, positions, jobs and work queues) specified and also the notification
delivery mechanism to be employed.Constructor and Description |
---|
NotificationDeliveryStrategy()
Guice injection.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
convertUserList(curam.core.struct.UserNameKeyList userNameKeyList)
Converts a list of user name key objects into a list of user identifiers
and returns the result.
|
boolean |
deliverNotification(curam.util.workflow.struct.NotificationDetails notificationDetails,
curam.core.sl.struct.AllocationTargetList allocationTargetList)
Delivers a notification to the specified users based on the specified list
of allocation targets and also the delivery mechanism.
|
java.lang.String |
getEmailBody(java.lang.String actionLinkServerRoot,
curam.util.workflow.struct.NotificationBody notificationBody,
curam.util.workflow.struct.NotificationActionDetailsList notificationActionDetailsList)
Returns the body that will be used in a notification email using the
specified notification details.
|
java.util.List<java.lang.String> |
getUserListFromAllocationTarget(curam.core.sl.struct.AllocationTargetDetails allocationTargetDtls)
Examines an allocation target and returns a list the list of user
identifiers associated with that target.
|
void |
insertAlertForUser(curam.util.workflow.struct.NotificationDetails notificationDetails,
java.lang.String currentUserName)
Inserts an alert record for the specified user.
|
java.util.List<java.lang.String> |
removeDuplicatesFromUserIDList(java.util.List<java.lang.String> userIdentifiers)
Removes any duplicate user identifiers from the specified list of user
identifiers and returns the result.
|
java.util.List<java.lang.String> |
resolveAllocationTarget(curam.core.sl.struct.AllocationTargetDetails allocationTarget)
Resolves the specified allocation target into the corresponding list of
specific user identifiers and returns the result.
|
java.util.List<java.lang.String> |
resolveJob(curam.core.sl.struct.AllocationTargetDetails allocationTarget)
Resolves a specific job into a list of user identifiers.
|
java.util.List<java.lang.String> |
resolvePosition(curam.core.sl.struct.AllocationTargetDetails allocationTarget)
Resolves a specific position into a list of user identifiers.
|
java.util.List<java.lang.String> |
resolveUnit(curam.core.sl.struct.AllocationTargetDetails allocationTarget)
Resolves a specific organization unit into a list of user identifiers.
|
java.util.List<java.lang.String> |
resolveUser(curam.core.sl.struct.AllocationTargetDetails allocationTarget)
Resolves the identifier of the specified user contained in the
allocation target.
|
java.util.List<java.lang.String> |
resolveWorkQueue(curam.core.sl.struct.AllocationTargetDetails allocationTarget)
Returns a list of identifiers for all of the users that are subscribed
to the work queue specified in the allocation target details.
|
boolean |
selectDeliveryMechanism(curam.util.workflow.struct.NotificationDetails notificationDetails,
curam.core.sl.struct.AllocationTargetList allocationTargetList)
Evaluates the delivery mechanism from the notification details and calls
the appropriate method to send the notification
Subclasses can override this method to handle additional delivery mechanism
codes.
|
boolean |
shouldExcludeNotificationForCase(curam.util.workflow.struct.NotificationDetails notificationDetails)
This method get a Case ID from the notification Details if it exists and
checks to see if notifications should be disabled for that case.
|
static boolean |
shouldNotificationBeSentByAlert()
Examines the
ENV_SENDNOTIFICATIONALERTS application property to see if notifications
should be sent as alerts. |
static boolean |
shouldNotificationBeSentByMail()
Examines the
ENV_SENDNOTIFICATIONEMAILS application property to see if notifications
should be sent by email. |
boolean |
standardDeliverNotification(curam.util.workflow.struct.NotificationDetails notificationDetails,
curam.core.sl.struct.AllocationTargetList allocationTargetList)
Delivers a notification using the standard delivery mechanism.
|
deliverNotification, deliverNotification, deliverNotification
public NotificationDeliveryStrategy()
public boolean deliverNotification(curam.util.workflow.struct.NotificationDetails notificationDetails, curam.core.sl.struct.AllocationTargetList allocationTargetList)
deliverNotification
in class DefaultNotificationDeliveryAdapter
notificationDetails
- The details of the notification to be delivered.allocationTargetList
- A list of the allocation targets to be used to
deliver the notification.True
if the notification has been successfully
delivered to at least one user, otherwise False
.public boolean selectDeliveryMechanism(curam.util.workflow.struct.NotificationDetails notificationDetails, curam.core.sl.struct.AllocationTargetList allocationTargetList)
Subclasses can override this method to handle additional delivery mechanism
codes. To perform the out-of-the-box delivery mechanism selection code the
overridden methods should first invoke
super.selectDeliveryMechanism
.
notificationDetails
- The details of the notification to be delivered.allocationTargetList
- A list of the allocation targets to be used to
deliver the notification.True
if the notification has been successfully
delivered to at least one user, otherwise False
.public java.util.List<java.lang.String> resolveJob(curam.core.sl.struct.AllocationTargetDetails allocationTarget) throws curam.util.exception.AppException, curam.util.exception.InformationalException
allocationTarget
- An allocation target containing the details of
the job whose list of users will be sent a notification.curam.util.exception.AppException
curam.util.exception.InformationalException
public java.util.List<java.lang.String> resolvePosition(curam.core.sl.struct.AllocationTargetDetails allocationTarget) throws curam.util.exception.AppException, curam.util.exception.InformationalException
allocationTarget
- An allocation target containing the details of
the position whose list of users will be sent a notification.curam.util.exception.AppException
curam.util.exception.InformationalException
public java.util.List<java.lang.String> resolveWorkQueue(curam.core.sl.struct.AllocationTargetDetails allocationTarget) throws curam.util.exception.AppException, curam.util.exception.InformationalException
allocationTarget
- The allocation target containing the work queue
details.curam.util.exception.AppException
curam.util.exception.InformationalException
public java.util.List<java.lang.String> resolveUnit(curam.core.sl.struct.AllocationTargetDetails allocationTarget) throws curam.util.exception.AppException, curam.util.exception.InformationalException
allocationTarget
- An allocation target containing the details of
the organization unit whose list of users will be sent a notification.curam.util.exception.AppException
curam.util.exception.InformationalException
public java.util.List<java.lang.String> resolveUser(curam.core.sl.struct.AllocationTargetDetails allocationTarget) throws curam.util.exception.AppException, curam.util.exception.InformationalException
allocationTarget
- An allocation target containing the details of
the user who will be sent a notification. No validation is carried out
here to ensure that the user exists.curam.util.exception.AppException
curam.util.exception.InformationalException
public java.util.List<java.lang.String> resolveAllocationTarget(curam.core.sl.struct.AllocationTargetDetails allocationTarget) throws curam.util.exception.AppException, curam.util.exception.InformationalException
allocationTarget
- The allocation target to be resolved.curam.util.exception.AppException
curam.util.exception.InformationalException
public boolean standardDeliverNotification(curam.util.workflow.struct.NotificationDetails notificationDetails, curam.core.sl.struct.AllocationTargetList allocationTargetList)
NotificationExcludedCaseTypes
to filter unnecessary
notifications.
If the ENV_SENDNOTIFICATIONEMAILS
application property is set to true, the
notification will be sent via email.
If the ENV_SENDNOTIFICATIONALERTS
application property is set to true, the
notification will be sent via alerts.
A number of email configuration properties are also used:
ENV_ACTIONLINKSERVERROOT
application property provides the server root
that will be used in the construction of the notification action
links.ENV_NOTIFICATIONEMAILSERVER
application property provides the email server
that will be used to send the notification emails.ENV_NOTIFICATIONEMAILPORT
application property provides the email server
port that will be used to send the notification emails.ENV_NOTIFICATION_EMAIL_FROM
application property provides the email from
address that will be used in the sending of the notifications.notificationDetails
- The details of the notification to be delivered.allocationTargetList
- A list of the allocation targets to be used to
deliver the notification.True
if the notification has been successfully
delivered to at least one user, otherwise False
.public java.util.List<java.lang.String> convertUserList(curam.core.struct.UserNameKeyList userNameKeyList)
userNameKeyList
- The list of user name key objects.public static boolean shouldNotificationBeSentByMail()
ENV_SENDNOTIFICATIONEMAILS
application property to see if notifications
should be sent by email.True
if the notification should be sent by email,
otherwise False
.public static boolean shouldNotificationBeSentByAlert()
ENV_SENDNOTIFICATIONALERTS
application property to see if notifications
should be sent as alerts.True
if the notification should be sent as an alert,
otherwise False
.public boolean shouldExcludeNotificationForCase(curam.util.workflow.struct.NotificationDetails notificationDetails)
true
indicates that the notification should be disabled.
false
indicates that the notification should remain enabled.public java.util.List<java.lang.String> getUserListFromAllocationTarget(curam.core.sl.struct.AllocationTargetDetails allocationTargetDtls)
allocationTargetDtls
- The allocation target to be examined for a
list of associated users.public java.lang.String getEmailBody(java.lang.String actionLinkServerRoot, curam.util.workflow.struct.NotificationBody notificationBody, curam.util.workflow.struct.NotificationActionDetailsList notificationActionDetailsList)
actionLinkServerRoot
- The server root that will be concatenated to
the page identifier for the notification action link.notificationBody
- The body of the notification as specified in the
notification details.notificationActionDetailsList
- The list of actions as specified in
the notification action details.public void insertAlertForUser(curam.util.workflow.struct.NotificationDetails notificationDetails, java.lang.String currentUserName)
notificationDetails
- The details of the notification that are used in
the creation of the alert record for the specified user.currentUserName
- The name of the user for which an alert record
will be created for.public java.util.List<java.lang.String> removeDuplicatesFromUserIDList(java.util.List<java.lang.String> userIdentifiers)
userIdentifiers
- The list of user identifiers.