Configuring Siebel Open UI > Example of Customizing Siebel Open UI > Process of Customizing the Presentation Model >

Customizing the Presentation Model to Handle Notifications


This task is a step in Process of Customizing the Presentation Model.

The Siebel Server sends a confirmation of the record deletion when it receives the InvokeMethod request for the DeleteRecord method. You can write a handler for the NotifyDeleteRecord notification to process this confirmation in the client. For more information, see DeleteRecord Method.

Siebel Open UI packages a notification that it gets from the Siebel Server in the business component layer as part of a reply property set. This property set includes information about server state modifications or replies to requests for state information. For example, if Siebel Open UI deletes a record on the server, then it sends a NotifyDeleteRecord notification to the client. When Siebel Open UI sends a request to the server, the server processes the request, Siebel Open UI examines the relevant modifications that exist on the server, and then collects and packages notifications that are ready to communicate to the client. If Siebel Open UI sends an InvokeMethod call for the DeleteRecord method to the server, then the Siebel Web Engine sends a NotifyDeleteRecord notification from the business component layer to the client. For more information about the business component layer, see Configuring Siebel Business Applications.

Figure 21 illustrates the code you use to customize the presentation model to handle notifications. Each number in this figure identifies the corresponding step number in the numbered task list that this book includes immediately after this figure.

Figure 21. Customizing the Presentation Model to Handle Notifications

To customize the presentation model to handle notifications

  1. Identify the notification type that Siebel Open UI must handle.

    Examine the notification types in the Notifications That Siebel Open UI Supports topic. Look for a notification type that indicates it might include the information that your customization requires. For this example, the notification type for the NotifyDeleteRecord notification is SWE_PROP_BC_NOTI_DELETE_RECORD.

  2. Examine the methods in the presentation model that indicate they might be useful for your customization.

    The AttachNotificationHandler method is the appropriate method to use for this example. For more information, see AttachNotificationHandler Method.

  3. In the recyclebinpmodel.js file, add the AttachNotificationHandler to the Init method of the presentation model:

    this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_DELETE_RECORD"), HandleDeleteNotification);

  4. Add the custom method that Siebel Open UI uses to handle replies from NotifyDeleteRecord and to populate the recycle bin:

    function HandleDeleteNotification(propSet){

  5. Get the property that you use to identify the objects that are currently flagged for deletion:

    var objectsUnderDeletion = this.Get("ObjectsUnderDeletion");

    You configured this property in Step 10 to back up the records that Siebel Open UI is in the process of deleting.

  6. Determine whether or not any records exist in the In Progress list:

    if(objectsUnderDeletion.length > 0){

    Siebel Open UI must process these records and move them to the recycle bin. In this step and in several subsequent steps, you do more than one examination to make sure the notification instance that Siebel Open UI is handling is the instance that it requires for the notification handler. Some repeating notifications might exist that you must process to avoid duplication.

  7. Identify the row involved with the NotifyDeleteRecord notification:

    var activeRow = propSet.GetProperty(consts.get("SWE_PROP_BC_NOTI_ACTIVE_ROW"));

    In this example, you use the SWE_PROP_BC_NOTI_ACTIVE_ROW property. For more information about this property, see Summary of Notifications That Siebel Open UI Supports.

  8. Make sure that this notification confirms the deletion, and make sure that this notification is not a duplicate:

    if(activeRow == this.Get("GetSelection") && objectsUnderDeletion[activeRow]){

    where:

    • The following code determines if the record that the NotifyDeleteRecord method references is the currently selected record:

    activeRow == this.Get("GetSelection")

    This example uses a synchronous request, so Siebel Open UI selects the record that the DeleteRecord method references in the context of PreInvokeMethod. It selects no other record after it makes this initial selection while the Siebel Server sends the delete confirmation notification to the client. For more information, see About Synchronous and Asynchronous Requests.

    • The following code makes sure that this notification is not a duplicate:

    objectsUnderDeletion[ activeRow ]

    It determines whether or not Siebel Open UI has already removed the record that it is examining in a previous instance of handling the same notification for the same record.

  9. Add a property that Siebel Open UI can use to store the list of records that the user deletes but might retrieve from the recycle bin:

    this.AddProperty("DeletionCompleteSet", []);

  10. Store the deleted record:

    this.Get("DeletionCompleteSet").push(objectsUnderDeletion[activeRow]);

    The conditional block where this code resides determines that this notification is not a duplicate NotifyDeleteRecord notification for the record that the DeleteRecord method requests deletion. So, this push statement pushes the deleted record into the DeletionCompletedSet property that you defined Step 9.

  11. Remove the record from the Deletion in Progress list:

    objectsUnderDeletion[ activeRow ] = null;

  12. Add the RefreshList method:

    this.AddMethod("RefreshList", function(){});

    Siebel Open UI must refresh the recycle bin after Step 11 adds a record to this recycle bin. You can use dependency injection through the AttachPMBinding method to inform the physical renderer that the recycle bin requires a refresh. For more information, see About Dependency Injection. For more information, see How Siebel Open UI Uses Nondetailed Data to Indicate Modifications That Occur in Detailed Data.

  13. Run the RefreshList method:

    this.ExecuteMethod("RefreshList");

  14. Save the recyclebinpmodel.js file.

How Siebel Open UI Uses Nondetailed Data to Indicate Modifications That Occur in Detailed Data

Siebel Open UI uses the dependency that exists between the presentation model and the physical renderer to indicate a high-level modification in a property or method, such as a modifying in the list of records that it must display. This dependency configures Siebel Open UI to run a high-level renderer method, such as a method that repopulates the entire physical markup of columns and data in the grid container. The renderer method then gets the detailed presentation model attributes, such as columns and data, through properties or methods that the presentation model contains.

This example uses the RefreshList method as an indicator that Siebel Open UI modified something in the DeletionCompletedSet property. When you configure the physical renderer in Customizing the Physical Renderer to Refresh the Recycle Bin, you configure Siebel Open UI to use AttachPMBinding to bind a physical renderer method to the RefreshList method. You also configure Siebel Open UI to use this physical renderer method to get the detailed data that the DeletionCompletedSet method references. Siebel Open UI gets this data from the presentation model so that the physical renderer can render it. For more information, see AttachPMBinding Method.

Configuring Siebel Open UI Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.