Class sap.ushell.services.NavTargetResolutionModule: sap/ushell/services/NavTargetResolution


The Unified Shell's internal navigation target resolution service

Methods in this class deal with *internal* representations of the shell hash.

configurations: config : { allowTestUrlComponentConfig : true } allow to redefine the Test-url, Test-local1, Test-local2 applications via url parameters (sap-ushell-test-local1-url= / sap-ushell-test-local1-additionalInformation= ... )


Since: 1.15.0.
Constructor Summary
new sap.ushell.services.NavTargetResolution(a)This method MUST be called by the Unified Shell's container only, others MUST call sap.ushell.Container.getService("NavTargetResolution").
Method Summary
expandCompactHash(sHashFragment)expands a URL hash fragment

This function gets the hash part of the URL and expands a sap-intent-param if present and retrievable

This is an asynchronous operation.

isNavigationSupported(aIntents)Tells whether the given navigation intent(s) are supported for the given parameters Supported" means that a valid navigation target is configured for the user for the given device form factor.
resolveHashFragment(sHashFragment)Resolves the URL hash fragment.
Constructor Detail
new sap.ushell.services.NavTargetResolution(a)
This method MUST be called by the Unified Shell's container only, others MUST call sap.ushell.Container.getService("NavTargetResolution"). Constructs a new instance of the navigation target resolution service.
Parameters:
{oServiceConfiguration}a Service configuration
See:
sap.ushell.services.Container#getService
Method Detail
expandCompactHash(sHashFragment): string
expands a URL hash fragment

This function gets the hash part of the URL and expands a sap-intent-param if present and retrievable

This is an asynchronous operation.

Parameters:
{string}sHashFragment The formatted URL hash fragment in internal format(as obtained by the SAPUI5 hasher service, not as given in location.hash)
Returns:
{string} A jQuery.Promise. Its done() function gets an expanded shell hash (in internal format)
isNavigationSupported(aIntents): object
Tells whether the given navigation intent(s) are supported for the given parameters Supported" means that a valid navigation target is configured for the user for the given device form factor.

This is effectively a test function for toExternal/ hrefForExternal. It is functionally equivalent to isIntentSupported but accepts the same input as toExternal/ hrefForExternal.

Parameters:
{object[]}aIntents the intents (such as ["#AnObject-action?A=B&c=e"]) to be checked with object beeing instances the oArgs object of toExternal, hrefForExternal etc.

e.g. { target : { semanticObject : "AnObject", action: "action" },
params : { A : "B" } }
or e.g. { target : { semanticObject : "AnObject", action: "action" },
params : { A : "B", c : "e" } }
or { target : { shellHash : "AnObject-action?A=B&c=e" }, }

Since:
1.32
Returns:
{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: an array of parameterized (parsed) Intent objects, in the corresponding structure to arguments to sap.ushell.services.CrossApplicationNavigation.toExternal, sap.ushell.services.CrossApplicationNavigation.hrefForExternal

 [
   {  target : {
         semanticObject : "AnObject",
         action: "action"
      },
      params : { P1 : "B", P2 : [ "V2a", "V2b"]  }
   },
   {  target : {
         semanticObject : "SalesOrder",
         action: "display"
      },
      params : { P3 : "B", SalesOrderIds : [ "4711", "472"] }
   }
]

The following formats are also supported as input: [ "#AnObject-action?P1=B&SalesOrderIds=4711&SalesOrderIds=472" ] to ease migration of existing code

response:

[
  { 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 });
resolveHashFragment(sHashFragment): object
Resolves the URL hash fragment.

This function should be used by a custom renderer in order to implement custom navigation. Do not use this function for developing Fiori applications.

This function gets the hash part of the URL and returns data of the target application.

Example of the returned data:

{
   "additionalInformation": "SAPUI5.Component=sap.ushell.renderers.fiori2.search.container",
   "applicationType": "URL",
   "url": "/sap/bc/ui5_ui5/ui2/ushell/resources/sap/ushell/renderers/fiori2/search/container",
   "navigationMode": "embedded"
}

This is an asynchronous operation.

Parameters:
{string}sHashFragment The formatted URL hash fragment in internal format (as obtained by the SAPUI5 hasher service) not as given in location.hash)! example #SemanticObject-action?P1=V1&P2=A%20B%20C
Returns:
{object} A jQuery.Promise. Its done() function gets an object that you can use to create a sap.ushell.components.container.ApplicationContainer or undefined in case the hash fragment was empty.

Typically it contains the following information:

{
  "applicationType": "URL",
  "url": "/sap/bc/",
  "additionalInformation": "SAPUI5.Component=com.sap.AComponent",
  "text": "My targetmapping description",
  "navigationMode": "embedded"
}

The navigationMode indicates how the target application should be navigated. It is added to the result using the logic in _getNavigationMode if none of the resolvers in the chain added it.

No navigation should occur when the promise is resolved to undefined.