92. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/1/2018 12:13:17 PM Central Standard 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.

92.1 Files compared

# Location File Last Modified
1 ehealth_xchange_cif.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\utils\prefetch PrefetchHelper.java Thu Feb 22 14:26:38 2018 UTC
2 ehealth_xchange_cif.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\utils\prefetch PrefetchHelper.java Wed Feb 28 18:07:06 2018 UTC

92.2 Comparison summary

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

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

92.4 Active regular expressions

No regular expressions were active.

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