
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.
You have set up your project in SAP NetWeaver Developer Studio. For more information, see Setting Up Your Project .
Retrieving Notification Instances
importcom.sap.caf.eu.gp.process.api.GPProcessFactory; importcom.sap.caf.eu.gp.process.rt.api.IGPNotificationManager; importcom.sap.caf.eu.gp.process.rt.api.IGPRuntimeManager; IGPRuntimeManager rtManager = GPProcessFactory.getRuntimeManager(); IGPNotificationManager notifManager = GPProcessFactory.getNotificationManager();
|
importjava.util.Calendar; importjava.util.Date; Calendar calendar = Calendar.getInstance(); calendar.set(2006, 1, 1); Date startDate = calendar.getTime(); calendar.set(2006, 11, 31); Date endDate = calendar.getTime();
|
importjava.util.Locale; importcom.sap.security.api.IUser; importcom.sap.caf.eu.gp.context.api.GPContextFactory; importcom.sap.caf.eu.gp.context.api.IGPContextManager; importcom.sap.caf.eu.gp.context.api.IGPUserContext; importcom.sap.caf.eu.gp.process.api.GPSearchRole; importcom.sap.caf.eu.gp.process.api.IGPProcessInstanceInfo; // create user context from the current user and locale IGPContextManagercontextManager = GPContextFactory.getContextManager(); IGPUserContextuserContext = contextManager.createUserContext(user, locale); IGPProcessInstanceInfoprocessInfo[] = rtManager.getRunningInstances( // specify a search role GPSearchRole.SEARCH_ROLE_ADMINISTRATOR, startDate, endDate, // specify user context userContext ); |
importcom.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 ); |
importjava.util.Enumeration; Enumerationnotifications = process.getNotificationInstanceEnumeration();
|
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):
importcom.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):
importcom.sap.caf.eu.gp.process.rt.notification.api.IGPNotificationInstanceEnumeration; IGPNotificationInstanceEnumeration notifEnum = notifManager.retrieveNotificationHistory( processInstanceID, activityID, notifID ); |
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 .