Produced by Araxis Merge on 10/4/2017 8:04:33 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | rdk.zip\rdk\product\production\rdk\src\fhir\communication | communication-resource.js | Mon Aug 21 12:51:00 2017 UTC |
| 2 | rdk.zip\rdk\product\production\rdk\src\fhir\communication | communication-resource.js | Tue Oct 3 17:15:05 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 944 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | 'use stric t'; | |
| 2 | ||
| 3 | var _ = re quire('lod ash'); | |
| 4 | var oracle Connection Pool = req uire('../. ./utils/or acle-conne ction-pool '); | |
| 5 | var oracle db = requi re('oracle db'); | |
| 6 | ||
| 7 | var rdk = require('. ./../core/ rdk'); | |
| 8 | var RdkErr or = rdk.u tils.RdkEr ror; | |
| 9 | ||
| 10 | var PROCED URE_GET_AT TACHMENT = 'BEGIN CO MMUNICATIO N.MESSAGE_ API.FETCH_ MESSAGE_AT TACHMENT(: identifier , :content Type, :out put); END; '; | |
| 11 | var PROCED URE_UPDATE _USER_PREF ERENCES = 'BEGIN COM MUNICATION .MESSAGE_A PI.UPDATE_ USER_PREFE RENCES(:us erId, :cat egorySyste m, :catego ryCode, :e nabled, :o utput); EN D;'; | |
| 12 | var NO_DAT A_ERROR_CO DE = 'ORA- 01403'; | |
| 13 | ||
| 14 | ||
| 15 | function g etResource Config() { | |
| 16 | return [{ | |
| 17 | na me: 'ehmp- announceme nts', | |
| 18 | pa th: '', | |
| 19 | ge t: getComm unications , | |
| 20 | in terceptors : { | |
| 21 | synchron ize: false , | |
| 22 | validate Pid: false | |
| 23 | }, | |
| 24 | re quiredPerm issions: [ 'read-mess age'], | |
| 25 | is PatientCen tric: fals e, | |
| 26 | su bsystems: [] | |
| 27 | }, { | |
| 28 | na me: 'ehmp- announceme nts-attach ment', | |
| 29 | pa th: '/:ide ntifier/at tachment/: idAttachme nt', | |
| 30 | ge t: getAtta chment, | |
| 31 | in terceptors : { | |
| 32 | synchron ize: false , | |
| 33 | validate Pid: false | |
| 34 | }, | |
| 35 | re quiredPerm issions: [ 'read-mess age'], | |
| 36 | is PatientCen tric: fals e, | |
| 37 | su bsystems: [] | |
| 38 | }, { | |
| 39 | na me: 'ehmp- announceme nts-prefer ences', | |
| 40 | pa th: '/pref erences', | |
| 41 | po st: postUs erPreferen ces, | |
| 42 | in terceptors : { | |
| 43 | synchron ize: false , | |
| 44 | validate Pid: false | |
| 45 | }, | |
| 46 | re quiredPerm issions: [ 'read-mess age'], | |
| 47 | is PatientCen tric: fals e, | |
| 48 | su bsystems: [] | |
| 49 | }]; | |
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * A mappi ng between keys used in the fe tch messag es procedu re and key s used wit hin getMes sages() | |
| 54 | * @type { {userId: s tring, ver sion: stri ng, catego ry: string , status: string, ov erride: st ring}} | |
| 55 | */ | |
| 56 | var fetchP rocedureMa p = { | |
| 57 | userId : 'i_user_ id', | |
| 58 | versio n: 'i_vers ion', | |
| 59 | catego ry: 'i_cat egory', | |
| 60 | status : 'i_statu s', | |
| 61 | overri de: 'i_ove rride_pref erences' | |
| 62 | }; | |
| 63 | Object.fre eze(fetchP rocedureMa p); | |
| 64 | ||
| 65 | ||
| 66 | /** | |
| 67 | * Data ty pe prefixe s for imag es. | |
| 68 | * @type { {jpg: stri ng, jpeg: string, bm p: string, png: stri ng}} | |
| 69 | */ | |
| 70 | var conten tTypeMap = { | |
| 71 | 'image /jpg': 'da ta:image/j peg;base64 ,', | |
| 72 | 'image /jpeg': 'd ata:image/ jpeg;base6 4,', | |
| 73 | 'image /bmp': 'da ta:image/b mp;base64, ', | |
| 74 | 'image /png': 'da ta:image/p ng;base64, ' | |
| 75 | }; | |
| 76 | Object.fre eze(conten tTypeMap); | |
| 77 | ||
| 78 | ||
| 79 | var PREFER ENCE_WHITE _LIST = [' http://ehm p. DNS /messageCa tegories/a nnouncemen ts-promoti ons']; | |
| 80 | ||
| 81 | ||
| 82 | /** | |
| 83 | * BEGIN | |
| 84 | * CO MMUNICATIO N.MESSAGE_ API.FETCH_ MESSAGES( | |
| 85 | * :userId, -- VARCHA R2 (Requir ed) | |
| 86 | * :version, -- VARCHA R2 (Requir ed) | |
| 87 | * :category , -- VARCHA R2 (Requir ed) | |
| 88 | * :status, -- VARCHA R2 (option al) | |
| 89 | * :override , -- VARCHA R2 (option al) 'Y' or 'N' | |
| 90 | * :output -- CLOB ( Output) | |
| 91 | * ) ; | |
| 92 | * END; | |
| 93 | */ | |
| 94 | function g etCommunic ations(req , res) { | |
| 95 | var db Config = _ .get(req, 'app.confi g.oracledb .communica tionsDatab ase'); | |
| 96 | if (!d bConfig) { | |
| 97 | va r unavaila bleError = new RdkEr ror({ | |
| 98 | logger: req.logger , | |
| 99 | code: 'o racledb.50 3.1000' | |
| 100 | }) ; | |
| 101 | re turn res.s tatus(unav ailableErr or.status) .rdkSend(u navailable Error.erro r); | |
| 102 | } | |
| 103 | ||
| 104 | var in putData = { | |
| 105 | us erId: _.ge t(req, ['q uery', 're quester.us erId']), | |
| 106 | ve rsion: _.g et(req, [' query', 'r equester.e hmpAppVers ion'], '') , | |
| 107 | ca tegory: _. get(req, [ 'query', ' category'] ), | |
| 108 | st atus: _.ge t(req, ['q uery', 'st atus']), | |
| 109 | ov erride: _. get(req, [ 'query', ' overridePr eferences' ]) | |
| 110 | }; | |
| 111 | ||
| 112 | if (_. isString(i nputData.c ategory)) { | |
| 113 | in putData.ca tegory = [ inputData. category]; | |
| 114 | } | |
| 115 | ||
| 116 | var cu rrentUser = req.sess ion.user.u id; | |
| 117 | if (in putData.us erId !== c urrentUser ) { | |
| 118 | va r message = 'request .userId: ( ' + inputD ata.userId + ') does not match the user authentica ted to thi s session' ; | |
| 119 | re turn res.s tatus(400) .rdkSend(m essage); | |
| 120 | } | |
| 121 | ||
| 122 | var ve rsion = in putData.ve rsion.spli t('.'); | |
| 123 | if (ve rsion.leng th > 2) { | |
| 124 | ve rsion.leng th = 2; | |
| 125 | } | |
| 126 | inputD ata.versio n = versio n.join('.' ); | |
| 127 | ||
| 128 | if (_. isBoolean( inputData. override)) { | |
| 129 | in putData.ov erride = i nputData.o verride ? 'Y' : 'N'; | |
| 130 | } else if (_.isS tring(inpu tData.over ride)) { | |
| 131 | in putData.ov erride = i nputData.o verride.to LowerCase( ) === 'tru e' ? 'Y' : 'N'; | |
| 132 | } | |
| 133 | ||
| 134 | oracle Connection Pool.getPo ol(req, db Config, fu nction get Pool(err, pool) { | |
| 135 | if (err) { | |
| 136 | var erro r = new Rd kError({ | |
| 137 | code : 'oracled b.500.1000 ', | |
| 138 | logg er: req.lo gger, | |
| 139 | erro r: _.get(e rr, 'messa ge', 'Fail ed to get resource f rom connec tion pool' ) | |
| 140 | }); | |
| 141 | return r es.status( error.stat us).rdkSen d(error); | |
| 142 | } | |
| 143 | po ol.getConn ection(fun ction getC onnection( err, conne ction) { | |
| 144 | if (err) { | |
| 145 | req. logger.deb ug('failed to connec tion to or acle'); | |
| 146 | var error = ne w RdkError ({ | |
| 147 | code: 'ora cledb.500. 1000', | |
| 148 | logger: re q.logger, | |
| 149 | error: _.g et(err, 'm essage', ' Failed to open oracl e connecti on') | |
| 150 | }); | |
| 151 | retu rn res.sta tus(error. status).rd kSend(erro r); | |
| 152 | } | |
| 153 | ||
| 154 | var data = createF etchOracle Bindings(i nputData); | |
| 155 | var quer y = create FetchProce dureString (data); | |
| 156 | req.logg er.info({q uery: quer y, binds: data, mess age: 'Gene rated quer y and orac le binds'} ); | |
| 157 | ||
| 158 | connecti on.execute (query, da ta, functi on execute (err, resu lt) { | |
| 159 | if ( err) { | |
| 160 | oracleConn ectionPool .doClose(r eq, connec tion); | |
| 161 | var connec tionError = new RdkE rror({ | |
| 162 | code: 'oracledb. 500.1000', | |
| 163 | logger : req.logg er, | |
| 164 | error: _.get(err , 'message ', 'Failed to execut e get user preferenc es') | |
| 165 | }); | |
| 166 | return res .status(co nnectionEr ror.status ).rdkSend( connection Error); | |
| 167 | } | |
| 168 | ||
| 169 | var clob = _.g et(result, 'outBinds .output'); | |
| 170 | if ( _.isUndefi ned(clob) || !_.isFu nction(_.g et(clob, ' on'))) { | |
| 171 | oracleConn ectionPool .doClose(r eq, connec tion); | |
| 172 | req.logger .debug('cl ob was not returned' ); | |
| 173 | var undefi nedError = new RdkEr ror({ | |
| 174 | code: 'oracledb. 500.1000', | |
| 175 | logger : req.logg er, | |
| 176 | error: _.get(err , 'message ', 'Did no t receive a clob buf fer object ') | |
| 177 | }); | |
| 178 | return res .status(un definedErr or.status) .rdkSend(u ndefinedEr ror); | |
| 179 | } | |
| 180 | ||
| 181 | var output = ' '; | |
| 182 | clob .on('err', function( err) { | |
| 183 | oracleConn ectionPool .doClose(r eq, connec tion); | |
| 184 | req.logger .debug('Th e connecti on to the CLOB was i nterrupted '); | |
| 185 | var clobEr ror = new RdkError({ | |
| 186 | code: 'oracledb. 500.1000', | |
| 187 | logger : req.logg er, | |
| 188 | error: _.get(err , 'message ', 'Clob r ead error' ) | |
| 189 | }); | |
| 190 | return res .status(cl obError.st atus).rdkS end(clobEr ror); | |
| 191 | }); | |
| 192 | ||
| 193 | clob .on('data' , function (chunk) { | |
| 194 | output += chunk; | |
| 195 | }); | |
| 196 | ||
| 197 | clob .on('close ', functio n() { | |
| 198 | oracleConn ectionPool .doClose(r eq, connec tion); | |
| 199 | return res .status(20 0).rdkSend ({ | |
| 200 | data: { | |
| 201 | it ems: parse (output) | |
| 202 | } | |
| 203 | }); | |
| 204 | }); | |
| 205 | }); | |
| 206 | }) ; | |
| 207 | }); | |
| 208 | } | |
| 209 | ||
| 210 | ||
| 211 | /** | |
| 212 | * BEGIN | |
| 213 | * CO MMUNICATIO N.MESSAGE_ API.FETCH_ MESSAGE_AT TACHMENT( | |
| 214 | * :identif ier -- VARCHAR ( Required) | |
| 215 | * :content Type -- VARCHAR ( Output) | |
| 216 | * :output -- BLOB (Out put) The i mage | |
| 217 | * ); | |
| 218 | * END; | |
| 219 | */ | |
| 220 | function g etAttachme nt(req, re s) { | |
| 221 | var db Config = _ .get(req, 'app.confi g.oracledb .communica tionsDatab ase'); | |
| 222 | if (!d bConfig) { | |
| 223 | va r unavaila bleError = new RdkEr ror({ | |
| 224 | logger: req.logger , | |
| 225 | code: 'o racledb.50 3.1000' | |
| 226 | }) ; | |
| 227 | re turn res.s tatus(unav ailableErr or.status) .rdkSend(u navailable Error.erro r); | |
| 228 | } | |
| 229 | ||
| 230 | ||
| 231 | var id entifier = _.get(req , 'params. identifier '); | |
| 232 | ||
| 233 | oracle Connection Pool.getPo ol(req, db Config, fu nction get Pool(err, pool) { | |
| 234 | if (err) { | |
| 235 | var erro r = new Rd kError({ | |
| 236 | code : 'oracled b.500.1000 ', | |
| 237 | logg er: req.lo gger, | |
| 238 | erro r: _.get(e rr, 'messa ge', 'Fail ed to get resource f rom connec tion pool' ) | |
| 239 | }); | |
| 240 | return r es.status( error.stat us).rdkSen d(error); | |
| 241 | } | |
| 242 | po ol.getConn ection(fun ction getC onnection( err, conne ction) { | |
| 243 | if (err) { | |
| 244 | var error = ne w RdkError ({ | |
| 245 | code: 'jbp m.500.1000 ', | |
| 246 | logger: re q.logger, | |
| 247 | error: _.g et(err, 'm essage', ' Was not ab le to esta blish orac le connect ion') | |
| 248 | }); | |
| 249 | retu rn res.sta tus(error. status).rd kSend(erro r); | |
| 250 | } | |
| 251 | ||
| 252 | var data = { | |
| 253 | iden tifier: {v al: identi fier, dir: oracledb. BIND_IN, t ype: oracl edb.STRING }, | |
| 254 | cont entType: { dir: oracl edb.BIND_O UT, type: oracledb.S TRING}, | |
| 255 | outp ut: {dir: oracledb.B IND_OUT, t ype: oracl edb.BLOB} | |
| 256 | }; | |
| 257 | req.logg er.info('g etAttachme nt oracle binds', da ta); | |
| 258 | ||
| 259 | connecti on.execute (PROCEDURE _GET_ATTAC HMENT, dat a, functio n execute( err, resul t) { | |
| 260 | if ( err) { | |
| 261 | oracleConn ectionPool .doClose(r eq, connec tion); | |
| 262 | var messag e = _.get( err, 'mess age', ''); | |
| 263 | if (_.cont ains(messa ge, NO_DAT A_ERROR_CO DE)) { | |
| 264 | var no DataError = new RdkE rror({ | |
| 265 | co de: 'oracl edb.404.10 00', | |
| 266 | lo gger: req. logger, | |
| 267 | er ror: messa ge | |
| 268 | }); | |
| 269 | return res.statu s(noDataEr ror.status ).rdkSend( noDataErro r); | |
| 270 | } | |
| 271 | ||
| 272 | var error = new RdkE rror({ | |
| 273 | code: 'oracledb. 500.1000', | |
| 274 | logger : req.logg er, | |
| 275 | error: message | |
| 276 | }); | |
| 277 | return res .status(er ror.status ).rdkSend( error); | |
| 278 | } | |
| 279 | ||
| 280 | var contentTyp e = _.get( result, 'o utBinds.co ntentType' ); | |
| 281 | var blob = _.g et(result, 'outBinds .output'); | |
| 282 | if ( _.isUndefi ned(blob) || !_.isFu nction(_.g et(blob, ' on'))) { | |
| 283 | oracleConn ectionPool .doClose(r eq, connec tion); | |
| 284 | var undefi nedError = new RdkEr ror({ | |
| 285 | code: 'oracledb. 404.1000', | |
| 286 | logger : req.logg er, | |
| 287 | error: 'Blob not returned' | |
| 288 | }); | |
| 289 | return res .status(un definedErr or.status) .rdkSend(u ndefinedEr ror); | |
| 290 | } | |
| 291 | ||
| 292 | var output = n ew Buffer( 0); | |
| 293 | blob .on('err', function( err) { | |
| 294 | oracleConn ectionPool .doClose(r eq, connec tion); | |
| 295 | var blobEr ror = new RdkError({ | |
| 296 | code: 'oracledb. 500.1000', | |
| 297 | logger : req.logg er, | |
| 298 | error: _.get(err , 'message ', 'Blob r ead error' ) | |
| 299 | }); | |
| 300 | return res .status(bl obError.st atus).rdkS end(blobEr ror); | |
| 301 | }); | |
| 302 | ||
| 303 | blob .on('data' , function (chunk) { | |
| 304 | output = B uffer.conc at([output , chunk]); | |
| 305 | }); | |
| 306 | ||
| 307 | blob .on('close ', functio n() { | |
| 308 | oracleConn ectionPool .doClose(r eq, connec tion); | |
| 309 | var respon se = { | |
| 310 | conten tType: con tentType | |
| 311 | }; | |
| 312 | var imageP refix = _. get(conten tTypeMap, contentTyp e, null); | |
| 313 | if (imageP refix) { | |
| 314 | respon se.src = i magePrefix + output. toString(' base64'); | |
| 315 | } else { | |
| 316 | respon se.src = o utput.toSt ring('base 64'); | |
| 317 | } | |
| 318 | response.i magePrefix = imagePr efix; | |
| 319 | response.h asPrefix = !_.isNull (imagePref ix); | |
| 320 | return res .status(20 0).rdkSend (response) ; | |
| 321 | }); | |
| 322 | }); | |
| 323 | }) ; | |
| 324 | }); | |
| 325 | } | |
| 326 | ||
| 327 | ||
| 328 | /*** | |
| 329 | * BEGIN | |
| 330 | * CO MMUNICATIO N.MESSAGE_ API.UPDATE _USER_PREF ERENCES( | |
| 331 | * :userId, -- VARCH AR (Requir ed) | |
| 332 | * :categor ySystem, -- VARCH AR (Requir ed) | |
| 333 | * :categor yCode, -- VARCH AR (Requir ed) | |
| 334 | * :enabled , -- VARCH AR (Requir ed) 'Y' or 'N' | |
| 335 | * :output -- NUMBE R (Output) The numbe r of rows affected | |
| 336 | * ); | |
| 337 | * END; | |
| 338 | */ | |
| 339 | function p ostUserPre ferences(r eq, res) { | |
| 340 | var db Config = _ .get(req, 'app.confi g.oracledb .communica tionsDatab ase'); | |
| 341 | if (!d bConfig) { | |
| 342 | va r unavaila bleError = new RdkEr ror({ | |
| 343 | logger: req.logger , | |
| 344 | code: 'o racledb.50 3.1000' | |
| 345 | }) ; | |
| 346 | re turn res.s tatus(unav ailableErr or.status) .rdkSend(u navailable Error.erro r); | |
| 347 | } | |
| 348 | ||
| 349 | ||
| 350 | var us erId = _.g et(req, 'b ody.userId '); | |
| 351 | var ca tegorySyst em = _.get (req, 'bod y.category .system'); | |
| 352 | var ca tegoryCode = _.get(r eq, 'body. category.c ode'); | |
| 353 | var en abled = _. get(req, ' body.enabl ed'); | |
| 354 | ||
| 355 | if (ca tegorySyst em[categor ySystem.le ngth - 1] === '/') { | |
| 356 | ca tegorySyst em = categ orySystem. substr(0, categorySy stem.lengt h - 1); | |
| 357 | } | |
| 358 | ||
| 359 | if (!_ .contains( PREFERENCE _WHITE_LIS T, categor ySystem + '/' + cate goryCode)) { | |
| 360 | re turn res.s tatus(400) .rdkSend(' Invalid ca tegory.sys tem and ca tegory.cod e combinat ion.'); | |
| 361 | } | |
| 362 | ||
| 363 | var cu rrentUser = req.sess ion.user.u id; | |
| 364 | if (us erId !== c urrentUser ) { | |
| 365 | va r message = 'request .userId: ( ' + userId + ') does not match the user authentica ted to thi s session' ; | |
| 366 | re turn res.s tatus(400) .rdkSend(m essage); | |
| 367 | } | |
| 368 | ||
| 369 | if (_. isBoolean( enabled)) { | |
| 370 | en abled = en abled ? 'Y ' : 'N'; | |
| 371 | } | |
| 372 | ||
| 373 | oracle Connection Pool.getPo ol(req, db Config, fu nction get Pool(err, pool) { | |
| 374 | if (err) { | |
| 375 | var erro r = new Rd kError({ | |
| 376 | code : 'oracled b.500.1000 ', | |
| 377 | logg er: req.lo gger, | |
| 378 | erro r: _.get(e rr, 'messa ge', 'Coul d not get resource f rom connec tion pool' ) | |
| 379 | }); | |
| 380 | return r es.status( error.stat us).rdkSen d(error); | |
| 381 | } | |
| 382 | po ol.getConn ection(fun ction getC onnection( err, conne ction) { | |
| 383 | if (err) { | |
| 384 | var error = ne w RdkError ({ | |
| 385 | code: 'ora cledb.500. 1000', | |
| 386 | logger: re q.logger, | |
| 387 | error: _.g et(err, 'm essage', ' Was not ab le to esta blish orac le connect ion') | |
| 388 | }); | |
| 389 | retu rn res.sta tus(error. status).rd kSend(erro r); | |
| 390 | } | |
| 391 | ||
| 392 | var data = { | |
| 393 | user Id: {val: userId, di r: oracled b.BIND_IN, type: ora cledb.STRI NG}, | |
| 394 | cate gorySystem : {val: ca tegorySyst em, dir: o racledb.BI ND_IN, typ e: oracled b.STRING}, | |
| 395 | cate goryCode: {val: cate goryCode, dir: oracl edb.BIND_I N, type: o racledb.ST RING}, | |
| 396 | enab led: {val: enabled, dir: oracl edb.BIND_I N, type: o racledb.ST RING}, | |
| 397 | outp ut: {dir: oracledb.B IND_OUT, t ype: oracl edb.NUMBER } | |
| 398 | }; | |
| 399 | ||
| 400 | connecti on.execute (PROCEDURE _UPDATE_US ER_PREFERE NCES, data , {autoCom mit: true} , function (err, resu lt) { | |
| 401 | if ( err) { | |
| 402 | oracleConn ectionPool .doClose(r eq, connec tion); | |
| 403 | var error = new RdkE rror({ | |
| 404 | code: 'oracledb. 500.1000', | |
| 405 | logger : req.logg er, | |
| 406 | error: _.get(err , 'message ', 'Failed to execut e update u sers prefe rences') | |
| 407 | }); | |
| 408 | return res .status(er ror.status ).rdkSend( error); | |
| 409 | } | |
| 410 | orac leConnecti onPool.doC lose(req, connection ); | |
| 411 | var output = _ .get(resul t, 'outBin ds.output' ); | |
| 412 | retu rn res.sta tus(200).r dkSend({ro wsAltered: output}); | |
| 413 | }); | |
| 414 | }) ; | |
| 415 | }); | |
| 416 | } | |
| 417 | ||
| 418 | ||
| 419 | /** | |
| 420 | * Wrapper for JSON. parse enca se it fail s | |
| 421 | */ | |
| 422 | function p arse(str) { | |
| 423 | var ou t; | |
| 424 | try { | |
| 425 | ou t = JSON.p arse(str); | |
| 426 | } catc h (e) { | |
| 427 | ou t = str; | |
| 428 | } | |
| 429 | return out; | |
| 430 | } | |
| 431 | ||
| 432 | ||
| 433 | /** | |
| 434 | * Creates the fetch _messages query base d on the i nput binds supplied | |
| 435 | * @param {*} oracle Bindings T he data bi ndings use d to make the reques t | |
| 436 | * @return s {string} | |
| 437 | */ | |
| 438 | function c reateFetch ProcedureS tring(orac leBindings ) { | |
| 439 | var pa rams = ''; | |
| 440 | _.each (oracleBin dings, fun ction(val, key) { | |
| 441 | va r paramVal ue = _.get (fetchProc edureMap, key); | |
| 442 | if (paramVal ue) { | |
| 443 | params + = paramVal ue + ' => :' + key + ', '; | |
| 444 | } | |
| 445 | }); | |
| 446 | params += 'o_mes sages => : output'; | |
| 447 | return 'BEGIN CO MMUNICATIO N.MESSAGE_ API.FETCH_ MESSAGES(' + params + '); END; '; | |
| 448 | } | |
| 449 | ||
| 450 | ||
| 451 | /** | |
| 452 | * Creates the oracl e bindings based on the values received from the t he request . | |
| 453 | * @param {*} inputD ata Flatte ned data f rom the re quest | |
| 454 | * @return s {{}} | |
| 455 | */ | |
| 456 | function c reateFetch OracleBind ings(input Data) { | |
| 457 | var or acleBindin gs = {}; | |
| 458 | _.each (inputData , function (val, key) { | |
| 459 | if (!_.isUnd efined(val )) { | |
| 460 | oracleBi ndings[key ] = {val: val, dir: oracledb.B IND_IN, ty pe: oracle db.STRING} ; | |
| 461 | } | |
| 462 | }); | |
| 463 | oracle Bindings.o utput = {d ir: oracle db.BIND_OU T, type: o racledb.CL OB}; | |
| 464 | return oracleBin dings; | |
| 465 | } | |
| 466 | ||
| 467 | ||
| 468 | module.exp orts.getRe sourceConf ig = getRe sourceConf ig; | |
| 469 | module.exp orts._getC ommunicati ons = getC ommunicati ons; | |
| 470 | module.exp orts._getA ttachment = getAttac hment; | |
| 471 | module.exp orts._post UserPrefer ences = po stUserPref erences; | |
| 472 | module.exp orts._crea teFetchPro cedureStri ng = creat eFetchProc edureStrin g; | |
| 473 | module.exp orts._crea teFetchOra cleBinding s = create FetchOracl eBindings; |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.