Advertisement
Guest User

Fluxo parametros globais

a guest
Jan 27th, 2020
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.45 KB | None | 0 0
  1. [{"id":"d9fcef3.9d2ec1","type":"subflow","name":"Oracle RPA_[ENV] - V 1.0.1","info":"Changelog:\n\n```\nV 1.0.1\n* Fluxo dispara um msg.error.message em caso de binding inválido\nV 1.0.0\n* Versão inicial\n```","category":"storage","in":[{"x":40,"y":140,"wires":[{"id":"b2c98595.e65298"}]}],"out":[{"x":860,"y":120,"wires":[{"id":"b002dcb9.56fc2","port":0}]},{"x":340,"y":200,"wires":[{"id":"b2c98595.e65298","port":1},{"id":"839c41b0.bd139","port":0}]}],"env":[]},{"id":"9106e43e.3f3188","type":"switch","z":"d9fcef3.9d2ec1","name":"Enviroment?","property":"environment","propertyType":"global","rules":[{"t":"eq","v":"Production","vt":"str"},{"t":"eq","v":"Homologation","vt":"str"},{"t":"eq","v":"Development","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":350,"y":120,"wires":[["ba4b241.c2c9cd8"],["a573a76f.e1cc58"],["767b3bea.1c339c"]]},{"id":"a573a76f.e1cc58","type":"oracledb","z":"d9fcef3.9d2ec1","name":"Homologation","usequery":false,"query":"INSERT INTO oracleTableName\n\t(fieldName1, fieldName2, Fieldname3)\n\tVALUES (\n\t\t:valueOfValuesArrayIndex0,\n\t\t:valueOfValuesArrayIndex1,\n\t\t:valueOfValuesArrayIndex2,\n\t)","usemappings":false,"mappings":"[\n\t\"location.of.first.array.index.field.in.msg.payload\",\n\t\"location.of.second.array.index.field\",\n\t\"last_array_indexfield.in[3]\"\n]","server":"12f60c7d.bd157c","resultaction":"single","resultlimit":"9999","x":520,"y":120,"wires":[["b002dcb9.56fc2"]]},{"id":"767b3bea.1c339c","type":"oracledb","z":"d9fcef3.9d2ec1","name":"Development","usequery":false,"query":"INSERT INTO oracleTableName\n\t(fieldName1, fieldName2, Fieldname3)\n\tVALUES (\n\t\t:valueOfValuesArrayIndex0,\n\t\t:valueOfValuesArrayIndex1,\n\t\t:valueOfValuesArrayIndex2,\n\t)","usemappings":false,"mappings":"[\n\t\"location.of.first.array.index.field.in.msg.payload\",\n\t\"location.of.second.array.index.field\",\n\t\"last_array_indexfield.in[3]\"\n]","server":"feb5f65b.120e58","resultaction":"single","resultlimit":"9999","x":510,"y":160,"wires":[["b002dcb9.56fc2"]]},{"id":"ba4b241.c2c9cd8","type":"oracledb","z":"d9fcef3.9d2ec1","name":"Production","usequery":false,"query":"INSERT INTO oracleTableName\n\t(fieldName1, fieldName2, Fieldname3)\n\tVALUES (\n\t\t:valueOfValuesArrayIndex0,\n\t\t:valueOfValuesArrayIndex1,\n\t\t:valueOfValuesArrayIndex2,\n\t)","usemappings":false,"mappings":"[\n\t\"location.of.first.array.index.field.in.msg.payload\",\n\t\"location.of.second.array.index.field\",\n\t\"last_array_indexfield.in[3]\"\n]","server":"3b678260.bdb7e6","resultaction":"single","resultlimit":"9999","x":510,"y":80,"wires":[["b002dcb9.56fc2"]]},{"id":"839c41b0.bd139","type":"catch","z":"d9fcef3.9d2ec1","name":"","scope":null,"x":80,"y":200,"wires":[[]]},{"id":"5b92160e.ecbb4","type":"comment","z":"d9fcef3.9d2ec1","name":"V 1.0.1","info":"","x":70,"y":40,"wires":[]},{"id":"b2c98595.e65298","type":"function","z":"d9fcef3.9d2ec1","name":"Check msg.values","func":"let binds = msg.query.match(/[\\W]:\\w+/g);\nif(binds === null){\n binds = [];\n}\n\nbinds = binds.map(bind => bind.replace(/^[\\W]+/g, \"\")); // Limpa o início do bind\n\nif(typeof msg.values === \"object\"){ // msg.values foi passado\n if(Array.isArray(msg.values)){\n msg.payload = msg.values;\n }\n else{\n msg.payload = [];\n for(let bind of binds){\n if(typeof msg.values[bind] !== undefined){\n msg.payload.push(msg.values[bind]);\n }\n }\n }\n}\n\nif(!Array.isArray(msg.payload)){\n msg.payload = [];\n}\n\nif(binds.length !== msg.payload.length){\n msg.error = {\n message: `Invalid Binding: msg.payload has ${msg.payload.length} binds, msg.query has ${binds.length} binds`,\n source: {\n id: node.id,\n type: \"function\",\n name: node.name,\n count: 1\n }\n };\n return [null, msg];\n}\nreturn [msg, null];","outputs":2,"noerr":0,"x":170,"y":140,"wires":[["9106e43e.3f3188"],[]]},{"id":"b002dcb9.56fc2","type":"change","z":"d9fcef3.9d2ec1","name":"","rules":[{"t":"delete","p":"values","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":120,"wires":[[]]},{"id":"12f60c7d.bd157c","type":"oracle-server","z":"","host":"oraracsne_scan.internal.timbrasil.com.br","port":"1521","reconnect":true,"reconnecttimeout":"0","db":"OSSDB","queuedMaxLength":"250","minPool":"1","maxPool":"10"},{"id":"feb5f65b.120e58","type":"oracle-server","z":"","host":"oraracsne_scan.internal.timbrasil.com.br","port":"1521","reconnect":true,"reconnecttimeout":"0","db":"OSSDB","queuedMaxLength":"250","minPool":"1","maxPool":"10"},{"id":"3b678260.bdb7e6","type":"oracle-server","z":"","host":"oraracsne_scan.internal.timbrasil.com.br","port":"1521","reconnect":true,"reconnecttimeout":"0","db":"OSSDB","queuedMaxLength":"250","minPool":"1","maxPool":"10"},{"id":"6807bf5e.c1f2b8","type":"inject","z":"9195b6aa.8a04","name":"Inject Once","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"","x":110,"y":80,"wires":[["7ac4645e.0f13dc"]]},{"id":"7ac4645e.0f13dc","type":"change","z":"9195b6aa.8a04","name":"Prepare Select Global Params","rules":[{"t":"set","p":"query","pt":"msg","to":"SELECT * FROM ICT_RPA_GLOBAL_PARAMS","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":80,"wires":[["125fdec9.af8b29"]]},{"id":"125fdec9.af8b29","type":"subflow:d9fcef3.9d2ec1","z":"9195b6aa.8a04","name":"Global Params Table","env":[],"x":580,"y":80,"wires":[["e8a78be8.fce14"],[]]},{"id":"e8a78be8.fce14","type":"function","z":"9195b6aa.8a04","name":"SET Global Params","func":"param = msg.payload;\n\nnode.log(\"Setting global configuration...\");\n\nfor(var i = 0; i < param.length; i++){\n global.set(param[i].PARAMETER, param[i].VALUE);\n node.log(param[i].PARAMETER + \": \" + param[i].VALUE);\n}\n\nfunction pad(num){\n if ( num < 10 && num >= 0){\n num = \"0\" + num;\n }\n return num;\n}\n\nlet date = new Date();\n\nlet datestring = \n date.getDate() + \"/\" + \n (date.getMonth()+1) + \"/\" + \n date.getFullYear() + \" \" +\n pad(date.getHours()) + \":\" + \n pad(date.getMinutes()) + \":\" + \n pad(date.getSeconds());\n\nglobal.set('last_get', datestring);\nmsg.last_get = datestring;\nreturn msg;","outputs":1,"noerr":0,"x":800,"y":80,"wires":[["3678e661.b5957a","6c50f75c.c28758"]]},{"id":"3678e661.b5957a","type":"debug","z":"9195b6aa.8a04","name":"Global Params","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1000,"y":60,"wires":[]}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement