"use strict"; /** * Value object for metadata. * * @constructor */ function MetadataVO() { this.impacts = []; this.availableValueFields = {}; this.priorities = []; this.urgencies = []; this.metadatatype = ''; this.statuses = []; this.types = []; this.documentTypes = []; this.categories = []; this.resCategories = []; this.workinfoTypes = []; this.primaryCapabilities = []; this.visibilities = []; this.timings = []; this.timingReasons = []; this.changeReasons = []; this.languages = []; this.riskLevels = []; this.milestones = []; this.businessJustifications = []; this.ootbMapping = {}; this.requiredOOTBObjectName = []; this.configurationParameters = {}; this.investigationDrivers = []; this.collisionStatuses = []; this.rootCause = {}; this.viewAccesses = {}; this.assetTypes = []; this.currencyFields = {}; this.depreciated = []; this.systemConfigurations = {}; this.systemType = []; this.virtualSystemType = []; this.clientSensitivities = []; this.clientTypes = []; this.vip = []; this.contactTypes = []; this.consoleColumns = {}; this.useCognitive = false; this.ootbFieldOptionsMapping = { urgency: "urgencies", priority: "priorities", impact: "impacts", status: "statuses", serviceType: "types", changeReason: "changeReasons" }; this.applyCognitiveForCategorization = 'No'; this.callLogEventTypes = []; } // inherit BaseVO MetadataVO.prototype = new BaseVO(); // correct the constructor pointer MetadataVO.prototype.constructor = MetadataVO; MetadataVO.prototype.getProps = function () { var keys = Object.keys(new MetadataVO()); return BaseVO.prototype.getProps().concat(keys); }; MetadataVO.prototype.postBuild = function () { this.allCategories = this.categories.concat(this.resCategories); _.forEach(this.allCategories, function (category) { category.listOfTiersToShow = angular.copy(category.listOfTiersToShow).reverse(); }); //todo: remove when required OOTB fields feature is stable if (this.metadatatype === 'broadcast' && this.requiredOOTBObjectName.length === 0) { this.requiredOOTBObjectName.push('desc'); } //Viktor: it is not a good practice to make this processing on a frontend, better to get correct structure from backend if possible var expanded = true, workNoteSection; _.forEach(this.workinfoTypes, function (item) { if (item.type === 'section') { item.options = []; item.expanded = expanded; workNoteSection = item; if (expanded) { expanded = false; } } else { if (workNoteSection) { workNoteSection.options.push(item); item.hasParentSection = true; } } }); };