24 Notification API

This chapter provides a use case for the Notification API that describes how to create a new read notification substitution list and how to create an Oracle Enterprise Repository notification.

This chapter includes the following sections:

24.1 Overview

The Notification subsystem provides a web services-based mechanism that is used to create Oracle Enterprise Repository notifications.

24.2 Use Case

This section describes the use case using the Notification API. It includes the following topic:

24.2.1 Use Case: Create a Read Notification Substitution List and Create a Notification

Description

To create a read notification substitution list and create an Oracle Enterprise Repository notification.

Sample Code

Example 24-1 Use Case: Create a Read Notification Substitution List and Create a Notification

    String[] lSubstitutions = null;
    String[] lRecipients = null;
    String lTemplateType = "asset_registered";
    NameValue[] lNameValues = null;
 
    
    lRecipients = new String[] {"recipient@xyz.com"};
            
    try {
      //////////////////////////
      // read the existing substitutions based on the given template
      lSubstitutions = mFlashlineRegistry.notificationSubstitutionsRead(mAuthToken, lTemplateType);               
      
      //////////////////////////
      // create an array of namevalue pairs; a namevalue pair for each required substitution
      lNameValues = new NameValue[lSubstitutions.length];
            
      // populate the namevalues
      for(int i=0; i<lSubstitutions.length; i++) {
        lNameValues[i] = new NameValue();
        lNameValues[i].setName(lSubstitutions[i]);
        lNameValues[i].setValue("valueof-"+lSubstitutions[i]);
      }
 
      ////////////////////////////////////////////
      // create the notification
      mFlashlineRegistry.notificationCreate(mAuthToken, lTemplateType, lRecipients, lNameValues);
           
    } catch(Exception e) {
      fail(e.getMessage());
    }