83. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/5/2017 4:21:47 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.

83.1 Files compared

# Location File Last Modified
1 C:\working_scrub\Unredacted\eHX Code Base\eHX_Bld2_Source Code_CIF_2017-02-14\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\utils\prefetch PrefetchHelper.java Fri Feb 10 15:41:44 2017 UTC
2 eHX-CIF.zip\eHX-CIF\eHX Code Base\eHX_Bld2_Source Code_CIF_2017-02-14\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\utils\prefetch PrefetchHelper.java Tue Apr 4 13:01:22 2017 UTC

83.2 Comparison summary

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

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

83.4 Active regular expressions

No regular expressions were active.

83.5 Comparison detail

  1   package go v.va.med.n hin.adapte r.utils.pr efetch;
  2  
  3   import gov .va.med.nh in.adapter .prefetch. PrefetchQu eryRespons e;
  4   import gov .va.med.nh in.adapter .prefetch. RetrieveDo cumentsReq uest;
  5   import gov .va.med.nh in.adapter .prefetch. RetrieveDo cumentsRes ponse;
  6   import gov .va.med.nh in.adapter .utils.JAX BContextFa ctory;
  7   import gov .va.med.nh in.adapter .utils.Nul lChecker;
  8   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetRequ estType;
  9   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetRequ estType.Do cumentRequ est;
  10   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetResp onseType;
  11   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetResp onseType.D ocumentRes ponse;
  12  
  13   import jav a.io.File;
  14   import jav a.util.Pro perties;
  15  
  16   import jav ax.ws.rs.c lient.Clie nt;
  17   import jav ax.ws.rs.c lient.Clie ntBuilder;
  18   import jav ax.ws.rs.c lient.Enti ty;
  19   import jav ax.ws.rs.c lient.WebT arget;
  20   import jav ax.ws.rs.c ore.MediaT ype;
  21   import jav ax.ws.rs.c ore.Respon se;
  22   import jav ax.xml.bin d.JAXBCont ext;
  23   import jav ax.xml.bin d.JAXBElem ent;
  24   import jav ax.xml.bin d.Marshall er;
  25  
  26   import oas is.names.t c.ebxml_re grep.xsd.q uery._3.Ad hocQueryRe quest;
  27   import oas is.names.t c.ebxml_re grep.xsd.q uery._3.Ad hocQueryRe sponse;
  28   import oas is.names.t c.ebxml_re grep.xsd.r im._3.Extr insicObjec tType;
  29  
  30   import oas is.names.t c.ebxml_re grep.xsd.r im._3.Iden tifiableTy pe;
  31  
  32   import org .apache.co mmons.coll ections.Co llectionUt ils;
  33   import org .apache.co mmons.lang 3.StringUt ils;
  34   import org .glassfish .jersey.cl ient.Clien tConfig;
  35   import org .glassfish .jersey.cl ient.Clien tPropertie s;
  36  
  37   import org .slf4j.Log ger;
  38   import org .slf4j.Log gerFactory ;
  39  
  40   public cla ss Prefetc hHelper
  41   {
  42           pr ivate stat ic final L ogger logg er = Logge rFactory.g etLogger(P refetchHel per.class. getName()) ;
  43  
  44           pu blic stati c Prefetch QueryRespo nse queryD ocuments(P roperties  props, Str ing patien tICN, Stri ng loinc)
  45           {
  46                    Pref etchQueryR esponse re sponseData  = null;
  47                    try
  48                    {
  49                             String  serviceUr l = props. getPropert y("prefetc h.service. url");
  50                             int co nnectTimeo ut = NullC hecker.isN otNullOrEm pty(props. getPropert y("prefetc h.connect. timeout"))  ? Integer .parseInt( props.getP roperty("p refetch.co nnect.time out")) : 0 ;
  51                             int re adTimeout  = NullChec ker.isNotN ullOrEmpty (props.get Property(" prefetch.r ead.timeou t")) ? Int eger.parse Int(props. getPropert y("prefetc h.read.tim eout")) :  0;
  52  
  53                             logger .debug("se rviceUrl:  {}, connec tTimeout:  {}, readTi meout: {}" , new Obje ct[] { ser viceUrl, c onnectTime out, readT imeout });
  54  
  55                             Client  client =  null;
  56                             if(con nectTimeou t > 0 || r eadTimeout  > 0)
  57                             {
  58                                      ClientCo nfig confi guration =  new Clien tConfig();
  59                                      if(conne ctTimeout  > 0)
  60                                      {
  61                                               configurat ion.proper ty(ClientP roperties. CONNECT_TI MEOUT, con nectTimeou t * 1000);
  62                                      }
  63                                      if(readT imeout > 0 )
  64                                      {
  65                                               configurat ion.proper ty(ClientP roperties. READ_TIMEO UT, readTi meout * 10 00);
  66                                      }
  67                                      client =  ClientBui lder.newCl ient(confi guration);
  68  
  69                             }
  70                             else
  71                             {
  72                                      client =  ClientBui lder.newCl ient();
  73                             }
  74  
  75                             WebTar get target ;
  76                             if(Nul lChecker.i sNotNullOr Empty(loin c))
  77                             {
  78                                      target =  client.ta rget(servi ceUrl).que ryParam("i cn", patie ntICN).que ryParam("l oinc", loi nc);
  79                             }
  80                             else
  81                             {
  82                                      target =  client.ta rget(servi ceUrl).que ryParam("i cn", patie ntICN);
  83                             }
  84  
  85                             Respon se respons e = target .request(M ediaType.A PPLICATION _XML).get( );
  86                             
  87                             respon se.bufferE ntity();
  88                             String  noDataTes t = respon se.readEnt ity(String .class);
  89                             logger .debug("re sponse: {} ", noDataT est);
  90                             if(Str ingUtils.i sNotBlank( noDataTest ) && Strin gUtils.equ alsIgnoreC ase(noData Test, "No  Data Found ")) {
  91                                      return n ull;
  92                             }
  93  
  94                             respon seData = r esponse.re adEntity(P refetchQue ryResponse .class);
  95                    }
  96                    catc h(Throwabl e ex)
  97                    {
  98                             logger .error("Er ror while  making a c all to pre fetch syst em. Please  correct t his.", ex) ;
  99                    }
  100  
  101                    retu rn respons eData;
  102           }
  103  
  104           pu blic stati c Prefetch QueryRespo nse queryD ocumentsTe st(Propert ies props,  String pa tientICN,  String loi nc)
  105           {
  106  
  107                    Pref etchQueryR esponse re sponseData  = null;
  108                    try
  109                    {
  110                             String  serviceUr l = props. getPropert y("prefetc h.service. url");
  111                             int co nnectTimeo ut = NullC hecker.isN otNullOrEm pty(props. getPropert y("prefetc h.connect. timeout"))  ? Integer .parseInt( props.getP roperty("p refetch.co nnect.time out")) : 0 ;
  112                             int re adTimeout  = NullChec ker.isNotN ullOrEmpty (props.get Property(" prefetch.r ead.timeou t")) ? Int eger.parse Int(props. getPropert y("prefetc h.read.tim eout")) :  0;
  113  
  114                             logger .debug("se rviceUrl:  {}, connec tTimeout:  {}, readTi meout: {}" , new Obje ct[] { ser viceUrl, c onnectTime out, readT imeout });
  115  
  116                             Client  client =  null;
  117                             if(con nectTimeou t > 0 || r eadTimeout  > 0)
  118                             {
  119                                      ClientCo nfig confi guration =  new Clien tConfig();
  120                                      if(conne ctTimeout  > 0)
  121                                      {
  122                                               configurat ion.proper ty(ClientP roperties. CONNECT_TI MEOUT, con nectTimeou t * 1000);
  123                                      }
  124                                      if(readT imeout > 0 )
  125                                      {
  126                                               configurat ion.proper ty(ClientP roperties. READ_TIMEO UT, readTi meout * 10 00);
  127                                      }
  128                                      client =  ClientBui lder.newCl ient(confi guration);
  129  
  130                             }
  131                             else
  132                             {
  133                                      client =  ClientBui lder.newCl ient();
  134                             }
  135  
  136                             WebTar get target ;
  137                             if(Nul lChecker.i sNotNullOr Empty(loin c))
  138                             {
  139                                      target =  client.ta rget(servi ceUrl).que ryParam("i cn", patie ntICN).que ryParam("l oinc", loi nc);
  140                             }
  141                             else {
  142                                      target =  client.ta rget(servi ceUrl).que ryParam("i cn", patie ntICN);
  143                             }
  144  
  145                             Respon se respons e = target .request(M ediaType.A PPLICATION _XML).get( );
  146                             System .out.print ln("respon se: " + re sponse.toS tring());
  147                             respon seData = r esponse.re adEntity(P refetchQue ryResponse .class);
  148                    }
  149                    catc h(Throwabl e ex)
  150                    {
  151                             logger .error("Er ror while  making a c all to pre fetch syst em. Please  correct t his.", ex) ;
  152                    }
  153                    retu rn respons eData;
  154           }
  155  
  156           pu blic stati c Retrieve DocumentsR esponse re trieveDocu ments(fina l Properti es props,  final Stri ng adapter DocId, fin al String  exchangeDo cId, final  String re positoryId ) throws E xception
  157           {
  158                    Retr ieveDocume ntsRespons e response Data = nul l;
  159                    try
  160                    {
  161                             String  serviceUr l = props. getPropert y("prefetc h.service. url");
  162                             int co nnectTimeo ut = NullC hecker.isN otNullOrEm pty(props. getPropert y("prefetc h.connect. timeout"))  ? Integer .parseInt( props.getP roperty("p refetch.co nnect.time out")) : 0 ;
  163                             int re adTimeout  = NullChec ker.isNotN ullOrEmpty (props.get Property(" prefetch.r ead.timeou t")) ? Int eger.parse Int(props. getPropert y("prefetc h.read.tim eout")) :  0;
  164  
  165                             logger .debug("se rviceUrl:  {}, connec tTimeout:  {}, readTi meout: {}" , new Obje ct[] { ser viceUrl, c onnectTime out, readT imeout });
  166  
  167                             Client  client =  null;
  168                             if(con nectTimeou t > 0 || r eadTimeout  > 0)
  169                             {
  170                                      ClientCo nfig confi guration =  new Clien tConfig();
  171                                      if(conne ctTimeout  > 0)
  172                                      {
  173                                               configurat ion.proper ty(ClientP roperties. CONNECT_TI MEOUT, con nectTimeou t * 1000);
  174                                      }
  175                                      if(readT imeout > 0 )
  176                                      {
  177                                               configurat ion.proper ty(ClientP roperties. READ_TIMEO UT, readTi meout * 10 00);
  178                                      }
  179                                      client =  ClientBui lder.newCl ient(confi guration);
  180  
  181                             }
  182                             else
  183                             {
  184                                      client =  ClientBui lder.newCl ient();
  185                             }
  186                             WebTar get target  = client. target(ser viceUrl).q ueryParam( "docId", a dapterDocI d).queryPa ram("repos itoryId",  repository Id);
  187  
  188                             logger .debug("Pr efetch Ret rieve Requ est URI: { }", target .getUri(). toString() );
  189  
  190                             Respon se respons e = target .request(M ediaType.A PPLICATION _XML).get( );
  191                             respon se.bufferE ntity();
  192                             logger .debug("re sponse: {}  ", respon se.readEnt ity(String .class));
  193                             respon seData = r esponse.re adEntity(R etrieveDoc umentsResp onse.class );
  194  
  195                             // Nee d to chang e docid fr om the ada pter gener ated one t o the exch ange id.
  196                             if(res ponseData  != null)
  197                             {
  198                                      if(Colle ctionUtils .isNotEmpt y(response Data.getDo cumentResp onse()))
  199                                      {
  200                                               for(Docume ntResponse  document  : response Data.getDo cumentResp onse())
  201                                               {
  202                                                       do cument.set DocumentUn iqueId(exc hangeDocId );
  203                                               }
  204                                      }
  205                             }
  206                    }
  207                    catc h(Throwabl e ex)
  208                    {
  209                             logger .error("Er ror while  making a c all to pre fetch syst em. Please  correct t his.", ex) ;
  210                    }
  211  
  212                    retu rn respons eData;
  213           }
  214  
  215           pu blic stati c void mai n(String[]  args) thr ows Except ion
  216           {
  217                    Syst em.out.pri ntln("star t");
  218  
  219                    {
  220                             Prefet chQueryRes ponse pqR  = new Pref etchQueryR esponse();
  221                             Extrin sicObjectT ype test =  new Extri nsicObject Type();
  222                             test.s etId("test ");
  223                             oasis. names.tc.e bxml_regre p.xsd.rim. _3.ObjectF actory obj Factory =  new oasis. names.tc.e bxml_regre p.xsd.rim. _3.ObjectF actory();
  224                             ;
  225                             pqR.ge tIdentifia ble().add( objFactory .createExt rinsicObje ct(test));
  226                             Extrin sicObjectT ype test1  = new Extr insicObjec tType();
  227                             test1. setId("tes t1");
  228                             // oas is.names.t c.ebxml_re grep.xsd.r im._3.Obje ctFactory  objFactory  =
  229                             // new  oasis.nam es.tc.ebxm l_regrep.x sd.rim._3. ObjectFact ory();
  230                             ;
  231                             pqR.ge tIdentifia ble().add( objFactory .createExt rinsicObje ct(test1)) ;
  232                             JAXBCo ntext cont ext = JAXB ContextFac tory.getIn stance().g etJaxBCont ext(Prefet chQueryRes ponse.clas s);
  233                             Marsha ller m = c ontext.cre ateMarshal ler();
  234                             m.mars hal(pqR, n ew File("c :/temp/pqr .txt"));
  235  
  236                             System .out.print ln("pqr do ne");
  237                             // if  (true) {
  238                             // ret urn;
  239                             // }
  240                    }
  241  
  242                    Prop erties pro ps = new P roperties( );
  243                    // p rops.setPr operty("pr efetch.ser vice.url",
  244                     // "http:/ / s e r v er    : PORT /PrefetchS ervices/se rvices/pre fetchServi ce/queryDo cuments");
  245                    prop s.setPrope rty("prefe tch.servic e.url", "h ttp://pref etch.fisci entific.or g/queryDoc uments?for mat=soap") ;
  246  
  247                    // p rops.setPr operty("pr efetch.ser vice.path" , "retriev eDocument" );
  248  
  249                    // S ystem.out. println("r etrievingD ocument");
  250                    // R etrieveDoc umentsResp onse resp  = retrieve DocumentsN ew(props,
  251                    // " testDocId" , "testRep osId");
  252                    // J AXBContext  context =
  253                    // J AXBContext Factory.ge tInstance( ).getJaxBC ontext(Ret rieveDocum entsRespon se.class);
  254                    // M arshaller  m = contex t.createMa rshaller() ;
  255                    // m .marshal(r esp, new F ile("c:/te mp/test1.t xt"));
  256                    Syst em.out.pri ntln("quer yDocument" );
  257                    prop s.setPrope rty("prefe tch.servic e.path", " queryDocum ents");
  258                    Pref etchQueryR esponse pq Response =  queryDocu mentsTest( props, "10 12581676V3 77802", nu ll);
  259  
  260                    Syst em.out.pri ntln("done ");
  261  
  262           }
  263           //  public st atic Retri eveDocumen tsResponse  retrieveD ocuments(P roperties
  264           //  props,
  265           //  RetrieveD ocumentsRe quest rdRe quest) thr ows Except ion {
  266           //  String se rviceUrl =  props.get Property(" prefetch.s ervice.url ");
  267           //  String pa th = props .getProper ty("prefet ch.service .path");
  268           //  //String  user = pro ps.getProp erty("time r.manageme nt.service .user");
  269           //  //String  password =
  270           //  EncryptDe cryptUtil. decryptStr ing(props. getPropert y("timer.m anagement. service.pa ssword"));
  271           //
  272           //  logger.fi ne("servic eUrl: " +  serviceUrl );
  273           //  logger.fi ne("path:  " + path);
  274           // // logger. fine("user : " + user );
  275           //
  276           //  Client c  = ClientBu ilder.newC lient();
  277           //  //Client  c = Client .create();
  278           //  WebTarget  target =  c.target(s erviceUrl) .path(path );
  279           //
  280           //  Response  response
  281           //  = target. request(Me diaType.AP PLICATION_ XML)
  282           //  .post(Ent ity.entity (rdRequest , MediaTyp e.APPLICAT ION_XML));
  283           //  logger.fi ne("respon se: " + re sponse.toS tring());
  284           //  RetrieveD ocumentsRe sponse ret String =
  285           //  response. readEntity (RetrieveD ocumentsRe sponse.cla ss);
  286           //  return re tString;
  287           //  }
  288  
  289           //  public st atic Adhoc QueryRespo nse queryD ocuments(P roperties  props,
  290           //  AdhocQuer yRequest q ueryReques t) throws  Exception  {
  291           //  String se rviceUrl =  props.get Property(" prefetch.s ervice.url ");
  292           //  String pa th = props .getProper ty("prefet ch.service .path");
  293           //
  294           //  logger.fi ne("servic eUrl: " +  serviceUrl );
  295           //  logger.fi ne("path:  " + path);
  296           //
  297           //  Client c  = ClientBu ilder.newC lient();
  298           //  //Client  c = Client .create();
  299           //  WebTarget  target =  c.target(s erviceUrl) .path(path );
  300           //
  301           //  Response  response
  302           //  = target. request(Me diaType.AP PLICATION_ XML)
  303           //  .post(Ent ity.entity (queryRequ est, Media Type.APPLI CATION_XML ));
  304           //  logger.fi ne("respon se: " + re sponse.toS tring());
  305           //  AdhocQuer yResponse  retString  =
  306           //  response. readEntity (AdhocQuer yResponse. class);
  307           //  return re tString;
  308           //  }
  309   }