Name

sn_collab_request.CollabControllerUtils

Description

No description available

Script

var CollabControllerUtils = Class.create();
CollabControllerUtils.prototype = {
  initialize: function() {
      var pipelineConfigChecks = new sn_pipeline.PipelineConfigChecks();
      this.currentInstanceInfo = pipelineConfigChecks.getCurrentInstanceInfo();
      this.controllerEnv = pipelineConfigChecks.getControllerRecord();

      if (this.isCurrentInstanceController()) {
          this.isControllerConfigured = true;
      } else {
  		this.isControllerConfigured = this.checkIfControllerIsConfigured();
  	}
  },
  isCurrentInstanceController: function() {
      return (this.currentInstanceInfo || {}).isController;
  },
  getIsControllerConfigured: function() {
      return this.isControllerConfigured;
  },
  getControllerRecord: function() {
      return this.controllerEnv;
  },
  checkIfControllerIsConfigured: function() {
  	var inputs = {
          environment: this.controllerEnv
      };

      var result = sn_fd.FlowAPI.getRunner()
  					.subflow("sn_collab_request.check_if_collaboration_request_is_active_on_instance")
  					.inForeground()
  					.withInputs(inputs)
  					.run();

  	var outputs = result.getOutputs() || {};
  	
  	if (outputs.unhandled_error) {
  		throw gs.getMessage("The environment setup as controller is not valid.");
  	}

  	return outputs.is_active;
  },

  type: 'CollabControllerUtils'
};

Sys ID

bfe60905c7333010408bc8d6f2c26073

Offical Documentation

Official Docs: