3794. EPMO Open Source Coordination Office Redaction File Detail Report

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

3794.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:50:35 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-mock\src\main\java\gov\va\nvap\mock\endpoint\adapter\audit MockAuditWebServiceTemplate.java Fri Apr 21 20:03:28 2017 UTC

3794.2 Comparison summary

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

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

3794.4 Active regular expressions

No regular expressions were active.

3794.5 Comparison detail

        1   package go v.va.nvap. mock.endpo int.adapte r.audit;
        2  
        3   import gov .va.med.nh in.adapter .audit.Act ionType;
        4   import gov .va.med.nh in.adapter .audit.Aud itSummarie sType;
        5   import gov .va.med.nh in.adapter .audit.Aud itSummaryT ype;
        6   import gov .va.med.nh in.adapter .audit.Aud itType;
        7   import gov .va.med.nh in.adapter .audit.Aud itsType;
        8   import gov .va.med.nh in.adapter .audit.Fie ldType;
        9   import gov .va.med.nh in.adapter .audit.Get Audits;
        10   import gov .va.med.nh in.adapter .audit.Get AuditsResp onse;
        11   import gov .va.med.nh in.adapter .audit.Get AuditsSumm ary;
        12   import gov .va.med.nh in.adapter .audit.Get AuditsSumm aryRespons e;
        13   import gov .va.med.nh in.adapter .audit.Pag eInfoType;
        14   import gov .va.med.nh in.adapter .audit.Sor tDirection ;
        15   import gov .va.med.nh in.adapter .audit.Sor tFieldType ;
        16   import gov .va.med.nh in.adapter .audit.Sor tFieldsTyp e;
        17   import gov .va.med.nh in.adapter .audit.Sum maryFields Type;
        18   import gov .va.nvap.c ommon.date .Gregorian DateUtil;
        19   import gov .va.nvap.c ommon.vali dation.Nul lChecker;
        20  
        21   import jav a.security .SecureRan dom;
        22   import jav a.sql.Time stamp;
        23   import jav a.util.Arr ays;
        24  
        25   import jav a.util.Cal endar;
        26   import jav a.util.Col lections;
        27   import jav a.util.Com parator;
        28   import jav a.util.Dat e;
        29   import jav a.util.Lis t;
        30   import jav a.util.Ran dom;
        31   //import j ava.util.R andom;
        32  
        33   import org .springfra mework.ws. client.cor e.WebServi ceTemplate ;
        34  
        35   public cla ss MockAud itWebServi ceTemplate  extends W ebServiceT emplate {
        36  
        37           pr ivate stat ic int i =  0;
        38           pr ivate fina l Calendar  dateCal =  Calendar. getInstanc e();
        39           pr ivate fina l List<Str ing> first Names;
        40           pr ivate fina l List<Str ing> middl eNames;
        41           pr ivate fina l List<Str ing> lastN ames;
        42           pr ivate fina l List<Str ing> SSNs;
        43            p rivate fin al List<St ring> ICNs ;
        44            
        45           pu blic MockA uditWebSer viceTempla te() {
        46                    this .dateCal.s et(1980, 1 2, 1);
        47                    //ea ch of thse  lists mus t have ent ries match ing across  all lists  or patien t records  indices wo n't line u p,
        48                    //ma ybe should  refactor  to have so me sort of  MockPatie nt class t hat contai ns relevan t info
        49                    firs tNames = A rrays.asLi st("CHDRON E", "NWHIN ONE","MOCK FIRST");
        50                    last Names = Ar rays.asLis t("ZZZCHDR PATIENTONE ", "NWHINZ ZZTESTPATI ENT","MOCK LAST");
        51                    midd leNames =  Arrays.asL ist("ALLEN ", "EDWARD ","MOCKMID DLE");
        52                    SSNs  = Arrays. asList("00 0004444"," 666100001" ,"22200000 0");
        53                    ICNs  = Arrays. asList("10 12581676V3 77802","10 12638924V5 46709","10 12638924V0 0000");
        54           }
        55  
        56           @O verride
        57           pu blic void  afterPrope rtiesSet()  {
        58           }
        59  
        60           pr ivate void  createSum maryRespon se(
        61                             final  GetAuditsS ummaryResp onse getAu ditsSummar yResponseJ unk,
        62                             final  ActionType  actionTyp e) {
        63  
        64                    fina l AuditSum mariesType  auditSumm ariesTypeJ unk = new  AuditSumma riesType() ;
        65                    fina l List<Aud itSummaryT ype> Audit SummaryTyp eListJunk  = auditSum mariesType Junk
        66                                      .getAudi tSummary() ;
        67  
        68                    fina l AuditSum maryType a uditSummar yTypeJunk1  = new Aud itSummaryT ype();
        69                    fina l SummaryF ieldsType  summaryFie ldsType =  new Summar yFieldsTyp e();
        70                    fina l List<Str ing> field Set1 = sum maryFields Type.getSu mmaryField ();
        71  
        72                    if ( actionType .compareTo (ActionTyp e.RETRIEVE _DOCUMENT_ OUT) == 0)  {
        73                             auditS ummaryType Junk1.setC ount(11);
        74                             fieldS et1.add("u rn:oid:2.1 6.840.1.11 3883.3.424 ");
        75                             fieldS et1.add("9 83");
        76                             fieldS et1.add("S ome VA Fac ility Name ");
        77                             fieldS et1.add("S ome Organi zation Nam e");
        78                    } el se {
        79                             auditS ummaryType Junk1.setC ount(25);
        80                             fieldS et1.add("u rn:oid:1.3 .6.1.4.1.2 6580");
        81                             fieldS et1.add("9 98");
        82                             fieldS et1.add("S ome VA Fac ility Name ");
        83                             fieldS et1.add("A nother Org anization  Name");
        84                    }
        85           fi eldSet1.ad d("junk");
        86           fi eldSet1.ad d("junk");
        87           fi eldSet1.ad d("junk");
        88           fi eldSet1.ad d("junk");
        89           fi eldSet1.ad d("junk");
        90           fi eldSet1.ad d("junk");
        91           
        92                    audi tSummaryTy peJunk1.se tSummaryFi elds(summa ryFieldsTy pe);
        93                    Audi tSummaryTy peListJunk .add(audit SummaryTyp eJunk1);
        94                    fina l AuditSum maryType a uditSummar yTypeJunk2  = new Aud itSummaryT ype();
        95                    fina l SummaryF ieldsType  summaryFie ldsType2 =  new Summa ryFieldsTy pe();
        96                    fina l List<Str ing> field Set2 = sum maryFields Type2.getS ummaryFiel d();
        97  
        98                    if ( actionType .compareTo (ActionTyp e.RETRIEVE _DOCUMENT_ OUT) == 0)  {
        99                             auditS ummaryType Junk2.setC ount(12);
        100                             fieldS et2.add("u rn:oid:2.1 6.840.1.11 3883.3.715 ");
        101                             fieldS et2.add("9 99");
        102                             fieldS et2.add("S ome VA Fac ility Name ");
        103                             fieldS et2.add("S ome Organi zation Nam e");
        104                    } el se {
        105                             auditS ummaryType Junk2.setC ount(28);
        106                             fieldS et2.add("u rn:oid:2.1 6.840.1.11 3883.3.42. 10001.1000 01.12");
        107                             fieldS et2.add("9 99");
        108                             fieldS et2.add("A nother VA  Facility N ame");
        109                             fieldS et2.add("A nother Org anization  Name");
        110                    }
        111           fi eldSet2.ad d("junk");
        112           fi eldSet2.ad d("junk");
        113           fi eldSet2.ad d("junk");
        114           fi eldSet2.ad d("junk");
        115           fi eldSet2.ad d("junk");
        116           fi eldSet2.ad d("junk");
        117  
        118                    audi tSummaryTy peJunk2.se tSummaryFi elds(summa ryFieldsTy pe2);
        119  
        120                    Audi tSummaryTy peListJunk .add(audit SummaryTyp eJunk2);
        121                    getA uditsSumma ryResponse Junk.setAu ditSummari es(auditSu mmariesTyp eJunk);
        122           }
        123  
        124       /**
        125        * Fil ters mock  data by te st patient  SSN, firs t name and  last name .
        126        * 
        127        * @pa ram reques tPayload P ayload rec eived by m ock servic e
        128        * @re turn true  if test pa tient meet s filterin g criteria ,
        129        *           fals e otherwis e
        130        */
        131       privat e boolean  filterAudi tType(GetA udits requ estPayload ) {
        132           
        133           bo olean matc h;
        134           if  (requestP ayload.get PatientSSN s()!= null ) {
        135                match =  false;
        136                for (Str ing item :  requestPa yload.getP atientSSNs ().getValu e()) {
        137                    if ( SSNs.conta ins(item))  {
        138                         match = tr ue;
        139                         break;
        140                    }
        141                }
        142                if (!mat ch) {
        143                    retu rn false;
        144                }
        145           }
        146           if  (requestP ayload.get PatientGiv enNames()  != null) {
        147                match =  false;
        148                for (Str ing item :  requestPa yload.getP atientGive nNames().g etValue())  {
        149                    if ( firstNames .contains( item.toUpp erCase()))  {
        150                         match = tr ue;
        151                         break;
        152                    }
        153                }
        154                if (!mat ch) {
        155                    retu rn false;
        156                }
        157           }
        158           if  (requestP ayload.get PatientLas tNames() ! = null) {
        159                match =  false;
        160                for (Str ing item :  requestPa yload.getP atientLast Names().ge tValue())  {
        161                    if ( lastNames. contains(i tem.toUppe rCase()))  {
        162                         match = tr ue;
        163                         break;
        164                    }
        165                }
        166                if (!mat ch) {
        167                    retu rn false;
        168                }             
        169           }
        170           re turn true;
        171       }
        172       
        173           pr ivate Audi tType getA uditType(f inal GetAu dits audit s, int pat ient) {
        174                    fina l AuditTyp e auditTyp e = new Au ditType();
        175                    Secu reRandom r and = new  SecureRand om();
        176                    int  actionType  = rand.ne xtInt(audi ts.getActi ons().getV alue().siz e());
        177                    audi tType.setA ction(audi ts.getActi ons().getV alue().get (actionTyp e));
        178                    audi tType.setA uditId(new  SecureRan dom().next Long());
        179                    this .dateCal.a dd(Calenda r.MONTH, 1 );
        180           au ditType.se tAuditTime (Gregorian DateUtil.g etGregoria nCalendarB yDate(getR andomDateT ime()));
        181                    audi tType.setD ocumentId( Long.toStr ing(MockAu ditWebServ iceTemplat e.i));
        182                    Mock AuditWebSe rviceTempl ate.i++;
        183                    if ( audits.get Actions(). getValue() .get(0).eq uals(Actio nType.RETR IEVE_DOCUM ENT)) {
        184                         auditType. setOrganiz ationId("2 .16.840.1. 113883.3.4 2.10001.10 0001.12");
        185                    } el se {
        186                         auditType. setOrganiz ationId("2 .16.840.1. 113883.4.3 49");
        187                    }
        188                    if(p atient > f irstNames. size() - 1  || patien t > middle Names.size () - 1 ||  patient >  lastNames. size() - 1  || patien t > SSNs.s ize() - 1  || patient  > ICNs.si ze() - 1)  {
        189                         auditType. setPatient Id("101258 1676V37780 2");
        190                         auditType. setPatient SSN("00000 4444");
        191                         auditType. setPatient LastName(" ZZZCHDRPAT IENTONE");
        192                         auditType. setPatient MiddleName ("ALLEN");
        193                         auditType. setPatient GivenName( "CHDRONE") ;
        194                    }
        195                    else  {
        196                         auditType. setPatient Id(ICNs.ge t(patient) );
        197                         auditType. setPatient SSN(SSNs.g et(patient ));
        198                         auditType. setPatient LastName(l astNames.g et(patient ));
        199                         auditType. setPatient MiddleName (middleNam es.get(pat ient));
        200                         auditType. setPatient GivenName( firstNames .get(patie nt));
        201                    }
        202                    audi tType.setP urposeForU se("TREATM ENT");
        203                    audi tType.setR emoteDocum entId(Long .toString( MockAuditW ebServiceT emplate.i) );
        204                    audi tType.setP atientFaci lityName(" PAT_PREF_F AC");
        205           au ditType.se tPatientFa cilityNumb er("528");
        206                    Mock AuditWebSe rviceTempl ate.i++;
        207                    audi tType.setR emoteDocum entReposit oryId("0") ;
        208                    audi tType.setD ocumentTit le("Contin uity of Ca re Documen t");
        209           in t rnd = ra nd.nextInt (4);
        210           sw itch (rnd)  {
        211                case 0:
        212                    audi tType.setR emoteOrgan izationId( "urn:oid:2 .16.840.1. 113883.3.4 2.10001.10 0001.12");  // DoD
        213                    brea k;
        214                case 1:
        215                    audi tType.setR emoteOrgan izationId( "urn:oid:1 .3.6.1.4.1 .26580");  // Keiser
        216                    brea k;
        217                case 2:
        218                    audi tType.setR emoteOrgan izationId( "urn:oid:1 .3.6.1.4.1 .37619");  // South C arolina He alth
        219                    brea k;
        220                default:
        221                    audi tType.setR emoteOrgan izationId( "urn:oid:1 .2.3.4.5") ; // Unkno wn
        222                    brea k;             
        223           }
        224                    
        225                    audi tType.setU serId("528 :vacojsmit h,CN=John  Smith");
        226                    swit ch(actionT ype) {
        227                         case 0: // announce
        228                             auditT ype.setDet ails("SSN= " + auditT ype.getPat ientSSN()  + ",LASTNA ME=" + aud itType.get PatientLas tName() +  ",MIDDLENA ME=" + aud itType.get PatientMid dleName()  + "\n" +
        229                                                    ",GIV ENNAME=" +  auditType .getPatien tGivenName () + ",PRE FIX=NULL,S UFFIX=NULL ,DOB=19600 101" + "\n " + 
        230                                                    "ADDR ESS=123 FA KE ST,CITY =FAKE CITY ,STATE=VA, ZIP=12345, PHONE=" +  "\n" +
        231                                                    "(555 )555-5555, GENDER=M,M ULTIBIRTH= FALSE,MARI TALSTATUS= NULL," + " \n" +
        232                                                    "PATI ENTID=" +  auditType. getPatient Id() + "\n " +
        233                                                    ",HOM ECOMMUNITY ID=" + aud itType.get Organizati onId());
        234                             break;
        235                         case 1: // check poli cy
        236                             String  inOut = " OUT";
        237                             if(aud itType.get Organizati onId().equ als("2.16. 840.1.1138 83.4.349") ) { inOut  = "IN"; } 
        238                             auditT ype.setDet ails("PERM IT PATIENT DISCOVERY"  + inOut +  " REMOTE"  + "\n" +
        239                                                    "FACI LITY=URN:O ID:" + aud itType.get Organizati onId() + "  ICN=" + a uditType.g etPatientI d() + ",") ;
        240                             break;
        241                         case 2: // mpi find m atch
        242                              if(ne w SecureRa ndom().nex tInt(2) ==  1) {
        243                                 au ditType.se tDetails(" MATCH FOUN D ICN=" +  auditType. getPatient Id() + " R EMOTE FACI LITY=" + a uditType.g etOrganiza tionId() +  "\n" + 
        244                                                        " SSN=" + au ditType.ge tPatientSS N() + ",LA STNAME=" +  auditType .getPatien tLastName( ) + ",FIRS TNAME=" +  auditType. getPatient GivenName( ) + "\n" +  
        245                                                        " ,MIDDLENAM E=" + audi tType.getP atientMidd leName() +  ",GENDER= M,DOB=1981 -01-01 00: 00:00.0,"  + "\n" +
        246                                                        " MOTHERSMAI DENNAME=,S TREET=,CIT Y=,STATE=, ZIP=,PHONE NUMBER=,PO BCITY=,POB STATE=,");
        247                             }
        248                             else {
        249                                 au ditType.se tDetails(" MATCH FAIL ED ICN=" +  auditType .getPatien tId() + "  REMOTE FAC ILITY=" +  auditType. getOrganiz ationId()  + "\n" + 
        250                                                        " SSN=" + au ditType.ge tPatientSS N() + ",LA STNAME=" +  auditType .getPatien tLastName( ) + ",FIRS TNAME=" +  auditType. getPatient GivenName( ) + "\n" +  
        251                                                        " ,MIDDLENAM E=" + audi tType.getP atientMidd leName() +  ",GENDER= M,DOB=1981 -01-01 00: 00:00.0,"  + "\n" +
        252                                                        " MOTHERSMAI DENNAME=,S TREET=,CIT Y=,STATE=, ZIP=,PHONE NUMBER=,PO BCITY=,POB STATE=,");
        253                             }
        254                             break;
        255                         case 3: // add patien t correlat ion
        256                             auditT ype.setDet ails("CORR ELATION AL READY EXIS TS, ICN="  + auditTyp e.getPatie ntId());
        257                             break;
        258                         default:
        259                             auditT ype.setDet ails("MPI  Detail - 2 .16.840.1. 113883.3.4 2.10001.10 0001.12 2. 16.840.1.1 13883.3.42 .10001.100 001.12 2.1 6.840.1.11 3883.3.42. 10001.1000 01.12 2.16 .840.1.113 883.3.42.1 0001.10000 1.12 Test  Match 2.16 .840.1.113 883.3.42.1 0001.10000 1.12 2.16. 840.1.1138 83.3.42.10 001.100001 .12");
        260                             break;
        261                    }
        262                    retu rn auditTy pe;
        263           }
        264  
        265           @O verride
        266           pr otected vo id initDef aultStrate gies() {
        267           }
        268  
        269           @O verride
        270           pu blic Objec t marshalS endAndRece ive(final  Object req uestPayloa d) {
        271                    if ( requestPay load insta nceof GetA udits) {
        272                         final GetA udits audi ts = (GetA udits) req uestPayloa d;
        273                         final GetA uditsRespo nse respon se = new G etAuditsRe sponse();
        274                         final Audi tsType aud itsType =  new Audits Type();
        275                         AuditType  auditType;
        276                         int totalS ize = 900  + (new Ran dom()).nex tInt(200);
        277                         if ( audit s.getPageI nfo()!= nu ll && audi ts.getPage Info().get PageSize()  > 0) {
        278                                 // add random  patient a udit from  mock patie nts for ea ch record  on page
        279                                 fo r (int i =  0; i < au dits.getPa geInfo().g etPageSize (); i++) {
        280                                      auditTyp e = this.g etAuditTyp e(audits,  new Secure Random().n extInt(SSN s.size())) ;
        281                                      if (filt erAuditTyp e((GetAudi ts)request Payload))  {
        282                                          audi tsType.get Audit().ad d(auditTyp e);
        283                                      }
        284                                 }
        285                                 au dits.getPa geInfo().s etTotalSiz e(totalSiz e);
        286                                 re sponse.set PageInfo(a udits.getP ageInfo()) ;
        287                        
        288                         else {
        289                             //add  totalSize  random pat ient audit  from mock  patients 
        290                             int si ze = total Size;
        291                             for (i nt i = 0;  i < size;  i++) {
        292                                 au ditsType.g etAudit(). add(this.g etAuditTyp e(audits,  new Secure Random().n extInt(SSN s.size())) );
        293                             }
        294                         }
        295                         //deal wit h sorting
        296                         SortFields Type sortF ields = au dits.getSo rtFields() ;
        297                         if(!NullCh ecker.isNu llOrEmpty( sortFields )) {
        298                             for(So rtFieldTyp e sortFiel d : sortFi elds.getSo rtField())  {
        299                                 fi nal FieldT ype field  = sortFiel d.getField ();
        300                                 fi nal SortDi rection di rection =  sortField. getDirecti on();
        301                                 Co llections. sort(audit sType.getA udit(), ne w Comparat or<AuditTy pe>() { 
        302                                      @Overrid e
        303                                      public i nt compare (AuditType  o1, Audit Type o2) {
        304                                          int  sortModifi er = 1;
        305                                          try  {
        306                                               if(directi on.value() .equals("D ESC")) { s ortModifie r = -1; }
        307                                               if(field.v alue().equ als("patie ntSSN")) {
        308                                                   return  sortModif ier * o1.g etPatientS SN().compa reTo(o2.ge tPatientSS N());
        309                                               }
        310                                               else if(fi eld.value( ).equals(" auditTime" )) {
        311                                                   return  sortModif ier * o1.g etAuditTim e().toGreg orianCalen dar().comp areTo(o2.g etAuditTim e().toGreg orianCalen dar());
        312                                               }
        313                                               else if(fi eld.value( ).equals(" patientLas tName")) {
        314                                                   return  sortModif ier * o1.g etPatientL astName(). compareTo( o2.getPati entLastNam e());
        315                                               }
        316                                               else if(fi eld.value( ).equals(" patientGiv enName"))  {
        317                                                   return  sortModif ier * o1.g etPatientG ivenName() .compareTo (o2.getPat ientGivenN ame());
        318                                               }
        319                                               else if(fi eld.value( ).equals(" patientMid dleName"))  {
        320                                                   return  sortModif ier * o1.g etPatientM iddleName( ).compareT o(o2.getPa tientMiddl eName());
        321                                               }
        322                                               else if(fi eld.value( ).equals(" organizati onName"))  {
        323                                                   return  sortModif ier * o1.g etOrganiza tionName() .compareTo (o2.getOrg anizationN ame());
        324                                               }
        325                                               else if(fi eld.value( ).equals(" purposeFor Use")) {
        326                                                   return  sortModif ier * o1.g etPurposeF orUse().co mpareTo(o2 .getPurpos eForUse()) ;
        327                                               }
        328                                               else if(fi eld.value( ).equals(" remoteOrga nizationNa me")) {
        329                                                   return  sortModif ier * o1.g etRemoteOr ganization Name().com pareTo(o2. getRemoteO rganizatio nName());
        330                                               }
        331                                               else if(fi eld.value( ).equals(" action"))  {
        332                                                   return  sortModif ier * o1.g etAction() .value().c ompareTo(o 2.getActio n().value( ));
        333                                               }
        334                                               else if(fi eld.value( ).equals(" details"))  {
        335                                                   return  sortModif ier * o1.g etDetails( ).compareT o(o2.getDe tails());
        336                                               }
        337                                          }
        338                                          //wi th mock se rvices, cu rrently do n't do any  compariso n with nul l values
        339                                          //TO DO: do som ething bet ter with c omparing n ull values  to better  mimic rea l response
        340                                          catc h(NullPoin terExcepti on npe) {
        341                                               return sor tModifier;
        342                                          }
        343                                          retu rn sortMod ifier;
        344                                      }
        345  
        346                                 }) ;
        347                             }
        348                         }
        349                         response.s etAudits(a uditsType) ;
        350                         return res ponse;
        351                    } el se {
        352                             final  GetAuditsS ummaryResp onse getAu ditsSummar yResponseJ unk = new  GetAuditsS ummaryResp onse();
        353                             this.c reateSumma ryResponse (getAudits SummaryRes ponseJunk,
        354                                               ((GetAudit sSummary)  requestPay load).getA ctions().g etValue()
        355                                                                .get (0));
        356                             return  getAudits SummaryRes ponseJunk;
        357                    }
        358  
        359           }
        360       
        361       privat e Timestam p getRando mDateTime( ) {
        362           lo ng offset  = Timestam p.valueOf( "2012-01-0 1 00:00:00 ").getTime ();
        363           lo ng end = T imestamp.v alueOf("20 16-12-31 2 3:59:00"). getTime();
        364           lo ng diff =  end - offs et + 1;
        365           Ti mestamp ra nd = new T imestamp(o ffset + (l ong)(Math. random() *  diff));
        366           
        367           re turn rand;
        368       }
        369   }