3887. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/9/2017 3:50:57 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.

3887.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:50:57 2017 UTC
2 eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-server\src\main\java\gov\va\nvap\server\endpoint\vista\link VistALinkEndpoint.java Fri Apr 21 20:03:28 2017 UTC

3887.2 Comparison summary

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

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

3887.4 Active regular expressions

No regular expressions were active.

3887.5 Comparison detail

        1   package go v.va.nvap. server.end point.vist a.link;
        2  
        3   import gov .va.med.ex ception.Fo undationsE xception;
        4   import gov .va.med.vi stalink.ad apter.cci. VistaLinkC onnection;
        5   import gov .va.med.vi stalink.rp c.RpcReque st;
        6   import gov .va.med.vi stalink.rp c.RpcReque stFactory;
        7   import gov .va.med.vi stalink.rp c.RpcReque stParams;
        8   import gov .va.med.vi stalink.rp c.RpcRespo nse;
        9   import gov .va.med.vi stalink.se curity.Vis taKernelPr incipalImp l;
        10   import gov .va.nvap.c ommon.auth .context.L oginContex tExt;
        11   import gov .va.nvap.c ommon.endp oint.Endpo intExcepti on;
        12   import gov .va.nvap.c ommon.vali dation.Nul lChecker;
        13   import jav a.net.Sock etTimeoutE xception;
        14  
        15   import jav a.util.Lis t;
        16   import jav a.util.Map ;
        17  
        18   import jav ax.resourc e.Resource Exception;
        19   import jav ax.securit y.auth.cal lback.Call backHandle r;
        20   import jav ax.securit y.auth.log in.Configu ration;
        21   import jav ax.securit y.auth.log in.LoginCo ntext;
        22   import jav ax.securit y.auth.log in.LoginEx ception;
        23   import org .apache.co mmons.lang .exception .Exception Utils;
        24  
        25   import org .apache.co mmons.logg ing.Log;
        26   import org .apache.co mmons.logg ing.LogFac tory;
        27   import org .springfra mework.bea ns.factory .annotatio n.Required ;
        28  
        29   /**
        30    * VistALi nk Endpoin t to make  RPC calls  into VistA  systems.
        31    * 
        32    * @author  Asha Amri traj
        33    */
        34   public cla ss VistALi nkEndpoint  implement s
        35                    gov. va.nvap.co mmon.endpo int.Endpoi nt<Object,  String> {
        36  
        37           pr ivate stat ic final L og LOG = L ogFactory. getLog(Vis tALinkEndp oint.class );
        38           pr ivate Call backHandle r callback Handler;
        39           pr ivate Conf iguration  configurat ion;
        40           pr ivate Stri ng loginCo ntextName;
        41           pr ivate Map< Integer, S tring> par ameterType s;
        42           pr ivate Stri ng rpcCont ext;
        43           pr ivate Stri ng rpcName ;
        44           pr ivate int  timeout;
        45           pr ivate int  retries;
        46           
        47           pu blic Strin g getRpcCo ntext() {
        48                    retu rn this.rp cContext;
        49           }
        50  
        51           pu blic Strin g getRpcNa me() {
        52                    retu rn this.rp cName;
        53           }
        54  
        55           pu blic int g etTimeout( ) {
        56                    retu rn this.ti meout;
        57           }
        58           
        59           pu blic int g etRetries( ) {
        60                    retu rn this.re tries;
        61           }
        62  
        63           @O verride
        64           pu blic Strin g invoke(f inal Objec t args) th rows Endpo intExcepti on {
        65                return t his.invoke (args, 0);
        66           }
        67           
        68           pu blic Strin g invoke(f inal Objec t args, fi nal int re triesUsed)  throws En dpointExce ption {
        69  
        70                    Vist aLinkConne ction conn ection = n ull;
        71                    Logi nContext l oginContex t = null;
        72                    try  {
        73                             // Log in using t he access/ verify cod e set in t he callbac k handler
        74                             loginC ontext = n ew LoginCo ntextExt(t his.loginC ontextName ,
        75                                               this.callb ackHandler , this.con figuration );
        76                             loginC ontext.log in();
        77                             final  VistaKerne lPrincipal Impl userP rincipal =  VistaKern elPrincipa lImpl
        78                                               .getKernel Principal( loginConte xt.getSubj ect());
        79                             connec tion = use rPrincipal .getAuthen ticatedCon nection();
        80                             connec tion.setTi meOut(this .timeout);
        81                             final  RpcRequest  rpcReques t = RpcReq uestFactor y.getRpcRe quest(
        82                                               this.rpcCo ntext, thi s.rpcName) ;
        83                             final  RpcRequest Params par ams = rpcR equest.get Params();
        84  
        85                             if (Li st.class.i sInstance( args)) {
        86                                      final Li st<?> argL ist = (Lis t<?>) args ;
        87                                      for (int  i = 0; i  < argList. size(); i+ +) {
        88                                               params.set Param(i +  1, this.pa rameterTyp es.get(i +  1),
        89                                                                argL ist.get(i) );
        90                                      }
        91                             } else  if (Strin g.class.is Instance(a rgs)) {
        92                                      final St ring argVa lue = (Str ing) args;
        93                                      params.s etParam(1,  this.para meterTypes .get(1), a rgValue);
        94                             }
        95  
        96                             final  RpcRespons e rpcRespo nse = conn ection.exe cuteRPC(rp cRequest);
        97                             final  String res ults = rpc Response.g etResults( );
        98                             return  results;
        99                    } ca tch (final  LoginExce ption ex)  {
        100                             throw  new Runtim eException (ex);
        101                    } ca tch (final  Foundatio nsExceptio n ex) {
        102                         if(Excepti onUtils.ge tRootCause (ex) insta nceof Sock etTimeoutE xception)  {
        103                             if(ret riesUsed <  retries)  {
        104                                 re turn this. invoke(arg s, retries Used+1);
        105                             }
        106                             else {
        107                                 LO G.warn("Ex hausted "  + retriesU sed + " re tries, soc ket timeou t while co ntacting V istA.");
        108                                 th row new Ru ntimeExcep tion(ex);
        109                             }
        110                         }
        111                         else { thr ow new Run timeExcept ion(ex); }
        112                    } fi nally {
        113                             if (lo ginContext  != null & & NullChec ker.isNotE mpty(login Context))  {
        114                                      try {
        115                                          // A lways logo ut
        116                                          logi nContext.l ogout();
        117                                      } catch  (final Log inExceptio n ex) {
        118                                          LOG. warn("Logi n issue wh ile contac ting VistA . Details:  " + ex.ge tMessage() );
        119                                          // I gnore Exce ption!!
        120                                      }
        121                             }
        122                             if (co nnection ! = null &&  NullChecke r.isNotEmp ty(connect ion)) {
        123                                      try {
        124                                          conn ection.clo se();
        125                                      } catch  (final Res ourceExcep tion ex) {
        126                                          LOG. warn("Prob lem while  contacting  VistA. De tails: " +  ex.getMes sage());
        127                                          // I gnore Exce ption!!
        128                                      }
        129                             }
        130                    }
        131           }
        132  
        133           @R equired
        134           pu blic void  setCallbac kHandler(f inal Callb ackHandler  callbackH andler) {
        135                    this .callbackH andler = c allbackHan dler;
        136           }
        137  
        138           @R equired
        139           pu blic void  setConfigu ration(fin al Configu ration con figuration ) {
        140                    this .configura tion = con figuration ;
        141           }
        142  
        143           @R equired
        144           pu blic void  setLoginCo ntextName( final Stri ng loginCo ntextName)  {
        145                    this .loginCont extName =  loginConte xtName;
        146           }
        147  
        148           @R equired
        149           pu blic void  setParamet erTypes(fi nal Map<In teger, Str ing> param eterTypes)  {
        150                    this .parameter Types = pa rameterTyp es;
        151           }
        152  
        153           @R equired
        154           pu blic void  setRpcCont ext(final  String rpc Context) {
        155                    this .rpcContex t = rpcCon text;
        156           }
        157  
        158           @R equired
        159           pu blic void  setRpcName (final Str ing rpcNam e) {
        160                    this .rpcName =  rpcName;
        161           }
        162  
        163           @R equired
        164           pu blic void  setTimeout (final int  timeout)  {
        165                    this .timeout =  timeout;
        166           }
        167           
        168           @R equired
        169           pu blic void  setRetries (final int  retries)  {
        170                    this .retries =  retries;
        171           }
        172   }