Mashups

Mashups are used to invoke XAPIs on the server and return data to the UI layer.

Defining mashup XMLs

The following code snippet defines a sample mashup XML
<?xml version="1.0" encoding="UTF-8"?>
	<mashups>
		<mashup description="Mashup description"
			endpoint="<mashup_endpoint>" id="mashup_id" mashuptype="XAPI"
			skipDataProvider="false" transactional="true">
			<classInformation name="<java class name with full package>" />
			<API Name="<api_name>">
				<Input>
					<!-- APi input goes here-->
				</Input>
				<Template>
					<!-- APi output template goes here -->
				</Template>
			</API>
			<APINamespace inputNS="<input_namespace>" outputNS="<output_namespace>" />
			<AlternateResourceIds>
				<AlternateResourceId altResourceId="resource id" />
			</AlternateResourceIds>
		</mashup>
	</mashups>

Defining mashupRefs in view or screen controllers

Refer to the following code snippet to define a mashupref in a view controller or screen controller.
"mashupRefs":[
	{
	mashupRefId: '<mashuprefid>',// local mashup name
	mashupId: '<mashupid>',// mashup id defined in the mashup xmls
	modelName: '<model_name>',// model to which output of mashup to be set
	isPaginated:<true/false>,// flag to indicate whether mashup is calling a paginated XAPI
	pageSize: <number>,// indicates the page size. Default value is 5, if not specified.
	append:<true/false>,// flag to indicate whether mashup output should be appended to existing data. 
     //This is used only if isPaginated is set true
	handler:'<handlerMethodName>',//method to be called for massaging the mashup output.				
       }
	]

Calling a mashup from view controllers

MashupRefs should be defined in the view controllers to call a mashup. Use the iscMashup service to call a mashup. Refer the javascript documentation available with the application for more information.
  • Use iscMashup.callMashup(this, mashupRefId, mashupInput, options); to call a single mashup. For example,
    iscMashup.callMashup(this, "getOrderDetails",{"Order":{"OrderHeaderKey":"Order1"}},{})
    .then(this.handleSuccessMethod.bind(this),this.handleErrorMethod.bind(this));
  • Use iscMashup.callMashups(this,mashupRefObjList,options) to call multiple mashups in a single network call. For example,
    var mashupRefList = [];
    mashupRefList.push(iscMashup.getMashupRefObj(this,"getOrderDetails",
    {"Order":{"OrderHeaderKey":"Order1"}}));
    mashupRefList.push(iscMashup.getMashupRefObj(this,"getCustomerDetails",
    {"Customer":{"CustomerKey":"Customer1"}}));
    iscMashup.callMashups(this,mashupRefList,{})
    .then(this.handleSuccessMethod.bind(this),this.handleErrorMethod.bind(this));
  • Use iscMashup.callPaginatedMashup(this, mashupRefId, inputData,pageAction, options) to call a paginated mashup. For example,
    iscMashup.callPaginatedMashup(this, "getOrderLineList",{"Order":{"OrderHeaderKey":"OrderNo1"}},
    "NEXT",{}) 
    .then(this.handleSuccessMethod.bind(this),this.handleErrorMethod.bind(this));

Calling a mashup from directive controllers

In case of directives, mashupRef object is not defined. Therefore, you can call the mashup directly without a mashuprefid and mashupRefs array.

Use callSimpleMashup, callSimpleMashups, and callSimplePaginatedMashup. Refer the javascript documentation available with the application for usage and examples.

Customizing existing mashup definitions

You can override the existing mashup definition XMLs either differentially or completely. For more information see
Notes:
  • AngularJS-based components cannot be customized by using the Extensibility Workbench.
  • The init servlet to load the incremental and override mashups is provided with the application and the servlet scans only for XML files in the <wscwar>/extn/ngstore folder.

    The mashup XMLs should be placed in the respective feature folder in the <EXTN_WORKSPACE>. The file naming conventions for mashups are as follows:
    • <feature/folder_name>_mashups.xml: The default mashup file for any feature.
    • <feature/folder_name>_incrementalmashups.xml: The file should contain all the incremental changes for an existing mashup.
    • <feature/folder_name>_overridemashups.xml: The file should contain all the overridden changes for an existing mashup.
  • You must restart the application server for the changes to take effect.