Skip to content

Creating a Nexus Bridge instance

Oleg edited this page Jul 29, 2024 · 24 revisions

Create a new instance of the Nexus Bridge

You create a new instance of the Nexus Bridge passing the instance of applet's Presentation Model (PM).

The way you create the instance of the Nexus Bridge depends on how you included the Nexus Bridge into your project:

const nexus = new window.SiebelAppFacade.NexusBridge({pm});
  • Dependency
import Nexus from '@ideaportriga/nexus-bridge';
const nexus = new Nexus ({pm});

The Nexus Bridge Creation Settings

The Nexus Bridge creation settings:

Initialization Examples

The custom PR application can create the instances of the Nexus Bridge:

View applets

  const nexus = [];
  const appletmap = window.SiebelApp.S_App.GetActiveView().GetAppletMap();
  for (const applet in appletmap) {
    const pm = appletmap[applet].GetPModel();
    nexus.push(new window.SiebelAppFacade.NexusBridge({ pm, convertDates: true }));
  }

Popup applets

This ES5 code could be used in the PR file deployed for the popup applet. Pay attention that the CreatePopupNB is a static method.

  var pm = this.GetPM();
  var appletName = pm.Get('GetName');
  var isPopup = pm.Get('IsPopup');
  var popupPM = window.SiebelApp.S_App.GetPopupPM();
  var isShuttle = popupPM.Get('isPopupMVGAssoc');
  var mvgAssoc = popupPM.Get('MVGAssocAppletObject');
  var applet = window.SiebelApp.S_App.GetActiveView().GetApplet(appletName)
  var isMvgAssoc = isShuttle && applet && applet === mvgAssoc;
  window.SiebelAppFacade.NB[appletName] =
    window.SiebelAppFacade.NexusBridge.CreatePopupNB(Object.assign(
      { pm: pm, isMvgAssoc: isMvgAssoc, isPopup: true }, options
    ));

As outcome of the Oracle review, the Nexus Bridge is not allowed to use the GetPModel function and advised to create the instances of the Nexus Bridge in applet PRs.

View PR (optional)

  • Overrides Init, BindData, BindEvents, and ShowUI, and does not call the methods of superclasses.

  • Injects the external application that manipulates with Siebel Data using the instances of Nexus Bridge (not shown in the piece of the code below).

if (typeof (SiebelAppFacade.DefaultViewPR) === "undefined") {

  SiebelJS.Namespace("SiebelAppFacade.DefaultViewPR");
  define("siebel/custom/DefaultViewPR", ["siebel/viewpr"],
    function () {
      SiebelAppFacade.DefaultViewPR = (function () {

        function DefaultViewPR(pm) {
          SiebelAppFacade.DefaultViewPR.superclass.constructor.apply(this, arguments);
        }

        SiebelJS.Extend(DefaultViewPR, SiebelAppFacade.ViewPR);

        DefaultViewPR.prototype.Init = function () { }

        DefaultViewPR.prototype.ShowUI = function () { }

        DefaultViewPR.prototype.BindData = function () { }

        DefaultViewPR.prototype.BindEvents = function () { }

        DefaultViewPR.prototype.EndLife = function () {
          SiebelAppFacade.DefaultViewPR.superclass.EndLife.apply(this, arguments);
        }

        return DefaultViewPR;
      }()
      );
      return "SiebelAppFacade.DefaultViewPR";
    })
}

The Nexus Bridge instances are not independent. Standard Siebel functionality is also triggered when you are manipulating the Nexus Bridge instances. For example, when one Nexus Bridge instance is in the process of creating a new record, manipulating the another instance could cause the implicit write record in the first instance.

Clone this wiki locally