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.
| # | 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 | OptInOptOutSummaryReport.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 | 508 |
| 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.sort .BubbleSor tListMap; | |||||
| 4 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 5 | import gov .va.nvap.p rivacy.Con sentType; | |||||
| 6 | import gov .va.nvap.w eb.app.Res ponseDispa tcherHttpS ervlet; | |||||
| 7 | import gov .va.nvap.w eb.consent .audit.Aud itedConsen tSummary; | |||||
| 8 | import gov .va.nvap.w eb.consent .audit.dao .AuditedCo nsentDAO; | |||||
| 9 | import gov .va.nvap.w eb.dao.Fac ilityDAO; | |||||
| 10 | import gov .va.nvap.w eb.helper. report.Rep ortHelper; | |||||
| 11 | import gov .va.nvap.w eb.util.Co nstants; | |||||
| 12 | ||||||
| 13 | import gov .va.nvap.w eb.util.xl s.ExcelExp orter; | |||||
| 14 | ||||||
| 15 | import jav a.io.IOExc eption; | |||||
| 16 | import jav a.io.Strin gWriter; | |||||
| 17 | import jav a.util.Arr ayList; | |||||
| 18 | ||||||
| 19 | ||||||
| 20 | import jav a.util.Has hMap; | |||||
| 21 | import jav a.util.Lin kedHashMap ; | |||||
| 22 | import jav a.util.Lis t; | |||||
| 23 | import jav a.util.Map ; | |||||
| 24 | import jav a.util.log ging.Level ; | |||||
| 25 | import jav a.util.log ging.Logge r; | |||||
| 26 | ||||||
| 27 | import jav ax.servlet .ServletEx ception; | |||||
| 28 | import jav ax.servlet .http.Http ServletReq uest; | |||||
| 29 | import jav ax.servlet .http.Http ServletRes ponse; | |||||
| 30 | import jav ax.servlet .http.Http Session; | |||||
| 31 | import org .apache.po i.ss.userm odel.Workb ook; | |||||
| 32 | import org .json.JSON Exception; | |||||
| 33 | import org .json.JSON Object; | |||||
| 34 | ||||||
| 35 | /** | |||||
| 36 | * Consent Directive Summary R eport sear ch servlet | |||||
| 37 | * | |||||
| 38 | * @author Asha Amri traj edite d by Steph en Miller, updated b y Raul Alf aro | |||||
| 39 | */ | |||||
| 40 | public cla ss OptInOp tOutSummar yReport ex tends Resp onseDispat cherHttpSe rvlet { | |||||
| 41 | ||||||
| 42 | /** | |||||
| 43 | * Ser ial UID. | |||||
| 44 | */ | |||||
| 45 | privat e static f inal long serialVers ionUID = 3 7215033550 79491829L; | |||||
| 46 | ||||||
| 47 | @Overr ide | |||||
| 48 | protec ted void u nspecified (final Htt pServletRe quest requ est, final HttpServl etResponse response) throws Se rvletExcep tion, IOEx ception { | |||||
| 49 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 50 | ||||||
| 51 | Re portHelper .setDefaul tSearchDat es(session ); | |||||
| 52 | se ssion.remo veAttribut e("results "); | |||||
| 53 | se ssion.remo veAttribut e("sortCol "); | |||||
| 54 | se ssion.remo veAttribut e("sortDir "); | |||||
| 55 | se ssion.remo veAttribut e("unprocc essedResul ts"); | |||||
| 56 | ||||||
| 57 | th is.forward (request, response, "show"); | |||||
| 58 | } | |||||
| 59 | ||||||
| 60 | /** | |||||
| 61 | * Ret urns searc h results in JSON fo rm. JSON c ontains tw o arrays: "data" and "summary" . | |||||
| 62 | * If no request parameter s are pres ent, defau lt values are used f or search. | |||||
| 63 | * | |||||
| 64 | * @pa ram reques t | |||||
| 65 | * @pa ram respon se | |||||
| 66 | * @th rows Servl etExceptio n | |||||
| 67 | * @th rows IOExc eption | |||||
| 68 | */ | |||||
| 69 | public void doSe arch(HttpS ervletRequ est reques t, HttpSer vletRespon se respons e) throws ServletExc eption, IO Exception { | |||||
| 70 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 71 | ||||||
| 72 | Re sultPackag e results = getResul ts(request ); | |||||
| 73 | // used if on ly sorting is reques t as to no t hit db a gain. | |||||
| 74 | se ssion.setA ttribute(" unproccess edResults" , results) ; | |||||
| 75 | se ssion.setA ttribute(" sortCol", request.ge tParameter ("order[0] [column]") ); | |||||
| 76 | se ssion.setA ttribute(" sortDir", request.ge tParameter ("order[0] [dir]")); | |||||
| 77 | ||||||
| 78 | // actual res ults used by DT | |||||
| 79 | se ssion.setA ttribute(" results", encodeInto JSON(resul ts)); | |||||
| 80 | ||||||
| 81 | th is.forward (request, response, "searchRes ultsJSON") ; | |||||
| 82 | } | |||||
| 83 | ||||||
| 84 | /** | |||||
| 85 | * Gat hers searc h results and summar y totals, packaging them toget her for ea se in tran sport. | |||||
| 86 | * | |||||
| 87 | * @pa ram httpRe quest | |||||
| 88 | * @re turn Resul tPackage | |||||
| 89 | * @th rows Servl etExceptio n | |||||
| 90 | */ | |||||
| 91 | privat e ResultPa ckage getR esults(Htt pServletRe quest http Request) t hrows Serv letExcepti on { | |||||
| 92 | Ht tpSession session = httpReques t.getSessi on(false); | |||||
| 93 | /* | |||||
| 94 | Co mpare sort col/dir o f previous call. if they are t he same, i t is a new search re quest. If it it diff erent its a resortin g. use bub ble. | |||||
| 95 | Sh ould somet hing go wr ong, a nor mal search is done. | |||||
| 96 | */ | |||||
| 97 | St ring sortC olCheck = (String)se ssion.getA ttribute(" sortCol"); | |||||
| 98 | St ring sortD irCheck = (String)se ssion.getA ttribute(" sortDir"); | |||||
| 99 | ||||||
| 100 | if (sortColCh eck != nul l && sortD irCheck != null){ | |||||
| 101 | ||||||
| 102 | if(httpR equest.get Parameter( "order[0][ column]") != null && httpReque st.getPara meter("ord er[0][dir] ") != null ){ | |||||
| 103 | /* | |||||
| 104 | if o rder[0][co lumn] and order[0][d ir] are nu ll then it s an excel call, new search. | |||||
| 105 | */ | |||||
| 106 | if(! sortColChe ck.equals( httpReques t.getParam eter("orde r[0][colum n]")) | |||||
| 107 | || !so rtDirCheck .equals(ht tpRequest. getParamet er("order[ 0][dir]")) ){ | |||||
| 108 | //if here then dir/c ol were no t the same as the la st call wh ich means resorting. | |||||
| 109 | ||||||
| 110 | ResultPack age previo usResult = (ResultPa ckage)sess ion.getAtt ribute("un proccessed Results"); | |||||
| 111 | ||||||
| 112 | if(previou sResult!=n ull){ | |||||
| 113 | previo usResult.s etSearchRe sults( sor tResults(p reviousRes ult.getSea rchResults (), httpRe quest) ); | |||||
| 114 | //retu rn newly s orted old result as to not cal l db again . | |||||
| 115 | return previousR esult; | |||||
| 116 | } | |||||
| 117 | } | |||||
| 118 | } | |||||
| 119 | } | |||||
| 120 | ||||||
| 121 | fi nal Audite dConsentDA O auditedC onsentDAO = this.get Bean("audi tedConsent DAO", Audi tedConsent DAO.class) ; | |||||
| 122 | fi nal Audite dConsentDA O.SummaryR equest req = prepare SummaryReq uest(audit edConsentD AO.new Sum maryReques t(), httpR equest); | |||||
| 123 | ||||||
| 124 | Lo ng nwhinAu thorizatio nTotal = 0 L; | |||||
| 125 | Lo ng ssaAuth orizationT otal = 0L; | |||||
| 126 | Lo ng nwhinRe vocationTo tal = 0L; | |||||
| 127 | Lo ng ssaRevo cationTota l = 0L; | |||||
| 128 | Lo ng nwhinRe strictionT otal = 0L; | |||||
| 129 | Lo ng nwhinRe strictionR evocationT otal = 0L; | |||||
| 130 | ||||||
| 131 | fi nal List<A uditedCons entSummary > auditedC onsentSumm aryList = auditedCon sentDAO.ge tEventsSum mary(req); | |||||
| 132 | fi nal List<M ap<String, Object>> endResults = new Arr ayList<Map <String, O bject>>(); | |||||
| 133 | fi nal Map<St ring, Faci lityResult s> combine dByFacilit yResults = new Linke dHashMap<S tring,Faci lityResult s>(); | |||||
| 134 | ||||||
| 135 | fo r (final A uditedCons entSummary auditSumm ary : audi tedConsent SummaryLis t) { | |||||
| 136 | ||||||
| 137 | ||||||
| 138 | final St ring facil ity = Repo rtDataProc essor.fixS tation(aud itSummary. getFacilit y()); | |||||
| 139 | String d isplayCons entType = auditSumma ry.getCons entType(); | |||||
| 140 | if (disp layConsent Type.conta ins("NwHIN ")) { | |||||
| 141 | disp layConsent Type = dis playConsen tType.repl ace("NwHIN ", Constan ts.getOrga nizationNa me()); | |||||
| 142 | } | |||||
| 143 | ||||||
| 144 | //combin e all repo rts by fac ility | |||||
| 145 | if(!comb inedByFaci lityResult s.contains Key(facili ty)){ | |||||
| 146 | //if new entry for facil ity, creat e class ob ject and a dd to map | |||||
| 147 | Faci lityResult s facility Results = new Facili tyResults( facility); | |||||
| 148 | faci lityResult s.addConse ntType(dis playConsen tType, aud itSummary. getCount() ); | |||||
| 149 | ||||||
| 150 | comb inedByFaci lityResult s.put(faci lity,facil ityResults ); | |||||
| 151 | } else { | |||||
| 152 | //if facility object alr eady exist s, add con sent type value to e xisting ob ject | |||||
| 153 | Faci lityResult s facility Results = combinedBy FacilityRe sults.get( facility); | |||||
| 154 | faci lityResult s.addConse ntType(dis playConsen tType, aud itSummary. getCount() ); | |||||
| 155 | } | |||||
| 156 | ||||||
| 157 | final St ring conse ntType = a uditSummar y.getConse ntType(); | |||||
| 158 | final Co nsentType ct = Conse ntType.fro mValue(con sentType); | |||||
| 159 | switch ( ct) { | |||||
| 160 | case NW_HIN_AU THORIZATIO N: | |||||
| 161 | nwhinAutho rizationTo tal += aud itSummary. getCount() ; | |||||
| 162 | break; | |||||
| 163 | case NW_HIN_RE VOCATION: | |||||
| 164 | nwhinRevoc ationTotal += auditS ummary.get Count(); | |||||
| 165 | break; | |||||
| 166 | case SSA_AUTHO RIZATION: | |||||
| 167 | ssaAuthori zationTota l += audit Summary.ge tCount(); | |||||
| 168 | break; | |||||
| 169 | case SSA_REVOC ATION: | |||||
| 170 | ssaRevocat ionTotal + = auditSum mary.getCo unt(); | |||||
| 171 | break; | |||||
| 172 | case NW_HIN_OR GANIZATION _RESTRICTI ON_AUTHORI ZATION: | |||||
| 173 | nwhinRestr ictionTota l += audit Summary.ge tCount(); | |||||
| 174 | break; | |||||
| 175 | case NW_HIN_OR GANIZATION _RESTRICTI ON_REVOCAT ION: | |||||
| 176 | nwhinRestr ictionRevo cationTota l += audit Summary.ge tCount(); | |||||
| 177 | break; | |||||
| 178 | defa ult: | |||||
| 179 | try { | |||||
| 180 | throw new Except ion("unrec ognized co nsent type : " + cons entType); | |||||
| 181 | } catch (E xception e ) { | |||||
| 182 | e.prin tStackTrac e(); | |||||
| 183 | } | |||||
| 184 | break; | |||||
| 185 | } | |||||
| 186 | } | |||||
| 187 | ||||||
| 188 | Fa cilityResu lts curren tResultsRe port; | |||||
| 189 | fo r(String c urrentFaci lityKey: c ombinedByF acilityRes ults.keySe t()){ | |||||
| 190 | currentR esultsRepo rt = combi nedByFacil ityResults .get(curre ntFacility Key); | |||||
| 191 | endResul ts.add(cur rentResult sReport.tr ansformToM ap()); | |||||
| 192 | } | |||||
| 193 | // Summary Ma p used in excel outp ut | |||||
| 194 | fi nal Map<St ring, Obje ct> summar yMap = new LinkedHas hMap<Strin g, Object> (); | |||||
| 195 | ||||||
| 196 | // add everyt hing to ma p so it ca n passed a round in p ackage and later con verted to JSON | |||||
| 197 | su mmaryMap.p ut(Constan ts.getOrga nizationNa me() + " A uthorizati ons", nwhi nAuthoriza tionTotal) ; | |||||
| 198 | su mmaryMap.p ut(Constan ts.getOrga nizationNa me() + " R evocations ", nwhinRe vocationTo tal); | |||||
| 199 | su mmaryMap.p ut(Constan ts.getOrga nizationNa me() + " R estriction s", nwhinR estriction Total); | |||||
| 200 | su mmaryMap.p ut(Constan ts.getOrga nizationNa me() + " R estriction Revocatio ns", nwhin Restrictio nRevocatio nTotal); | |||||
| 201 | su mmaryMap.p ut("SSA Au thorizatio ns", ssaAu thorizatio nTotal); | |||||
| 202 | su mmaryMap.p ut("SSA Re vocations" , ssaRevoc ationTotal ); | |||||
| 203 | ||||||
| 204 | // Package so rted searc h results and summar y totals | |||||
| 205 | Re sultPackag e resultPa ckage = ne w ResultPa ckage( sor tResults(e ndResults, httpReque st), summa ryMap); | |||||
| 206 | ||||||
| 207 | re turn resul tPackage; | |||||
| 208 | } | |||||
| 209 | ||||||
| 210 | /** | |||||
| 211 | * Sor t List<Map <String,Ob ject>> bas ed on map keys (aka column nam es) | |||||
| 212 | * @pa ram unsort edList | |||||
| 213 | * @pa ram reques t | |||||
| 214 | * @re turn | |||||
| 215 | */ | |||||
| 216 | privat e List<Map <String,Ob ject>> sor tResults(L ist<Map<St ring,Objec t>> unsort edList, Ht tpServletR equest req uest){ | |||||
| 217 | ||||||
| 218 | if (unsortedL ist.size() > 1){ | |||||
| 219 | final Bu bbleSortLi stMap bSor ter = new BubbleSort ListMap(); | |||||
| 220 | // When exporting, we'll rec eive sort field and sort order explicitl y in the c orrespondi ng params. | |||||
| 221 | String s ortValue = request.g etParamete r("order[0 ][column]" ) == null ? request. getParamet er("sortBy ") : reque st.getPara meter("ord er[0][colu mn]"); | |||||
| 222 | boolean sortAscend ing = requ est.getPar ameter("or der[0][dir ]") == nul l ? !"desc ".equalsIg noreCase(r equest.get Parameter( "sortOrder ")) | |||||
| 223 | : !"desc". equalsIgno reCase(req uest.getPa rameter("o rder[0][di r]")); | |||||
| 224 | ||||||
| 225 | sortValu e = getSor tValue(sor tValue); | |||||
| 226 | ||||||
| 227 | return b Sorter.sor tByColumn( unsortedLi st, sortVa lue, sortA scending); | |||||
| 228 | } else { | |||||
| 229 | return u nsortedLis t; | |||||
| 230 | } | |||||
| 231 | } | |||||
| 232 | ||||||
| 233 | /** | |||||
| 234 | * Get sort valu e from col umn locati on | |||||
| 235 | * @pa ram paramV alue | |||||
| 236 | * @re turn | |||||
| 237 | */ | |||||
| 238 | privat e String g etSortValu e(String p aramValue) { | |||||
| 239 | St ring sortV alue; | |||||
| 240 | if ("0".equa ls(paramVa lue)) { | |||||
| 241 | sort Value = "f acilityNam e"; | |||||
| 242 | } else i f ("1".equ als(paramV alue)) { | |||||
| 243 | sort Value = Co nstants.ge tOrganizat ionName() + " Author ization"; | |||||
| 244 | } else i f ("2".equ als(paramV alue)) { | |||||
| 245 | sort Value = Co nstants.ge tOrganizat ionName() + " Revoca tion"; | |||||
| 246 | } else i f ("3".equ als(paramV alue)) { | |||||
| 247 | sort Value = Co nstants.ge tOrganizat ionName() + " Organi zation Res triction A uthorizati on"; | |||||
| 248 | } else i f("4".equa ls(paramVa lue)){ | |||||
| 249 | sort Value = Co nstants.ge tOrganizat ionName() + " Organi zation Res triction R evocation" ; | |||||
| 250 | } else i f("5".equa ls(paramVa lue)){ | |||||
| 251 | sort Value = "S SA Authori zation"; | |||||
| 252 | } else i f("6".equa ls(paramVa lue)){ | |||||
| 253 | sort Value = "S SA Revocat ion"; | |||||
| 254 | } else { | |||||
| 255 | sort Value = "f acilityNam e"; | |||||
| 256 | } | |||||
| 257 | re turn sortV alue; | |||||
| 258 | } | |||||
| 259 | ||||||
| 260 | /** | |||||
| 261 | * Add all of th e httpServ letRequest parameter s to the A uditConsen tDao reque st, using defaults i f not prov ided. | |||||
| 262 | * | |||||
| 263 | * @pa ram auditR equest | |||||
| 264 | * @pa ram httpRe quest | |||||
| 265 | * @re turn | |||||
| 266 | */ | |||||
| 267 | privat e AuditedC onsentDAO. SummaryReq uest prepa reSummaryR equest(Aud itedConsen tDAO.Summa ryRequest auditReque st, | |||||
| 268 | Ht tpServletR equest htt pRequest) { | |||||
| 269 | ||||||
| 270 | au ditRequest .aggregate AtFacility Level = "t rue".equal s(httpRequ est.getPar ameter("ag gregateAtF acilityLev el")); | |||||
| 271 | au ditRequest .consentTy pe = ""; | |||||
| 272 | au ditRequest .endDate = ReportHel per.getEnd Date(httpR equest.get Parameter( "endDate") ); | |||||
| 273 | au ditRequest .includeUn knownVisn = "true". equals(htt pRequest.g etParamete r("include UnknownVis n")); | |||||
| 274 | au ditRequest .patientTy pes = (htt pRequest.g etParamete r("patient Types") != null) ? I nteger.par seInt(http Request.ge tParameter ("patientT ypes")) : 1; | |||||
| 275 | au ditRequest .sortDirec tion = ""; | |||||
| 276 | au ditRequest .sortField = ""; | |||||
| 277 | au ditRequest .startDate = ReportH elper.getS tartDate(h ttpRequest .getParame ter("start Date")); | |||||
| 278 | au ditRequest .stationNu mbers = Re portHelper .getStatio nNumbersFr omRequest( httpReques t); | |||||
| 279 | au ditRequest .userId = (httpReque st.getPara meter("ent eredBy") ! = null) ? (String) h ttpRequest .getParame ter("enter edBy").tri m() : ""; | |||||
| 280 | ||||||
| 281 | re turn audit Request; | |||||
| 282 | } | |||||
| 283 | ||||||
| 284 | /** | |||||
| 285 | * Sea rch Result s are comb ined into to JSON St ring which includes two arrays . The firs t contains the searc h results as "data", the | |||||
| 286 | * sec ond is the summary t otals arra y as "summ ary" | |||||
| 287 | * | |||||
| 288 | * @pa ram search Results | |||||
| 289 | * @re turn | |||||
| 290 | */ | |||||
| 291 | privat e String e ncodeIntoJ SON(Result Package se archResult s) { | |||||
| 292 | St ring jsonS tring = "" ; | |||||
| 293 | ||||||
| 294 | tr y { | |||||
| 295 | StringWr iter json = new Stri ngWriter() ; | |||||
| 296 | JSONObje ct obj = n ew JSONObj ect(); | |||||
| 297 | List<Lis t> data = new ArrayL ist<List>( ); | |||||
| 298 | ||||||
| 299 | for (Map <String, O bject> row : searchR esults.get SearchResu lts()) { | |||||
| 300 | List <String> d ataItem = new ArrayL ist<String >(); | |||||
| 301 | ||||||
| 302 | for (String ke y : row.ke ySet()) { | |||||
| 303 | dataItem.a dd(row.get (key).toSt ring()); | |||||
| 304 | } | |||||
| 305 | data .add(dataI tem); | |||||
| 306 | } | |||||
| 307 | ||||||
| 308 | obj.put( "data", da ta); | |||||
| 309 | ||||||
| 310 | obj.writ e(json); | |||||
| 311 | ||||||
| 312 | jsonStri ng = json. toString() ; | |||||
| 313 | } catch (JSO NException ex) { | |||||
| 314 | Logger.g etLogger(O ptInOptOut SummaryRep ort.class. getName()) .log(Level .SEVERE, n ull, ex); | |||||
| 315 | } | |||||
| 316 | re turn jsonS tring; | |||||
| 317 | } | |||||
| 318 | ||||||
| 319 | /** | |||||
| 320 | * 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 | |||||
| 321 | * Res ponseDispa tcherHttpS ervlet to call this method bas ed on the http param eters. | |||||
| 322 | * | |||||
| 323 | * @pa ram reques t HTTP Req uest | |||||
| 324 | * @pa ram respon se HTTP Re sponse | |||||
| 325 | * @th rows Servl etExceptio n | |||||
| 326 | * @th rows IOExc eption | |||||
| 327 | */ | |||||
| 328 | public void expo rtToExcel( final Http ServletReq uest reque st, final HttpServle tResponse response) throws Ser vletExcept ion, IOExc eption { | |||||
| 329 | ||||||
| 330 | // Gather up search res ults | |||||
| 331 | fi nal Result Package re sults = ge tResults(r equest); | |||||
| 332 | fi nal Map<St ring, Stri ng> consen tDirective SummaryMap = new Lin kedHashMap <String, S tring>(); | |||||
| 333 | ||||||
| 334 | if (NullChec ker.isNull OrEmpty(re sults.getS earchResul ts())) { | |||||
| 335 | consentD irectiveSu mmaryMap.p ut("", "No records w ere found. "); | |||||
| 336 | } else { | |||||
| 337 | consentD irectiveSu mmaryMap.p ut("facili tyName", " Authentica ting Facil ity"); | |||||
| 338 | consentD irectiveSu mmaryMap.p ut(Constan ts.getOrga nizationNa me() + " A uthorizati on", Const ants.getOr ganization Name() + " Authoriza tions"); | |||||
| 339 | consentD irectiveSu mmaryMap.p ut(Constan ts.getOrga nizationNa me() + " R evocation" , Constant s.getOrgan izationNam e() + " Re vocations" ); | |||||
| 340 | consentD irectiveSu mmaryMap.p ut(Constan ts.getOrga nizationNa me() + " O rganizatio n Restrict ion Author ization", Constants. getOrganiz ationName( ) + " Rest rictions") ; | |||||
| 341 | consentD irectiveSu mmaryMap.p ut(Constan ts.getOrga nizationNa me() + " O rganizatio n Restrict ion Revoca tion", Con stants.get Organizati onName() + " Restric tion Revoc ations"); | |||||
| 342 | consentD irectiveSu mmaryMap.p ut("SSA Au thorizatio n", "SSA A uthorizati ons"); | |||||
| 343 | consentD irectiveSu mmaryMap.p ut("SSA Re vocation", "SSA Revo cations"); | |||||
| 344 | } | |||||
| 345 | ||||||
| 346 | // Create Opt ional Rows | |||||
| 347 | fi nal Map<St ring, List <Object>> optionalRo ws = new L inkedHashM ap<String, List<Obje ct>>(); | |||||
| 348 | Li st<Object> typePlace Holder; | |||||
| 349 | ||||||
| 350 | ty pePlaceHol der = new ArrayList< Object>(); | |||||
| 351 | fo r (String key : resu lts.getSum maryTotals ().keySet( )) { | |||||
| 352 | typePlac eHolder.ad d(results. getSummary Totals().g et(key)); | |||||
| 353 | } | |||||
| 354 | op tionalRows .put("Tota l", typePl aceHolder) ; | |||||
| 355 | ||||||
| 356 | // Generate filters | |||||
| 357 | fi nal Map<St ring, List <Object>> filterMap = new Link edHashMap< String, Li st<Object> >(); | |||||
| 358 | fi nal Linked HashMap<St ring, Obje ct> filter s = new Li nkedHashMa p<String, Object>(); | |||||
| 359 | ||||||
| 360 | fi lters.put( "Start Dat e", this.g etReportHe lper().get FormattedD ate(reques t.getParam eter("star tDate"))); | |||||
| 361 | fi lters.put( "End Date" , this.get ReportHelp er().getFo rmattedDat e(request. getParamet er("endDat e"))); | |||||
| 362 | fi lters.put( "Authentic ating Faci lity", Exc elExporter .getFacili tiesFilter (getFacili tyDAO(), r equest.get Parameter( "stationNu mbers"))); | |||||
| 363 | fi lters.put( "Entered B y", reques t.getParam eter("ente redBy")); | |||||
| 364 | Ex celExporte r.populate FilterMapF orExport(r equest, fi lters, fil terMap, re quest.getP arameter(" patientTyp es")); | |||||
| 365 | ||||||
| 366 | // Create wo rkbook | |||||
| 367 | St ring title = "Consen t Directiv e Summary Report"; | |||||
| 368 | fi nal Workbo ok wb = th is.getExce lExporter( ).exportTo Excel(titl e, title, consentDir ectiveSumm aryMap, re sults.getS earchResul ts(), filt erMap, opt ionalRows) ; | |||||
| 369 | ||||||
| 370 | // Write Exc el to Stre am | |||||
| 371 | th is.getExce lExporter( ).writeExc elToStream ("Consent_ Directive_ Summary_Re port", wb, response) ; | |||||
| 372 | } | |||||
| 373 | ||||||
| 374 | privat e ExcelExp orter getE xcelExport er() { | |||||
| 375 | re turn this. getBean("e xcelExport er", Excel Exporter.c lass); | |||||
| 376 | } | |||||
| 377 | ||||||
| 378 | privat e Facility DAO getFac ilityDAO() { | |||||
| 379 | re turn this. getBean("F acilityDAO ", Facilit yDAO.class ); | |||||
| 380 | } | |||||
| 381 | ||||||
| 382 | privat e ReportHe lper getRe portHelper () { | |||||
| 383 | re turn this. getBean("r eportHelpe r", Report Helper.cla ss); | |||||
| 384 | } | |||||
| 385 | ||||||
| 386 | /** | |||||
| 387 | * Nea tly brings together the summar y totals a nd the sea rch result s for pass ing as par ameters | |||||
| 388 | * Onl y used wit hin this c lass | |||||
| 389 | */ | |||||
| 390 | privat e class Re sultPackag e { | |||||
| 391 | ||||||
| 392 | pr ivate List <Map<Strin g, Object> > searchRe sults; | |||||
| 393 | pr ivate Map< String, Ob ject> summ aryTotals; | |||||
| 394 | ||||||
| 395 | pu blic void setSearchR esults(Lis t<Map<Stri ng, Object >> searchR esults) { | |||||
| 396 | this.sea rchResults = searchR esults; | |||||
| 397 | } | |||||
| 398 | ||||||
| 399 | pu blic void setSummary Totals(Map <String, O bject> sum maryTotals ) { | |||||
| 400 | this.sum maryTotals = summary Totals; | |||||
| 401 | } | |||||
| 402 | ||||||
| 403 | pu blic Resul tPackage(L ist<Map<St ring, Obje ct>> resul ts, Map<St ring, Obje ct> summar yTotals) { | |||||
| 404 | this.sea rchResults = results ; | |||||
| 405 | this.sum maryTotals = summary Totals; | |||||
| 406 | } | |||||
| 407 | ||||||
| 408 | pu blic List< Map<String , Object>> getSearch Results() { | |||||
| 409 | return s earchResul ts; | |||||
| 410 | } | |||||
| 411 | ||||||
| 412 | pu blic Map<S tring, Obj ect> getSu mmaryTotal s() { | |||||
| 413 | return s ummaryTota ls; | |||||
| 414 | } | |||||
| 415 | ||||||
| 416 | } | |||||
| 417 | ||||||
| 418 | /** | |||||
| 419 | * Cla ss used to group all report ty pes of a g iven facil ity. | |||||
| 420 | */ | |||||
| 421 | privat e class Fa cilityResu lts{ | |||||
| 422 | fi nal String facilityN ame; | |||||
| 423 | lo ng authori zationCoun t = 0; | |||||
| 424 | lo ng restric tionsCount = 0; | |||||
| 425 | lo ng revocat ionsCount = 0; | |||||
| 426 | lo ng restric tionRevoca tionsCount = 0; | |||||
| 427 | lo ng ssaAuth orizations Count = 0; | |||||
| 428 | lo ng ssaRevo cationsCou nt = 0; | |||||
| 429 | ||||||
| 430 | fi nal String authoriza tionName = Constants .getOrgani zationName () + " Aut horization "; | |||||
| 431 | fi nal String restricti onsName = Constants. getOrganiz ationName( ) + " Orga nization R estriction Authoriza tion"; | |||||
| 432 | fi nal String revocatio nsName = C onstants.g etOrganiza tionName() + " Revoc ation"; | |||||
| 433 | fi nal String restricti onRevocati onsName = Constants. getOrganiz ationName( ) + " Orga nization R estriction Revocatio n"; | |||||
| 434 | fi nal String ssaAuthor izationsNa me = "SSA Authorizat ion"; | |||||
| 435 | fi nal String ssaRevoca tionsName = "SSA Rev ocation"; | |||||
| 436 | ||||||
| 437 | ||||||
| 438 | pu blic Facil ityResults (String fa cilityName ) { | |||||
| 439 | this.fac ilityName = facility Name; | |||||
| 440 | } | |||||
| 441 | ||||||
| 442 | pu blic Long getAuthori zation() { | |||||
| 443 | return a uthorizati onCount; | |||||
| 444 | } | |||||
| 445 | ||||||
| 446 | pu blic Long getRestric tions() { | |||||
| 447 | return r estriction sCount; | |||||
| 448 | } | |||||
| 449 | ||||||
| 450 | pu blic Long getRevocat ions() { | |||||
| 451 | return r evocations Count; | |||||
| 452 | } | |||||
| 453 | ||||||
| 454 | pu blic Long getRestric tionRevoca tions() { | |||||
| 455 | return r estriction Revocation sCount; | |||||
| 456 | } | |||||
| 457 | ||||||
| 458 | pu blic Long getSsaAuth orizations () { | |||||
| 459 | return s saAuthoriz ationsCoun t; | |||||
| 460 | } | |||||
| 461 | ||||||
| 462 | pu blic Long getSsaRevo cations() { | |||||
| 463 | return s saRevocati onsCount; | |||||
| 464 | } | |||||
| 465 | ||||||
| 466 | /* * | |||||
| 467 | * updates c lass value s based on parameter s passed. | |||||
| 468 | * @param co nsentType | |||||
| 469 | * @param co unt | |||||
| 470 | * / | |||||
| 471 | pu blic void addConsent Type(Strin g consentT ype, long count){ | |||||
| 472 | ||||||
| 473 | if(conse ntType.equ als(author izationNam e)){ | |||||
| 474 | this .authoriza tionCount = count; | |||||
| 475 | } else i f (consent Type.equal s(restrict ionsName)) { | |||||
| 476 | this .restricti onsCount = count; | |||||
| 477 | } else i f (consent Type.equal s(revocati onsName)){ | |||||
| 478 | this .revocatio nsCount = count; | |||||
| 479 | } else i f (consent Type.equal s(restrict ionRevocat ionsName)) { | |||||
| 480 | this .restricti onRevocati onsCount = count; | |||||
| 481 | } else i f (consent Type.equal s(ssaAutho rizationsN ame)){ | |||||
| 482 | this .ssaAuthor izationsCo unt = coun t; | |||||
| 483 | } else i f (consent Type.equal s(ssaRevoc ationsName )){ | |||||
| 484 | this .ssaRevoca tionsCount = count; | |||||
| 485 | } | |||||
| 486 | } | |||||
| 487 | ||||||
| 488 | /* * | |||||
| 489 | * Combines the class variables into a Lin ked Hash M ap. | |||||
| 490 | * @return | |||||
| 491 | * / | |||||
| 492 | pu blic Map<S tring,Obje ct> transf ormToMap() { | |||||
| 493 | LinkedHa shMap comb inedMap = new Linked HashMap<St ring,Objec t>(); | |||||
| 494 | ||||||
| 495 | combined Map.put("f acilityNam e", this.f acilityNam e); | |||||
| 496 | combined Map.put(th is.authori zationName , this.aut horization Count); | |||||
| 497 | combined Map.put(th is.revocat ionsName, this.revoc ationsCoun t); | |||||
| 498 | combined Map.put(th is.restric tionsName, this.rest rictionsCo unt); | |||||
| 499 | combined Map.put(th is.restric tionRevoca tionsName, this.rest rictionRev ocationsCo unt); | |||||
| 500 | combined Map.put(th is.ssaAuth orizations Name, this .ssaAuthor izationsCo unt); | |||||
| 501 | combined Map.put(th is.ssaRevo cationsNam e, this.ss aRevocatio nsCount); | |||||
| 502 | ||||||
| 503 | return c ombinedMap ; | |||||
| 504 | } | |||||
| 505 | ||||||
| 506 | } | |||||
| 507 | ||||||
| 508 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.