SmartIT_Extensions/BMC/smart-it-full/scripts/app/user/user-vo.js

75 lines
1.7 KiB
JavaScript

"use strict";
/**
* Value object for user item.
*
* @author Igor Samulenko
* @constructor
*/
function UserVO() {
this.accessRestrictions = [];
this.available = '';
this.availableForAssignment = false;
this.cell = '';
this.company = {};
this.costCenter = '';
this.createDate = '';
this.customFields = {};
this.department = '';
this.displayId = '';
this.email = '';
this.enabled = false;
this.fax = '';
this.firstName = '';
this.following = false;
this.fullName = '';
this.id = '';
this.instanceId = '';
this.isSupportStaff = false;
this.jid = '';
this.jobTitle = '';
this.lastName = '';
this.loginId = '';
this.manager = {};
this.modifiedDate = '';
this.openTickets = 0;
this.organization = '';
this.personId = '';
this.phone = '';
this.site = {};
this.supportGroups = [];
this.svcProviderCompanyNames = [];
this.thumbnail = '';
this.thumbnailMime = '';
this.groups = null;
this.roles = null;
//derived fields
this.entityLink = '';
}
/**
* Setup inheritance chain.
*/
UserVO.prototype = Object.create(BaseVO.prototype);
UserVO.prototype.constructor = UserVO;
/**
* @override
* @return {Array}
*/
UserVO.prototype.getProps = function () {
var keys = Object.keys(new UserVO());
return BaseVO.prototype.getProps().concat(keys);
};
/**
* @override
*/
UserVO.prototype.postBuild = function () {
this.entityLink = '#/' + EntityVO.TYPE_PERSON + '/' + encodeURIComponent(this.loginId);
};
/**
* Returns user's full name.
*
* @returns {String}
*/
UserVO.prototype.getFullName = function () {
return this.fullName ? this.fullName : this.firstName + ' ' + this.lastName;
};