SmartIT_Extensions/BMC/smart-it-full-helix/scripts/app/ticket/task-vo.js

50 lines
1.9 KiB
JavaScript

"use strict";
/**
* Value object for task item.
*
* @author Alex Hnatkovskyy
* @constructor
*/
function TaskVO() {
this.name = '';
this.parentType = '';
this.parentName = '';
this.parentDisplayId = '';
this.parentId = '';
this.parentSummary = '';
this.type = EntityVO.TYPE_TASK;
this.scheduledEndDate = null;
this.scheduledStartDate = null;
this.actualStartDate = null;
this.actualEndDate = null;
this.isAutomatic = false;
this.subType = '';
this.jobID = '';
this.jobType = '';
this.jobVersion = '';
}
TaskVO.prototype = new TicketVO();
TaskVO.prototype.constructor = TaskVO;
/**
* @override
* @return {Array} properties
*/
TaskVO.prototype.getProps = function () {
return TicketVO.prototype.getProps().concat('name', 'parentType', 'parentName', 'parentDisplayId', 'parentId', 'parentSummary', 'scheduledEndDate', 'scheduledStartDate', 'actualStartDate', 'actualEndDate', 'isAutomatic', 'jobID', 'jobType', 'jobVersion');
};
/**
* @override
*/
TaskVO.prototype.postBuild = function () {
TicketVO.prototype.postBuild.call(this);
this.scheduledStartDate = this.scheduledStartDate ? new Date(this.scheduledStartDate) : null;
this.scheduledEndDate = this.scheduledEndDate ? new Date(this.scheduledEndDate) : null;
this.actualStartDate = this.actualStartDate ? new Date(this.actualStartDate) : null;
this.actualEndDate = this.actualEndDate ? new Date(this.actualEndDate) : null;
this.scheduledStartDateHumanized = this.scheduledStartDate ? moment(this.scheduledStartDate).format('lll') : null;
this.scheduledEndDateHumanized = this.scheduledEndDate ? moment(this.scheduledEndDate).format('lll') : null;
this.actualStartDateHumanized = this.actualStartDate ? moment(this.actualStartDate).format('lll') : null;
this.actualEndDateHumanized = this.actualEndDate ? moment(this.actualEndDate).format('lll') : null;
this.subType = this.isAutomatic ? "-auto" : "";
};