4325. EPMO Open Source Coordination Office Redaction File Detail Report

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

4325.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:51:29 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-web\src\main\java\gov\va\nvap\web\report ReceivedNwHINDocumentSummaryReportResults.java Fri Apr 21 20:03:30 2017 UTC

4325.2 Comparison summary

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

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

4325.4 Active regular expressions

No regular expressions were active.

4325.5 Comparison detail

        1   /*
        2    * To chan ge this te mplate, ch oose Tools  | Templat es
        3    * and ope n the temp late in th e editor.
        4    */
        5   package go v.va.nvap. web.report ;
        6  
        7   import gov .va.med.nh in.adapter .audit.Act ionType;
        8   import gov .va.med.nh in.adapter .audit.Act ionValuesT ype;
        9   import gov .va.med.nh in.adapter .audit.Aud itSummarie sType;
        10   import gov .va.med.nh in.adapter .audit.Aud itSummaryT ype;
        11   import gov .va.med.nh in.adapter .audit.Fie ldType;
        12   import gov .va.med.nh in.adapter .audit.Get AuditsSumm ary;
        13   import gov .va.med.nh in.adapter .audit.Get AuditsSumm aryRespons e;
        14   import gov .va.med.nh in.adapter .audit.Gro upByFields Type;
        15   import gov .va.med.nh in.adapter .audit.Str ingValuesT ype;
        16   import gov .va.med.nh in.adapter .audit.Sum maryFields Type;
        17   import gov .va.nvap.c ommon.date .Gregorian DateUtil;
        18   import gov .va.nvap.c ommon.sort .BubbleSor tListMap;
        19   import gov .va.nvap.c ommon.vali dation.Nul lChecker;
        20   import gov .va.nvap.p rivacy.Org anizationT ype;
        21   import gov .va.nvap.s ervice.ada pter.audit .AdapterAu ditManager ;
        22   import gov .va.nvap.s ervice.aud it.AuditEx ception;
        23   import gov .va.nvap.w eb.app.Res ponseDispa tcherHttpS ervlet;
        24   import gov .va.nvap.w eb.dao.Fac ilityDAO;
        25   import gov .va.nvap.w eb.helper. document.D ocumentHel per;
        26   import gov .va.nvap.w eb.helper. facility.F acilityHel per;
        27   import gov .va.nvap.w eb.helper. privacy.Co nsentManag ementHelpe r;
        28   import gov .va.nvap.w eb.helper. report.Rep ortHelper;
        29   import gov .va.nvap.w eb.util.xl s.ExcelExp orter;
        30   import jav a.io.IOExc eption;
        31   import jav a.util.Arr ayList;
        32   import jav a.util.Dat e;
        33   import jav a.util.Has hMap;
        34   import jav a.util.Lin kedHashMap ;
        35   import jav a.util.Lis t;
        36   import jav a.util.Map ;
        37   import jav ax.ejb.EJB ;
        38   import jav ax.servlet .ServletEx ception;
        39   import jav ax.servlet .http.Http ServletReq uest;
        40   import jav ax.servlet .http.Http ServletRes ponse;
        41   import jav ax.servlet .http.Http Session;
        42   import org .apache.po i.ss.userm odel.Workb ook;
        43  
        44   /**
        45    */
        46   public cla ss Receive dNwHINDocu mentSummar yReportRes ults exten ds
        47                    Resp onseDispat cherHttpSe rvlet {
        48  
        49           /* *
        50            *  Serial UI D.
        51            * /
        52           pr ivate stat ic final l ong serial VersionUID  = 2018359 6581046119 15L;
        53           pr ivate Adap terAuditMa nager adap terAuditMa nager;
        54  
        55       /**
        56        * Exp ort to exc el - This  method is  called whe n the user  clicks on  the excel  icon in t he JSP. Re flection i s used in  the
        57        * Res ponseDispa tcherHttpS ervlet to  call this  method bas ed on the  http param eters.
        58        *
        59        * @pa ram reques t HTTP Req uest
        60        * @pa ram respon se HTTP Re sponse
        61        * @th rows Servl etExceptio n
        62        * @th rows IOExc eption
        63        */
        64       public  void expo rtToExcel( final Http ServletReq uest reque st,
        65           fi nal HttpSe rvletRespo nse respon se) throws  ServletEx ception,
        66           IO Exception  {
        67           //  Get the s ession
        68           fi nal HttpSe ssion sess ion = requ est.getSes sion(false );
        69           //  Get the r esults fro m the adap ter with t he paginat or set to  -1 (all
        70           //  results)
        71           fi nal List<M ap<String,  Object>>  results =  this.getRe sults(requ est.getSes sion());
        72  
        73           //  Create a  map of key  which is  based on t he result  data key a nd the
        74           //  heading v alue
        75           fi nal Map<St ring, Stri ng> receiv edNwhinDoc umentMap =  new Linke dHashMap<S tring, Str ing>();
        76  
        77           //  Generate  filters.
        78           fi nal Map<St ring, List <Object>>  filterMap  = new Link edHashMap< String, Li st<Object> >();
        79           fi nal Linked HashMap<St ring, Obje ct> filter s = new Li nkedHashMa p<String,  Object>();
        80  
        81           fi lters.put( "Start Dat e", this.g etReportHe lper().get FormattedD ate((Date)  session.g etAttribut e("receive dNwHINDocu mentSummar yQueryStar tDate")));
        82           fi lters.put( "End Date" , this.get ReportHelp er().getFo rmattedDat e((Date) s ession.get Attribute( "receivedN wHINDocume ntSummaryQ ueryEndDat e")));
        83           fi lters.put( "User ID",  session.g etAttribut e("receive dNwHINDocu mentSummar yQueryUser Id"));
        84           fi lters.put( "Patient P referred F acility",  ExcelExpor ter.getPat ientPrefer redFacilit yFilter(ge tFacilityD AO(), (Str ing) sessi on.getAttr ibute("rec eivedNwHIN DocumentSu mmaryQuery Facility") ));
        85           fi lters.put( "eHealth E xchange Or ganization ", ExcelEx porter.get FilterValu e(session. getAttribu te("receiv edNwHINDoc umentSumma ryQueryOrg Name")));
        86           Ex celExporte r.populate FilterMapF orExport(r equest, fi lters, fil terMap, se ssion.getA ttribute(" patientTyp es").toStr ing());
        87  
        88           fi nal Object  receivedN whinDocume ntCount =  session.ge tAttribute ("received NwHINDocum entSummary TotalCount ");
        89           fi nal Map<St ring, List <Object>>  optionalRo ws = new L inkedHashM ap<String,  List<Obje ct>>();
        90           fi nal List<O bject> rec eivedNwhin DocumentRo w = new Ar rayList<Ob ject>();
        91           re ceivedNwhi nDocumentR ow.add(rec eivedNwhin DocumentCo unt);
        92           op tionalRows .put("Gran d Total",  receivedNw hinDocumen tRow);
        93           //  Create th e options  selected l ist
        94  
        95           if  (NullChec ker.isNull OrEmpty(re sults)) {
        96                received NwhinDocum entMap.put ("", "No r ecords wer e found.") ;
        97           }  else {
        98                // The h eading is  used to cr eate the c olumn head ers and th e key is u sed
        99                // to pu ll the dat a from the  results
        100                received NwhinDocum entMap.put ("partnerO rg", "eHea lth Exchan ge Organiz ation");
        101                received NwhinDocum entMap.put ("vaFacili ty", "Pati ent Prefer red Facili ty");
        102                received NwhinDocum entMap.put ("vaFacili tyNumber",  "Patient  Preferred  Facility S tation ID" );
        103                received NwhinDocum entMap.put ("oid", "O ID");
        104                received NwhinDocum entMap.put ("total",  "Total");
        105           }
        106  
        107           //  Create wo rkbook
        108           fi nal String  title = " Received e Health Exc hange Docu ments Summ ary Report ";
        109           fi nal Workbo ok wb = th is.getExce lExporter( ).exportTo Excel(titl e, title,  receivedNw hinDocumen tMap, resu lts, filte rMap, opti onalRows);
        110  
        111           //  Write Exc el to Stre am
        112           th is.getExce lExporter( ).writeExc elToStream ("Received _eHealth_E xchange_Do cuments_Su mmary_Repo rt", wb, r esponse);
        113       }
        114       
        115           /* *
        116            *  Get the c onsent man agement he lper from  Spring.
        117            * /
        118           pu blic Conse ntManageme ntHelper g etCmsHelpe r() {
        119                    fina l ConsentM anagementH elper cmsH elper = th is.getBean ("cmsHelpe r",
        120                                      ConsentM anagementH elper.clas s);
        121                    retu rn cmsHelp er;
        122           }
        123  
        124           /* *
        125            *  Get the d ocument he lper from  Spring.
        126            * /
        127           pu blic Docum entHelper  getDocumen tHelper()  {
        128                    retu rn this.ge tBean("ada pterDocume ntHelper",  DocumentH elper.clas s);
        129           }
        130  
        131           /* *
        132            *  Get the e xcel expor ter class  from Sprin g.
        133            *  
        134            *  @return t he excel e xporter ob ject
        135            * /
        136           pu blic Excel Exporter g etExcelExp orter() {
        137                    fina l ExcelExp orter exce lExporter  = this.get Bean("exce lExporter" ,
        138                                      ExcelExp orter.clas s);
        139                    retu rn excelEx porter;
        140           }
        141  
        142           /* *
        143            *  Get the f acility he lper from  Spring.
        144            * /
        145           pu blic Facil ityHelper  getFacilit yHelper()  {
        146                    retu rn this.ge tBean("fac ilityHelpe r", Facili tyHelper.c lass);
        147           }
        148  
        149           pu blic Repor tHelper ge tReportHel per() {
        150                    fina l ReportHe lper repor tHelper =  this.getBe an("report Helper",
        151                                      ReportHe lper.class );
        152                    retu rn reportH elper;
        153           }
        154           
        155           pr ivate List <Map<Strin g, Object> > getResul ts(final H ttpSession  session)  throws Aud itExceptio n {
        156                    fina l String p atientFaci lity = (St ring) sess ion
        157                                      .getAttr ibute("rec eivedNwHIN DocumentSu mmaryQuery Facility") ;
        158                    fina l String e xternalPar tnerOrg =  (String) s ession
        159                                      .getAttr ibute("rec eivedNwHIN DocumentSu mmaryQuery Organizati ons");
        160                    fina l Date sd  = (Date) s ession
        161                                      .getAttr ibute("rec eivedNwHIN DocumentSu mmaryQuery StartDate" );
        162                    fina l Date ed  = (Date) s ession
        163                                      .getAttr ibute("rec eivedNwHIN DocumentSu mmaryQuery EndDate");
        164           fi nal String  userId =  (String) s ession
        165                    .get Attribute( "receivedN wHINDocume ntSummaryQ ueryUserId ");
        166                    
        167                    fina l int pati entTypes =  (Integer)  session.g etAttribut e("patient Types");
        168                    // s ort
        169                    fina l String r eceivedNwh inDocument sSummaryRe portSortVa lue = (Str ing) sessi on
        170                                      .getAttr ibute("rec eivedNwhin DocumentsS ummaryRepo rtSortValu e");
        171                    fina l String r eceivedNwh inDocument sSummaryRe portSortDi rection =  (String) s ession
        172                                      .getAttr ibute("rec eivedNwhin DocumentsS ummaryRepo rtSortDire ction");
        173  
        174                    fina l GetAudit sSummary g etAuditsSu mmary = ne w GetAudit sSummary() ;
        175  
        176                    // s tart time
        177                    if ( NullChecke r.isNotEmp ty(sd)) {
        178                             getAud itsSummary .setFromDa te(Gregori anDateUtil
        179                                               .getGregor ianCalenda rByDate(sd ));
        180                    }
        181                    // t o time
        182                    if ( NullChecke r.isNotEmp ty(ed)) {
        183                             getAud itsSummary .setToDate (Gregorian DateUtil
        184                                               .getGregor ianCalenda rByDate(ed ));
        185                    }
        186           // Set User I D
        187           if  (NullChec ker.isNotE mpty(userI d)) {
        188                final St ringValues Type userI dValue = n ew StringV aluesType( );
        189                userIdVa lue.getVal ue().add(u serId);
        190                userIdVa lue.setNot In(false);
        191                getAudit sSummary.s etUserIds( userIdValu e);
        192           }
        193                    fina l ActionVa luesType a ctionValue sType = ne w ActionVa luesType() ;
        194                    fina l List<Act ionType> a ctiontype  = actionVa luesType.g etValue();
        195                    acti ontype.add (ActionTyp e.RETRIEVE _DOCUMENT_ OUT);
        196                    acti onValuesTy pe.setNotI n(false);
        197                    getA uditsSumma ry.setActi ons(action ValuesType );
        198                    getA uditsSumma ry.setPati entTypes(p atientType s);
        199  
        200                    // / / sorting
        201                    // i f
        202                    // ( NullChecke r.isNotEmp ty(receive dNwhinDocu mentsSumma ryReportSo rtValue))
        203                    // {
        204                    // S ortFieldTy pe sortFie ld = new S ortFieldTy pe();
        205                    // s ortField.s etField(Fi eldType.fr omValue(re ceivedNwhi nDocuments SummaryRep ortSortVal ue));
        206                    // i f
        207                    // ( "DESC".equ alsIgnoreC ase(receiv edNwhinDoc umentsSumm aryReportS ortDirecti on))
        208                    // {
        209                    // s ortField.s etDirectio n(SortDire ction.DESC );
        210                    // }  else {
        211                    // s ortField.s etDirectio n(SortDire ction.ASC) ;
        212                    // }
        213                    // S ortFieldsT ype sortFi eldsType =  new SortF ieldsType( );
        214                    // s ortFieldsT ype.getSor tField().a dd(sortFie ld);
        215                    // g etAuditsSu mmary.setS ortFields( sortFields Type);
        216                    // }
        217  
        218                    // p atient pre ferred fac ility
        219                    if ( !NullCheck er.isNullO rEmpty(pat ientFacili ty)) {
        220  
        221                             final  StringValu esType pat ientFacily Number = n ew StringV aluesType( );
        222                             patien tFacilyNum ber.setNot In(false);
        223                             final  List<Strin g> patient FacilyNumb erList = p atientFaci lyNumber
        224                                               .getValue( );
        225                             patien tFacilyNum berList.ad d(patientF acility);
        226                             getAud itsSummary .setPatien tFacilityN umbers(pat ientFacily Number);
        227                    }
        228  
        229                    if ( !NullCheck er.isNullO rEmpty(ext ernalPartn erOrg)
        230                                      && !exte rnalPartne rOrg.equal s("externa l")) {
        231                             final  StringValu esType rem oteOrganiz ationIds =  new Strin gValuesTyp e();
        232                             remote Organizati onIds.setN otIn(false );
        233                             final  List<Strin g> remoteO rganizatio nIdsList =  remoteOrg anizationI ds
        234                                               .getValue( );
        235                             remote Organizati onIdsList. add(extern alPartnerO rg.replace ("%",
        236                                               "urn:oid:" ));
        237                             getAud itsSummary .setRemote Organizati onIds(remo teOrganiza tionIds);
        238                    }
        239  
        240                    // g roup by
        241                    fina l GroupByF ieldsType  groupByFie ldsType =  new GroupB yFieldsTyp e();
        242                    fina l List<Fie ldType> fi eldTypeLis t = groupB yFieldsTyp e
        243                                      .getGrou pByField() ;
        244                    fiel dTypeList. add(FieldT ype.REMOTE _ORGANIZAT ION_ID);
        245                    fiel dTypeList. add(FieldT ype.PATIEN T_FACILITY _NUMBER);
        246                    fiel dTypeList. add(FieldT ype.PATIEN T_FACILITY _NAME);
        247                    fiel dTypeList. add(FieldT ype.REMOTE _ORGANIZAT ION_NAME);
        248                    getA uditsSumma ry.setGrou pByFields( groupByFie ldsType);
        249  
        250                    // w eb service s response
        251                    GetA uditsSumma ryResponse  getAudits SummaryRes ponse;
        252                    try  {
        253                             getAud itsSummary Response =  this.adap terAuditMa nager
        254                                               .getAuditS ummary(get AuditsSumm ary);
        255                    } ca tch (final  AuditExce ption e) {
        256                             throw  new AuditE xception() ;
        257                    }
        258  
        259                    fina l List<Map <String, O bject>> re sults = ne w ArrayLis t<Map<Stri ng, Object >>();
        260                    long  totalCoun t = 0l;
        261                    fina l AuditSum mariesType  auditSumm ariesType  = getAudit sSummaryRe sponse
        262                                      .getAudi tSummaries ();
        263                    //
        264                    List <AuditSumm aryType> a uditSummar y = new Ar rayList<Au ditSummary Type>();
        265                    if ( auditSumma riesType ! = null) {
        266                             auditS ummary = a uditSummar iesType.ge tAuditSumm ary();
        267                    }
        268                    for  (final Aud itSummaryT ype auditS ummaryType 2 : auditS ummary) {
        269                             final  AuditSumma ryType aud itSummaryT ype = audi tSummaryTy pe2;
        270  
        271                             final  Map<String , Object>  resultMap  = new Hash Map<String , Object>( );
        272                             final  long count  = auditSu mmaryType. getCount() ;
        273                             final  SummaryFie ldsType su mmaryField s = auditS ummaryType
        274                                               .getSummar yFields();
        275                             final  List<Strin g> summary Field = su mmaryField s.getSumma ryField();
        276  
        277                             if (Nu llChecker. isEmpty(su mmaryField )) {
        278                                      continue ;
        279                             }
        280  
        281                             if (su mmaryField .size() <  4) {
        282                                      continue ;
        283                             }
        284  
        285                             Organi zationType  organizat ionType =  null;
        286                             if (Nu llChecker. isNotEmpty (summaryFi eld.get(0) )) {
        287                                      organiza tionType =  (this.get CmsHelper( )
        288                                                       .g etOrganiza tionByHome CommunityI d(summaryF ield.get(0 )
        289                                                                         .repla ce("urn:oi d:", ""))) ;
        290                    if ( !NullCheck er.isNullO rEmpty(org anizationT ype)) {
        291                         resultMap. put("oid",  ReportDat aProcessor .nullEmpty ReplaceWit hUnknown(o rganizatio nType.getO rgOid()));
        292                    }
        293                    else  {
        294                         resultMap. put("oid",  "Unknown" );
        295                    }
        296                             }
        297  
        298                             if (or ganization Type != nu ll && !Nul lChecker.i sNullOrEmp ty(organiz ationType) ) {
        299                                      resultMa p.put("par tnerOrg",  ReportData Processor
        300                                                       .n ullEmptyRe placeWithU nknown(org anizationT ype
        301                                                                         .getOr gName()));
        302                             } else  {
        303                                      resultMa p.put("par tnerOrg",  ReportData Processor
        304                                                       .n ullEmptyRe placeWithU nknown(sum maryField. get(3)));
        305                             }
        306                             // Ext ract value
        307                             final  String ada pterVAFaci lity = sum maryField. get(1);
        308                             if(!Nu llChecker. isNullOrEm pty(adapte rVAFacilit y)) {
        309                                 re sultMap.pu t("vaFacil ityNumber" , ReportDa taProcesso r
        310                                                       .n ullEmptyRe placeWithU nknown(ada pterVAFaci lity));
        311                             }
        312                             String  vaFacilit y = "";
        313                             if (Re portDataPr ocessor.is ValidStati on(adapter VAFacility )) {
        314                                      vaFacili ty = this. getFacilit yHelper()
        315                                                       .g etFacility NameByStat ionId(adap terVAFacil ity);
        316                                      if (Null Checker.is Empty(vaFa cility)) {
        317                                               vaFacility  = summary Field.get( 2);
        318                                      }
        319                             } else  {
        320                                      vaFacili ty = summa ryField.ge t(2);
        321                             }
        322                             result Map.put("v aFacility" ,
        323                                               ReportData Processor. fixStation (vaFacilit y));
        324                             // res ultMap.put ("vaFacili ty",
        325                             // Rep ortDataPro cessor.nul lEmptyRepl aceWithUnk nownFacili ty(vaFacil ity));
        326                             
        327                             result Map.put("v aFacility" ,
        328                                               ReportData Processor. fixStation (vaFacilit y));
        329                             
        330                             result Map.put("t otal", cou nt);
        331                             result s.add(resu ltMap);
        332                             totalC ount += co unt;
        333  
        334                    }
        335                    sess ion.setAtt ribute("re ceivedNwHI NDocumentS ummaryTota lCount",
        336                                      totalCou nt);
        337                    // s ort
        338                    if ( !NullCheck er
        339                                      .isNullO rEmpty(rec eivedNwhin DocumentsS ummaryRepo rtSortValu e)
        340                                      && !Null Checker
        341                                                       .i sNullOrEmp ty(receive dNwhinDocu mentsSumma ryReportSo rtDirectio n)) { // f irst
        342                                                                                                                                                                                                             // tim e
        343                                                                                                                                                                                                             // thr ough,
        344                                                                                                                                                                                                             // no
        345                                                                                                                                                                                                             // sor t
        346                                                                                                                                                                                                             // spe cified
        347                             boolea n ascendin g = true;
        348                             if (re ceivedNwhi nDocuments SummaryRep ortSortDir ection
        349                                               .equalsIgn oreCase("D ESC")) {
        350                                      ascendin g = false;
        351                             }
        352                             final  BubbleSort ListMap bS orter = ne w BubbleSo rtListMap( );
        353                             return  bSorter.s ortByColum n(results,
        354                                               receivedNw hinDocumen tsSummaryR eportSortV alue, asce nding);
        355                    }
        356                    retu rn results ;
        357           }
        358  
        359           @E JB(beanInt erface = A dapterAudi tManager.c lass, mapp edName = " AdapterAud itManager" )
        360           pu blic void  setAdapter AuditManag er(
        361                             final  AdapterAud itManager  adapterAud itManager)  {
        362                    this .adapterAu ditManager  = adapter AuditManag er;
        363           }
        364  
        365           @O verride
        366           pu blic void  unspecifie d(final Ht tpServletR equest req uest,
        367                             final  HttpServle tResponse  response)  throws IOE xception,  ServletExc eption {
        368                    fina l HttpSess ion sessio n = reques t.getSessi on(false);
        369  
        370                    // s ort
        371                    fina l String r eceivedNwh inDocument sSummaryRe portSortVa lue = requ est
        372                                      .getPara meter("rec eivedNwhin DocumentsS ummaryRepo rtSortValu e");
        373                    fina l String r eceivedNwh inDocument sSummaryRe portSortDi rection =  request
        374                                      .getPara meter("rec eivedNwhin DocumentsS ummaryRepo rtSortDire ction");
        375                    sess ion.setAtt ribute("re ceivedNwhi nDocuments SummaryRep ortSortVal ue",
        376                                      received NwhinDocum entsSummar yReportSor tValue);
        377                    sess ion.setAtt ribute(
        378                                      "receive dNwhinDocu mentsSumma ryReportSo rtDirectio n",
        379                                      received NwhinDocum entsSummar yReportSor tDirection );
        380  
        381           tr y {
        382                session. setAttribu te("receiv edNwHINDoc umentSumma ryResults" ,this.getR esults(ses sion));
        383           }  catch(Audi tException  e) {
        384                throw ne w AuditExc eption(e);
        385           }
        386           
        387                    this .forward(r equest, re sponse, "s how");
        388           }
        389  
        390       privat e Facility DAO getFac ilityDAO()  {
        391           re turn this. getBean("F acilityDAO ", Facilit yDAO.class );
        392       }
        393       
        394   }