Skip to main content

node.model

NodeModel : d2/sdk/models/node.model

NodeModel. Represents a Documentum object. Holds data attriutes that correspond to equivalent Documentum object properties.

Smartview core framework uses a similar interface. See NodeModel

Extends: Backbone.Model
Example

define([
'd2/sdk/models/node.model',
'd2/sdk/utils/contexts/context.utils',
'd2/sdk/utils/contexts/factories/factory'
], function(NodeModel, contextUtils, ConnectorFactory){
'use strict';

//To instantiate a NodeModel and fetch details of a Documentum object with id '090015fa8000441a'
var context = contextUtils.getPerspectiveContext(),
connector = context.getObject(ConnectorFactory);

var node = new NodeModel({id: '090015fa8000441a'}, {connector: connector});
//connector instance must be passed in the constructor options for all fetchable nodes.

node.fetch().done(function(){
console.log('Node name: ' + node.get('name');
}).fail(function(){
console.log('Failed fetching node with id:' + node.get('id'));
});


//NodeModel could also be extended to suit particular Docuemntum type specific usage
var TaskModel = NodeModel.extend({
constructor: function TaskModel(attr, options) {
TaskModel.__super__.constructor.call(this, attr, options);
},

parse: function(response, options) {
var data = TaskModel.__super__.parse.call(this, response, options);

//Custom logic to parse task specific attributes

return data;
}
});
});

NodeModel ⏏

Kind: Exported class
Mixes: ResourceMixin, CommandableMixin

new NodeModel([attributes], [options])

ParamTypeDescription
[attributes]object

An object hash containing set of initial attributes for the NodeModel.

[options]object

Constructor options. Mixin specific options are supported as-is through constructor options.

[options.connector]Connector

Mandatory if the NodeModel is to be synced with server.

[options.ignoreObjectData]Boolean

Whether to fetch additional data like menu actions, favorited status etc. when this node syncs with server. Defaults to false. This flag acts as a master flag for other addtional data specific flags like fetchAction, fetchFavorites, fetchPreviewFormats,fetchRelationsCount & fetchExternalShare.

[options.fetchActions]Boolean

Whether to fetch menu actions after this node syncs with server. Defaults to true.

[options.fetchFavorites]Boolean

Whether to fetch 'favorited' status for this nodes after sync with server. Defaults to true.

[options.fetchPreviewFormats]Boolean

Whether to fetch preview formats for the node after it has synced with server. Defautls to true.

[options.fetchRelationsCount]Boolean

Whether to fetch relations count for the node after it has synced with server. Defaults to true.

[options.fetchExternalShare]Boolean

Whether to fetch external share status for the node after it has synced with server. Defaults to true.