src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js
function (rules, selectedRulesIDs, issues) {
				var rulesViewModel = {},
					issueCount = 0,
					group = {},
					library = {},
					rule = {},
					rulesCopy = jQuery.extend(true, {}, rules),
					issuesCopy = jQuery.extend(true, {}, issues);

				for (group in rulesCopy) {
					rulesViewModel[group] = jQuery.extend(true, {}, rulesCopy[group].ruleset._mRules);
					library = rulesViewModel[group];

					// Create non-enumerable properties
					Object.defineProperty(library, 'selected', {
						enumerable: false,
						configurable: true,
						writable: true,
						value: false
					});
					Object.defineProperty(library, 'issueCount', {
						enumerable: false,
						configurable: true,
						writable: true,
						value: 0
					});

					for (rule in rulesCopy[group].ruleset._mRules) {
						library[rule] = jQuery.extend(true, [], library[rule]);

						// Create non-enumerable properties
						Object.defineProperty(library[rule], 'selected', {
							enumerable: false,
							configurable: true,
							writable: true,
							value: false
						});
						Object.defineProperty(library[rule], 'issueCount', {
							enumerable: false,
							configurable: true,
							writable: true,
							value: 0
						});

						// Add selected flag to library and rule level.
						if (selectedRulesIDs[rule]) {
							library[rule].selected = true;
							library.selected = true;
						}

						// Add issue count to library and rule level.
						if (issuesCopy[group] && issuesCopy[group][rule]) {
							// Not creating a new array to keep the properties.
							library[rule].push.apply(library[rule], issuesCopy[group][rule]);
							issueCount = issuesCopy[group][rule].length;
							library[rule].issueCount = issueCount;
							library.issueCount += issueCount;
						}
					}
				}

				return rulesViewModel;
			}
function (rules, selectedRulesIDs, issues) {
				var rulesViewModel = {},
					issueCount = 0,
					group = {},
					library = {},
					rule = {},
					rulesCopy = jQuery.extend(true, {}, rules),
					issuesCopy = jQuery.extend(true, {}, issues);

				for (group in rulesCopy) {
					rulesViewModel[group] = jQuery.extend(true, {}, rulesCopy[group].ruleset._mRules);
					library = rulesViewModel[group];

					// Create non-enumerable properties
					Object.defineProperty(library, 'selected', {
						enumerable: false,
						configurable: true,
						writable: true,
						value: false
					});
					Object.defineProperty(library, 'issueCount', {
						enumerable: false,
						configurable: true,
						writable: true,
						value: 0
					});

					for (rule in rulesCopy[group].ruleset._mRules) {
						library[rule] = jQuery.extend(true, [], library[rule]);

						// Create non-enumerable properties
						Object.defineProperty(library[rule], 'selected', {
							enumerable: false,
							configurable: true,
							writable: true,
							value: false
						});
						Object.defineProperty(library[rule], 'issueCount', {
							enumerable: false,
							configurable: true,
							writable: true,
							value: 0
						});

						// Add selected flag to library and rule level.
						if (selectedRulesIDs[rule]) {
							library[rule].selected = true;
							library.selected = true;
						}

						// Add issue count to library and rule level.
						if (issuesCopy[group] && issuesCopy[group][rule]) {
							// Not creating a new array to keep the properties.
							library[rule].push.apply(library[rule], issuesCopy[group][rule]);
							issueCount = issuesCopy[group][rule].length;
							library[rule].issueCount = issueCount;
							library.issueCount += issueCount;
						}
					}
				}

				return rulesViewModel;
			}
function ( rules , selectedRulesIDs , issues ) { var rulesViewModel = { } , issueCount = 0 , group = { } , library = { } , rule = { } , rulesCopy = jQuery . extend ( true , { } , rules ) , issuesCopy = jQuery . extend ( true , { } , issues ) ; for ( group in rulesCopy ) { rulesViewModel [ group ] = jQuery . extend ( true , { } , rulesCopy [ group ] . ruleset . _mRules ) ; library = rulesViewModel [ group ] ; // Create non-enumerable properties Object . defineProperty ( library , 'selected' , { enumerable : false , configurable : true , writable : true , value : false } ) ; Object . defineProperty ( library , 'issueCount' , { enumerable : false , configurable : true , writable : true , value : 0 } ) ; for ( rule in rulesCopy [ group ] . ruleset . _mRules ) { library [ rule ] = jQuery . extend ( true , [ ] , library [ rule ] ) ; // Create non-enumerable properties Object . defineProperty ( library [ rule ] , 'selected' , { enumerable : false , configurable : true , writable : true , value : false } ) ; Object . defineProperty ( library [ rule ] , 'issueCount' , { enumerable : false , configurable : true , writable : true , value : 0 } ) ; // Add selected flag to library and rule level. if ( selectedRulesIDs [ rule ] ) { library [ rule ] . selected = true ; library . selected = true ; } // Add issue count to library and rule level. if ( issuesCopy [ group ] && issuesCopy [ group ] [ rule ] ) { // Not creating a new array to keep the properties. library [ rule ] . push . apply ( library [ rule ] , issuesCopy [ group ] [ rule ] ) ; issueCount = issuesCopy [ group ] [ rule ] . length ; library [ rule ] . issueCount = issueCount ; library . issueCount += issueCount ; } } } return rulesViewModel ; }
Gets rules and issues, and converts each rule to a ruleViewModel - parameters should be converted as specified beforehand.
@public
@method
@name sap.ui.support.IssueManager.getRulesViewModel
@param {object} rules All the rules from _mRulesets
@param {array} selectedRulesIDs The rule ID's of the selected rules.
@param {array} issues The issues to map to the rulesViewModel
The issues passes should be grouped and in ViewModel format.
@returns {object} rulesViewModel All the rules with issues, selected flag and issueCount properties
The issues are in ViewModel format.
Gets rules and issues and converts each rule to a ruleViewModel - parameters should be converted as specified beforehand .