364. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2017 12:06:49 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.

364.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\SiteServiceDataSourceProvider\main\src\java\gov\va\med\siteservice SiteServiceTranslator.java Mon Dec 4 21:34:18 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\SiteServiceDataSourceProvider\main\src\java\gov\va\med\siteservice SiteServiceTranslator.java Tue Dec 5 13:34:15 2017 UTC

364.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 462
Changed 2 6
Inserted 0 0
Removed 0 0

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

364.4 Active regular expressions

No regular expressions were active.

364.5 Comparison detail

  1   package go v.va.med.s iteservice ;
  2  
  3   import jav a.net.Malf ormedURLEx ception;
  4   import jav a.util.Arr ayList;
  5   import jav a.util.Has hMap;
  6   import jav a.util.Lis t;
  7   import jav a.util.Map ;
  8   import org .apache.lo gging.log4 j.LogManag er;
  9   import org .apache.lo gging.log4 j.Logger;
  10   import org .w3c.dom.E lement;
  11   import org .w3c.dom.N odeList;
  12  
  13   import gov .va.med.im aging.exch ange.busin ess.*;
  14   import gov .va.med.vi staweb.Web Services.S iteService .ArrayOfRe gionTO;
  15   import gov .va.med.vi staweb.Web Services.S iteService .RegionTO;
  16   import gov .va.med.vi staweb.web services.I magingExch angeSiteSe rvice.prox y.ArrayOfI magingExch angeSiteTO ;
  17   import gov .va.med.vi staweb.web services.I magingExch angeSiteSe rvice.prox y.ImagingE xchangeSit eTO;
  18  
  19   /**
  20    * 
  21    * @author         
BECKEC
  22    *
  23    */
  24   public cla ss SiteSer viceTransl ator
  25   {
  26       privat e static L ogger logg er = LogMa nager.getL ogger(Site ServiceTra nslator.cl ass);
  27         private st atic final  int defau ltVistaPor t =  PORT ;
  28         // private  static fi nal int de faultVixPo rt =  PORT ; // not u sed
  29  
  30           /* *
  31            *  Translate  the respo nse from t he SiteSer vice into
  32            *  a List of  Site inst ances.
  33            *   
  34            *  @param si tesArray
  35            *  @return
  36            * /
  37           pu blic List< Site> tran slate(Arra yOfImaging ExchangeSi teTO sites Array)
  38           {
  39                    Imag ingExchang eSiteTO[]  sites = si tesArray.g etImagingE xchangeSit eTO();
  40                    List <Site> vaS ites = new  ArrayList <Site>(sit es.length) ;
  41  
  42                    Map< String, Si te> tempMa p = new Ha shMap<Stri ng, Site>( );
  43                    for(  ImagingEx changeSite TO siteTO  : sites )
  44                    {
  45                             Site s ite = null ;
  46                             // sit e 200 is t he gateway  to the Do D for radi ology imag es
  47                             // it  is treated  almost as  a VA site  but it do es not sup port the
  48                             // sam e protocol s as a sit e VIX
  49                             try
  50                             {
  51                                      Map<Stri ng, SiteCo nnection>  siteConnec tions = ne w HashMap< String, Si teConnecti on>();
  52                                      siteConn ections.pu t(SiteConn ection.sit eConnectio nVista, 
  53                                                       ne w SiteConn ection(Sit eConnectio n.siteConn ectionVist a, siteTO. getVistaSe rver(),  s iteTO.getV istaPort() ));
  54                                      
  55                                      if(siteT O.getAccel eratorServ er() != nu ll && site TO.getAcce leratorSer ver().leng th() > 0)
  56                                               siteConnec tions.put( SiteConnec tion.siteC onnectionV ix, 
  57                                                                new  SiteConnec tion(SiteC onnection. siteConnec tionVista,  siteTO.ge tAccelerat orServer() ,  siteTO. getAcceler atorPort() ));
  58                                      site = n ew SiteImp l(
  59                                               siteTO.get SiteNumber (), 
  60                                               siteTO.get SiteName() ,
  61                                               siteTO.get SiteAbbr() ,
  62                                               siteTO.get VistaServe r(), siteT O.getVista Port(),
  63                                               siteTO.get Accelerato rServer(),  siteTO.ge tAccelerat orPort(),
  64                                               siteTO.get RegionID() ,
  65                                               true,
  66                                               true,
  67                                               siteConnec tions
  68                                      );
  69                                      
  70   //                                 if(      "200".equa ls(siteTO. getSiteNum ber()) )
  71   //                                          site = new  SiteImpl(
  72   //                                                  si teTO.getRe gionID(),
  73   //                                                  si teTO.getSi teNumber()
  74   //                                                  si teTO.getSi teName(),
  75   //                                                  si teTO.getSi teAbbr(),
  76   //                                                  ne w URL("xca ", siteTO. getAcceler atorServer (), siteTO .getAccele ratorPort( ), ""),
  77   //                                                  ne w URL("vis taimaging" , siteTO.g etVistaSer ver(), sit eTO.getVis taPort(),  ""),
  78   //                                                  ne w URL("vis ta", siteT O.getVista Server(),  siteTO.get VistaPort( ), ""),
  79   //                                                  ne w URL("exc hange", si teTO.getAc celeratorS erver(), s iteTO.getA ccelerator Port(), "" )
  80   //                                          );
  81   //                                 else
  82   //                                 {
  83   //                                          site = new  SiteImpl(
  84   //                                                  si teTO.getRe gionID(), 
  85   //                                                  si teTO.getSi teNumber()
  86   //                                                  si teTO.getSi teName(), 
  87   //                                                  si teTO.getSi teAbbr(), 
  88   //                                                  ne w URL(Site Impl.VISTA _PROTOCOL,  siteTO.ge tVistaServ er(), site TO.getVist aPort(), " "),
  89   //                                                  ne w URL(Site Impl.VISTA IMAGING_PR OTOCOL, si teTO.getVi staServer( ), siteTO. getVistaPo rt(), ""),
  90   //                                                  ne w URL(Site Impl.VFTP_ PROTOCOL,  siteTO.get Accelerato rServer(),  siteTO.ge tAccelerat orPort(),  "")
  91   //                                          );
  92   //                                 }
  93                                      tempMap. put(site.g etSiteNumb er(), site );
  94                                      vaSites. add(site);  // also p ut the sit e into a l ist so we  can store  them to di sk                                   
  95                                      logger.i nfo("SiteS ervice add ed site ("  + site.to String() +  ")");
  96                             }
  97                             catch  (Malformed URLExcepti on x)
  98                             {
  99                                      System.o ut.println ("SiteServ ice failed  to add si te (" + si teTO.getSi teNumber()  + ") due  to " + x.g etMessage( ));
  100                             }
  101                    }
  102                    
  103                    retu rn vaSites ;
  104           }
  105           
  106           /* *
  107            *  Translate s an array  of region  site serv ice object s into a l ist of 
  108            *  Region in stances
  109            *  @param re gionsArray
  110            *  @return
  111            * /
  112           pu blic List< Region> tr anslate(Ar rayOfRegio nTO region sArray)
  113           {
  114                    Regi onTO [] re gions = re gionsArray .getRegion TO();
  115                    List <Region> v aRegions =  new Array List<Regio n>();
  116                    for( RegionTO r egion : re gions)
  117                    {
  118                             Region  vaRegion  = new Regi onImpl(reg ion.getNam e(),
  119                                               region.get ID());
  120                             vaRegi ons.add(va Region);
  121                             logger .info("Sit eService a dded regio n (" + vaR egion.toSt ring() + " )");
  122                    }
  123                    retu rn vaRegio ns;
  124           }
  125           
  126           pu blic List< Site> tran slateSiteN odes(NodeL ist siteNo des)
  127           {
  128                    List <Site> vaS ites = new  ArrayList <Site>(sit eNodes.get Length());
  129                    Node List dataS ourceNodes ;
  130                    Elem ent siteEl ement, dat aSourceEle ment;
  131                    Site  site;
  132                    Stri ng siteNum ber = "",  siteName,  siteAbbr,  vistaServe r, acceler atorServer , regionId , protocol ;
  133                    int  vistaPort,  accelerat orPort;          
  134                    for  (int siteI ndex = 0;  siteIndex  < siteNode s.getLengt h(); siteI ndex++){
  135                             try{
  136                                      siteElem ent = (Ele ment)siteN odes.item( siteIndex) ;
  137                                      siteNumb er = siteE lement.get Attribute( "ID");
  138                                      siteName  = siteEle ment.getAt tribute("n ame");
  139                                      siteAbbr  = siteEle ment.getAt tribute("m oniker");
  140                                      regionId  = ((Eleme nt)siteEle ment.getPa rentNode() ).getAttri bute("ID") ;
  141                                      boolean  siteUserAu thenticata ble = true ;
  142                                      boolean  sitePatien tLookupabl e = true;
  143                                      if(siteE lement.has Attribute( "siteUserA uthenticat able"))
  144                                      {
  145                                               siteUserAu thenticata ble = Bool ean.parseB oolean(sit eElement.g etAttribut e("siteUse rAuthentic atable"));
  146                                      }
  147                                      if(siteE lement.has Attribute( "sitePatie ntLookupab le"))
  148                                      {
  149                                               sitePatien tLookupabl e = Boolea n.parseBoo lean(siteE lement.get Attribute( "sitePatie ntLookupab le"));
  150                                      }
  151                                      Map<Stri ng, SiteCo nnection>  siteConnec tions = ne w HashMap< String, Si teConnecti on>();
  152                                      
  153                                      vistaPor t = defaul tVistaPort ;
  154                                      vistaSer ver = "";
  155                                      accelera torServer  = "";
  156                                      accelera torPort =  0; // defa ult the VI X port to  0, if not  in site se rvice, not  using VIX
  157                                      dataSour ceNodes =  siteElemen t.getEleme ntsByTagNa me("DataSo urce");
  158                                      for (int  dataSourc eIndex=0;d ataSourceI ndex<dataS ourceNodes .getLength ();dataSou rceIndex++ ){
  159                                               dataSource Element =  (Element)d ataSourceN odes.item( dataSource Index);
  160                                               protocol =  dataSourc eElement.g etAttribut e("protoco l");
  161                                               if (protoc ol.equals( "VIX")){
  162                                                       ac celeratorS erver = da taSourceEl ement.getA ttribute(" source");
  163                                                       if  (dataSour ceElement. hasAttribu te("port") ){
  164                                                                acce leratorPor t = Intege r.parseInt (dataSourc eElement.g etAttribut e("port")) ;
  165                                                       }
  166                                                       si teConnecti ons.put(Si teConnecti on.siteCon nectionVix
  167                                                                         new Si teConnecti on(SiteCon nection.si teConnecti onVix, acc eleratorSe rver, acce leratorPor t));
  168                                               }
  169                                               else if (p rotocol.eq uals("VIST A")) {
  170                                                       vi staServer  = dataSour ceElement. getAttribu te("source ");
  171                                                       if  (dataSour ceElement. hasAttribu te("port") ){
  172                                                                vist aPort = In teger.pars eInt(dataS ourceEleme nt.getAttr ibute("por t"));
  173                                                       }
  174                                              
  175                                               else if (p rotocol.eq uals("FHIE ") && vist aServer.eq uals("")) 
  176                                               {
  177                                                       vi staServer  = dataSour ceElement. getAttribu te("source ");
  178                                                       if  (dataSour ceElement. hasAttribu te("port") )
  179                                                       {
  180                                                                vist aPort = In teger.pars eInt(dataS ourceEleme nt.getAttr ibute("por t"));
  181                                                       }
  182                                               }
  183                                               else
  184                                               {
  185                                                       St ring serve r = dataSo urceElemen t.getAttri bute("sour ce");
  186                                                       in t port = 0 ;
  187                                                       if  (dataSour ceElement. hasAttribu te("port") )
  188                                                       {
  189                                                                port  = Integer .parseInt( dataSource Element.ge tAttribute ("port"));
  190                                                       }
  191                                                       si teConnecti ons.put(pr otocol, 
  192                                                                         new Si teConnecti on(protoco l, server,  port));
  193                                               }
  194                                              
  195                                               // always  add an ent ry for Vis tA
  196                                               siteConnec tions.put( SiteConnec tion.siteC onnectionV ista, 
  197                                                                new  SiteConnec tion(SiteC onnection. siteConnec tionVista,  vistaServ er, vistaP ort));
  198                                      }
  199                                      site = n ew SiteImp l(siteNumb er,
  200                                                       si teName,
  201                                                       si teAbbr,
  202                                                       vi staServer,
  203                                                       vi staPort,
  204                                                       ac celeratorS erver,
  205                                                       ac celeratorP ort,
  206                                                       re gionId,
  207                                                       si tePatientL ookupable,
  208                                                       si teUserAuth enticatabl e,
  209                                                       si teConnecti ons);
  210                                      vaSites. add(site);
  211                                      logger.i nfo("SiteS ervice add ed site ("  + site.to String() +  ")");
  212                             }
  213                             catch  (Malformed URLExcepti on mux)
  214                             {
  215                                      System.o ut.println ("SiteServ ice failed  to add si te (" + si teNumber +  ") due to  " + mux.g etMessage( ));
  216                             }
  217                    }
  218                    retu rn vaSites ;
  219           }
  220           
  221           pu blic List< Region> tr anslateReg ionNodes(N odeList re gionNodes) {
  222                    List <Region> v aRegions =  new Array List<Regio n>(regionN odes.getLe ngth());
  223                    Elem ent region Element;
  224                    Regi on region;
  225                    for  (int regio nIndex = 0 ; regionIn dex < regi onNodes.ge tLength();  regionInd ex++){
  226                    //wh ile (regio nNodes.get CurrentNod e() != nul l){
  227                             region Element =  (Element)r egionNodes .item(regi onIndex);
  228                             region  = new Reg ionImpl(re gionElemen t.getAttri bute("name "), region Element.ge tAttribute ("ID"));
  229                             vaRegi ons.add(re gion);
  230                             logger .info("Sit eService a dded regio n (" + reg ion.toStri ng() + ")" );
  231                    }
  232                    retu rn vaRegio ns;                
  233           }
  234   }