_BaseConnection

This is the base class that all connection objects extend. This class should not be instantiated directly.

Example
define([
    // @formatter:off
      "dojo/_base/declare",
      "dojo/_base/lang",
      "dojo/i18n!./nls/languageResource",
      "dojo/text!./YourWidgetHtml.html",
      "dojo/on",

      "dijit/_TemplatedMixin",
      "dijit/_WidgetsInTemplateMixin",
      "dijit/form/TextBox",

      "blueconic/api/widgets/plugins/_BaseConnection"
    // @formatter:on

    ], function(declare, lang, languageResource, template, on, _TemplatedMixin, _WidgetsInTemplateMixin, TextBox, _BaseConnection) {

      return declare("your.package.yourconnectionwidget", [_BaseConnection, _TemplatedMixin, _WidgetsInTemplateMixin], {

        templateString: template,
        i18n: languageResource,

        // injected by BC
        parameters: null,
        schedule: null,
        consumerId: null,
        active: null,
        readOnly: null,

        // private
        _someValueObject: null,

        // attach points
        _myTextBox: null, // this is instantiated in the HTML template

        startup: function() {
          this.inherited(arguments);

          // create an object
          this._someValueObject = {};

          if (this.readOnly) {
            domClass.add(this.domNode, "bcDisabled");
          }
          // disable input logic here
          this._myTextBox.set("disabled", this.readOnly);

          var value = this.parameters.getValue("somevalue");
          if (value) {
            this._someValueObject = JSON.parse(value);

            // do something with someValueObject, like filling form fields
            this._myTextBox.set("value", this._someValueObject.myTextBoxValue);
          }

          this.own(
            on(this._myTextBox, "change", lang.hitch(this, function() {
              // save the value of the textbox in our private object
              this._someValueObject.myTextBoxValue = this._myTextBox.get("value");

              // enables the save button
              this.onChange();
            }))
          );
        },

        beforeSave: function() {
          this.parameters.setValue("somevalue", JSON.stringify(this._someValueObject);
        }
      });
    });

Extends

Properties

active boolean

Indicates if the tab this connection is on is active (has the focus) NOTE: this is a connection version 2 only property

connectionId String

The ID of this connection NOTE: this is a connection version 2 only property

consumerId String

The consumerId that's configured for this connection (batchconnection only) NOTE: this is a connection version 2 only property

objectives Array.<blueconic.api.data.domain.Objective>

The objectives configured for this connection. Note that this property might be set later than the other properties of this connection. The 'onObjectivesChange' event is thrown when objectives change after initially setting them. NOTE: this is a connection version 2 only property

Parameters for this plugin, injected by the framework.

schedule blueconic.api.data.domain.Schedule

The schedule configured for this connection (batchconnection only) NOTE: this is a connection version 2 only property

The whereConfiguration for this connection NOTE: this is a connection version 2 only property

Functions

inherited beforeDelete(domainObjectToDelete)undefined | dojo/Deferred

This method can be implemented to hook into the "delete" (before) event of the containing domain object. Either return nothing or a {dojo/Deferred}, which is waited on before actually deleting the domain object.

Name Type Description
domainObjectToDelete blueconic.api.data.domain._Base

The domain object that's going to be deleted.

Returns:
Type Description
undefined |
dojo/Deferred
Nothing or a deferred when the function is asynchronous

inherited beforeSave(domainObjectToSave)undefined | dojo/Deferred

This method can be implemented to hook into the "save" (before) event of the containing domain object. Either return nothing or a {dojo/Deferred}, which is waited on before actually saving the domain object.

Name Type Description
domainObjectToSave blueconic.api.data.domain._Base

The domain object that's going to be saved.

Returns:
Type Description
undefined |
dojo/Deferred
Nothing or a deferred when the function is asynchronous

inherited beforeSaveAs(domainObjectToSaveAs)undefined | dojo/Deferred

This method can be implemented to hook into the "save as" (before) event of the containing domain object. Either return nothing or a {dojo/Deferred}, which is waited on before actually copying the domain object.

Name Type Description
domainObjectToSaveAs blueconic.api.data.domain._Base

The domain object that's going to be saved as.

Returns:
Type Description
undefined |
dojo/Deferred
Nothing or a deferred when the function is asynchronous