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 wsc.home.portlets.BackroomPickPortlet
screen
with wsc.home.portlets.BackroomPickPortletInitController
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="wsc.home.portlets.BackroomPickPortletInitController"
requestMethodSupported="POST" screenId="wcc.home.portlets.BackroomPickPortlet">
<Group isAggregator="Y"/>
<MashupRefs>
<MashupRef mashupId="backroomPick_getShipmentListReadyForPick"
mashupRefId="getShipmentListReadyForPickInit" 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!sc/plat/dojo/controller/ScreenController",
"scbase/loader!wsc/home/portlets/BackroomPickPortlet"],
function(
_dojodeclare, _dojokernel, _dojotext, _scScreenController, _wscBackroomPickPortlet) {
return _dojodeclare("wsc.home.portlets.BackroomPickPortletInitController", [_scScreenController], {
screenId: 'wsc.home.portlets.BackroomPickPortlet',
mashupRefs: [{
sourceNamespace: 'backroomPick_getShipmentListReadyForPick_output',
mashupRefId: 'getShipmentListReadyForPickInit',
sequence: '',
mashupId: 'backroomPick_getShipmentListReadyForPick',
callSequence: '',
sourceBindingOptions: ''
}]
});
});
In these examples, the screen calls the
backroomPick_getShipmentListReadyForPick
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.BackroomPickPortletExtnInitController"
screenId="extn.home.portlets.BackroomPickPortletExtn">
<Group isAggregator="Y"/>
<MashupRefs>
<MashupRef mashupId="extn_backroomPick_getShipmentListReadyForPick"
mashupRefId="getShipmentListReadyForPickInit" permissionId="" 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
MashupRef
element must contain a new attributeextnType
with the value set toMODIFY
. - In the
MashupRef
element, themashupRefId
attribute must be same as the attribute defined in the application-providedInitController
to determine the mashup call overridden in the extension. - In the
MashupRef
element, add only those attributes you want to override other thanmashupId
,mashupRefId
, andextnType
attributes. In most cases, only themashupId
,mashupRefId
, andextnType
attributes are needed.
scDefine(["scbase/loader!dojo/_base/declare", "scbase/loader!dojo/_base/kernel",
"scbase/loader!dojo/text", "scbase/loader!sc/plat/dojo/controller/ScreenController",
"scbase/loader!extn/home/portlets/BackroomPickPortletExtn",
"scbase/loader!sc/plat/dojo/controller/ExtnScreenController"],
function(
_dojodeclare, _dojokernel, _dojotext, _scScreenController, _extnBackroomPickPortletExtn,_scExtnScreenController) {
return _dojodeclare("extn.home.portlets.BackroomPickPortletExtnInitController", [_scScreenController], {
screenId: 'extn.home.portlets.BackroomPickPortletExtn',
mashupRefs: [{
sourceNamespace: 'backroomPick_getShipmentListReadyForPick_output',
mashupRefId: 'getShipmentListReadyForPickInit',
mashupId: 'extnbackroomPick_getShipmentListReadyForPick',
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
InitController
extension must extendsc.plat.dojo.controller.ExtnScreenController
. - Each
MashupRef
provided in themashupRefs
property must contain the newextnType
attribute and the value that is set toMODIFY
same as the server-side XML file. - Each
MashupRef
provided in themashupRefs
property add only those attributes that you want to override other thanmashupId
,mashupRefId
, andextnType
attributes. In most cases, only themashupId
,mashupRefId
, andextnType
attributes 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.