SmartIT_Extensions/BMC/smart-it-full-helix/scripts/app/common/vo/base-vo.js

49 lines
1.0 KiB
JavaScript

"use strict";
/**
* Created by igor.samulenko on 2/15/14.
*/
/**
* Base value object.
*
* @constructor
*/
function BaseVO() {
this.id = '';
this.createDate = null;
}
/**
* Get array of domain object properties.
*
* @return {Array} properties
*/
BaseVO.prototype.getProps = function () {
return ['id', 'createDate'];
};
/**
* Build domain object from raw source.
*
* @param source
*/
BaseVO.prototype.build = function (source) {
var props = this.getProps();
if (source && props && props.length) {
var property;
for (var i = 0, l = props.length; i < l; i++) {
property = props[i];
if (source.hasOwnProperty(property)) {
this[property] = source[property];
}
}
}
// execute post-processing
this.postBuild();
// allow chaining of calls
return this;
};
/**
* Designed for performing post-build processing.
* Derived classes may override it and add specific operations.
*/
BaseVO.prototype.postBuild = function () {
};