Extending the WPC Notification Mechanism 
Web Page Composer provides a standard notification mechanism for various scenarios, such as the approval workflow for publishing a page. This notification mechanism uses a standard mail client, such as Microsoft Outlook, to open an e-mail message, in which the notification details can be written.
WPC enables you to replace the standard notification mechanism, by sending notifications to a custom iView. For such an iView, you need to develop a custom portal component that receives a portal request with the relevant parameters. Then, you can process the data as required by the custom implementation.
The keys for the parameters of the portal request are defined in the class com.sap.portal.wpc.api.constants.NotificationConstants, under the subclass PropertyKeys. The message type parameter, NotificationConstants.PropertyKeys.MESSAGE_TYPE, determines the notification scenario. The following message types are provided:
Approval Message Types
REQUEST_APPROVAL
CANCEL_REQUEST
APPROVAL_REQUEST
REJECT_REQUEST
The following section lists the request parameters that are relevant for each notification scenario.
When requesting approval to publish a page (REQUEST_APPROVAL), or canceling an approval request (CANCEL_REQUEST), the following parameters are relevant:
|
Request Parameter |
Description |
|---|---|
|
FROM |
The unique ID of the user who initiated the approval request. |
|
TO |
A semicolon-separated list of unique IDs of the users who should approve the request. |
|
OBJECT_LINK |
A URL that navigates to the design-time page. Note that the approver needs to be logged in to the portal for the link to work. |
|
OBJECT_ID_DESIGNTIME |
The ID of the design-time object. |
|
OBJECT_NAME |
The name of the design-time object. |
|
VERSION_DESCRIPTION |
If versioning is enabled, the description of the page version that will be saved. This parameter is optional. |
|
SCHEDULED_PUBLICATION_DATE |
If publication is scheduled, the value of this parameter is the Long UTC representation of the publication date. |
|
SCHEDULED_EXPIRATION_DATE |
If removal is scheduled, the value of this parameter is the Long UTC representation of the expiration date. |
When approving a request (APPROVE_REQUEST), or rejecting an approval request (REJECT_REQUEST), the following parameters are relevant:
|
Request Parameter |
Description |
|---|---|
|
FROM |
The unique ID of the user who is the first approver of the request. |
|
TO |
The unique ID of the user who initiated the approval request. |
CC_RECIPIENTS |
A semicolon-separated list of unique IDs of additional approvers who should be notified (cc'ed) when a request is approved or rejected. |
|
OBJECT_ID_DESIGNTIME |
The ID of the design-time object. |
|
OBJECT_NAME |
The name of the design-time object. |
|
VERSION_DESCRIPTION |
If versioning is enabled, the description of the page version that will be saved. This parameter is optional. |
|
SCHEDULED_PUBLICATION_DATE |
If publication is scheduled, the value of this parameter is the Long UTC representation of the publication date. |
|
SCHEDULED_EXPIRATION_DATE |
If removal is scheduled, the value of this parameter is the Long UTC representation of the expiration date. |
Example
The following example shows how to use the approval message types within the doContent method of a custom implementation:
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
{
String messageType = request.getParameter(NotificationConstants.PropertyKeys.MESSAGE_TYPE);
if (messageType.equals(NotificationConstants.PropertyValues.ApprovalMessageTypes.REQUEST_APPROVAL)) {
//...
}
else if (messageType.equals(NotificationConstants.PropertyValues.ApprovalMessageTypes.CANCEL_REQUEST)) {
//...
}
else if (messageType.equals(NotificationConstants.PropertyValues.ApprovalMessageTypes.APPROVE_REQUEST)) {
//...
}
else if (messageType.equals(NotificationConstants.PropertyValues.ApprovalMessageTypes.REJECT_REQUEST)) {
//...
}
}