Add mashups to the application-provided controllers
You can add mashups to the application-provided controllers.
Adding a mashup to the application-provided controllers is same
as replacing a mashup for both InitController
and BehaviorController
.
InitController
,
the server-side XML for the InitController
extension
is as follows: <?xml version="1.0" encoding="UTF-8"?>
<Controller controllerId="extn.home.portlets.OrderPortletExtnInitController"
screenId="extn.home.portlets.OrderPortletExtn">
<MashupRefs>
<MashupRef mashupId="extn_orderPortlet_getOrganizationList"
mashupRefId="extn_getOrganizationList" permissionId="" extnType="ADD"/>
</MashupRefs>
</Controller>
InitController
extension
is as follows:scDefine([
"scbase/loader!dojo/_base/declare",
"scbase/loader!dojo/_base/kernel",
"scbase/loader!extn/home/portlets/OrderPortletExtn",
"scbase/loader!sc/plat/dojo/controller/ExtnScreenController"
], function(
_dojodeclare,
_dojokernel,
_extnOrderPortletExtn,
_scExtnScreenController
) {
return _dojodeclare("extn.home.portlets.OrderPortletExtnInitController",
[_scExtnScreenController], {
screenId: 'extn.home.portlets.OrderPortletExtn',
mashupRefs: [{
sourceNamespace: 'extn_getOrganizationList_output',
mashupRefId: 'extn_getOrganizationList',
sequence: '',
mashupId: 'extn_orderPortlet_getOrganizationList',
sourceBindingOptions: '',
extnType: 'ADD'
}]
});
});
The value of the
extnType
attribute in server-side XML and client-side definition is set toADD
.All the attributes for a mashup are defined.
The
mashupRefId
attribute starts withextn_
that does not match with any value in the application-provided screenThe
mashupId
attribute contains an application-provided mashup.
Whenever the mashup calls present in BehaviorController
completes,
the onExtnMashupCompletion
event is raised in a screen
extension. To get the handle after the completion of mashup call present
in BehaviorController
, define a local subscriber
in the onExtnMashupCompletion
event.
onExtnMashupCompletion
event:subscribers : {
local : [
{
eventId: 'onExtnMashupCompletion',
sequence: '51',
description: '',
listeningControlUId: '',
handler : {
methodName : "handleOnExtnMashupCompletion" // name of the handler method
}
}
]
handleOnExtnMashupCompletion
hanlder
handler method as follows: handleOnExtnMashupCompletion: function(event, bEvent, ctrl, args)
{
// add custom logic
}
The following table describes the data of the last argument (args):
Data of the last argument (args) | Description |
---|---|
mashupContext | Context of the mashup call. |
mashupObject | Mashup reference object when only one mashup is called. |
mashupArray | The list of mashup references when multiple mashups are called. |
inputData | The input data for the mashup call. |
hasError | If an error occurs on calling the mashup, the
value is set to True . |
errorData | Contains the error-related data when an error occurs on calling the mashup. |