2. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/2/2019 9:41:18 PM Eastern 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.

2.1 Files compared

# Location File Last Modified
1 JLV_JLV 2_7_2_0_0.zip\JLV_Src\BHIERelayService\src\test\java\gov\va\med\bhie\patient NoteDaoTest.java Wed Mar 20 21:43:38 2019 UTC
2 JLV_JLV 2_7_2_0_0.zip\JLV_Src\BHIERelayService\src\test\java\gov\va\med\bhie\patient NoteDaoTest.java Mon Apr 1 18:19:24 2019 UTC

2.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 476
Changed 2 4
Inserted 0 0
Removed 0 0

2.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

2.4 Active regular expressions

No regular expressions were active.

2.5 Comparison detail

  1   /**
  2    * Janus 4 .0 (c)
  3    * Copyrig ht (c) 201 1 Hawaii R esource Gr oup LLC. A ll Rights  Reserved.
  4    * Develop ed for the  Pacific T elehealth  & Technolo gy Hui and  the Pacif ic Joint I nformation  Technolog y Center
  5    * Contrib utors:
  6    *     Hon orable Sen ator Danie l K. Inouy e
  7    *     VA  Pacific Is lands Heal th Care Sy stem
  8    *     Tri pler Army  Medical Ce nter
  9    */
  10  
  11  
  12   package go v.va.med.b hie.patien t;
  13  
  14   import com .sun.jerse y.core.uti l.Base64;
  15   import gov .va.med.bh ie.BaseTes t;
  16   import gov .va.med.bh ie.beans.N oteImage;
  17   import gov .va.med.bh ie.common. AppConfig;
  18   import gov .va.med.bh ie.common. ClinicalDo mainLoincC ode;
  19   import gov .va.med.bh ie.dao.Dao Exception;
  20   import gov .va.med.bh ie.dao.pat ient.NoteD ao;
  21   import gov .va.med.bh ie.dao.pat ient.V4Dao ;
  22   import gov .va.med.bh ie.resultc ollection. V4ResultCo llection;
  23   import gov .va.med.bh ie.webserv ice.NoteFi xer;
  24   import org .apache.co mmons.lang 3.StringEs capeUtils;
  25   import org .apache.co mmons.lang 3.StringUt ils;
  26   import org .junit.Tes t;
  27   import org .w3c.dom.D ocument;
  28   import org .xml.sax.I nputSource ;
  29   import org .xml.sax.S AXExceptio n;
  30  
  31   import jav ax.xml.par sers.Docum entBuilder ;
  32   import jav ax.xml.par sers.Docum entBuilder Factory;
  33   import jav ax.xml.par sers.Parse rConfigura tionExcept ion;
  34   import jav a.io.IOExc eption;
  35   import jav a.io.Strin gReader;
  36  
  37   import sta tic org.ju nit.Assert .assertTru e;
  38  
  39   public cla ss NoteDao Test exten ds BaseTes t
  40   {
  41  
  42       privat e static f inal Strin g C62_NODE _ID = "tem plateId ro ot=\"1.3.6 .1.4.1.193 76.1.5.3.1 .1.1\"";
  43  
  44       @Test
  45       public  void test GetPatient Notes() th rows DaoEx ception {
  46  
  47   //         NoteDao no teDao = ne w NoteDao( );
  48   //         NoteResult Collection V3 noteRes ults = not eDao.getPa tientNotes V3(queryBe an);
  49   //
  50   //         //long sti me = logRe quest(quer yBean);
  51   //         String tok en = "";
  52   //         try {
  53   //             NoteRe sultCollec tionV3 rtc ;
  54   //             int co unt = 0;
  55   //             //rtc  = BHIELimi t.getInsta nce().getP atientNote sCache(que ryBean);
  56   //             //if ( rtc == nul l) {
  57   //             //     token = BH IELimit.ge tInstance( ).getToken ();
  58   //                 rt c = noteDa o.getPatie ntNotesV3( queryBean) ;
  59   //             //     if (rtc !=  null && r tc.getData RecordList () != null ) {
  60   //             //         count  = rtc.getD ataRecordL ist().size ();
  61   //             //     }
  62   //              //    logRespons e(queryBea n, "", rtc , count, s time, "fal se");
  63   //              //    BHIELimit. getInstanc e().putPat ientNotesC ache(query Bean, rtc) ;
  64   //             //} el se {
  65   //              //    logRespons e(queryBea n, "", rtc , rtc.getD ataRecordL ist().size (), stime,  "true");
  66   //             //}
  67   //            // retu rn rtc;
  68   //         } catch (E xception e ) {
  69   //             //logR esponse(qu eryBean, e .getLocali zedMessage (), null,  0, stime,  "false");
  70   //             throw  new Runtim eException (e);
  71   //         } finally  {
  72   //             BHIELi mit.getIns tance().re leaseToken (token);
  73   //         }
  74   //
  75   //         assertTrue (noteResul ts.getData RecordList ().size()  > 0);
  76       }
  77  
  78       @Test
  79       public  void test GetPatient NotesV4()  throws Dao Exception  {
  80           V4 Dao v4Dao  = new V4Da o();
  81           V4 ResultColl ection v4R esults = v 4Dao.getV4 Data(Clini calDomainL oincCode.N OTES, quer yBean);
  82           as sertTrue(v 4Results.g etDataReco rdList().g etAllergy( ).size() >  0);
  83       }
  84  
  85       @Test
  86       public  void test GetEncount erNotes()  throws Dao Exception  {
  87  
  88           No teDao note Dao = new  NoteDao();
  89   //         NoteResult Collection V3 noteRes ults = not eDao.getEn counterNot esV3(query Bean);
  90   //         assertTrue (noteResul ts.getData RecordList ().size()  > 0);
  91       }
  92  
  93       @Test
  94       public  void test GetNoteIma ge() throw s DaoExcep tion {
  95  
  96           No teDao note Dao = new  NoteDao();
  97           No teImage re sponse = n oteDao.get NoteImage( "215286578 7");
  98           as sertTrue(r esponse.ge tNoteBytes ().length  > 0);
  99       }
  100  
  101       @Test
  102       public  void test GetNoteIma geFromUrl( ) throws D aoExceptio n {
  103  
  104           No teDao note Dao = new  NoteDao();
  105           Il legalArgum entExcepti on iae = n ull;
  106           tr y
  107           {
  108                  NoteImage  ni = noteD ao.getNote ImageFromU rl("http:/ / IP            /MockDoDAd aptor/asyn c/complex/ note/99999 01");
  109                ni.getCo ntentType( );
  110           }
  111           ca tch (Illeg alArgument Exception  e)
  112           {
  113                iae = e;
  114           }
  115  
  116           as sertTrue(i ae != null );
  117  
  118           ia e = null;
  119  
  120           tr y
  121           {
  122                noteDao. getNoteIma geFromUrl( "http://BH IEdomain/a sync/comet ?loinc=123 4&userid=1 2345");
  123           }
  124           ca tch (Illeg alArgument Exception  e)
  125           {
  126                iae = e;
  127           }
  128  
  129           as sertTrue(i ae != null );
  130  
  131           ia e = null;
  132  
  133           No teImage re sponse = n oteDao.get NoteImageF romUrl("ht tp://BHIEd omain:8080 /async/com plex/note/ 2157580439 ");
  134           as sertTrue(r esponse.ge tNoteBytes ().length  > 0);
  135       }
  136  
  137  
  138       @Test
  139       public  void test GetNoteAtt achmentFro mUrl() thr ows DaoExc eption {
  140           St ring error Text = "";
  141  
  142           No teDao note Dao = new  NoteDao();
  143           No teImage rt c;
  144  
  145           tr y {
  146  
  147                  rtc = note Dao.getNot eImageFrom Url("http: // IP            /MockDoDAd aptor/asyn c/complex/ note/doc9. json");
  148  
  149                if (rtc  != null &&  rtc.getNo teBytes()  != null) {
  150                    try  {
  151  
  152                         String dat aXML = new  String(rt c.getNoteB ytes(), "U TF-8");
  153  
  154                         //unwrap C 62 documen ts coming  over as js on strings
  155                         if(StringU tils.isNot Empty(rtc. getContent Type()) &&  rtc.getCo ntentType( ).endsWith ("json") & & dataXML. startsWith ("\"")){
  156                             dataXM L = dataXM L.replaceA ll("^\"|\" $", "");
  157                             dataXM L = String EscapeUtil s.unescape Java(dataX ML);
  158                         }
  159  
  160                         DocumentBu ilderFacto ry dbFacto ry = Docum entBuilder Factory.ne wInstance( );
  161  
  162                         dbFactory. setFeature ("http://x ml.org/sax /features/ external-g eneral-ent ities", fa lse);
  163                         dbFactory. setFeature ("http://x ml.org/sax /features/ external-p arameter-e ntities",  false);
  164                         dbFactory. setFeature ("http://j avax.xml.X MLConstant s/feature/ secure-pro cessing",  true);
  165  
  166                         DocumentBu ilder dBui lder = dbF actory.new DocumentBu ilder();
  167                         InputSourc e is = new  InputSour ce(new Str ingReader( dataXML));
  168                         Document d oc = dBuil der.parse( is);
  169  
  170   //                      StringBu ffer attac hmentOutpu t = new St ringBuffer ("");
  171                         String enc odedText =  "";
  172                         String med iaType = " text/html" ;
  173  
  174                         if (doc !=  null && d oc.getElem entsByTagN ame("text" ) != null
  175                                 &&  doc.getEl ementsByTa gName("tex t").item(0 ) != null
  176                                 &&  !doc.getE lementsByT agName("te xt").item( 0).getText Content(). isEmpty())  {
  177                             encode dText = do c.getEleme ntsByTagNa me("text") .item(0).g etTextCont ent().trim ();
  178  
  179                             if (do c.getEleme ntsByTagNa me("text") .item(0).g etAttribut es().getNa medItem("m ediaType")  != null)  {
  180                                 me diaType =  doc.getEle mentsByTag Name("text ").item(0) .getAttrib utes().get NamedItem( "mediaType ").getNode Value();
  181                             }
  182                         }
  183  
  184                         rtc.setCon tentType(m ediaType);
  185  
  186                         if(isC62Do c(dataXML) ){
  187                             rtc.se tNoteBytes (Base64.de code(encod edText));
  188                         } else if  (mediaType .contains( "plain") | | mediaTyp e.contains ("html") | | mediaTyp e.contains ("image"))  {
  189                             // do  nothing, l et web-fro nt end ren der the at tachment i n-line
  190                         } else if  (mediaType .contains( "applicati on") || me diaType.co ntains("rt f")) {
  191                             rtc.se tNoteBytes (Base64.de code(encod edText));
  192                         }
  193  
  194                    } ca tch (Parse rConfigura tionExcept ion e) {
  195   //                      logError (e);
  196                         errorText  = "1";
  197                    } ca tch (SAXEx ception e)  {
  198   //                      logError (e);
  199                         errorText  = "1";
  200                    } ca tch (IOExc eption e)  {
  201   //                      logError (e);
  202                         errorText  = "1";
  203                    }
  204                }
  205  
  206   //             if (!" false".equ alsIgnoreC ase((Strin g) AppConf ig.getInst ance().get Properties ().get("fi xrtf"))) {
  207   //                 rt c = NoteFi xer.fixNot eImage(rtc , "pdf".eq ualsIgnore Case(AppCo nfig.getIn stance().g etNoteConv ertFormat( )));
  208   //             }
  209  
  210                if (rtc  != null) {
  211                    Stri ng content Type = rtc .getConten tType();
  212                    /* f latten pdf  note type s to remov e fillable  pdf */
  213                    if ( "applicati on/octet-s tream".equ alsIgnoreC ase(conten tType)
  214                             || "ap plication/ pdf".equal sIgnoreCas e(contentT ype)) {
  215                         rtc = Note Fixer.flat tenNoteFor m(rtc);
  216                    }
  217                }
  218  
  219           }  catch (Dao Exception  e) {
  220  
  221                throw ne w RuntimeE xception(e );
  222           }
  223           as sertTrue(r tc != null );
  224       }
  225  
  226       public  static bo olean isC6 2Doc(Strin g xmlDoc)  {
  227           if  (xmlDoc.i ndexOf(C62 _NODE_ID)  > 0) {
  228                return t rue;
  229           }
  230           re turn false ;
  231       }
  232  
  233   //    @Tes t
  234   //    publ ic void te stGetPatie ntConsults () throws  DaoExcepti on {
  235   //
  236   //         NoteDao no teDao = ne w NoteDao( );
  237   //         NoteResult Collection V3 noteRes ults = not eDao.getPa tientConsu ltsV3(quer yBean);
  238   //         assertTrue (noteResul ts.getData RecordList ().size()  > 0);
  239   //    }
  240   }