1/** 2 * @module jira/ajs/list/item-descriptor-factory 3 */ 4define('jira/ajs/list/item-descriptor-factory', ['jira/ajs/list/item-descriptor', 'jira/ajs/list/message-descriptor'], function (ItemDescriptor, MessageDescriptor) { 5 'use strict'; 6 7 /** 8 * Factory method. 9 * 10 * This method knows how to create a {@link ItemDescriptor} and descendant classes (delegating the creation to their 11 * factories) 12 * @param suggestion 13 * @param groupIndex 14 * @return {ItemDescriptor} 15 */ 16 function createItemDescriptor(suggestion, groupIndex) { 17 if (suggestion.isMessage) { 18 return createMessageDescriptor(suggestion, groupIndex); 19 } else { 20 return new ItemDescriptor({ 21 label: suggestion.label, 22 styleClass: suggestion.styleClass, 23 value: suggestion.value, 24 keywords: suggestion.keywords, 25 meta: { 26 groupIndex: groupIndex 27 } 28 }); 29 } 30 } 31 32 /** 33 * Factory method. 34 * 35 * This method knows how to create a {@link MessageDescriptor} and descendant classes (delegating the creation to their 36 * factories) 37 * @param suggestion 38 * @param groupIndex 39 * @return {MessageDescriptor} 40 */ 41 function createMessageDescriptor(suggestion, groupIndex) { 42 return new MessageDescriptor({ 43 label: suggestion.label, 44 styleClass: suggestion.styleClass, 45 useAUI: suggestion.useAUI, 46 messageID: suggestion.messageID, 47 value: suggestion.value, 48 keywords: suggestion.keywords, 49 meta: { 50 groupIndex: groupIndex 51 } 52 }); 53 } 54 return { 55 createItemDescriptor: createItemDescriptor, 56 createMessageDescriptor: createMessageDescriptor 57 }; 58}); 59(function (Factory) { 60 'use strict'; 61 62 AJS.namespace('AJS.ItemDescriptor.create', null, Factory.createItemDescriptor); 63 AJS.namespace('AJS.MessageDescriptor.create', null, Factory.createMessageDescriptor); 64})(require('jira/ajs/list/item-descriptor-factory'));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.