Setting Up and Using the Events Framework

Use the Events Framework to track events and send notifications if required. The Events Framework provides the flexibility to track events and to connect to the Notifications Framework to send notifications.

The Events Framework can be used with or without the Notifications Framework.

The Batch Events Framework provides the flexibility to track batch events alone or with batch notifications for multiple consumers with multiple templates.

This topic discusses how to:

  1. Configure an event for the Events Framework.

  2. Trigger the Events Framework.

Page Name

Definition Name

Navigation

Usage

Event Setup

SCC_NTFEVT_CFG

Set Up SACR > System Administration > Utilities > Notifications > Event Setup

Configure the event and specify the notification consumers related to the event to send notifications when the event is tracked.

Access the Event Setup page (Set Up SACR > System Administration > Utilities > Notifications > Event Setup).

This example illustrates the fields and controls on the Event Setup page. You can find definitions for the fields and controls later on this page.

Event Setup Page

Field or Control

Description

Event ID

Displays a read-only unique ID field which is generated automatically after successful save of component.

Event Name

Enter the event name.

Status

Select the event status. Only active events can be raised.

Description

Enter the event description.

Application Class

Select the application class which is extending AbstractEvent class (SCC_COMMON:NOTIFICATION:EVENT:AbstractEvent) which handles the event notifications.

Select the SCC_COMMON:NOTIFICATION:EVENT:BatchEvent app class for batch events.

Event Template Name

Select a Generic template which is configured for event message text and event context data.

View Event Template

Select this link to open the Generic Template Definition page for the selected template.

Consumer Name

Select the Notification consumer for this event to connect the Notifications Framework into the Events Framework. The Notifications Framework is invoked for the selected consumers when the event is raised.

Application Class

Select the application which is extending AbstractEventNotifier (SCC_COMMON:NOTIFICATION:EVENT:AbstractEventNotifier) application class which handles the connection with the Notifications Framework. Select SCC_COMMON:NOTIFICATION:EVENT:BatchEventNotifier app class for batch events.

View Consumer Details

Select this link to open the Notification Consumer Setup page for selected consumer.

These methods must be used by the Events Framework to raise the event and to invoke the Notifications Framework:

  1. Write an Event context App class that extends BaseEventContext.

    Sample Code:

    class GradeEventContext extends SCC_COMMON:NOTIFICATION:EVENT:BaseEventContext
    
    
  2. Write an AppClass that extends AbstractEvent class. The Event ID must be passed to the Super Class constructor here, as shown below.

    Sample Code:

    %Super = create SCC_COMMON:NOTIFICATION:EVENT:AbstractEvent(&pEvtId);
    1. Implement the abstract method populateEventContext(). This method populates the event context with necessary information for further processing.

      Sample Code:

      method populateEventContext
         /+ &p_eventContext as SCC_COMMON:NOTIFICATION:EVENT:IEventContext +/
         /+ Extends/implements SCC_COMMON:NOTIFICATION:EVENT:AbstractEvent.populateEventContext +/
         Local SCC_USER_NOTIFICATIONS:EVENT:CONTEXT:GradeEventContext &grdContext = &p_eventContext As SCC_USER_NOTIFICATIONS:EVENT:CONTEXT:GradeEventContext;
         Local Record &recStdEnrl = &grdContext.recPayload;
         Local SCC_USER_NOTIFICATIONS:UTIL:UserNotificationUtil &ntfUtil = create SCC_USER_NOTIFICATIONS:UTIL:UserNotificationUtil();
         
         &grdContext.getEventParameterMap().Put("%1", &ntfUtil.getClassDescriptor(&recStdEnrl));
         
         &grdContext.getEventDataMap().Put("EVENT_TYPE", "FINAL_GRADE_POSTED");
         &grdContext.getEventDataMap().Put("INST", String(&recStdEnrl.INSTITUTION.Value));
         &grdContext.getEventDataMap().Put("CAREER", String(&recStdEnrl.ACAD_CAREER.Value));
         &grdContext.getEventDataMap().Put("TERM", String(&recStdEnrl.STRM.Value));
         &grdContext.getEventDataMap().Put("GOTO", "Grades");
         
      end-method;
    2. Override the onSucess(), onError() for custom behavior.

  3. Raise the event by invoking the EventHandler.raiseEvent() by passing the event ID and event context or by passing the asynchronous service operation and rowset based on need.

    Sample Code:

    Local SCC_COMMON:NOTIFICATION:EVENT:EventHandler &evtHndlr = create SCC_COMMON:NOTIFICATION:EVENT:EventHandler();
       
    &evtHndlr.raiseEvent("SCC_NTF_EVT_20131120095842", &grdCntxt);
    
    Or 
    
    &evtHndlr.publishMessage(OPERATION.SCC_NTF_PUBLISH_STDNT_ENRL, &rs_stdnt_enrl, "");
  4. Write an Event Notifier App class that extends AbstractEventNotifier for each notification consumer for an event if notifications should be sent along with event notifications. The Consumer ID must be passed to the Super Class constructor here, as shown below.

    Sample Code:

    %Super = create SCC_COMMON:NOTIFICATION:EVENT:AbstractEventNotifier(&pNtfConsID);

    Implement the raiseEventNotification() abstract method to send consumer notifications by invoking by existing notification consumer app class which extends AbstractNotification.

    Sample Code:

    method raiseEventNotification
       /+ &pEventContext as SCC_COMMON:NOTIFICATION:EVENT:IEventContext +/
       /+ Returns Number +/
       /+ Extends/implements SCC_COMMON:NOTIFICATION:EVENT:AbstractEventNotifier.raiseEventNotification +/
       Local SCC_USER_NOTIFICATIONS:EVENT:CONTEXT:GradeEventContext &grdContext = &pEventContext As SCC_USER_NOTIFICATIONS:EVENT:CONTEXT:GradeEventContext;
       Local Record &p_EnrlRec = &grdContext.recPayload;
       Local string &ntfMode = &grdContext.ntfMode;
       
       Local SCC_USER_NOTIFICATIONS:NOTIFICATION:GradeNotifier &grdNtf = create SCC_USER_NOTIFICATIONS:NOTIFICATION:GradeNotifier(%This.ntfConsID);
       &grdNtf.sendGrade(&p_EnrlRec.EMPLID.Value, &p_EnrlRec, &ntfMode);
       
       Return %This.getNotificationReqID(&grdNtf);
    end-method;