Hi,
Few Days Ago, One From My Friends in Oracle Fusion Discusssion Group B Team, Asked for interesting Small Facility to notify System User with any Notification coming to his notification pool inside our ADF ERP System under name SBA - Smart Business Applications.
Brief Description ..
i have small Notification Table contains all notifications contents & transactions with Flags to be in Mail Box Mode & Archiving Mode, Mail Box Area contains normal Steps like Read, Write, Reply & Transfer to Archive mode with two types of Notifications (System Notifications : Auto Generated From System & User Notifications).
My Notification Facility should work with Mail Box Mode and notify System user with Systematic / User Notifications related to him, in addition user affect-less this Auto Refresh Task.
Note : it is not make sense to include Poll Component in Page
Navigation Solution as you go from Page Source to another which make the
solution so hard to implement specially when we speak about general notifications solution.
Today, i show how to implement this solution for my favorite Java / ADF Framework and FYI : Recommended Structure to use ADF Regions - Page Fragment JSF Structure instead of Page Navigation Solution and in addition (panel tab to show & control one VO to include Tab : Mail Box & Tab : Archive).
<af:showDetailItem text="Mail Box" id="sdi1" stretchChildren="first"
disclosureListener="#{backingBeanScope.Notifications.NotificationRefreshMailBox}"
immediate="true">
<af:showDetailItem id="sdi2" stretchChildren="first" text="Archive"
disclosureListener="#{backingBeanScope.Notifications.NotificationRefreshArchive}"
immediate="true">
public void NotificationRefreshMailBox(DisclosureEvent disclosureEvent) {
if (disclosureEvent.isExpanded()) {
OperationBinding operationBinding = mybean.AccessOperation("RefreshNotificationUsingParams");
operationBinding.getParamsMap().put("PPUSER",
mybean.getScopeParameterValue("SScope_UserId", "SessionScope"));
operationBinding.getParamsMap().put("READFLAG", "N");
operationBinding.execute();
}
}
public void NotificationRefreshArchive(DisclosureEvent disclosureEvent) {
if (disclosureEvent.isExpanded()) {
OperationBinding operationBinding = mybean.AccessOperation("RefreshNotificationUsingParams");
operationBinding.getParamsMap().put("PPUSER",
mybean.getScopeParameterValue("SScope_UserId", "SessionScope"));
operationBinding.getParamsMap().put("READFLAG", "Y");
operationBinding.execute();
}
}
Finally : you need to include one image item and initiate default image based on iterator row count and Poll Component in your Mother page which include your Regions and customize it to work with your Iterators based on specified time.
<af:image id="i2"
binding="#{Notifications.mailBox}"source="#{bindings.PendingNotifications1Iterator.estimatedRowCount <= 0 ? '/images/mail-close.png' : '/images/mail-open.png'}"/>
Refresh every 30 sec using listener specified ..
<af:poll id="p4" interval="30000" pollListener="#{Notifications.MailBoxPollListener}"/>
public void MailBoxPollListener(PollEvent pollEvent) {
// refresh every 30 sec & checking for mail box ..
DCIteratorBinding iteratorBinding = mybean.AccessIteratorBinding("PendingNotifications1Iterator");
iteratorBinding.executeQuery();
if (iteratorBinding.getEstimatedRowCount() > 0) {
getMailBox().setSource("/images/mail-open.png");
} else {
getMailBox().setSource("/images/mail-close.png");
}
mybean.RefreshItem(getMailBox());
}
two images required to notify End user (First one : No New Message) (Second one : You have new Message-s).
so, i think you can implement this small solution easy for your notification table - s one time per ADF Applications.
No comments:
Post a Comment