Replace mashups for a screen in controllers
You can replace mashups for a particular screen.
If you want to replace the mashup called by the application with
your own mashup, a service is called instead of an API provided by
the application. If you want to replace the mashup called by the application
with your own mashup, all the screens that use the application mashup
are impacted. You can replace mashup reference for a specific screen
by changing the custom mashup reference in both
InitController and BehaviorController.
To change the mashup reference, create extensions for the client-side
definition of a screen that requires extension files for both server-side
and client-side components.Note: If you want to change the mashup
definition across the application, ensure to override the capability
at a mashup layer.
For more information about overriding a mashup
and the screens impacted due to the change in mashup definition, seeExtend mashups. For example, to extend InitController and
change the mashup, the following example explains the application-provided InitController for
the isccs.home.portlets.OrderPortlet screen
with isccs.home.portlets.OrderPortletInitController controllerId.The server-side XML file for the application-provided InitController is
as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Controller
className="com.sterlingcommerce.ui.web.platform.controller.SCUIXAPIMashupController"
controllerId="isccs.home.portlets.OrderPortletInitController"
requestMethodSupported="POST" screenId="isccs.home.portlets.OrderPortlet">
<Group isAggregator="Y"/>
<MashupRefs>
<MashupRef mashupId="orderPortlet_getOrganizationList"
mashupRefId="getOrganizationList" permissionId=""/>
</MashupRefs>
</Controller>
The client-side definition for
InitController is
as follows:scDefine(["scbase/loader!dojo/_base/declare", "scbase/loader!dojo/_base/kernel",
"scbase/loader!dojo/text", "scbase/loader!isccs/home/portlets/OrderPortlet",
"scbase/loader!sc/plat/dojo/controller/ScreenController"], function(
_dojodeclare, _dojokernel, _dojotext, _isccsOrderPortlet, _scScreenController) {
return _dojodeclare("isccs.home.portlets.OrderPortletInitController",
[_scScreenController], {
screenId: 'isccs.home.portlets.OrderPortlet',
mashupRefs: [{
sourceNamespace: 'getOrganizationList_output',
mashupRefId: 'getOrganizationList',
sequence: '',
mashupId: 'orderPortlet_getOrganizationList',
sourceBindingOptions: ''
}]
});
});In these examples, the screen calls the
orderPortlet_getOrganizationList mashup.
If you want to call another mashup, create the InitController XML
file for the extension 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="getOrganizationList" extnType="MODIFY"/>
</MashupRefs>
</Controller>Note:
The client-side definition of the InitController extension
is as follows:The structure of the custom server-side XML is same as the application-provided server-side XML with few changes.
- The
MashupRefelement must contain a new attributeextnTypewith the value set toMODIFY. - In the
MashupRefelement, themashupRefIdattribute must be same as the attribute defined in the application-providedInitControllerto determine the mashup call overridden in the extension. - In the
MashupRefelement, add only those attributes you want to override other thanmashupId,mashupRefId, andextnTypeattributes. In most cases, only themashupId,mashupRefId, andextnTypeattributes are needed.
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: [{
mashupRefId: 'getOrganizationList',
mashupId: 'extn_orderPortlet_getOrganizationList',
extnType: 'MODIFY'
}]
});
});
Note:
- The structure of the client-side definition is same as the application-provided client-side definition with few changes.
- The client-side definition of the
InitControllerextension must extendsc.plat.dojo.controller.ExtnScreenController. - Each
MashupRefprovided in themashupRefsproperty must contain the newextnTypeattribute and the value that is set toMODIFYsame as the server-side XML file. - Each
MashupRefprovided in themashupRefsproperty add only those attributes that you want to override other thanmashupId,mashupRefId, andextnTypeattributes. In most cases, only themashupId,mashupRefId, andextnTypeattributes are needed.
Extending BehaviorController is same as extending InitController except
that the client-side definition of InitController must
extend sc.plat.dojo.controller.ExtnScreenController.
The client-side definition of BehaviorController must
extend sc.plat.dojo.controller.ExtnServerDataController.
As a prerequisite to ensure that extensions work on controllers, configure
the screen extensions appropriately.