69. EPMO Open Source Coordination Office Redaction File Detail Report

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

69.1 Files compared

# Location File Last Modified
1 ehealth_xchange_cif.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters ESRDataAdapter.java Thu Feb 22 14:26:46 2018 UTC
2 ehealth_xchange_cif.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters ESRDataAdapter.java Tue Feb 27 14:28:25 2018 UTC

69.2 Comparison summary

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

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

69.4 Active regular expressions

No regular expressions were active.

69.5 Comparison detail

  1   package go v.va.med.n hin.adapte r.datamana ger.adapte rs;
  2  
  3   import jav a.net.URL;
  4   import jav a.util.Arr ayList;
  5   import jav a.util.Lis t;
  6   import jav a.util.Pro perties;
  7   import jav a.util.Set ;
  8  
  9   import jav ax.xml.nam espace.QNa me;
  10   import jav ax.xml.soa p.SOAPElem ent;
  11   import jav ax.xml.soa p.SOAPEnve lope;
  12   import jav ax.xml.soa p.SOAPHead er;
  13   import jav ax.xml.ws. handler.Ha ndler;
  14   import jav ax.xml.ws. handler.Ha ndlerResol ver;
  15   import jav ax.xml.ws. handler.Me ssageConte xt;
  16   import jav ax.xml.ws. handler.Po rtInfo;
  17   import jav ax.xml.ws. handler.so ap.SOAPHan dler;
  18   import jav ax.xml.ws. handler.so ap.SOAPMes sageContex t;
  19   import jav ax.xml.ws. soap.SOAPF aultExcept ion;
  20   import jav ax.xml.soa p.SOAPExce ption;
  21   import org .w3c.dom.D OMExceptio n;
  22  
  23   import org .slf4j.Log ger;
  24   import org .slf4j.Log gerFactory ;
  25  
  26   import gov .va.med.es r.webservi ces.jaxws. schemas.De mographicI nfo;
  27   import gov .va.med.es r.webservi ces.jaxws. schemas.Ee Summary;
  28   import gov .va.med.es r.webservi ces.jaxws. schemas.Ee SummaryPor t;
  29   import gov .va.med.es r.webservi ces.jaxws. schemas.Ee SummaryPor tService;
  30   import gov .va.med.es r.webservi ces.jaxws. schemas.Ge tEESummary Request;
  31   import gov .va.med.es r.webservi ces.jaxws. schemas.Ge tEESummary Response;
  32   import gov .va.med.nh in.adapter .datamanag er.DataAda pter;
  33   import gov .va.med.nh in.adapter .datamanag er.DataQue ry;
  34   import gov .va.med.nh in.adapter .utils.Nul lChecker;
  35   import gov .va.med.nh in.adapter .utils.Pro pertiesCol lectionFac tory;
  36   import gov .va.med.nh in.adapter .utils.soa p.handler. LoggingSOA PHandler;
  37  
  38   /**
  39    *
  40    * @author   DN S      VAZQUD
  41    */
  42   public cla ss ESRData Adapter im plements D ataAdapter <GetEESumm aryRespons e>
  43   {
  44       privat e static f inal Logge r logger =  LoggerFac tory.getLo gger(ESRDa taAdapter. class);
  45  
  46       privat e class He aderHandle rResolver  implements  HandlerRe solver
  47       {
  48           pr ivate fina l String u sername;
  49           pr ivate fina l String p assword;
  50  
  51           pu blic Heade rHandlerRe solver(Str ing userna me, String  password)
  52           {
  53                this.use rname = us ername;
  54                this.pas sword = pa ssword;
  55           }
  56  
  57           @O verride
  58           pu blic List< Handler> g etHandlerC hain(PortI nfo portIn fo)
  59           {
  60                List<Han dler> ret  = new Arra yList<>();
  61                ret.add( new Header Handler(us ername, pa ssword));
  62                ret.add( new Loggin gSOAPHandl er(true));
  63                return r et;
  64           }
  65       }
  66  
  67       privat e class He aderHandle r implemen ts SOAPHan dler<SOAPM essageCont ext>
  68       {
  69           pr ivate fina l String u n;
  70           pr ivate fina l String p w;
  71  
  72           pu blic Heade rHandler(S tring user name, Stri ng passwor d)
  73           {
  74                this.un  = username ;
  75                this.pw  = password ;
  76           }
  77  
  78           @O verride
  79           pu blic Set<Q Name> getH eaders()
  80           {
  81                return n ull;
  82           }
  83  
  84           @O verride
  85           pu blic void  close(Mess ageContext  context)
  86           {
  87           }
  88  
  89           @O verride
  90           pu blic boole an handleF ault(SOAPM essageCont ext contex t)
  91           {
  92                return t rue;
  93           }
  94  
  95           @O verride
  96           pu blic boole an handleM essage(SOA PMessageCo ntext smc)
  97           {
  98                Boolean  outboundPr operty = ( Boolean)sm c.get(Mess ageContext .MESSAGE_O UTBOUND_PR OPERTY);
  99  
  100                if (outb oundProper ty) {
  101                    try  {
  102                         SOAPEnvelo pe envelop e = smc.ge tMessage() .getSOAPPa rt().getEn velope();
  103                         SOAPHeader  header =  envelope.g etHeader() ;
  104  
  105                         if (header  == null)  {
  106                             header  = envelop e.addHeade r();
  107                         }
  108  
  109                         SOAPElemen t security  = header. addChildEl ement("Sec urity", "w sse", "htt p://docs.o asis-open. org/wss/20 04/01/oasi s-200401-w ss-wssecur ity-secext -1.0.xsd") ;
  110  
  111                         SOAPElemen t username Token = se curity.add ChildEleme nt("Userna meToken",  "wsse");
  112                         usernameTo ken.addAtt ribute(new  QName("xm lns:wsu"),  "http://d ocs.oasis- open.org/w ss/2004/01 /oasis-200 401-wss-ws security-u tility-1.0 .xsd");
  113  
  114                         SOAPElemen t username  = usernam eToken.add ChildEleme nt("Userna me", "wsse ");
  115                         username.a ddTextNode (un);
  116  
  117                         SOAPElemen t password  = usernam eToken.add ChildEleme nt("Passwo rd", "wsse ");
  118                         password.s etAttribut e("Type",  "http://do cs.oasis-o pen.org/ws s/2004/01/ oasis-2004 01-wss-use rname-toke n-profile- 1.0#Passwo rdText");
  119                         password.a ddTextNode (pw);
  120                    }
  121                    // C CR 179231  -Exception  handling
  122                    catc h (SOAPExc eption | D OMExceptio n e) {
  123                         // CCR 179 231
  124                         throw new  DataAdapte rException ("Exceptio n occurred  while try ing to pro cess SOAP  message.",  e);
  125                    }
  126                }
  127  
  128                return t rue;
  129           }
  130       }
  131  
  132       privat e EeSummar yPortServi ce eeSumma ryService  = null;
  133  
  134       @Overr ide
  135       public  List<GetE ESummaryRe sponse> ge tData(Data Query data Query)
  136       {
  137           Ar rayList<Ge tEESummary Response>  ret = new  ArrayList< >();
  138           St ring icn =  (String)d ataQuery.g etParamete r("icn");
  139           St ring conne ctionFilen ame = data Query.getP roperty("c onnectionF ilename");
  140           St ring conne ction = da taQuery.ge tProperty( "connectio n");
  141  
  142           Ge tEESummary Request ee SummaryReq uest = new  GetEESumm aryRequest ();
  143           ee SummaryReq uest.setKe y(icn);
  144           ee SummaryReq uest.setKe yType("VPI D");
  145           ee SummaryReq uest.setRe questName( "preferred Facility") ;
  146  
  147           Ge tEESummary Response e eSummaryRe sponse;
  148           tr y {
  149                Properti es propert iesCollect ion = Prop ertiesColl ectionFact ory.getPro pertiesCol lection(co nnectionFi lename);
  150                Properti es connect ionPropert ies = (Pro perties)pr opertiesCo llection.g et(connect ion);
  151                String w sdlURL = c onnectionP roperties. getPropert y("wsdlURL ");
  152                String u sername =  connection Properties .getProper ty("userna me");
  153                String p assword =  connection Properties .getProper ty("passwo rd");
  154  
  155                eeSummar yResponse  = getEESum maryPort(w sdlURL, us ername, pa ssword).ge tEESummary (eeSummary Request);
  156                if (eeSu mmaryRespo nse.getSum mary() ==  null || ee SummaryRes ponse.getS ummary().g etDemograp hics() ==  null || Nu llChecker. isNullOrEm pty(eeSumm aryRespons e.getSumma ry().getDe mographics ().getPref erredFacil ity())) {
  157                    eeSu mmaryRespo nse = crea teDefaultR esponse("< UNKNOWN>",  "<UNKNOWN >");
  158                }
  159           }
  160           ca tch (SOAPF aultExcept ion sfe) {
  161                if (sfe. getMessage ().equals( "PERSON_NO T_FOUND"))  {
  162                    logg er.warn("E SR reports  PERSON_NO T_FOUND");
  163                    eeSu mmaryRespo nse = crea teDefaultR esponse("< UNKNOWN>",  "<UNKNOWN >");
  164                }
  165                else {
  166                    logg er.warn("E SR respond ed with an  unexpetec ed error:  ", sfe);
  167                    eeSu mmaryRespo nse = crea teDefaultR esponse("< UNAVAILABL E>", "<UNA VAILABLE>" );
  168                }
  169           }
  170           //  CCR 17798 6- improve d log rela ted code
  171           ca tch (Excep tion e) {
  172                logger.e rror("Ther e was an e rror getti ng data fr om ESR.  M essage = { }", e);
  173                eeSummar yResponse  = createDe faultRespo nse("<UNAV AILABLE>",  "<UNAVAIL ABLE>");
  174           }
  175  
  176           re t.add(eeSu mmaryRespo nse);
  177  
  178           re turn ret;
  179       }
  180  
  181       privat e synchron ized EeSum maryPort g etEESummar yPort(Stri ng eeSumma ryServiceW SDL, Strin g username , String p assword)
  182       {
  183           if  (eeSummar yService = = null) {
  184                try {
  185                      eeSummaryS ervice = n ew EeSumma ryPortServ ice(new UR L(eeSummar yServiceWS DL), new Q Name("http ://jaxws.w ebservices .esr. URL         /schemas",  "eeSummar yPortServi ce"));
  186  
  187                    if ( !NullCheck er.isNullO rEmpty(use rname) &&  !NullCheck er.isNullO rEmpty(pas sword)) {
  188                         eeSummaryS ervice.set HandlerRes olver(new  HeaderHand lerResolve r(username , password ));
  189                    }
  190                }
  191                catch (T hrowable t ) {
  192                    thro w new Runt imeExcepti on("Error  getting EE SummaryPor t.", t);
  193                }
  194           }
  195           re turn eeSum maryServic e.getEeSum maryPortSo ap11();
  196       }
  197  
  198       privat e GetEESum maryRespon se createD efaultResp onse(Strin g facility Number, St ring facil ityName)
  199       {
  200           Ge tEESummary Response e eSummaryRe sponse = n ew GetEESu mmaryRespo nse();
  201  
  202           Ee Summary ee Summary =  new EeSumm ary();
  203           ee SummaryRes ponse.setS ummary(eeS ummary);
  204  
  205           De mographicI nfo demogr aphicInfo  = new Demo graphicInf o();
  206           ee Summary.se tDemograph ics(demogr aphicInfo) ;
  207  
  208           //  CCR 17798 6-logging  updates
  209           lo gger.debug ("facility Number: {} ", facilit yNumber);
  210           lo gger.debug ("facility Name: {}",  facilityN ame);
  211  
  212           de mographicI nfo.setPre ferredFaci lity(facil ityNumber  + " - " +  facilityNa me);
  213  
  214           re turn eeSum maryRespon se;
  215       }
  216   }