getHandlers function

If your task is an event requestor, consider calling the getHandlers function to determine if handlers are available to process your request. The getHandlers function does not initiate application linking. It helps your task determine if application linking is possible.

Overview

The getHandlers function identifies handlers that satisfy the following criteria:
  • The handler is registered as a handler for the event type.
  • The handler is enabled for the event type.
  • The user is authorized to access the handler.

If one or more handlers satisfy this criteria, application linking is possible. Otherwise, application linking is not possible. In the latter case, consider hiding or disabling the user interface control that will initiate the application linking process. Doing so increases the usability of your task because the control is enabled or displayed only when the Application Linking Manager can successfully process the user’s request.

Tip: If the getHandlers function does not find handlers that satisfy the aforementioned criteria, ensure that the event type is registered with the Application Linking Manager. If the event type is registered, verify that the event type ID is spelled correctly in your task.

Invoking the function

To call the getHandlers function, use the syntax shown in Figure 1.

Figure 1. Syntax to use to call the getHandlers function
//Define a function for the getHandlers function to call if the request
//completes without errors.
var callback = function(response){
	     //Specify what to do if there are handlers.
   }
   else {
      //Specify what to do if there are no handlers.
   }
}

//Define a function for the getHandlers function to call if errors
//occur with the request.
var errback = function(error){
	  //Specify how to proceed.
}

//Call the getHandlers function.
win.global.applinker.getHandlers(eventTypeId,callback,errback);
where,
response
JSON object array, which is provided by the getHandlers function, that contains the name of each handler that is available to process the event. To access the handlers in the array, use response.results.
errors
JSON object array, which is provided by the getHandlers function, that contains the error messages the function received. To access the messages in the array, use error.messages.
eventTypeId
ID that identifies the type of event.
callback
Function, which you provide, that the getHandlers function will call if it completes without errors.
errback
Function, which you provide, that the getHandlers function will call if errors occur when it is processing the request.

Example

var callback = function(response){
   if(response && response.results && response.results.length>0){
       //Handlers exist; enable the user controls.
   }else{
      //No handlers exist; disable the user controls.
   }
}
var errback = function(error){
   //Error occured when retrieving handlers; retrieve the messages.
   var messages = error.message;
}
win.global.applinker.getHandlers("IBM.ZOSMF.VIEW_DATASET",callback,errback);