command
CommandModel : d2/sdk/commands/command
Interface for classes that implement a business action over one or more NodeModel.
Extends: Backbone.Model
See: ProgressiveNodesComamnd
An implementation should be registered with the CommandCollection by an extension configuration.
Example (module mybundle/commands/my.command.js can be defined as)  
define([
   'nuc/lib/jquery',
   'd2/sdk/commands/command'
], function($, CommandModel){
 var MyCommandModel = CommandModel.extend({
    defaults: {
       signature: 'MyCommand',
       name: 'Example name',
       scope: 'single' // Indicates that this action could be executed on a selection of atmost one node, other possible value is 'multiple'
    },
    enabled: function(status, options) {
       return true; // enabled always
    },
    execute: function(status, options) {
       var firstNode = status.nodes.get(0);
       console.log("The first node object is: " + firstNode.get('name');
       return $.Deferred().resolve().promise(); // Here this command execution will be considered complete as soon as execute() returns
    }
 });
 return MyCommandModel;
});
Example ( to register the command with command collection, in extension.json )
{
  "d2/sdk/utils/commands": {
     "extensions": {
       "mybundle": {
         "mybundle/commands/my.command"
       }
     }
   }
}
- CommandModel : 
d2/sdk/commands/command- instance
- .attributes : 
AttributeType - .getCommandKey() ⇒ 
string - .isNonPromoted() ⇒ 
boolean - .enabled(status, [options]) ⇒ 
boolean - .execute(status, [options]) ⇒ 
jQuery.Promise 
 - .attributes : 
 - static
- .extend(protoProperties, staticProperties) ⇒ 
function 
 - .extend(protoProperties, staticProperties) ⇒ 
 - inner
- ~CommandStatus : 
Object - ~AttributeType : 
Object 
 - ~CommandStatus : 
 
 - instance
 
commandModel.attributes : AttributeType
Required attributes. Can be defined using defaults hash, checkout the example.
Kind: instance property of CommandModel
See: Backbone.Model#attributes for more details.  
commandModel.getCommandKey() ⇒ string
Get key associated wtih this command instance.
Kind: instance method of CommandModel
Returns: string - The key/signature of this command.  
commandModel.isNonPromoted() ⇒ boolean
Whether this command is non-promoted.
Kind: instance method of CommandModel
Returns: boolean - true if non-promoted, false otherwise.  
commandModel.enabled(status, [options]) ⇒ boolean
Whether this command should be enabled for a particular toolbar.
Kind: instance method of CommandModel
Returns: boolean - true if the command should be considered as enabled, false otherwise  
| Param | Type | Description | 
|---|---|---|
| status | CommandStatus | Object hash containing the contextual data  | 
| [options] | object | Additional options that are not part of contextual data like settings  | 
commandModel.execute(status, [options]) ⇒ jQuery.Promise
Business logic that executes as part of user interacting with this command (usually through a toolbar action).
A toast message is usually (unless suppressed) shown in the UI when execution completes and based on the state of the returned promise it can either be a success or an error taost.
Kind: instance abstract method of CommandModel
Returns: jQuery.Promise - The return promise object should be resolved to mark completion of the command execution successfully, whereas a rejection would indicate otherwise  
| Param | Type | Description | 
|---|---|---|
| status | CommandStatus | Object hash containing the contextual data  | 
| [options] | object | Additional options that are not part of contextual data like settings  | 
Example (Sample implementation of `execute` could look like)
var MyCommand = CommandModel.extend({
 ...
 execute: function(status, options) {
   var promise = $.Deferred().promise();
   if(status.say === 'hello') {
     console.log('I completed successfully');
     promise.resolve();
   } else {
     console.log('I completed with failure');
     promise.reject();
   }
   return promise;
 }
});
CommandModel.extend(protoProperties, staticProperties) ⇒ function
To define a derived type from CommandModel.
Kind: static method of CommandModel
Returns: function - The derived type.  
| Param | Type | Description | 
|---|---|---|
| protoProperties | object | Properties attached to the prototype of derived type.  | 
| protoProperties.constructor | function | The function to be used to construct instance of the derived type.  | 
| staticProperties | object | Properties statically attached to the derived type.  | 
CommandModel~CommandStatus : Object
Type of data passed as first argument for any command execution.
Kind: inner typedef of CommandModel
Properties
| Name | Type | Default | Description | 
|---|---|---|---|
| [suppressSuccessMessage] | boolean | false | Setting it to   | 
| [suppressFailMessage] | boolean | false | Setting it to   | 
| nodes | NodeCollection | instance of NodeCollection, on which node object(s) this command is being executed.  | |
| [context] | Context | Active application context  | |
| [toolitem] | ToolitemModel | The menu behind this action, if any.  | |
| [originatingView] | Marionette.View | The associated UI component where this command is being executed.  | 
CommandModel~AttributeType : Object
Attribute types.
Kind: inner typedef of CommandModel
Properties
| Name | Type | Default | Description | 
|---|---|---|---|
| signature | string | A unique identifier.  | |
| name | string | Display name. Usually gets overriden by menu item's label if this   | |
| [scope] | string | "single" | How many   |