Merge pull request #845 from Luis-Fernando-Molina/develop

Contribution: Important Bug Fixed at Lighting Path Function Impacting sequence of same type nodes.
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-04-26 18:08:52 -04:00
commit 396feb5c6b
4 files changed
+87 -20

No files matched your search

@@ -117,8 +117,10 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
if (apiMAP.config.hostName === undefined || apiMAP.config.hostName === "") {
// TODO Error Handling
return
} else {
hostName = apiMAP.config.hostName
}
if (apiMAP.config.portNumber !== undefined && apiMAP.config.portNumber !== "") {
portNumber = ":" + apiMAP.config.portNumber
}
@@ -185,8 +187,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
let separator = ""
if (productDefinition.apiQueryParameters !== undefined) {
queryString = '?'
for (j = 0; j < productDefinition.apiQueryParameters.length; j++) {
let apiQueryParameter = productDefinition.apiQueryParameters[j]
for (j = 0; j < productDefinition.apiQueryParameters.apiQueryParameters.length; j++) {
let apiQueryParameter = productDefinition.apiQueryParameters.apiQueryParameters[j]
queryString = queryString + separator + apiQueryParameter.config.codeName + '=' + apiQueryParameter.config.value
separator = "&"
}
@@ -99,7 +99,7 @@
botNode = TS.projects.superalgos.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Learning Bot')
}
if (botNode === undefined) {
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] start -> Product Definition not attached to a Bot. Product Definition = ");
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] start -> Product Definition not attached to a Bot. ");
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
return
}
@@ -2,14 +2,23 @@ function newSuperalgosFunctionLibraryProtocolNode() {
const MODULE_NAME = 'Protocol Node'
const ERROR_LOG = true
const logger = newWebDebugLog()
thisObject = {
getProtocolNode: getProtocolNode
}
return thisObject
function getProtocolNode(node, removePersonalData, parseConfig, includeIds, includePayload, includeReferencesInSavedPayload, lightingPath) {
function getProtocolNode(
node,
removePersonalData,
parseConfig,
includeIds,
includePayload,
includeReferencesInSavedPayload,
lightingPath,
excludeChildrenOfType
) {
if (node === undefined) { return }
if (node.payload === undefined) { return }
@@ -28,16 +37,34 @@ function newSuperalgosFunctionLibraryProtocolNode() {
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
if (property.childType === excludeChildrenOfType) {
continue
}
switch (property.type) {
case 'node': {
if (node[property.name] !== undefined) {
if (lightingPath === undefined) {
object[property.name] = getProtocolNode(node[property.name], removePersonalData, parseConfig, includeIds, includeReferencesInSavedPayload, includePayload)
object[property.name] = getProtocolNode(
node[property.name],
removePersonalData,
parseConfig,
includeIds,
includeReferencesInSavedPayload,
includePayload
)
} else {
let newLightingPath = getNewLightingPath(lightingPath, node.type, property.childType)
if (newLightingPath !== undefined) {
object[property.name] = getProtocolNode(node[property.name], removePersonalData, parseConfig, includeIds, includePayload, includeReferencesInSavedPayload, newLightingPath)
object[property.name] = getProtocolNode(
node[property.name],
removePersonalData,
parseConfig,
includeIds,
includePayload,
includeReferencesInSavedPayload,
newLightingPath
)
}
}
}
@@ -49,7 +76,14 @@ function newSuperalgosFunctionLibraryProtocolNode() {
let nodePropertyArray = node[property.name]
object[property.name] = []
for (let m = 0; m < nodePropertyArray.length; m++) {
let protocolNode = getProtocolNode(nodePropertyArray[m], removePersonalData, parseConfig, includeIds, includeReferencesInSavedPayload, includePayload)
let protocolNode = getProtocolNode(
nodePropertyArray[m],
removePersonalData,
parseConfig,
includeIds,
includeReferencesInSavedPayload,
includePayload
)
if (protocolNode !== undefined) {
object[property.name].push(protocolNode)
}
@@ -60,7 +94,15 @@ function newSuperalgosFunctionLibraryProtocolNode() {
let nodePropertyArray = node[property.name]
object[property.name] = []
for (let m = 0; m < nodePropertyArray.length; m++) {
let protocolNode = getProtocolNode(nodePropertyArray[m], removePersonalData, parseConfig, includeIds, includePayload, includeReferencesInSavedPayload, newLightingPath)
let protocolNode = getProtocolNode(
nodePropertyArray[m],
removePersonalData,
parseConfig,
includeIds,
includePayload,
includeReferencesInSavedPayload,
newLightingPath
)
if (protocolNode !== undefined) {
object[property.name].push(protocolNode)
}
@@ -74,11 +116,21 @@ function newSuperalgosFunctionLibraryProtocolNode() {
}
}
/* Parent Nodes */
if (node.payload.parentNode !== undefined) {
let newLightingPath = getNewLightingPath(lightingPath, node.type, node.payload.parentNode.type)
if (newLightingPath !== undefined) {
object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseConfig, includeIds, includePayload, includeReferencesInSavedPayload, newLightingPath)
object.parentNode = getProtocolNode(
node.payload.parentNode,
removePersonalData,
parseConfig,
includeIds,
includePayload,
includeReferencesInSavedPayload,
newLightingPath,
node.type
)
} else {
let newLightingPath = getNewLightingPath(lightingPath, node.type, node.payload.parentNode.type)
}
@@ -86,7 +138,15 @@ function newSuperalgosFunctionLibraryProtocolNode() {
if (node.payload.referenceParent !== undefined) {
let newLightingPath = getNewLightingPath(lightingPath, node.type, node.payload.referenceParent.type)
if (newLightingPath !== undefined) {
object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseConfig, includeIds, includePayload, includeReferencesInSavedPayload, newLightingPath)
object.referenceParent = getProtocolNode(
node.payload.referenceParent,
removePersonalData,
parseConfig,
includeIds,
includePayload,
includeReferencesInSavedPayload,
newLightingPath
)
}
}
@@ -127,19 +187,23 @@ function newSuperalgosFunctionLibraryProtocolNode() {
/*
In some situations, the current and next node are of the same type.
When that happens, we need to search for the second instance of that type
at the lighting path.
at the lighting path, and then remove one of the strings for the returning path.
*/
if (currentNodeType === nextNodeType) {
let tempLightingPath = lightingPath.substring(currentNodePosition + currentNodeType.length, lightingPath.length + 1)
let tempLightingPath = lightingPath.substring(currentNodePosition + currentNodeType.length + 2, lightingPath.length + 1)
nextNodePosition = tempLightingPath.indexOf('->' + nextNodeType + '->')
}
let newLightingPath = lightingPath.substring(nextNodePosition, lightingPath.length + 1)
let newLightingPath = lightingPath.substring(nextNodePosition, lightingPath.length + 1)
if (nextNodePosition > currentNodePosition) {
return newLightingPath
if (nextNodePosition >= currentNodePosition) {
return newLightingPath
}
} else {
return
let newLightingPath = lightingPath.substring(nextNodePosition, lightingPath.length + 1)
if (nextNodePosition > currentNodePosition) {
return newLightingPath
}
}
}
@@ -128,7 +128,8 @@ function newSuperalgosFunctionLibraryTaskFunctions() {
'Process Definition->' +
'Process Output->' +
'Output Dataset Folder->Output Dataset Folder->Output Dataset Folder->Output Dataset Folder->Output Dataset Folder->' +
'Output Dataset->Dataset Definition->Product Definition->' +
'Output Dataset->Dataset Definition->Product Definition->API Query Parameters->API Query Parameter->' +
'Product Definition Folder->Product Definition Folder->Product Definition Folder->Product Definition Folder->Product Definition Folder->' +
'Process Dependencies->' +
'Status Dependency->Status Report->Process Definition->' +
'Data Mine Data Dependencies->Bot Data Dependencies->' +