diff options
author | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2021-08-26 15:44:12 -0400 |
---|---|---|
committer | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2021-08-26 16:24:50 -0400 |
commit | bcca60b3c9e50e93a0f309905049ddbbf45768ef (patch) | |
tree | 63b7190e89ab6215393dda7baf8dd6aa99bbaea1 /gui-editors/gui-editor-apex/src/main/resources | |
parent | ad6a4573ef18da3395eee1c9f922a26b8ac1bbcf (diff) |
Fix sonar issues
Issue-ID: POLICY-3077
Change-Id: Iae7bad7bc69bc4c5cd974e8439f8f433a43123d0
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/resources')
12 files changed, 71 insertions, 70 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexAjax.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexAjax.js index 1a63375..4a6dc7d 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexAjax.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexAjax.js @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,8 +46,8 @@ function ajax_getWithKeyInfo(requestURL, objectType, callback, keyNam) { ajax_get(keyInfoURL, function(dataKeyInfos) { ajax_get(requestURL, function(data) { var keyInfos = []; - for ( var i = 0; i < dataKeyInfos.messages.message.length; i++) { - var ki = JSON.parse(dataKeyInfos.messages.message[i]).apexKeyInfo; + for ( let value of dataKeyInfos.messages.message) { + var ki = JSON.parse(value).apexKeyInfo; keyInfos.push(ki); } var object = JSON.parse(data.messages.message[0])[objectType]; diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumEditForm.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumEditForm.js index 79c9da1..b6d0fe6 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumEditForm.js @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +31,8 @@ function editContextAlbumForm_createContextAlbum(formParent) { var requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (var i = 0; i < data2.messages.message.length; i++) { - var contextSchema = JSON.parse(data2.messages.message[i]).apexContextSchema; + for (let value of data2.messages.message) { + var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, "version" : contextSchema.key.version, @@ -62,8 +63,8 @@ function editContextAlbumForm_viewContextAlbum(parent, name, version) { requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (var i = 0; i < data2.messages.message.length; i++) { - var contextSchema = JSON.parse(data2.messages.message[i]).apexContextSchema; + for (let value of data2.messages.message) { + var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, "version" : contextSchema.key.version, @@ -83,8 +84,8 @@ function editContextAlbumForm_editContextAlbum(formParent, name, version) { requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (var i = 0; i < data2.messages.message.length; i++) { - var contextSchema = JSON.parse(data2.messages.message[i]).apexContextSchema; + for (let value of data2.messages.message) { + var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, "version" : contextSchema.key.version, diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumTab.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumTab.js index f749b28..821e5f6 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumTab.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumTab.js @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,8 +38,8 @@ function contextAlbumTab_activate() { ajax_get(requestURL, function(data) { $("#contextAlbumTableBody").find("tr:gt(0)").remove(); - for (var i = 0; i < data.messages.message.length; i++) { - var contextAlbum = JSON.parse(data.messages.message[i]).apexContextAlbum; + for (let value of data.messages.message) { + var contextAlbum = JSON.parse(value).apexContextAlbum; var contextAlbumRow_tr = document.createElement("tr"); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaTab.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaTab.js index 45676b8..c5c7daa 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaTab.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaTab.js @@ -36,8 +36,8 @@ function contextSchemaTab_activate() { ajax_get(requestURL, function(data) { $("#contextSchemaTableBody").find("tr:gt(0)").remove(); - for (var i = 0; i < data.messages.message.length; i++) { - var contextSchema = JSON.parse(data.messages.message[i]).apexContextSchema; + for (let value of data.messages.message) { + var contextSchema = JSON.parse(value).apexContextSchema; var contextSchemaRow_tr = document.createElement("tr"); var contextSchemaid = contextSchema.key.name + ":" + contextSchema.key.version; diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventEditForm.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventEditForm.js index ea23895..fef9278 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventEditForm.js @@ -51,8 +51,8 @@ function editEventForm_createEvent(formParent) { var requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (var i = 0; i < data2.messages.message.length; i++) { - var contextSchema = JSON.parse(data2.messages.message[i]).apexContextSchema; + for (let value of data2.messages.message) { + var contextSchema = JSON.parse(value).apexContextSchema; var dt = { "name" : contextSchema.key.name, "version" : contextSchema.key.version, @@ -72,8 +72,8 @@ function editEventForm_editEvent_inner(formParent, name, version, viewOrEdit) { requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (var i = 0; i < data2.messages.message.length; i++) { - var contextSchema = JSON.parse(data2.messages.message[i]).apexContextSchema; + for (let value of data2.messages.message) { + var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, "version" : contextSchema.key.version, @@ -325,8 +325,7 @@ function editEventForm_activate(parent, operation, event, contextSchemas) { paramstable.appendChild(paramstable_body); // Add the parameters if (event && event.parameter && event.parameter.entry) { - for (var p = 0; p < event.parameter.entry.length; p++) { - var fieldEntry = event.parameter.entry[p]; + for (let fieldEntry of event.parameter.entry) { var contextSchema = fieldEntry.value.fieldSchemaKey; var optional = fieldEntry.value.optional; contextSchema["displaytext"] = contextSchema.name + ":" + contextSchema.version; @@ -470,7 +469,7 @@ function editEventForm_addEventParam(parentTBody, disabled, name, optional, cont if (name == null && contextSchema == null && !disabled) { paramOptionalInput.setAttribute("class", "field-eventparam-optional.new"); } - if (optional == true) { + if (optional) { paramOptionalInput.checked = true; } else { paramOptionalInput.checked = false; diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventTab.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventTab.js index 0192be6..44458c2 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventTab.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventTab.js @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,8 +40,8 @@ function eventTab_activate() { $("#eventTableBody").find("tr:gt(0)").remove(); - for (var i = 0; i < data.messages.message.length; i++) { - var event = JSON.parse(data.messages.message[i]).apexEvent; + for (let value of data.messages.message) { + var event = JSON.parse(value).apexEvent; var eventTableRow_tr = document.createElement("tr"); var eventid = event.key.name + ":" + event.key.version; @@ -61,8 +62,7 @@ function eventTab_activate() { eventTableRow += "<td><table class='ebTable'><thead><tr><th>Parameter</th><th>Parameter Type/Schema</th><th>Optional</th></tr></thead><tbody>"; - for (var p = 0; p < event.parameter.entry.length; p++) { - var fieldEntry = event.parameter.entry[p]; + for (let fieldEntry of event.parameter.entry) { eventTableRow += "<tr><td>" + diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js index ef0aacf..a002788 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,8 +62,8 @@ function files_fileUpload() { ajax_getOKOrFail(requestURL, function(data) { var uploadResultString = ""; - for (var i = 0; i < data.messages.message.length; i++) { - uploadResultString += (data.messages.message[i] + "\n"); + for (let value of data.messages.message) { + uploadResultString += (value + "\n"); } resultForm_activate(document.getElementById("mainArea"), "Model Upload Result", uploadResultString); }); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFormUtils.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFormUtils.js index 9476e58..f2a5983 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFormUtils.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFormUtils.js @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,9 +43,8 @@ function formUtils_generateDescription(name, version, uuid) { uuid = "null"; } - var description = "Generated description for a concept called \"" + name + "\" with version \"" + version + return "Generated description for a concept called \"" + name + "\" with version \"" + version + "\" and UUID \"" + uuid + "\""; - return description; } export {formUtils_generateDescription, formUtils_generateUUID}; diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexKeyInformationTab.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexKeyInformationTab.js index 8ca2718..6cfc28d 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexKeyInformationTab.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexKeyInformationTab.js @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,8 +37,8 @@ function keyInformationTab_activate() { ajax_get(requestURL, function(data) { $("#keyInformationTableBody").find("tr:gt(0)").remove(); - for (var i = 0; i < data.messages.message.length; i++) { - var keyInfo = JSON.parse(data.messages.message[i]).apexKeyInfo; + for (let value of data.messages.message) { + var keyInfo = JSON.parse(value).apexKeyInfo; var keyInfoRow_tr = document.createElement("tr"); var keyInfoRow = diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPageControl.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPageControl.js index e1a553e..f2acf87 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPageControl.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPageControl.js @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -209,8 +210,8 @@ function pageControl_successStatus(data) { } else { $('#statusString').css("color", "red"); $('#ebInlineMessage-iconHolder-icon').attr("class", "ebIcon ebIcon_big ebIcon_error"); - for (var i = 0; i < data.messages.message.length; i++) { - $("#statusMessageTable").append("<tr><td>" + data.messages.message[i] + "</td></tr>"); + for (let value of data.messages.message) { + $("#statusMessageTable").append("<tr><td>" + value + "</td></tr>"); } // A session with session ID "0" does not exist var sessionDoesNotExistStringStart = "A session with session ID "; @@ -257,8 +258,8 @@ function pageControl_recursiveDisable(el, disableValue, visibleValue) { } if (el.childNodes && el.childNodes.length > 0) { - for (var i = 0; i < el.childNodes.length; i++) { - recursiveDisable(el.childNodes[i], disableValue, visibleValue); + for (let value of el.childNodes) { + recursiveDisable(value, disableValue, visibleValue); } } } diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm.js index 97e1130..59af8f5 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm.js @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,8 +65,8 @@ function editPolicyForm_editPolicy_inner(formParent, policy, viewOrEdit) { var requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (var i = 0; i < data2.messages.message.length; i++) { - var contextSchema = JSON.parse(data2.messages.message[i]).apexContextSchema; + for (let value of data2.messages.message) { + var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, "version" : contextSchema.key.version, @@ -77,8 +78,8 @@ function editPolicyForm_editPolicy_inner(formParent, policy, viewOrEdit) { requestURL = window.restRootURL + "/Task/Get?name=&version="; var tasks = new Array(); ajax_get(requestURL, function(data3) { - for (var j = 0; j < data3.messages.message.length; j++) { - var task = JSON.parse(data3.messages.message[j]).apexTask; + for (let value of data3.messages.message) { + var task = JSON.parse(value).apexTask; tasks.push({ "name" : task.key.name, "version" : task.key.version, @@ -90,8 +91,8 @@ function editPolicyForm_editPolicy_inner(formParent, policy, viewOrEdit) { requestURL = window.restRootURL + "/ContextAlbum/Get?name=&version="; var albums = new Array(); ajax_get(requestURL, function(data4) { - for (var k = 0; k < data4.messages.message.length; k++) { - var album = JSON.parse(data4.messages.message[k]).apexContextAlbum; + for (let value of data4.messages.message) { + var album = JSON.parse(value).apexContextAlbum; albums.push({ "name" : album.key.name, "version" : album.key.version, @@ -103,8 +104,8 @@ function editPolicyForm_editPolicy_inner(formParent, policy, viewOrEdit) { requestURL = window.restRootURL + "/Event/Get?name=&version="; var events = new Array(); ajax_get(requestURL, function(data5) { - for (var m = 0; m < data5.messages.message.length; m++) { - var event = JSON.parse(data5.messages.message[m]).apexEvent; + for (let value of data5.messages.message) { + var event = JSON.parse(value).apexEvent; events.push({ "name" : event.key.name, "version" : event.key.version, @@ -300,9 +301,9 @@ function editPolicyForm_activate(parent, operation, policy, tasks, events, conte var firststateoptions = new Array(); var firststateselected = null; if (policy != null && policy.state != null) { - for (var i = 0; i < policy.state.entry.length; i++) { - if (policy.state.entry[i] != null && policy.state.entry[i].key != null) { - var statename = policy.state.entry[i].key; + for (let value of policy.state.entry) { + if (value != null && value.key != null) { + var statename = value.key; firststateoptions.push({ "name" : statename, "displaytext" : statename @@ -559,8 +560,8 @@ function editPolicyForm_addNewState(statesUL, createEditOrView, policy, tasks, e document.getElementById("editEventFormNewStateInput").value = ""; } if (policy && policy.state) { - for (var i = 0; i < policy.state.entry.length; i++) { - if (statename.toUpperCase() == policy.state.entry[i].key.toUpperCase()) { + for (let value of policy.state.entry) { + if (statename.toUpperCase() == value.key.toUpperCase()) { alert("Policy " + policy.policyKey.name + ":" + policy.policyKey.version + " already contains a state called \"" + statename + "\"."); document.getElementById("editEventFormNewStateInput").focus(); @@ -580,11 +581,11 @@ function editPolicyForm_getStateOptions() { "#editEventFormStates > li[stateName]"); // get li direct child // elements with an // attribute "stateName" - for (var i = 0; i < stateslis.length; i++) { - if (stateslis != null && stateslis[i] != null && stateslis[i].getAttribute("stateName") != null) { + for (let value of stateslis) { + if (stateslis != null && value != null && value.getAttribute("stateName") != null) { stateoptions.push({ - "name" : stateslis[i].getAttribute("stateName"), - "displaytext" : stateslis[i].getAttribute("stateName") + "name" : value.getAttribute("stateName"), + "displaytext" : value.getAttribute("stateName") }); } } @@ -784,10 +785,10 @@ function editPolicyForm_getPolicyBean() { "#editEventFormStates > li[stateName]"); // get li direct child // elements with an // attribute "stateName" - for (var i = 0; i < stateslis.length; i++) { // ignore last li ... it has + for (let value of stateslis) { // ignore last li ... it has // the new state button etc. - if (stateslis != null && stateslis[i] != null && stateslis[i].getAttribute("stateName") != null) { - var statename = stateslis[i].getAttribute("stateName"); + if (stateslis != null && value != null && value.getAttribute("stateName") != null) { + var statename = value.getAttribute("stateName"); var state = editPolicyForm_State_getStateBean(statename); if (state == null) { return null; @@ -796,7 +797,7 @@ function editPolicyForm_getPolicyBean() { } } - var policybean = { + return { "name" : name, "version" : version, "uuid" : uuid, @@ -805,7 +806,6 @@ function editPolicyForm_getPolicyBean() { "firstState" : firststateselectedoption.name, "states" : states }; - return policybean; } export { diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm_State.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm_State.js index e9db245..aa0db4b 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm_State.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm_State.js @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,8 +82,7 @@ function editPolicyForm_State_generateStateDiv(createEditOrView, policy, statena contextstable.appendChild(contextstable_body); // Add the contexts if (state && state.contextAlbumReference && $.isArray(state.contextAlbumReference)) { - for (var p = 0; p < state.contextAlbumReference.length; p++) { - var contextEntry = state.contextAlbumReference[p]; + for (let contextEntry of state.contextAlbumReference) { var contextName = contextEntry.name + ":" + contextEntry.version; var ce = { "name" : contextEntry.name, @@ -165,8 +165,7 @@ function editPolicyForm_State_generateStateDiv(createEditOrView, policy, statena } // Add the tasks if (state && state.taskReferences && $.isArray(state.taskReferences.entry)) { - for (var j = 0; j < state.taskReferences.entry.length; j++) { - var taskEntry = state.taskReferences.entry[j]; + for (let taskEntry of state.taskReferences.entry) { var taskName = taskEntry.key.name + ":" + taskEntry.key.version; var taskselected = { "name" : taskEntry.key.name, @@ -294,8 +293,7 @@ function editPolicyForm_State_generateStateDiv(createEditOrView, policy, statena "state" : null }); if (policy && policy.state && policy.state.entry && $.isArray(policy.state.entry)) { - for (var s = 0; s < policy.state.entry.length; s++) { - var st = policy.state.entry[s]; + for (let st of policy.state.entry) { if (statename != st.key) { // state cannot have itself as nextstate stateNextStateOptions.push({ "name" : st.key, @@ -306,8 +304,7 @@ function editPolicyForm_State_generateStateDiv(createEditOrView, policy, statena } } if (state && state.stateOutputs && $.isArray(state.stateOutputs.entry)) { - for (var h = 0; h < state.stateOutputs.entry.length; h++) { - var outputEntry = state.stateOutputs.entry[h]; + for (let outputEntry of state.stateOutputs.entry) { var outputName = outputEntry.key; var nextState = null; var nxtst = outputEntry.value.nextState.localName; @@ -391,8 +388,7 @@ function editPolicyForm_State_generateStateDiv(createEditOrView, policy, statena var logic_outputstable_body = document.createElement("tbody"); logic_outputstable.appendChild(logic_outputstable_body); if (state && state.stateFinalizerLogicMap && $.isArray(state.stateFinalizerLogicMap.entry)) { - for (var f = 0; f < state.stateFinalizerLogicMap.entry.length; f++) { - outputEntry = state.stateFinalizerLogicMap.entry[f]; + for (let outputEntry of state.stateFinalizerLogicMap.entry) { outputName = outputEntry.key; logic = null; if (outputEntry.value != null && outputEntry.value.logic != null) { @@ -738,8 +734,8 @@ function editPolicyForm_State_addPolicyTask(parentTBody, disabled, isdefault, st } var dir_outputOptions = new Array(); if (state != null && state.stateOutputs != null && $.isArray(state.stateOutputs.entry)) { - for (var p = 0; p < state.stateOutputs.entry.length; p++) { - var outputEntry = state.stateOutputs.entry[p].key; + for (let value of state.stateOutputs.entry) { + var outputEntry = value.key; dir_outputOptions.push({ "name" : outputEntry, "displaytext" : outputEntry @@ -748,8 +744,8 @@ function editPolicyForm_State_addPolicyTask(parentTBody, disabled, isdefault, st } var logic_outputOptions = new Array(); if (state != null && state.stateFinalizerLogicMap != null && $.isArray(state.stateFinalizerLogicMap.entry)) { - for (var l = 0; l < state.stateFinalizerLogicMap.entry.length; l++) { - outputEntry = state.stateFinalizerLogicMap.entry[l].key; + for (let value of state.stateFinalizerLogicMap.entry) { + outputEntry = value.key; logic_outputOptions.push({ "name" : outputEntry, "displaytext" : outputEntry @@ -1083,7 +1079,7 @@ function editPolicyForm_State_getStateBean(statename) { }; var r2 = document.getElementById("editPolicyFormTaskIsDefault_" + statename + "_" + task_id); - if (taskstablerows.length <= 3 || (r2 != null && r2.checked == true)) { // default + if (taskstablerows.length <= 3 || (r2 != null && r2.checked)) { // default // is // checked // or |