Produced by Araxis Merge on 6/9/2017 3:51:27 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Jun 9 19:51:27 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 | DelayedConsentSummaryReport.java | Fri Apr 21 20:03:30 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 254 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | package go v.va.nvap. web.report ; | |||||
| 2 | ||||||
| 3 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 4 | import gov .va.nvap.s vc.consent mgmt.stub. dao.DelayR easonDAO; | |||||
| 5 | import gov .va.nvap.s vc.consent mgmt.stub. dao.Delaye dConsentRe portDAO; | |||||
| 6 | import gov .va.nvap.s vc.consent mgmt.stub. data.Delay Reason; | |||||
| 7 | import gov .va.nvap.s vc.consent mgmt.stub. data.Delay edConsentR pt; | |||||
| 8 | import gov .va.nvap.w eb.dao.Fac ilityDAO; | |||||
| 9 | import gov .va.nvap.w eb.facilit y.Facility ; | |||||
| 10 | import gov .va.nvap.w eb.helper. report.Rep ortHelper; | |||||
| 11 | import gov .va.nvap.w eb.util.xl s.CsvExpor ter; | |||||
| 12 | import gov .va.nvap.w eb.util.xl s.ExcelExp orter; | |||||
| 13 | import jav a.io.IOExc eption; | |||||
| 14 | import jav a.io.Strin gWriter; | |||||
| 15 | import jav a.text.Par seExceptio n; | |||||
| 16 | import jav a.util.Arr ayList; | |||||
| 17 | import jav a.util.Has hMap; | |||||
| 18 | import jav a.util.Lin kedHashMap ; | |||||
| 19 | import jav a.util.Lis t; | |||||
| 20 | import jav a.util.Map ; | |||||
| 21 | import jav a.util.log ging.Level ; | |||||
| 22 | import jav a.util.log ging.Logge r; | |||||
| 23 | import jav ax.servlet .ServletEx ception; | |||||
| 24 | import jav ax.servlet .http.Http ServletReq uest; | |||||
| 25 | import jav ax.servlet .http.Http ServletRes ponse; | |||||
| 26 | import jav ax.servlet .http.Http Session; | |||||
| 27 | import org .apache.po i.ss.userm odel.Workb ook; | |||||
| 28 | import org .json.JSON Exception; | |||||
| 29 | import org .json.JSON Object; | |||||
| 30 | ||||||
| 31 | /** | |||||
| 32 | * | |||||
| 33 | * @since 04/05/2016 | |||||
| 34 | * @author Irakli Ka kushadze | |||||
| 35 | */ | |||||
| 36 | public cla ss Delayed ConsentSum maryReport extends g ov.va.nvap .web.app.R esponseDis patcherHtt pServlet { | |||||
| 37 | ||||||
| 38 | privat e DelayedC onsentRepo rtDAO getD elayedCons entReportD AO() { | |||||
| 39 | re turn this. getBean("D elayedCons entReportD AO", Delay edConsentR eportDAO.c lass); | |||||
| 40 | } | |||||
| 41 | ||||||
| 42 | privat e Facility DAO getFac ilityDAO() { | |||||
| 43 | re turn this. getBean("F acilityDAO ", Facilit yDAO.class ); | |||||
| 44 | } | |||||
| 45 | ||||||
| 46 | privat e DelayRea sonDAO get DelayReaso nDAO() { | |||||
| 47 | re turn this. getBean("D elayReason DAO", Dela yReasonDAO .class); | |||||
| 48 | } | |||||
| 49 | ||||||
| 50 | privat e static I nteger dra w = 0; // "global" v ariable to count up so every d raw of the Delayed C onsent Sum mary Repor t for Data Tables is new | |||||
| 51 | ||||||
| 52 | public void doSe arch(HttpS ervletRequ est reques t, HttpSer vletRespon se respons e) | |||||
| 53 | th rows Servl etExceptio n, IOExcep tion, Pars eException { | |||||
| 54 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 55 | ||||||
| 56 | dr aw++; | |||||
| 57 | ||||||
| 58 | // Perform t he search. | |||||
| 59 | De layedConse ntReportDA O.SearchAl lResponse searchResp onse = thi s.getResul ts(request , response ); | |||||
| 60 | ||||||
| 61 | // Generate JSON resul ts. | |||||
| 62 | se ssion.setA ttribute(" results", encodeInto JSON(searc hResponse, draw.toSt ring())); | |||||
| 63 | ||||||
| 64 | // Forward t he respons e. | |||||
| 65 | th is.forward (request, response, "searchRes ultsJSON") ; | |||||
| 66 | } | |||||
| 67 | ||||||
| 68 | @Overr ide | |||||
| 69 | protec ted void u nspecified (HttpServl etRequest request, H ttpServlet Response r esponse) | |||||
| 70 | th rows Servl etExceptio n, IOExcep tion { | |||||
| 71 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 72 | ||||||
| 73 | Li st<Facilit y> facilit ies = this .getFacili tyDAO().fi ndAll(); | |||||
| 74 | Li st<DelayRe ason> reas ons = this .getDelayR easonDAO() .findAll() ; | |||||
| 75 | ||||||
| 76 | se ssion.setA ttribute(" facilities ", facilit ies); | |||||
| 77 | se ssion.setA ttribute(" reasons", reasons); | |||||
| 78 | ||||||
| 79 | th is.forward (request, response, "searchFor m"); | |||||
| 80 | } | |||||
| 81 | ||||||
| 82 | public void expo rtToCSV(Ht tpServletR equest req uest, Http ServletRes ponse resp onse) thro ws Servlet Exception, IOExcepti on { | |||||
| 83 | De layedConse ntReportDA O.SearchAl lResponse searchResp onse = thi s.getResul ts(request , response ); | |||||
| 84 | Li st<Delayed ConsentRpt > dc = sea rchRespons e.delayedC onsents; | |||||
| 85 | fi nal List<M ap<String, Object>> results = new ArrayL ist<Map<St ring, Obje ct>>(); | |||||
| 86 | Cs vExporter csvExporte r = new Cs vExporter( ); | |||||
| 87 | ||||||
| 88 | // loop over all of the delayed c onsents an d put them in a form the csv e xporter li kes | |||||
| 89 | fo r (Delayed ConsentRpt r : dc) { | |||||
| 90 | final Ma p<String, Object> re sultMap = new HashMa p<String, Object>(); | |||||
| 91 | ||||||
| 92 | resultMa p.put("aut henticatin gFacility" , r.getFac ilityName( )); | |||||
| 93 | resultMa p.put("con sentType", ReportHel per.normal izeConsnen tTypeName( r.getConse ntTypeName ())); | |||||
| 94 | resultMa p.put("tot al", r.get Total().to String()); | |||||
| 95 | ||||||
| 96 | results. add(result Map); | |||||
| 97 | } | |||||
| 98 | ||||||
| 99 | Ma p<String, String> cs vReportMap = new Lin kedHashMap <String, S tring>(); | |||||
| 100 | ||||||
| 101 | if (NullChec ker.isNull OrEmpty(re sults)) { | |||||
| 102 | csvRepor tMap.put(" No records were foun d.", ""); | |||||
| 103 | } else { | |||||
| 104 | csvRepor tMap.put(" Authentica ting Facil ity", "aut henticatin gFacility" ); | |||||
| 105 | csvRepor tMap.put(" Consent Ty pe", "cons entType"); | |||||
| 106 | csvRepor tMap.put(" Total", "t otal"); | |||||
| 107 | } | |||||
| 108 | ||||||
| 109 | cs vExporter. exportToCS V(response , "Delayed _Consent_S ummary_Rep ort", resu lts, (Link edHashMap< String, St ring>) csv ReportMap) ; | |||||
| 110 | } | |||||
| 111 | ||||||
| 112 | public void expo rtToExcel( HttpServle tRequest r equest, Ht tpServletR esponse re sponse) th rows Servl etExceptio n, IOExcep tion { | |||||
| 113 | De layedConse ntReportDA O.SearchAl lResponse searchResp onse = thi s.getResul ts(request , response ); | |||||
| 114 | Lo ng totalCo unt = 0L; | |||||
| 115 | ||||||
| 116 | // Generate report dat a. | |||||
| 117 | fi nal List<M ap<String, Object>> results = new ArrayL ist<Map<St ring, Obje ct>>(); | |||||
| 118 | fo r (Delayed ConsentRpt r : searc hResponse. delayedCon sents) { | |||||
| 119 | final Ma p<String, Object> re sultMap = new HashMa p<String, Object>(); | |||||
| 120 | ||||||
| 121 | resultMa p.put("aut henticatin gFacility" , r.getFac ilityName( )); | |||||
| 122 | resultMa p.put("con sentType", ReportHel per.normal izeConsnen tTypeName( r.getConse ntTypeName ())); | |||||
| 123 | resultMa p.put("tot al", r.get Total()); | |||||
| 124 | ||||||
| 125 | totalCou nt = total Count + (N ullChecker .isNullOrE mpty(r.get Total()) ? 0 : r.get Total()); | |||||
| 126 | ||||||
| 127 | results. add(result Map); | |||||
| 128 | } | |||||
| 129 | ||||||
| 130 | // Create Opt ional Rows (the tota ls row) | |||||
| 131 | fi nal Map<St ring, List <Object>> optionalRo ws = new L inkedHashM ap<String, List<Obje ct>>(); | |||||
| 132 | Li st<Object> typePlace Holder; | |||||
| 133 | ||||||
| 134 | ty pePlaceHol der = new ArrayList< Object>(); | |||||
| 135 | ty pePlaceHol der.add("" ); | |||||
| 136 | ty pePlaceHol der.add(to talCount); | |||||
| 137 | ||||||
| 138 | op tionalRows .put("Tota l", typePl aceHolder) ; | |||||
| 139 | ||||||
| 140 | // Generate column hea ders. | |||||
| 141 | fi nal Map<St ring, Stri ng> column Headers = new Linked HashMap<St ring, Stri ng>(); | |||||
| 142 | if (NullChec ker.isNull OrEmpty(re sults)) { | |||||
| 143 | columnHe aders.put( "", "No re cords were found."); | |||||
| 144 | } else { | |||||
| 145 | columnHe aders.put( "authentic atingFacil ity", "Aut henticatin g Facility "); | |||||
| 146 | columnHe aders.put( "consentTy pe", "Cons ent Type") ; | |||||
| 147 | columnHe aders.put( "total", " Total"); | |||||
| 148 | } | |||||
| 149 | ||||||
| 150 | // Generate filters. | |||||
| 151 | fi nal Map<St ring, List <Object>> filterMap = new Link edHashMap< String, Li st<Object> >(); | |||||
| 152 | fi nal Linked HashMap<St ring, Obje ct> filter s = new Li nkedHashMa p<String, Object>(); | |||||
| 153 | ||||||
| 154 | St ring daysS inceDelaye d = reques t.getParam eter("days SinceDelay ed"); | |||||
| 155 | if (!NullChe cker.isNul lOrEmpty(d aysSinceDe layed) && !"ALL".equ als(daysSi nceDelayed )) { | |||||
| 156 | if (days SinceDelay ed.equals( "0")) { | |||||
| 157 | days SinceDelay ed = "0-5" ; | |||||
| 158 | } | |||||
| 159 | else { | |||||
| 160 | days SinceDelay ed = ">" + daysSince Delayed; | |||||
| 161 | } | |||||
| 162 | } | |||||
| 163 | ||||||
| 164 | fi lters.put( "Authentic ating Faci lity", Exc elExporter .getFacili tiesFilter (this.getF acilityDAO (), reques t.getParam eter("stat ionNumbers "))); | |||||
| 165 | fi lters.put( "Reason(s) for Delay ", ExcelEx porter.get ReasonsFor DelayFilte r(getDelay ReasonDAO( ), request .getParame ter("reaso nsForDelay "))); | |||||
| 166 | fi lters.put( "Days Sinc e Delayed" , daysSinc eDelayed); | |||||
| 167 | fi lters.put( "Consent T ype", Exce lExporter. getConsent TypeFilter (request.g etParamete r("consent Type"))); | |||||
| 168 | Ex celExporte r.populate FilterMapF orExport(r equest, fi lters, fil terMap, re quest.getP arameter(" patientTyp es")); | |||||
| 169 | ||||||
| 170 | // Create wo rkbook. | |||||
| 171 | St ring title = "Delaye d Consent Summary Re port"; | |||||
| 172 | fi nal Workbo ok wb = th is.getExce lExporter( ).exportTo Excel(titl e, title, columnHead ers, resul ts, filter Map, optio nalRows); | |||||
| 173 | ||||||
| 174 | // Write Exc el to Stre am. | |||||
| 175 | th is.getExce lExporter( ).writeExc elToStream ("Delayed_ Consent_Su mmary_Repo rt", wb, r esponse); | |||||
| 176 | } | |||||
| 177 | ||||||
| 178 | /** | |||||
| 179 | * Get the excel exporter class from Spring. | |||||
| 180 | */ | |||||
| 181 | privat e ExcelExp orter getE xcelExport er() { | |||||
| 182 | fi nal ExcelE xporter ex celExporte r = this.g etBean("ex celExporte r", ExcelE xporter.cl ass); | |||||
| 183 | re turn excel Exporter; | |||||
| 184 | } | |||||
| 185 | ||||||
| 186 | privat e DelayedC onsentRepo rtDAO.Sear chAllRespo nse getRes ults(HttpS ervletRequ est reques t, HttpSer vletRespon se respons e) { | |||||
| 187 | De layedConse ntReportDA O.SearchAl lRequest s earchReque st = this. getDelayed ConsentRep ortDAO().n ew SearchA llRequest( ); | |||||
| 188 | ||||||
| 189 | in t patientT ype = Null Checker.is NullOrEmpt y(request. getParamet er("patien tTypes")) ? 1 : Inte ger.parseI nt(request .getParame ter("patie ntTypes")) ; | |||||
| 190 | ||||||
| 191 | // Get param eters for the search from the request. | |||||
| 192 | se archReques t.stationN umbers = R eportHelpe r.getStati onNumbersF romRequest (request); | |||||
| 193 | se archReques t.aggregat eAtFacilit yLevel = " true".equa ls(request .getParame ter("aggre gateAtFaci lityLevel" )); | |||||
| 194 | se archReques t.includeU nknownVisn = (reques t.getParam eter("incl udeUnknown Visn") != null) ? "t rue".equal s(request. getParamet er("includ eUnknownVi sn")) : fa lse; | |||||
| 195 | se archReques t.reasonsF orDelay = request.ge tParameter ("reasonsF orDelay"); | |||||
| 196 | se archReques t.daysSinc eDelayed = request.g etParamete r("daysSin ceDelayed" ); | |||||
| 197 | se archReques t.consentT ype = requ est.getPar ameter("co nsentType" ); | |||||
| 198 | se archReques t.start = 0; // this is a summ ary report , so we wa nt it all and always start at the first record (th ere is no paging) | |||||
| 199 | se archReques t.length = -1; // th is is a su mmary repo rt, so we want it al l | |||||
| 200 | ||||||
| 201 | St ring sortV alue = req uest.getPa rameter("o rder[0][co lumn]") == null ? "0 " : reques t.getParam eter("orde r[0][colum n]"); | |||||
| 202 | St ring sortD irection = request.g etParamete r("order[0 ][dir]") = = null ? " asc" : req uest.getPa rameter("o rder[0][di r]"); | |||||
| 203 | se archReques t.sortBy = sortValue ; | |||||
| 204 | se archReques t.sortOrde r = sortDi rection; | |||||
| 205 | se archReques t.patientT ypes = pat ientType; | |||||
| 206 | ||||||
| 207 | // When expo rting, we' ll receive sort fiel d and sort order exp licitly in the corre sponding p arams. | |||||
| 208 | if (searchRe quest.sort By == null ) { | |||||
| 209 | searchRe quest.sort By = reque st.getPara meter("sor tBy"); | |||||
| 210 | } | |||||
| 211 | if (searchRe quest.sort Order == n ull) { | |||||
| 212 | searchRe quest.sort Order = re quest.getP arameter(" sortOrder" ); | |||||
| 213 | } | |||||
| 214 | ||||||
| 215 | // Perform t he search. | |||||
| 216 | De layedConse ntReportDA O.SearchAl lResponse searchResp onse = thi s.getDelay edConsentR eportDAO() .searchAll ForSummary (searchReq uest); | |||||
| 217 | ||||||
| 218 | re turn searc hResponse; | |||||
| 219 | } | |||||
| 220 | ||||||
| 221 | privat e String e ncodeIntoJ SON(Delaye dConsentRe portDAO.Se archAllRes ponse sear chResponse , String d raw) throw s ParseExc eption { | |||||
| 222 | St ring retur nValue = " "; | |||||
| 223 | ||||||
| 224 | tr y { | |||||
| 225 | StringWr iter json = new Stri ngWriter() ; | |||||
| 226 | JSONObje ct obj = n ew JSONObj ect(); | |||||
| 227 | List<Lis t> data = new ArrayL ist<List>( ); | |||||
| 228 | ||||||
| 229 | for (Del ayedConsen tRpt delay edConsent : searchRe sponse.del ayedConsen ts) { | |||||
| 230 | List <String> d ataItem = new ArrayL ist<String >(); | |||||
| 231 | ||||||
| 232 | data Item.add(d elayedCons ent.getFac ilityName( )); | |||||
| 233 | data Item.add(R eportHelpe r.normaliz eConsnentT ypeName(de layedConse nt.getCons entTypeNam e())); | |||||
| 234 | data Item.add(d elayedCons ent.getTot al().toStr ing()); | |||||
| 235 | ||||||
| 236 | data .add(dataI tem); | |||||
| 237 | } | |||||
| 238 | ||||||
| 239 | obj.put( "data", da ta); | |||||
| 240 | obj.put( "draw", In teger.pars eInt(draw) ); | |||||
| 241 | obj.put( "recordsTo tal", sear chResponse .count); | |||||
| 242 | obj.put( "recordsFi ltered", s earchRespo nse.count) ; | |||||
| 243 | ||||||
| 244 | obj.writ e(json); | |||||
| 245 | ||||||
| 246 | returnVa lue = json .toString( ); | |||||
| 247 | } catch (JSO NException ex) { | |||||
| 248 | Logger.g etLogger(D elayedCons entSummary Report.cla ss.getName ()).log(Le vel.SEVERE , null, ex ); | |||||
| 249 | } | |||||
| 250 | ||||||
| 251 | re turn retur nValue; | |||||
| 252 | } | |||||
| 253 | ||||||
| 254 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.