Show TOC Start of Content Area

Procedure documentation Retrieving Process Notification Instances  Locate the document in its SAP Library structure

Use

To be able to dynamically update at runtime the status and processing time of notifications you need to instantiate the runtime and notification managers and retrieve the available notification instances of the relevant process.

Prerequisites

You have set up your project in SAP NetWeaver Developer Studio. For more information, see Setting Up Your Project.

Procedure

Retrieving Notification Instances

...

       1.      Instantiate the runtime and notification managers:

Example

import com.sap.caf.eu.gp.process.api.GPProcessFactory;

import com.sap.caf.eu.gp.process.rt.api.IGPNotificationManager;

import com.sap.caf.eu.gp.process.rt.api.IGPRuntimeManager;

 

IGPRuntimeManager rtManager = GPProcessFactory.getRuntimeManager();

IGPNotificationManager notifManager = GPProcessFactory.getNotificationManager();

 

 

       2.      Retrieve a running process instance by specifying search criteria:

                            a.      Specify start and end dates for the process:

Example

import java.util.Calendar;

import java.util.Date;

 

Calendar calendar = Calendar.getInstance();

calendar.set(2006, 1, 1);

Date startDate = calendar.getTime();

 

calendar.set(2006, 11, 31);

Date endDate = calendar.getTime();

 

 

                            b.      Search for process instances meeting your requirements:

Example

import java.util.Locale;

import com.sap.security.api.IUser;

import com.sap.caf.eu.gp.context.api.GPContextFactory;

import com.sap.caf.eu.gp.context.api.IGPContextManager;

import com.sap.caf.eu.gp.context.api.IGPUserContext;

import com.sap.caf.eu.gp.process.api.GPSearchRole;

import com.sap.caf.eu.gp.process.api.IGPProcessInstanceInfo;

 

// create user context from the current user and locale

IGPContextManager contextManager = GPContextFactory.getContextManager();

IGPUserContext userContext = contextManager.createUserContext(user, locale);

 

IGPProcessInstanceInfo processInfo[] = rtManager.getRunningInstances(

                                  // specify a search role

                                  GPSearchRole.SEARCH_ROLE_ADMINISTRATOR,

                                  startDate,

                                  endDate,

                                  // specify user context

                                  userContext

                                 );

 

                            c.      Retrieve the information for a single process instance:

Example

import com.sap.caf.eu.gp.process.api.IGPProcessInstance;

 

// get process instance information

for (int i = 0; i < processInfo.length; i++) {

     IGPProcessInstance process = rtManager.getProcessInstance(

                                  processInfo[i],

                                  userContext

                                 );

         

       3.      Retrieve all notification instances related to the running process instance:

Example

import java.util.Enumeration;

 

Enumeration notifications = process.getNotificationInstanceEnumeration();

 

 

Note

You can directly retrieve a process notification if you know its ID, the ID of the process, and, optionally, the activity ID (if it is defined at the activity level):

import com.sap.caf.eu.gp.process.rt.notification.api.IGPNotificationInstance;

 

IGPNotificationInstance notif = notifManager.retrieveNotification(

                                    processInstanceID,

                                    activityID,

                                    notifID

                                   );

Retrieving Notification History

You can retrieve all versions of a notification instance by providing its ID, the ID of the process, and, optionally, the activity ID (if it is defined at the activity level):

Example

import com.sap.caf.eu.gp.process.rt.notification.api.IGPNotificationInstanceEnumeration;

 

IGPNotificationInstanceEnumeration notifEnum = notifManager.retrieveNotificationHistory(

                                   processInstanceID,

                                   activityID,

                                   notifID

                                  );

 

Result

Once you have information about the process notifications, you can update them or change their status. For more information, see Updating Notification Processing Time and Status.

 

End of Content Area