Class ecm.model._SharedRequestsMixin

Provides methods that allow multiple, identical requests to share a common server request.
Defined in: <ecm\model\_SharedRequestsMixin.js>.

Constructor Summary

Constructor Attributes Constructor Name and Description
 

Method Summary

Method Attributes Method Name and Description
 
Clears all pending shared requests.
 
completeSharedRequest(params, callback)
Completes a successful shared request by clearing the shared request and passing each callback in the shared request completed callbacks list to the callback method.
 
failSharedRequest(params, callback)
Fails a shared request by clearing the shared request and passing each callback in the shared request failed callbacks list to the callback method.
 
Invokes a single request on behalf of an object method that may be called multiple times.

Constructor Detail

ecm.model._SharedRequestsMixin()

Since:
2.0.3

Method Detail

clearSharedRequests()

Clears all pending shared requests.

completeSharedRequest(params, callback)

Completes a successful shared request by clearing the shared request and passing each callback in the shared request completed callbacks list to the callback method.
Parameters:
params
An object containing parameters used to identify the shared request. The required parameters include:
  • shareRequestMethod - String name of the object method calling invokeSharedRequest.
  • sharedRequestKey - A string that uniquely identifies the shared request context. Multiple calls to invokeSharedRequest for the same request context should provide the same value. Along with the shareRequestMethod parameter, this value identifies a shared request.
callback
This callback is called once with each callback in the completed callbacks list, so that the callback can pass the results of the completed request to each completed callback.

failSharedRequest(params, callback)

Fails a shared request by clearing the shared request and passing each callback in the shared request failed callbacks list to the callback method.
Parameters:
params
An object containing parameters used to identify the shared request. The required parameters include:
  • shareRequestMethod - String name of the object method calling invokeSharedRequest.
  • sharedRequestKey - A string that uniquely identifies the shared request context. Multiple calls to invokeSharedRequest for the same request context should provide the same value. Along with the shareRequestMethod parameter, this value identifies a shared request.
callback
This callback is called once with each callback in the failed callbacks list, so that the callback can pass the results of the failed request to each failed callback.

invokeSharedRequest(params)

Invokes a single request on behalf of an object method that may be called multiple times. The multiple calls are associated with the single request using the calling object's method name and a key value that is shared by the common requests.
Parameters:
params
An object containing parameters. The parameters include:
  • shareRequestMethod - String name of the object method calling invokeSharedRequest.
  • sharedRequestKey - A string that uniquely identifies the shared request context. Multiple calls to invokeSharedRequest for the same request context should provide the same value. Along with the shareRequestMethod parameter, this value identifies a shared request. If not provided, the default value "shared" is used and all requests for the calling method share a common request.
  • sharedRequestCompleteCallback - The request completed callback method that was passed into the calling method. When invokeSharedRequest is called for a shared request, this callback method is added to the list of completed callbacks. The completed callbacks are called when completeSharedRequest is called after the request completes.
  • sharedRequestFailedCallback - The request failed callback method that was passed into the calling method. When invokeSharedRequest is called for a shared request, this callback method is added to the list of failed callbacks. The failed callbacks are called when failSharedRequest is called after the request fails.
  • serviceName - The name of the service. Refer to navigator/WEB-INF/struts.xml for a list of the services.
  • repositoryType - The type of content repository: od, cm, p8, ci, cmis, or undefined for common services.
  • requestParams - An object containing additional and request parameters. Parameters include:
    • requestHeaders - Parameters intended for the Request Header. When requestHeaders is provided, the caller is responsible for optionally setting the "Cache-Control" request header, as a default option will not be set. When requestHeaders is not provided, "Cache-Control" "no-cache" is used.
    • requestParams - Parameters intended for the URL (for GET requests) or request body (for POST requests).
    • cancellable - Flag indicating if the request can be canceled
    • backgroundRequest - Flag indicating if the request should be run in the background.
    • synchronous - Flag indicating if this is a synchronous request. By default all requests are asynchronous. Using synchronous requests is discouraged and should be used with extreme caution.
    • requestCompleteCallback - Callback method called when the a response from the server is received.
    • requestFailedCallback - Callback method called when a request returns from the server with errors.