3868. EPMO Open Source Coordination Office Redaction File Detail Report

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

3868.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:50:56 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\adapter\doc AdapterDocRetrieveEndpoint.java Fri Apr 21 20:03:28 2017 UTC

3868.2 Comparison summary

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

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

3868.4 Active regular expressions

No regular expressions were active.

3868.5 Comparison detail

        1   package go v.va.nvap. server.end point.adap ter.doc;
        2  
        3   import gov .hhs.fha.n hinc.commo n.nhinccom mon.Assert ionType;
        4   import gov .hhs.fha.n hinc.commo n.nhinccom mon.CeType ;
        5   import gov .hhs.fha.n hinc.commo n.nhinccom mon.HomeCo mmunityTyp e;
        6   import gov .hhs.fha.n hinc.commo n.nhinccom mon.Person NameType;
        7   import gov .hhs.fha.n hinc.commo n.nhinccom mon.UserTy pe;
        8   import gov .hhs.fha.n hinc.commo n.nhinccom monadapter .Respondin gGatewayCr ossGateway RetrieveRe quest;
        9   import gov .va.nvap.c ommon.vali dation.Nul lChecker;
        10   import gov .va.nvap.s ervice.ada pter.doc.A dapterExce ption;
        11   import gov .va.nvap.s ervice.pdq .PatientDe mographics ;
        12   import gov .va.nvap.s ervice.pdq .PatientDe mographics Query;
        13   import gov .va.nvap.s ervice.pdq .PatientDe mographics Response;
        14   import gov .va.nvap.s ervice.pdq .PdqExcept ion;
        15   import gov .va.nvap.s ervice.pdq .PdqServic e;
        16   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetRequ estType;
        17   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetRequ estType.Do cumentRequ est;
        18   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetResp onse;
        19   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetResp onseType.D ocumentRes ponse;
        20  
        21   import jav a.text.Sim pleDateFor mat;
        22   import jav a.util.Cal endar;
        23   import jav a.util.Lis t;
        24  
        25   import net .sf.ehcach e.Cache;
        26   import net .sf.ehcach e.CacheMan ager;
        27   import net .sf.ehcach e.Element;
        28  
        29   import org .springfra mework.bea ns.factory .annotatio n.Required ;
        30   import org .springfra mework.ws. client.cor e.WebServi ceTemplate ;
        31  
        32   /**
        33    * Endpoin t that tal ks to the  adapter's  document r etrieve en dpoint. Th is
        34    * endpoin t is creat ed using t he same in terfaces t hat the ad apter uses  to
        35    * communi cate with  the gatewa ys.
        36    * 
        37    * @author  Asha Amri traj
        38    */
        39   public cla ss Adapter DocRetriev eEndpoint  {
        40           pr ivate stat ic final S tring DOCU MENT_CACHE _NAME = "g ov.va.nvap .server.en dpoint.ada pter.doc.D ocumentCac he";
        41           /* *
        42            *  The templ ate for ca lling the  adapter's  webservice .
        43            * /
        44           pr ivate WebS erviceTemp late adapt erDocRetri eveWebServ iceTemplat e;
        45           //  Cache Man ager
        46           Ca cheManager  cacheMana ger;
        47           /* *
        48            *  Inject VA  home comm unity name .
        49            * /
        50           pr ivate Stri ng homeCom munityName ;
        51           /* *
        52            *  Inject VA  organizat ion detail .
        53            * /
        54           pr ivate Stri ng homeCom munityOid;
        55  
        56           /* *
        57            *  The patie nt demogra phics quer y service.
        58            * /
        59           pr ivate PdqS ervice pdq Service;
        60  
        61           pu blic Strin g getDocum ent(final  String icn , final St ring docum entUniqueI d,
        62                             final  String doc umentRepos itoryId, f inal Strin g homeComm unityId,
        63                             final  String use rName) thr ows Adapte rException  {
        64  
        65                    // C ache lives  for 10 mi ns. Check  the ehCach e.xml for  more
        66                    // i nformation .
        67                    if ( CacheManag er.getInst ance().cac heExists(
        68                                      AdapterD ocRetrieve Endpoint.D OCUMENT_CA CHE_NAME))  {
        69                             final  Cache cach e = CacheM anager.get Instance() .getCache(
        70                                               AdapterDoc RetrieveEn dpoint.DOC UMENT_CACH E_NAME);
        71                             final  String key  = documen tUniqueId  + document Repository Id
        72                                               + homeComm unityId;
        73                             if (ca che.isKeyI nCache(key )) {
        74                                      final El ement elem ent = cach e.get(key) ;
        75                                      if (Null Checker.is NotEmpty(e lement)) {
        76                                               return (St ring) elem ent.getObj ectValue() ;
        77                                      }
        78                             }
        79                    }
        80  
        81                    fina l Respondi ngGatewayC rossGatewa yRetrieveR equest req uest = new  Respondin gGatewayCr ossGateway RetrieveRe quest();
        82                    fina l ihe.iti. xds_b._200 7.ObjectFa ctory obje ctFactory  = new ihe. iti.xds_b. _2007.Obje ctFactory( );
        83                    fina l Retrieve DocumentSe tRequestTy pe retriev eRequest =  objectFac tory
        84                                      .createR etrieveDoc umentSetRe questType( );
        85                    requ est.setRet rieveDocum entSetRequ est(retrie veRequest) ;
        86  
        87                    // G et Patient  Demograph ics
        88                    fina l PatientD emographic s patientD emographic s = this
        89                                      .getPati entDemogra phics(icn) ;
        90  
        91                    fina l Assertio nType asse rtionValue  = new Ass ertionType ();
        92  
        93                    fina l gov.hhs. fha.nhinc. common.nhi nccommon.A ddressType  addressVa lue = new  gov.hhs.fh a.nhinc.co mmon.nhinc common.Add ressType() ;
        94                    fina l gov.hhs. fha.nhinc. common.nhi nccommon.C eType addr essTypeCod e = new go v.hhs.fha. nhinc.comm on.nhincco mmon.CeTyp e();
        95                    addr essTypeCod e.setCode( "H");
        96                    addr essValue.s etAddressT ype(addres sTypeCode) ;
        97                    addr essValue.s etCity(pat ientDemogr aphics.get ResidenceC ity());
        98                    addr essValue.s etCountry( "USA");
        99                    addr essValue.s etState(pa tientDemog raphics.ge tResidence State());
        100                    addr essValue.s etStreetAd dress(pati entDemogra phics
        101                                      .getStre etAddressL ine1());
        102                    addr essValue.s etZipCode( patientDem ographics. getResiden ceZip4());
        103                    asse rtionValue .setAddres s(addressV alue);
        104  
        105                    fina l SimpleDa teFormat f ormatter =  new Simpl eDateForma t("yyyyMMd d");
        106                    fina l Calendar  cal = Cal endar.getI nstance();
        107  
        108                    asse rtionValue .setDateOf Birth(form atter.form at(patient Demographi cs
        109                                      .getDob( )));
        110                    cal. add(Calend ar.YEAR, 5 );
        111                    asse rtionValue .setExplan ationNonCl aimantSign ature("NEE DED");
        112                    asse rtionValue .setHaveSe condWitnes sSignature (false);
        113                    asse rtionValue .setHaveSi gnature(tr ue);
        114                    asse rtionValue .setHaveWi tnessSigna ture(false );
        115  
        116                    fina l HomeComm unityType  homeCommun ityType =  new HomeCo mmunityTyp e();
        117                    home CommunityT ype.setHom eCommunity Id(this.ho meCommunit yOid);
        118                    home CommunityT ype.setNam e(this.hom eCommunity Name);
        119                    asse rtionValue .setHomeCo mmunity(ho meCommunit yType);
        120  
        121                    Pers onNameType  personNam eType = ne w PersonNa meType();
        122                    pers onNameType .setFamily Name(patie ntDemograp hics.getLa stName());
        123                    pers onNameType .setGivenN ame(patien tDemograph ics.getFir stName());
        124                    fina l CeType n ameType =  new CeType ();
        125                    name Type.setCo de("G");
        126                    pers onNameType .setNameTy pe(nameTyp e);
        127                    asse rtionValue .setPerson Name(perso nNameType) ;
        128  
        129                    fina l gov.hhs. fha.nhinc. common.nhi nccommon.P honeType p honeType =  new gov.h hs.fha.nhi nc.common. nhinccommo n.PhoneTyp e();
        130                    phon eType.setA reaCode("7 03");
        131                    phon eType.setC ountryCode ("1");
        132                    phon eType.setE xtension(" 1212");
        133                    phon eType.setL ocalNumber ("555");
        134                    fina l CeType p honeNumber Type = new  CeType();
        135                    phon eNumberTyp e.setCode( "W");
        136                    phon eType.setP honeNumber Type(phone NumberType );
        137                    asse rtionValue .setPhoneN umber(phon eType);
        138  
        139                    fina l UserType  userType  = new User Type();
        140                    pers onNameType  = new Per sonNameTyp e();
        141                    pers onNameType .setFamily Name("");
        142                    pers onNameType .setGivenN ame("");
        143                    pers onNameType .setSecond NameOrInit ials("");
        144                    name Type.setCo de("P");
        145                    user Type.setPe rsonName(p ersonNameT ype);
        146                    user Type.setUs erName(use rName);
        147                    pers onNameType .setNameTy pe(nameTyp e);
        148  
        149                    user Type.setOr g(homeComm unityType) ;
        150  
        151                    fina l gov.hhs. fha.nhinc. common.nhi nccommon.C eType role Coded = ne w gov.hhs. fha.nhinc. common.nhi nccommon.C eType();
        152                    role Coded.setC ode("30796 9004");
        153                    role Coded.setC odeSystem( "2.16.840. 1.113883.3 .18.7.1");
        154                    role Coded.setC odeSystemN ame("SNOME D_CT");
        155                    role Coded.setC odeSystemV ersion("1. 0");
        156                    role Coded.setD isplayName ("Public H ealth");
        157                    role Coded.setO riginalTex t("Public  Health");
        158                    user Type.setRo leCoded(ro leCoded);
        159  
        160                    asse rtionValue .setUserIn fo(userTyp e);
        161  
        162                    fina l gov.hhs. fha.nhinc. common.nhi nccommon.C eType purp oseOfDisco lureCoded  = new gov. hhs.fha.nh inc.common .nhinccomm on.CeType( );
        163                    purp oseOfDisco lureCoded. setCode("T REATMENT") ;
        164                    purp oseOfDisco lureCoded. setCodeSys tem("2.16. 840.1.1138 83.3.18.7. 1");
        165                    purp oseOfDisco lureCoded. setCodeSys temName("n hin-purpos e");
        166                    purp oseOfDisco lureCoded. setCodeSys temVersion ("1.0");
        167                    purp oseOfDisco lureCoded. setDisplay Name("Use  or disclos ure of");
        168                    purp oseOfDisco lureCoded. setOrigina lText("not es");
        169                    asse rtionValue .setPurpos eOfDisclos ureCoded(p urposeOfDi scolureCod ed);
        170                    asse rtionValue .setSSN(pa tientDemog raphics.ge tSsn());
        171  
        172                    requ est.setAss ertion(ass ertionValu e);
        173  
        174                    fina l Document Request do cumentRequ est = new  DocumentRe quest();
        175                    docu mentReques t.setDocum entUniqueI d(document UniqueId);
        176                    docu mentReques t.setHomeC ommunityId (homeCommu nityId);
        177                    docu mentReques t.setRepos itoryUniqu eId(docume ntReposito ryId);
        178                    retr ieveReques t.getDocum entRequest ().add(doc umentReque st);
        179                    // S end reques t using Sp ring-WS
        180                    fina l Retrieve DocumentSe tResponse  response =  (Retrieve DocumentSe tResponse)  this.adap terDocRetr ieveWebSer viceTempla te
        181                                      .marshal SendAndRec eive(reque st);
        182                    if ( NullChecke r.isNotEmp ty(respons e)) {
        183                             final  List<Docum entRespons e> documen tResponses  = respons e
        184                                               .getDocume ntResponse ();
        185                             if (Nu llChecker. isNotEmpty (documentR esponses))  {
        186                                      final Do cumentResp onse docRe sponse = d ocumentRes ponses.get (0);
        187                                      if (Null Checker.is NotEmpty(d ocResponse )) {
        188                                               // Note th at JAXB un marshaller  would dec ode the me ssage
        189                                               final byte [] doc = d ocResponse .getDocume nt();
        190                                               final Stri ng documen t = new St ring(doc);
        191  
        192                                               // Store i n cache
        193                                               if (CacheM anager.get Instance() .cacheExis ts(
        194                                                                Adap terDocRetr ieveEndpoi nt.DOCUMEN T_CACHE_NA ME)) {
        195                                                       fi nal String  key = doc umentUniqu eId
        196                                                                         + docu mentReposi toryId + h omeCommuni tyId;
        197                                                       fi nal Cache  cache = Ca cheManager
        198                                                                         .getIn stance()
        199                                                                         .getCa che(
        200                                                                                           AdapterDoc RetrieveEn dpoint.DOC UMENT_CACH E_NAME);
        201                                                       ca che.put(ne w Element( key, docum ent));
        202                                               }
        203                                               // Return  response
        204                                               return doc ument;
        205                                      }
        206                             }
        207                    }
        208                    // R eturn empt y document  if respon se is empt y
        209                    retu rn null;
        210           }
        211  
        212           /* *
        213            *  Get the p atient dem ographics  from the P DQ Service .
        214            *  
        215            *  @param pa tientId
        216            *  @return
        217            *  @throws A dapterExce ption
        218            * /
        219           pr otected Pa tientDemog raphics ge tPatientDe mographics (final Str ing patien tId)
        220                             throws  AdapterEx ception {
        221                    try  {
        222                             final  PatientDem ographicsQ uery patie ntDemograp hicsQuery  = new Pati entDemogra phicsQuery ();
        223                             patien tDemograph icsQuery.s etPatientI d(patientI d);
        224                             final  PatientDem ographicsR esponse re sponse = t his.pdqSer vice
        225                                               .getPatien tDemograph ics(patien tDemograph icsQuery);
        226                             if (Nu llChecker. isNotEmpty (response) ) {
        227                                      return r esponse.ge tPatientDe mographics ();
        228                             } else  {
        229                                      return n ull;
        230                             }
        231                    } ca tch (final  PdqExcept ion ex) {
        232                             throw  new Adapte rException (ex);
        233                    }
        234           }
        235  
        236           @R equired
        237           pu blic void  setAdapter DocRetriev eWebServic eTemplate(
        238                             final  WebService Template a dapterDocR etrieveWeb ServiceTem plate) {
        239                    this .adapterDo cRetrieveW ebServiceT emplate =  adapterDoc RetrieveWe bServiceTe mplate;
        240           }
        241  
        242           @R equired
        243           pu blic void  setCacheMa nager(fina l CacheMan ager cache Manager) {
        244                    this .cacheMana ger = cach eManager;
        245           }
        246  
        247           @R equired
        248           pu blic void  setHomeCom munityName (final Str ing homeCo mmunityNam e) {
        249                    this .homeCommu nityName =  homeCommu nityName;
        250           }
        251  
        252           @R equired
        253           pu blic void  setHomeCom munityOid( final Stri ng homeCom munityOid)  {
        254                    this .homeCommu nityOid =  homeCommun ityOid;
        255           }
        256  
        257           @R equired
        258           pu blic void  setPdqServ ice(final  PdqService  pdqServic e) {
        259                    this .pdqServic e = pdqSer vice;
        260           }
        261   }