62 lines
2.1 KiB
JavaScript
62 lines
2.1 KiB
JavaScript
"use strict";
|
|
/**
|
|
* Value object for metadata.
|
|
*
|
|
* @constructor
|
|
*/
|
|
function GlobalSearchItemVO() {
|
|
this.additionalInformation = {};
|
|
this.category = '';
|
|
this.desc = '';
|
|
this.displayId = '';
|
|
this.id = '';
|
|
this.relevancy = 0;
|
|
this.title = '';
|
|
this.type = '';
|
|
this.templateName = '';
|
|
this.visited = false;
|
|
this.subType = '';
|
|
}
|
|
// inherit BaseVO
|
|
GlobalSearchItemVO.prototype = new BaseVO();
|
|
// correct the constructor pointer
|
|
GlobalSearchItemVO.prototype.constructor = GlobalSearchItemVO;
|
|
GlobalSearchItemVO.prototype.getProps = function () {
|
|
var keys = Object.keys(new GlobalSearchItemVO());
|
|
return BaseVO.prototype.getProps().concat(keys);
|
|
};
|
|
GlobalSearchItemVO.prototype.getRating = function () {
|
|
return Math.round((this.additionalInformation.useCount / ((+this.additionalInformation.useCount) + (+this.additionalInformation.notUsefulCount))) * 100) || 0;
|
|
};
|
|
GlobalSearchItemVO.prototype.getNumberOfViews = function () {
|
|
if (!_.isUndefined(this.additionalInformation.viewCount) && (this.additionalInformation.viewCount !== null)) {
|
|
return this.additionalInformation.viewCount;
|
|
}
|
|
else {
|
|
return -1;
|
|
}
|
|
};
|
|
GlobalSearchItemVO.prototype.getNumberOfLinkedItems = function () {
|
|
if (!_.isUndefined(this.additionalInformation.linkedItems) && (this.additionalInformation.linkedItems !== null)) {
|
|
return this.additionalInformation.linkedItems;
|
|
}
|
|
else {
|
|
return -1;
|
|
}
|
|
};
|
|
GlobalSearchItemVO.prototype.getLastModifyDate = function () {
|
|
return this.additionalInformation.modifiedDate;
|
|
};
|
|
GlobalSearchItemVO.prototype.getStatus = function () {
|
|
return this.additionalInformation.status.value;
|
|
};
|
|
GlobalSearchItemVO.prototype.getAssigneeFullName = function () {
|
|
return this.additionalInformation.assignee && this.additionalInformation.assignee.fullName;
|
|
};
|
|
GlobalSearchItemVO.prototype.isDecisionTree = function () {
|
|
return this.templateName === 'Decision Tree';
|
|
};
|
|
GlobalSearchItemVO.prototype.postBuild = function () {
|
|
this.subType = this.additionalInformation.isAutomatic ? "-auto" : "";
|
|
};
|