118. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/2/2017 1:40:10 PM 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.

118.1 Files compared

# Location File Last Modified
1 chef-repo.zip\chef-repo\project_cookbooks\mocks\files\default\node-mocks\nodeMockServices-1.3.0.52.zip mockVhicProcess.js Fri Apr 24 20:10:02 2015 UTC
2 chef-repo.zip\chef-repo\project_cookbooks\mocks\files\default\node-mocks\nodeMockServices-1.3.0.52.zip mockVhicProcess.js Mon Oct 2 12:54:09 2017 UTC

118.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 200
Changed 1 2
Inserted 0 0
Removed 0 0

118.3 Comparison options

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

118.4 Active regular expressions

No regular expressions were active.

118.5 Comparison detail

  1   /*jslint n ode: true  */
  2   'use stric t';
  3  
  4   var config  = require ('./config .js');
  5   var bunyan  = require ('bunyan') ;
  6   var logger  = bunyan. createLogg er(config. logger);
  7   var _ = re quire('lod ash');
  8   var mockVh ic = requi re('./mock Vhic.js');
  9   var libxml js = requi re("libxml js");
  10  
  11   var data_p ath = '/da ta/';
  12   var data_f ile_extens ion = '.xm l';
  13  
  14   function g etElement( xmlDoc, pa th, namesp ace) {
  15       try {
  16           re turn xmlDo c.get(path , namespac e).text();
  17       }
  18       catch  (err) {
  19           re turn "";
  20       }
  21   }
  22  
  23   /**
  24    * Mimicks  the behav ior of the  VHIC Card PictureSer vice which  returns a
  25    * veteran 's VHIC ca rd photo b ased on a  veteran's  card id. T his functi on
  26    * takes i n a SOAP r equest tha t contains  a veteran 's cardId  and return s
  27    * a SOAP  response t hat contai ns the vet eran's car d photo.
  28    *
  29    * @param   {Object}  req - defa ult Expres s request
  30    * @param   {Object}  res - defa ult Expres s response
  31    * @return s undefine d
  32    */
  33   function f etchVhicDa ta(req, re s) {
  34       var fi lePath = " /vhic/";
  35       var ve teranCardI d = "";
  36       var si teId = "";
  37       var bo dy = "";
  38  
  39       req.on ('data', f unction(da ta) {
  40           bo dy = data. toString() ;
  41           lo gger.info( "body = "  + body);
  42  
  43           // Parse the  soap messa ge into an  XML objec t.
  44           va r xmlDoc =  null;
  45           tr y {
  46                xmlDoc =  libxmljs. parseXmlSt ring(body) ;
  47                logger.i nfo("xmlDo c = " + xm lDoc);
  48           }
  49           ca tch (err)  {
  50                res.stat us(404).en d("Problem  parsing X ML Soap Me ssage: " +  err);
  51                return;
  52           }
  53  
  54           // Define the  anticipat ed XML nam espaces.
  55             var namesp ace = { so ap: 'http: //www.w3.o rg/2003/05 /soap-enve lope', vhi c: 'http:/ /cardpictu reservice. vic.va. DNS     /'};
  56  
  57           // Define the  path to t he getVete ranPicture s message  element.
  58           va r pathGetV eteranPict ures = '// soap:Envel ope/soap:B ody/vhic:g etVeteranP ictures';
  59  
  60           // Define the  path to t he message  element t hat contai ns paramet ers for se arching fo r patient  photos.
  61           va r getVeter anPictures Critiera =  xmlDoc.ge t(pathGetV eteranPict ures, name space);
  62           lo gger.info( "getVetera nPicturesC ritiera =  " + getVet eranPictur esCritiera );
  63  
  64           if  (getVeter anPictures Critiera ! == undefin ed) {
  65                //Get th e veteran' s card id.
  66                veteranC ardId = ge tElement(x mlDoc, pat hGetVetera nPictures  + '/reques t/cardIds' , namespac e);
  67                logger.i nfo("veter anCardId =  " + veter anCardId);
  68  
  69                //Now, s ee which m essage fil e to retur n based of f of our c riteria.
  70                filePath  += mockVh ic.fetchVh icPhotoFil eName(vete ranCardId) ;
  71                logger.i nfo("fileP ath = " +  filePath);
  72           }
  73           el se {
  74                res.stat us(404).en d("The SOA P message  did not co ntain a va lid 'getVe teranPictu res' eleme nt.");
  75                return;
  76           }
  77  
  78           // We have th e full pat h and name  of the fi le, add th e extensio n to it so  we can se nd it.
  79           fi lePath +=  data_file_ extension;
  80  
  81           // Add a time stamp to t he header  and set th e root dir ectory to  find the f ile from.
  82           va r options  = {
  83                root: __ dirname +  data_path,
  84                headers:  {
  85                    'x-t imestamp':  Date.now( )
  86                }
  87           };
  88  
  89           // Send the p atient pho to.
  90           re s.sendFile (filePath,  options,  function ( err) {
  91                if (err)  {
  92                    logg er.error(e rr);
  93                    res. status(404 ).end("Pro blem sendi ng patient  photo: "  + err);
  94                } else {
  95                    logg er.debug(f ilePath +  ' sent');
  96                }
  97           }) ;
  98       });
  99   }
  100  
  101   module.exp orts.fetch VhicData =  fetchVhic Data;