4314. EPMO Open Source Coordination Office Redaction File Detail Report

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

4314.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:51:28 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 MonthlyReceivedDocumentsReport.java Fri Apr 21 20:03:30 2017 UTC

4314.2 Comparison summary

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

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

4314.4 Active regular expressions

No regular expressions were active.

4314.5 Comparison detail

        1   package go v.va.nvap. web.report ;
        2  
        3   import gov .va.med.nh in.adapter .audit.Act ionType;
        4   import gov .va.med.nh in.adapter .audit.Act ionValuesT ype;
        5   import gov .va.med.nh in.adapter .audit.Aud itSummarie sType;
        6   import gov .va.med.nh in.adapter .audit.Aud itSummaryT ype;
        7   import gov .va.med.nh in.adapter .audit.Fie ldType;
        8   import gov .va.med.nh in.adapter .audit.Get AuditsSumm ary;
        9   import gov .va.med.nh in.adapter .audit.Get AuditsSumm aryRespons e;
        10   import gov .va.med.nh in.adapter .audit.Gro upByFields Type;
        11   import gov .va.nvap.c ommon.date .Gregorian DateUtil;
        12   import gov .va.nvap.c ommon.sort .BubbleSor tListMap;
        13   import gov .va.nvap.c ommon.vali dation.Nul lChecker;
        14   import gov .va.nvap.p rivacy.Org anizationT ype;
        15   import gov .va.nvap.s ervice.ada pter.audit .AdapterAu ditManager ;
        16   import gov .va.nvap.s ervice.aud it.AuditEx ception;
        17   import gov .va.nvap.w eb.helper. privacy.Co nsentManag ementHelpe r;
        18   import gov .va.nvap.w eb.util.da te.DateUti l;
        19   import jav a.io.IOExc eption;
        20   import jav a.io.Strin gWriter;
        21   import jav a.text.Dat eFormat;
        22   import jav a.text.Par seExceptio n;
        23   import jav a.text.Sim pleDateFor mat;
        24   import jav a.util.Arr ayList;
        25   import jav a.util.Cal endar;
        26   import jav a.util.Dat e;
        27   import jav a.util.Has hMap;
        28   import jav a.util.Lin kedHashMap ;
        29   import jav a.util.Lis t;
        30   import jav a.util.Map ;
        31   import jav a.util.log ging.Level ;
        32   import jav a.util.log ging.Logge r;
        33   import jav ax.ejb.EJB ;
        34   import jav ax.servlet .ServletEx ception;
        35   import jav ax.servlet .http.Http ServletReq uest;
        36   import jav ax.servlet .http.Http ServletRes ponse;
        37   import jav ax.servlet .http.Http Session;
        38   import org .json.JSON Exception;
        39   import org .json.JSON Object;
        40  
        41   /**
        42    *
        43    * @author  Johann So nnenberg
        44    */
        45   public cla ss Monthly ReceivedDo cumentsRep ort extend s gov.va.n vap.web.ap p.Response Dispatcher HttpServle t {
        46  
        47       privat e AdapterA uditManage r adapterA uditManage r;
        48  
        49       @EJB(b eanInterfa ce = Adapt erAuditMan ager.class , mappedNa me = "Adap terAuditMa nager")
        50       public  void setA dapterAudi tManager(f inal Adapt erAuditMan ager adapt erAuditMan ager) {
        51           th is.adapter AuditManag er = adapt erAuditMan ager;
        52       }
        53  
        54       @Overr ide
        55       protec ted void u nspecified (HttpServl etRequest  request, H ttpServlet Response r esponse) t hrows Serv letExcepti on, IOExce ption {
        56           fi nal HttpSe ssion sess ion = requ est.getSes sion(false );
        57  
        58           // this is th e search f orm
        59           th is.forward (request,  response,  "searchFor m");
        60       }
        61  
        62       public  void doSe arch(HttpS ervletRequ est reques t, HttpSer vletRespon se respons e) throws  ServletExc eption, IO Exception,  ParseExce ption {
        63           fi nal HttpSe ssion sess ion = requ est.getSes sion(false );
        64           fi nal String  draw = re quest.getP arameter(" draw");
        65           fi nal String  monthAndY ear = requ est.getPar ameter("st artYearMon th");
        66           fi nal String [] mAndY =  monthAndY ear.split( "[|]");
        67           fi nal String  month = m AndY[0];
        68           fi nal String  year = mA ndY[1];
        69           
        70           tr y{
        71                SearchRe sultsPacka ge srp = t his.getRes ults(reque st, false,  month, ye ar); 
        72                session. setAttribu te("result s", this.e ncodeServi ceAuditInt oJSON(srp,  Integer.p arseInt(dr aw)));
        73           }  catch(Exce ption e){
        74                throw ne w AuditExc eption();
        75           }
        76           th is.forward (request,  response,  "searchRes ultsJSON") ;
        77       }
        78  
        79       privat e ConsentM anagementH elper getC msHelper()  {
        80           re turn this. getBean("c msHelper",  ConsentMa nagementHe lper.class );
        81       }
        82  
        83       // Pri vate metho ds
        84       privat e MonthlyR eceivedDoc umentsRepo rt.SearchR esultsPack age getRes ults(final  HttpServl etRequest  request, B oolean cal ledForExce l, String  startMonth , String s tartYear)  throws Aud itExceptio n, ParseEx ception {
        85           fi nal List<M ap<String,  Object>>  results =  new ArrayL ist<>();
        86           lo ng totalCo unt = 0L;
        87           lo ng totalRe cordCount  = 0L;
        88           
        89           //  Prepare a udit summa ry
        90           Ge tAuditsSum maryRespon se getAudi tsSummaryR esponse =  prepareAud itSummary( startMonth , startYea r);
        91  
        92           //  Retrieve  the data f rom Exchan ge
        93           fi nal AuditS ummariesTy pe summary Data = get AuditsSumm aryRespons e.getAudit Summaries( );
        94  
        95           Li st<AuditSu mmaryType>  auditSumm ary = summ aryData ==  null ? ne w ArrayLis t<AuditSum maryType>( ) : summar yData.getA uditSummar y();
        96  
        97           fo r (final A uditSummar yType audi tSummaryTy pe : audit Summary) {
        98                final Ma p<String,  Object> ro w = new Li nkedHashMa p<>();
        99                final lo ng count =  auditSumm aryType.ge tCount();
        100                final Li st<String>  summaryFi eld = audi tSummaryTy pe.getSumm aryFields( ).getSumma ryField();
        101  
        102                if (Null Checker.is Empty(summ aryField))  {
        103                    cont inue;
        104                }
        105  
        106                if (summ aryField.s ize() < 4)  {
        107                    cont inue;
        108                }
        109  
        110                // Add o rganizatio n
        111                Organiza tionType o rganizatio nType = nu ll;
        112                if (Null Checker.is NotEmpty(s ummaryFiel d.get(0)))  {
        113                    orga nizationTy pe = (this .getCmsHel per().getO rganizatio nByHomeCom munityId(s ummaryFiel d.get(0).r eplace("ur n:oid:", " ")));
        114                }
        115                if (orga nizationTy pe == null ) {
        116                    row. put("partn erOrg", Re portDataPr ocessor.nu llEmptyRep laceWithUn known(summ aryField.g et(3)));
        117                } else {
        118                    row. put("partn erOrg", Re portDataPr ocessor.nu llEmptyRep laceWithUn known(orga nizationTy pe.getOrgN ame()));
        119                }
        120  
        121                // Add u ser
        122                if(NullC hecker.isN otEmpty(su mmaryField .get(3)))  {
        123                    row. put("user" , summaryF ield.get(3 ));
        124                } else {
        125                    row. put("user" , "");
        126                }
        127                
        128  
        129                // Add c ount
        130                row.put( "total", c ount);
        131  
        132                // Add t he row to  the result s map
        133                results. add(row);
        134  
        135                totalCou nt += coun t;
        136                totalRec ordCount++ ;
        137           }
        138  
        139           //  Sort the  results
        140           Li st<Map<Str ing, Objec t>> sorted Results =  sortResult s(results,  request);
        141  
        142           //  Return th e packaged , sorted r esults
        143           re turn new M onthlyRece ivedDocume ntsReport. SearchResu ltsPackage (sortedRes ults, tota lCount, to talRecordC ount);
        144       }
        145  
        146       privat e GetAudit sSummaryRe sponse pre pareAuditS ummary(Str ing startM onth, Stri ng startYe ar) throws  AuditExce ption, Par seExceptio n {
        147  
        148           Ca lendar cal endar = Ca lendar.get Instance() ;
        149           // prep start  date
        150           // year,month ,date,hour ,min,sec
        151           ca lendar.set (Integer.p arseInt(st artYear),  Integer.pa rseInt(sta rtMonth) -  1, 1, 0,  0, 0);
        152           Da te startDa te = calen dar.getTim e();
        153           
        154           // prep end d ate
        155           ca lendar.set (Calendar. DAY_OF_MON TH, calend ar.getActu alMaximum( Calendar.D AY_OF_MONT H));
        156           ca lendar.set (Calendar. HOUR_OF_DA Y, 23);
        157           ca lendar.set (Calendar. MINUTE, 59 );
        158           ca lendar.set (Calendar. SECOND, 59 );
        159           Da te endDate  = calenda r.getTime( );
        160           
        161           fi nal GetAud itsSummary  getAudits Summary =  new GetAud itsSummary ();
        162  
        163           //  Start tim e
        164           ge tAuditsSum mary.setFr omDate(Gre gorianDate Util.getGr egorianCal endarByDat e(startDat e));
        165  
        166           //  End time
        167           ge tAuditsSum mary.setTo Date(Grego rianDateUt il.getGreg orianCalen darByDate( endDate));
        168  
        169           //  Action ty pes
        170           fi nal Action ValuesType  actionVal uesType =  new Action ValuesType ();
        171           fi nal List<A ctionType>  actiontyp e = action ValuesType .getValue( );
        172           ac tiontype.a dd(ActionT ype.RETRIE VE_DOCUMEN T_OUT);
        173           ac tionValues Type.setNo tIn(false) ;
        174           ge tAuditsSum mary.setAc tions(acti onValuesTy pe);
        175  
        176           //  Patient t ypes
        177           ge tAuditsSum mary.setPa tientTypes (1);
        178  
        179           //  Group by
        180           fi nal GroupB yFieldsTyp e groupByF ieldsType  = new Grou pByFieldsT ype();
        181           fi nal List<F ieldType>  fieldTypeL ist = grou pByFieldsT ype.getGro upByField( );
        182           fi eldTypeLis t.add(Fiel dType.REMO TE_ORGANIZ ATION_ID);
        183           fi eldTypeLis t.add(Fiel dType.REMO TE_ORGANIZ ATION_NAME );
        184           fi eldTypeLis t.add(Fiel dType.USER _ID);
        185           fi eldTypeLis t.add(Fiel dType.USER _NAME);
        186           ge tAuditsSum mary.setGr oupByField s(groupByF ieldsType) ;
        187  
        188           //  Call Exch ange
        189           Ge tAuditsSum maryRespon se getAudi tsSummaryR esponse;
        190           tr y {
        191                getAudit sSummaryRe sponse = t his.adapte rAuditMana ger.getAud itSummary( getAuditsS ummary);
        192                return g etAuditsSu mmaryRespo nse;
        193           }  catch (fin al AuditEx ception e)  {
        194                throw ne w AuditExc eption();
        195           }
        196       }
        197  
        198       privat e String e ncodeServi ceAuditInt oJSON(Sear chResultsP ackage srp , Integer  draw) thro ws ParseEx ception {
        199            t ry {
        200                StringWr iter json  = new Stri ngWriter() ;
        201                JSONObje ct obj = n ew JSONObj ect();
        202                List<Map <String, O bject>> re sults = sr p.getSearc hResults() ;
        203                
        204                obj.put( "recordsTo tal", srp. totalRecor dCount);
        205                obj.put( "recordsFi ltered", s rp.totalRe cordCount) ;
        206                obj.put( "draw", dr aw);
        207                
        208                List<Lis t> data =  new ArrayL ist<List>( ); //overa rching "da ta"
        209                
        210                if(resul ts != null ) { //make  it null s afe
        211                    for( Map<String , Object>  r : result s) {
        212                         List<Strin g> dataIte m = new Ar rayList<St ring>(); / /each "row "
        213                        
        214                         if(r != nu ll) {
        215                             dataIt em.add(r.g et("partne rOrg").toS tring());  //remote o rganizatio n
        216                             dataIt em.add(r.g et("user") .toString( )); //user
        217                             dataIt em.add(r.g et("total" ).toString ()); //cou nt
        218  
        219                             data.a dd(dataIte m); 
        220                         }
        221                    }
        222                }
        223                
        224                obj.put( "data", da ta);
        225                
        226                obj.writ e(json);
        227                
        228                return j son.toStri ng();
        229            }  catch(JSO NException  ex) {
        230                 Logger. getLogger( MonthlyRec eivedDocum entsReport .class.get Name()).lo g(Level.SE VERE, null , ex);
        231            }
        232           
        233           re turn null;
        234       }
        235  
        236       privat e List<Map <String, O bject>> so rtResults( List<Map<S tring, Obj ect>> unSo rtedData,  HttpServle tRequest r equest) {
        237           fi nal Bubble SortListMa p bSorter  = new Bubb leSortList Map();
        238           fi nal String  sortByInd ex = reque st.getPara meter("ord er[0][colu mn]");
        239           fi nal String  sortOrder  = request .getParame ter("order [0][dir]") ;
        240           St ring sortV alue = "pa rtnerOrg";
        241           fi nal boolea n sortAsce nding = so rtOrder ==  null ? !" desc".equa lsIgnoreCa se(request .getParame ter("sortO rder")) :  !"desc".eq ualsIgnore Case(sortO rder);
        242  
        243           if  (sortByIn dex == nul l) {
        244                if (Null Checker.is NotEmpty(r equest.get Parameter( "sortBy")) ) {
        245                    sort Value = re quest.getP arameter(" sortBy");
        246                }
        247           }  else {
        248                switch ( sortByInde x) {
        249                    case  "0":
        250                         sortValue  = "partner Org";
        251                         break;
        252                    case  "1":
        253                         sortValue  = "user";
        254                         break;
        255                    case  "2":
        256                         sortValue  = "total";
        257                         break;             
        258                }
        259           }
        260           
        261           re turn NullC hecker.isN ullOrEmpty (unSortedD ata) || un SortedData .size() ==  0 ? unSor tedData :  bSorter.so rtByColumn (unSortedD ata, sortV alue, sort Ascending) ;
        262       }
        263  
        264       // Pri vate class es
        265       /**
        266        * Pri vate class  specific  to this re port allow ing to pac kage repor t results  and the to tal count  into one o bject
        267        */
        268       privat e class Se archResult sPackage {
        269  
        270           pr ivate fina l List<Map <String, O bject>> se archResult s;
        271           pr ivate fina l long tot alCount; / /sum of al l of the " total" col umns
        272           pr ivate fina l long tot alRecordCo unt; //rec ords retur ned
        273  
        274           pu blic Searc hResultsPa ckage(List <Map<Strin g, Object> > searchRe sults, lon g totalCou nt, long t otalRecord Count) {
        275                this.sea rchResults  = searchR esults;
        276                this.tot alCount =  totalCount ;
        277                this.tot alRecordCo unt = tota lRecordCou nt;
        278           }
        279  
        280           pu blic List< Map<String , Object>>  getSearch Results()  {
        281                return s earchResul ts;
        282           }
        283  
        284           pu blic long  getTotalCo unt() {
        285                return t otalCount;
        286           }
        287           
        288           pu blic long  getTotalRe cordCount( ) {
        289                return t otalRecord Count;
        290           }
        291  
        292       }
        293  
        294   }