Class sap.ushell.services.CrossApplicationNavigationModule: sap/ushell/services/CrossApplicationNavigation
Since: 1.15.0.
This method MUST be called by the Unified Shell's container only, others MUST call sap.ushell.Container.getService("CrossApplicationNavigation")
.
This method MUST be called by the Unified Shell's container only, others MUST call sap.ushell.Container.getService("CrossApplicationNavigation")
. Constructs a new instance of the CrossApplicationNavigation service.
CrossApplicationNavigation currently provides platform independent functionality.
This interface is for usage by applications or shell renderers/containers.
Usage:
example: see demoapps/AppNavSample/MainXML.controller.js
var xnavservice = sap.ushell && sap.ushell.Container && sap.ushell.Container.getService;
&& sap.ushell.Container.getService("CrossApplicationNavigation");
var href = ( xnavservice && xnavservice.hrefForExternal({
target : { semanticObject : "Product", action : "display" },
params : { "ProductID" : "102343333" }
})) || "";
Parameter names and values are case sensitive.
Note that the usage of multi-valued parameters (specifying an array with more than one member as parameter value, e.g. params : { A : ["a1", "a2"] }
) is possible with this API but strongly discouraged. Especially the navigation target matching performed at the back-end is not supported for multi-value parameters. Furthermore, it is not guaranteed that additional parameter values specified in the back-end configuration are merged with parameter values passed in this method.
Note that the application parameter length (including SemanticObject/Action) shall not exceed 512 bytes when serialized as UTF-8
Note that when receiving the values as startup parameters (as part of the component data object) single values are represented as an array of size 1. Above example is returned as deepEqual(getComponentData().startupParameters , { "ProductID" : [ "102343333" ] } )
Make sure not to store security critical data within an URL URLs may appear in a server log, be persisted inside and outside the system.
Note: When constructing large URLs, the URLs may be shortened and persisted on a database server for prolonged time, the actual data is persisted under a key accessible to any User (guessing the key).
The same restrictions apply for the Application state
{string} | sHashFragment | an (internal format) shell hash |
{object} | promise the success handler of the resolve promise get an expanded shell hash as first argument |
- Since:
- 1.38.0
{jQuery.Deferred.promise} | A promise that resolves with an array of strings representing the semantic objects of the intents the current user can navigate to, or rejects with an error message. The returned array will not contain duplicates. NOTE: the caller should not rely on the specific order the semantic objects appear in the returned array. |
{object|object[]} | vArgs? | An object containing nominal arguments for the method, having the following structure: { semanticObject: "Object", // optional, matches any semantic // objects if undefined action: "action", // optional, matches any actions if // undefined params: { // optional business parameters A: "B", C: ["e", "j"] }, withAtLeastOneUsedParam: true, // optional, defaults to false. If // true, only the links that use // at least one (non sap-) parameter // from 'params' will be returned. treatTechHintAsFilter : true, // optional, defaults to false // if true, only apps that match // exactly the supplied technology // (e.g. sap-ui-tech-hint=WDA) will be considered ui5Component: UI5Component, // mandatory, the UI5 component // invoking the service, shall be a root component! appStateKey: "abc123...", // optional, application state key // to add to the generated links, // SAP internal usage only compactIntents: true // optional, whether intents // should be returned in compact // format. Defaults to false. ignoreFormFactor: true, // optional, defaults to false, deprecated, do not use, may have no effect in the future } This method supports a mass invocation interface to obtain multiple results with a single call, as shown in the following example: oCrossApplicationService.getLinks([ // array, because multiple invocations are to be made [ // arguments for the first invocation { semanticObject: "SO" } // this method supports one parameter only in each call ], [ // arguments for the second invocation { action: "someAction" } ] // ... and so on ]); Calling this method with no arguments will produce the same result as if the method was called with an empty object. |
- Since:
- 1.38.0
{jQuery.Deferred.promise} | A promise that resolves with an array of links objects containing (at least) the following properties: { intent: "#AnObject-Action?A=B&C=e&C=j", text: "Perform action" } NOTE: the intents returned are in internal format and cannot be directly put into a link tag. Example: Let the string Intent will be encoded as NOTE: in case the mass invocation interface is used (see [ // mass interface was used, so return multiple values [ // values returned from the first call (functions may return multiple values) // value returned from first getLinks call (as returned by single getLinks call) [ {intent: "#SO-something1", text: "Perform navigation"}, {intent: "#SO-something2", text: "Perform action"} ], ] ], [ // value returned from second getLinks call (as returned by single getLinks call) [ {intent: "#Object-someAction", text: "Some action1"} ] ] // ... and so on ] |
Example: hrefForAppSpecificHash("View1/details/0/")
returns #SemanticObject-action&/View1/details/0/
if the current application runs in the shell and was started using "SemanticObject-action" as shell navigation hash
{string} | sAppHash | the app specific router, obtained e.g. via router.getURL(...) |
- Since:
- 1.15.0
{string} | A string which can be put into the link tag, containing the current shell navigation target and the specified application specific hash suffix Note that sAppHash shall not exceed 512 bytes when serialized as UTF-8 |
{object} | oArgs | object encoding a semantic object and action e.g. { target : { semanticObject : "AnObject", action: "action" }, params : { A : "B" } }or e.g. { target : { semanticObject : "AnObject", action: "action", context : "AB7F3C" }, params : { A : "B", c : "e" } }or { target : { shellHash : "SO-36&jumper=postman" } } |
{object} | oComponent? | the root component of the application |
{bool} | bAsync | if set to true , a promise will be returned instead of the direct argument. The promise will only succeed after all compaction requests have been sent |
- Since:
- 1.15.0
{string} | the href for the specified parameters; always starting with a hash character; all parameters are URL-encoded (via encodeURIComponent) A proper way for an application to generate a link to return to the home page of the Fiori launchpad is : Do *not* use "#Shell-home" to navigate to a specific homepage! Note that the application parameter length (including SemanticObject/Action) shall not exceed 512 bytes when serialized as UTF-8. The function can be used to convert an shell hash internal format commonly encountered into the URL format to use in link tags: externalHash = oCrossApplicationNavigationService.hrefForExternal({ target: { shellHash: oLink.intent } }, that.oComponent); |
- Since:
- 1.36.0
{boolean} | Whether the initial navigation occurred. |
{string[]} | aIntents | the intents (such as ["#AnObject-action?A=B&c=e"] ) to be checked |
{object} | oComponent? | the root component of the application |
- Since:
- 1.19.1
{object} | A jQuery.Deferred object's promise which is resolved with a map containing the intents from aIntents as keys. The map values are objects with a property supported of type boolean .Example: { "#AnObject-action?A=B&c=e": { supported: false }, "#AnotherObject-action2": { supported: true } }Example usage: this.oCrossAppNav.isIntentSupported(["SalesOrder-approve?SOId=1234"]) .done(function(aResponses) { if (oResponse["SalesOrder-approve?SOId=1234"].supported===true){ // enable link } else { // disable link } }) .fail(function() { // disable link // request failed or other error }); * @deprecated switch to isNavigationSupported Note that this has a slightly different response format |
This is effectively a test function for toExternal/ hrefForExternal. It is functionally equivalent to isIntentSupported but accepts the same interface as toExternal/ hrefForExternal.
{object[]} | aIntents | the intents (such as ["#AnObject-action?A=B&c=e"] ) to be checked with object being instances the oArgs object of toExternal, hrefForExternal etc. e.g. |
{object} | oComponent? | the root component of the application |
- Since:
- 1.32
{object} | A jQuery.Deferred object's promise which is resolved with an array (!) of objects representing whether the intent is supported or not objects with a property supported of type boolean .representing Example: aIntents: [ { target : { semanticObject : "AnObject", action: "action" }, params : { P1 : "B", P2 : [ "V2a", "V2b"] } }, { target : { semanticObject : "SalesOrder", action: "display" }, params : { P3 : "B", SalesOrderIds : [ "4711", "472"] } } ] response: [Indices correspond] [ { supported: false }, { supported: true } ]Example usage: this.oCrossAppNav.isNavigationSupported([ ]) .done(function(aResponses) { if (oResponse[0].supported===true){ // enable link } else { // disable link } }) .fail(function() { // disable link // request failed or other fatal error }); |
If the navigation target opens in a new window the running application may be retained.
{Object} | oArgs | configuration object describing the target e.g. and navigate to it via changing the hash A proper way for an application to generate a link to return to the home page of the Fiori launchpad is: Do *not* use "#Shell-home" or "Shell-home" to navigate to a specific homepage! The actual navigation may occur deferred! Note that the application parameter length (including SemanticObject/Action) shall not exceed 512 bytes when serialized as utf-8 |
{object} | oComponent? | an optional SAP UI5 Component, |
- Since:
- 1.15.0
{string} | sSemanticObject | the semantic object such as "AnObject" |
{object} | mParameters? | the map of business parameters with values, for instance { A: "B", c: "e" } |
{boolean} | bIgnoreFormFactor? | when set to true the form factor of the current device is ignored |
{Object} | oComponent? | SAP UI5 Component invoking the service |
{string} | sAppStateKey? | application state key to add to the generated links, SAP internal usage only |
{boolean} | bCompactIntents? | whether the returned intents should be returned in compact format. Defaults to false. |
- Deprecated:
- since version 1.38.0 use getLinks
- Since:
- 1.19.0
{object} | A jQuery.Deferred object's promise which is resolved with an array of link objects containing (at least) the following properties: { intent: "#AnObject-action?A=B&C=e", text: "Perform action" } NOTE: the intents returned are in internal format and cannot be directly put into a link tag. Example: Let the string |