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 | ExpiringConsentReportResults.java | Fri Apr 21 20:15:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 484 |
| 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.p rivacy.Con sentDirect iveDetaile dExpiratio nRequest; | |||||
| 5 | import gov .va.nvap.s ervice.ada pter.doc.A dapterExce ption; | |||||
| 6 | import gov .va.nvap.s vc.consent mgmt.stub. dao.MailTe mplateDAO; | |||||
| 7 | import gov .va.nvap.s vc.consent mgmt.stub. dao.Patien tConsentDi rDAO; | |||||
| 8 | import gov .va.nvap.s vc.consent mgmt.stub. data.Detai ledConsent Directive; | |||||
| 9 | import gov .va.nvap.w eb.app.Res ponseDispa tcherHttpS ervlet; | |||||
| 10 | import gov .va.nvap.w eb.dao.Fac ilityDAO; | |||||
| 11 | import gov .va.nvap.w eb.dao.Use rDocumentD AO; | |||||
| 12 | import gov .va.nvap.w eb.helper. document.D ocumentHel per; | |||||
| 13 | import gov .va.nvap.w eb.helper. privacy.Co nsentManag ementHelpe r; | |||||
| 14 | import gov .va.nvap.w eb.helper. report.Rep ortHelper; | |||||
| 15 | import gov .va.nvap.w eb.patient .ExcelGene ratorThrea d; | |||||
| 16 | import gov .va.nvap.w eb.user.Us erHelper; | |||||
| 17 | import gov .va.nvap.w eb.util.Co nstants; | |||||
| 18 | import gov .va.nvap.w eb.util.Pa ginator; | |||||
| 19 | import gov .va.nvap.w eb.util.xl s.CsvExpor ter; | |||||
| 20 | import gov .va.nvap.w eb.util.xl s.ExcelExp orter; | |||||
| 21 | import jav a.io.ByteA rrayInputS tream; | |||||
| 22 | import jav a.io.IOExc eption; | |||||
| 23 | import jav a.io.Outpu tStream; | |||||
| 24 | import jav a.util.Arr ayList; | |||||
| 25 | import jav a.util.Dat e; | |||||
| 26 | import jav a.util.Has hMap; | |||||
| 27 | import jav a.util.Lin kedHashMap ; | |||||
| 28 | import jav a.util.Lis t; | |||||
| 29 | import jav a.util.Map ; | |||||
| 30 | import jav ax.servlet .ServletEx ception; | |||||
| 31 | import jav ax.servlet .http.Http ServletReq uest; | |||||
| 32 | import jav ax.servlet .http.Http ServletRes ponse; | |||||
| 33 | import jav ax.servlet .http.Http Session; | |||||
| 34 | ||||||
| 35 | /** | |||||
| 36 | * @author Zack Pete rson | |||||
| 37 | */ | |||||
| 38 | public cla ss Expirin gConsentRe portResult s extends ResponseDi spatcherHt tpServlet { | |||||
| 39 | ||||||
| 40 | /** | |||||
| 41 | * Ser ial UID. | |||||
| 42 | */ | |||||
| 43 | privat e static f inal long serialVers ionUID = - 4614454894 945125740L ; | |||||
| 44 | ||||||
| 45 | /** | |||||
| 46 | * Get the Conse nt Managem ent Servic e Helper c lass from Spring. Th e Helper c lass can b e used to access con sent manag ement func tions on | |||||
| 47 | * the server si de. | |||||
| 48 | * | |||||
| 49 | * @re turn helpe r class fo r consent management purposes | |||||
| 50 | */ | |||||
| 51 | public ConsentMa nagementHe lper getCm sHelper() { | |||||
| 52 | fi nal Consen tManagemen tHelper cm sHelper = this.getBe an("cmsHel per", | |||||
| 53 | ConsentM anagementH elper.clas s); | |||||
| 54 | re turn cmsHe lper; | |||||
| 55 | } | |||||
| 56 | ||||||
| 57 | public void expo rtToCsv(fi nal HttpSe rvletReque st request , | |||||
| 58 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, I OException { | |||||
| 59 | ||||||
| 60 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 61 | fi nal List<M ap<String, Object>> results = this.getRe sults( | |||||
| 62 | request. getSession (), new Pa ginator(th is.getRepo rtHelper() .getConsen tDirective sReportCap AsInt())); | |||||
| 63 | ||||||
| 64 | Cs vExporter csvExporte r = new Cs vExporter( ); | |||||
| 65 | ||||||
| 66 | Ma p<String, String> cs vReportMap = new Lin kedHashMap <String, S tring>(); | |||||
| 67 | ||||||
| 68 | cs vReportMap .put("SSN" , "ssn"); | |||||
| 69 | cs vReportMap .put("Pati ent Last N ame", "las tName"); | |||||
| 70 | cs vReportMap .put("Pati ent First Name", "fi rstName"); | |||||
| 71 | cs vReportMap .put("Pati ent Middle Name", "m iddleName" ); | |||||
| 72 | cs vReportMap .put("Opt In Date", "optInDate "); | |||||
| 73 | cs vReportMap .put("Expi ration Dat e", "expir ationDate" ); | |||||
| 74 | cs vReportMap .put("Cons ent Type", "consentT ypeName"); | |||||
| 75 | cs vReportMap .put("Ente red By", " userId"); | |||||
| 76 | cs vReportMap .put("Auth enticating Facility" , "facilit yName"); | |||||
| 77 | ||||||
| 78 | St ring repor tType = "E xpiring_Co nsent_Deta il_Report" ; | |||||
| 79 | tr y { | |||||
| 80 | if (sess ion.getAtt ribute("op tInReport" ).equals(" true")) { | |||||
| 81 | repo rtType = " Opt-In_Pat ients_Deta il_Report" ; | |||||
| 82 | } | |||||
| 83 | } catch (Nul lPointerEx ception e) { | |||||
| 84 | ||||||
| 85 | } | |||||
| 86 | ||||||
| 87 | cs vExporter. exportToCS V(response , reportTy pe, result s, (Linked HashMap<St ring, Stri ng>) csvRe portMap); | |||||
| 88 | } | |||||
| 89 | ||||||
| 90 | public void expo rtToExcel( final Http ServletReq uest reque st, | |||||
| 91 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, I OException { | |||||
| 92 | Ex celGenerat orThread e xGenThread = new Exc elGenerato rThread("e xGenThread "); | |||||
| 93 | ||||||
| 94 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 95 | ||||||
| 96 | // Create a map of key which is based on t he result data key a nd the hea ding value | |||||
| 97 | // The headin g is used to create the column headers a nd the | |||||
| 98 | // key is use d to pull the data f rom the re sults | |||||
| 99 | fi nal Map<St ring, Stri ng> report Map = new LinkedHash Map<String , String>( ); | |||||
| 100 | ||||||
| 101 | // Check to s ee if this is an Opt In Report. The sessi on attribu te gets | |||||
| 102 | // set in opt InReportRe sults.jsp. | |||||
| 103 | bo olean optI nReport; | |||||
| 104 | tr y { | |||||
| 105 | if (sess ion.getAtt ribute("op tInReport" ).equals(" true")) { | |||||
| 106 | optI nReport = true; | |||||
| 107 | exGe nThread.se tTitle("Op t-In Patie nts Detail ed Report" ); | |||||
| 108 | } else { | |||||
| 109 | optI nReport = false; | |||||
| 110 | exGe nThread.se tTitle("Ex piring Con sent Detai led Report "); | |||||
| 111 | } | |||||
| 112 | } catch (Nul lPointerEx ception e) { | |||||
| 113 | optInRep ort = fals e; | |||||
| 114 | exGenThr ead.setTit le("Expiri ng Consent Detailed Report"); | |||||
| 115 | } | |||||
| 116 | ||||||
| 117 | // Generate filters. | |||||
| 118 | fi nal Map<St ring, List <Object>> filterMap = new Link edHashMap< String, Li st<Object> >(); | |||||
| 119 | fi nal Linked HashMap<St ring, Obje ct> filter s = new Li nkedHashMa p<String, Object>(); | |||||
| 120 | // Check if t his this i s an Expir ing Consen t report i n which ca se the | |||||
| 121 | // start date and end d ates MUST be present . Otherwis e this is an Opt In | |||||
| 122 | // report and dates CAN NOT be pro vided. | |||||
| 123 | if (!optInRe port) { | |||||
| 124 | filters. put("Start Date", th is.getRepo rtHelper() .getFormat tedDate((D ate) sessi on.getAttr ibute("sta rtDate"))) ; | |||||
| 125 | filters. put("End D ate", this .getReport Helper().g etFormatte dDate((Dat e) session .getAttrib ute("endDa te"))); | |||||
| 126 | } | |||||
| 127 | fi lters.put( "Entered B y", sessio n.getAttri bute("user Id")); | |||||
| 128 | St ring facil ityNames = ExcelExpo rter.getFa cilitiesFi lter(getFa cilityDAO( ), (String ) session. getAttribu te("statio nNumbers") ); | |||||
| 129 | fi lters.put( "Authentic ating Faci lity", fac ilityNames ); | |||||
| 130 | fi lters.put( "Consent T ype", Exce lExporter. getConsent TypeFilter ((String) session.ge tAttribute ("consentT ypeName")) ); | |||||
| 131 | Ex celExporte r.populate FilterMapF orExport(r equest, fi lters, fil terMap, se ssion.getA ttribute(" patientTyp es").toStr ing()); | |||||
| 132 | ex GenThread. setFilterM ap(filterM ap); | |||||
| 133 | ||||||
| 134 | re portMap.pu t("ssn", " SSN"); | |||||
| 135 | re portMap.pu t("lastNam e", "Patie nt Last Na me"); | |||||
| 136 | re portMap.pu t("firstNa me", "Pati ent First Name"); | |||||
| 137 | re portMap.pu t("middleN ame", "Pat ient Middl e Name"); | |||||
| 138 | re portMap.pu t("optInDa te", "Opt In Date"); | |||||
| 139 | re portMap.pu t("expirat ionDate", "Expiratio n Date"); | |||||
| 140 | re portMap.pu t("consent TypeName", "Consent Type"); | |||||
| 141 | re portMap.pu t("userId" , "Entered By"); | |||||
| 142 | re portMap.pu t("facilit yName", "A uthenticat ing Facili ty"); | |||||
| 143 | ex GenThread. setReportM ap(reportM ap); | |||||
| 144 | ||||||
| 145 | ex GenThread. setExcelEx porter(thi s.getExcel Exporter() ); | |||||
| 146 | ex GenThread. setReportH elper(getR eportHelpe r()); | |||||
| 147 | ex GenThread. setUserId( UserHelper .getUserNa me(request )); | |||||
| 148 | ex GenThread. setDocumen tHelper(ge tDocumentH elper()); | |||||
| 149 | ex GenThread. setPatient ConsentDir DAO(getPat ientCosnen tDirDAO()) ; | |||||
| 150 | ex GenThread. setUserDoc umentDao(g etUserDocu mentDAO()) ; | |||||
| 151 | ||||||
| 152 | // Set searc h attribut es for get ting audit results | |||||
| 153 | ex GenThread. setAttribu tes(mapSes sionAttrib utes(sessi on)); | |||||
| 154 | ||||||
| 155 | ex GenThread. start(); | |||||
| 156 | ||||||
| 157 | th is.forward (request, response, "show"); | |||||
| 158 | } | |||||
| 159 | ||||||
| 160 | privat e Map<Stri ng, Object > mapSessi onAttribut es(HttpSes sion sessi on) { | |||||
| 161 | Ma p<String, Object> at tributes = new HashM ap<String, Object>() ; | |||||
| 162 | ||||||
| 163 | at tributes.p ut("userId ", (String ) session | |||||
| 164 | .get Attribute( "userId")) ; | |||||
| 165 | ||||||
| 166 | Da te startDa te = (Date ) session. getAttribu te("startD ate"); | |||||
| 167 | Da te endDate = (Date) session.ge tAttribute ("endDate" ); | |||||
| 168 | at tributes.p ut("startD ate", star tDate); | |||||
| 169 | at tributes.p ut("endDat e", endDat e); | |||||
| 170 | ||||||
| 171 | at tributes.p ut("statio nNumbers", (String) session.ge tAttribute ("stationN umbers")); | |||||
| 172 | at tributes.p ut("patien tTypes", ( Integer) s ession.get Attribute( "patientTy pes")); | |||||
| 173 | at tributes.p ut("consen tTypeName" , (String) session.g etAttribut e("consent TypeName") ); | |||||
| 174 | at tributes.p ut("includ eUnknownVi sn", Boole an.TRUE.eq uals(sessi on.getAttr ibute("inc ludeUnknow nVisn"))); | |||||
| 175 | // sort | |||||
| 176 | at tributes.p ut("sortVa lue", (Str ing) sessi on | |||||
| 177 | .get Attribute( "inboundSo rtValue")) ; | |||||
| 178 | at tributes.p ut("sortDi rection", (String) s ession | |||||
| 179 | .get Attribute( "inboundSo rtDirectio n")); | |||||
| 180 | ||||||
| 181 | re turn attri butes; | |||||
| 182 | } | |||||
| 183 | ||||||
| 184 | public DocumentH elper getD ocumentHel per() { | |||||
| 185 | re turn this. getBean("a dapterDocu mentHelper ", Documen tHelper.cl ass); | |||||
| 186 | } | |||||
| 187 | ||||||
| 188 | /** | |||||
| 189 | * Get the excel exporter class from Spring. | |||||
| 190 | * | |||||
| 191 | * @re turn the e xcel expor ter object | |||||
| 192 | */ | |||||
| 193 | public ExcelExpo rter getEx celExporte r() { | |||||
| 194 | fi nal ExcelE xporter ex celExporte r = this.g etBean("ex celExporte r", | |||||
| 195 | ExcelExp orter.clas s); | |||||
| 196 | re turn excel Exporter; | |||||
| 197 | } | |||||
| 198 | ||||||
| 199 | public ReportHel per getRep ortHelper( ) { | |||||
| 200 | fi nal Report Helper rep ortHelper = this.get Bean("repo rtHelper", | |||||
| 201 | ReportHe lper.class ); | |||||
| 202 | re turn repor tHelper; | |||||
| 203 | } | |||||
| 204 | ||||||
| 205 | privat e PatientC onsentDirD AO getPati entCosnent DirDAO() { | |||||
| 206 | re turn this. getBean("P atientCons entDirDAO" , PatientC onsentDirD AO.class); | |||||
| 207 | } | |||||
| 208 | ||||||
| 209 | /** | |||||
| 210 | * Gat hers and a ssembles t he informa tion for t he Expirin g Consent Report. | |||||
| 211 | * | |||||
| 212 | * @pa ram sessio n the http session | |||||
| 213 | * @pa ram pagina tor the pa ginator fo r the expi ring conse nt report | |||||
| 214 | * @re turn a lis t of map o bjects wit h patient informatio n for the report | |||||
| 215 | */ | |||||
| 216 | privat e List<Map <String, O bject>> ge tResults(H ttpSession session, | |||||
| 217 | fi nal Pagina tor pagina tor) { | |||||
| 218 | ||||||
| 219 | Pa tientConse ntDirDAO d ao = this. getPatient CosnentDir DAO(); | |||||
| 220 | Da te startDa te = (Date ) session. getAttribu te("startD ate"); | |||||
| 221 | Da te endDate = (Date) session.ge tAttribute ("endDate" ); | |||||
| 222 | fi nal Patien tConsentDi rDAO.Searc hRequest s earchReque st = new P atientCons entDirDAO( ).new Sear chRequest( ); | |||||
| 223 | ||||||
| 224 | se archReques t.startDat e = startD ate; | |||||
| 225 | se archReques t.endDate = endDate; | |||||
| 226 | se archReques t.stationN umbers = ( String) se ssion.getA ttribute(" stationNum bers"); | |||||
| 227 | se archReques t.includeU nknownVisn = Boolean .TRUE.equa ls(session .getAttrib ute("inclu deUnknownV isn")); | |||||
| 228 | se archReques t.consentT ypeName = (String) s ession.get Attribute( "consentTy peName"); | |||||
| 229 | se archReques t.userId = (String) session.ge tAttribute ("userId") ; | |||||
| 230 | ||||||
| 231 | fi nal String inboundSo rtValue = (String) s ession | |||||
| 232 | .getAttr ibute("inb oundSortVa lue"); | |||||
| 233 | fi nal String inboundSo rtDirectio n = (Strin g) session | |||||
| 234 | .getAttr ibute("inb oundSortDi rection"); | |||||
| 235 | ||||||
| 236 | fi nal int pa tientTypes = (Intege r) session .getAttrib ute("patie ntTypes"); | |||||
| 237 | ||||||
| 238 | se archReques t.patientT ypes = pat ientTypes; | |||||
| 239 | ||||||
| 240 | // For use i n sorting results | |||||
| 241 | if (NullChec ker.isNotE mpty(inbou ndSortValu e)) { | |||||
| 242 | searchRe quest.sort By = inbou ndSortValu e; | |||||
| 243 | } | |||||
| 244 | if (NullChec ker.isNotE mpty(inbou ndSortDire ction)) { | |||||
| 245 | searchRe quest.sort Order = in boundSortD irection; | |||||
| 246 | } | |||||
| 247 | ||||||
| 248 | se archReques t.fromPage = paginat or.getCurr entPage(); | |||||
| 249 | se archReques t.recordsP erPage = p aginator.g etRecordsP erPage(); | |||||
| 250 | ||||||
| 251 | fi nal List<M ap<String, Object>> results = new ArrayL ist<Map<St ring, Obje ct>>(); | |||||
| 252 | tr y { | |||||
| 253 | ||||||
| 254 | final Pa tientConse ntDirDAO.S earchRespo nse search Response = dao.find( searchRequ est); | |||||
| 255 | ||||||
| 256 | if (sear chResponse != null) { | |||||
| 257 | ||||||
| 258 | if ( (searchRes ponse.cons ents != nu ll) | |||||
| 259 | && (search Response.c onsents.si ze() > 0)) { | |||||
| 260 | ||||||
| 261 | Long total Rows = sea rchRespons e.count; | |||||
| 262 | session.se tAttribute ("totalRow s", totalR ows); | |||||
| 263 | session.se tAttribute ("expiredN otificatio nLettersMa xTime", Co nstants.ge tExpiredNo tification LettersMax Time()); | |||||
| 264 | session.se tAttribute ("expiredN otificatio nPerLetter Time", Con stants.get ExpiredNot ificationP erLetterTi me()); | |||||
| 265 | int pageNu mber = pag inator.get CurrentPag e(); | |||||
| 266 | int pageSi ze = pagin ator.getRe cordsPerPa ge(); | |||||
| 267 | int toPage = 0; | |||||
| 268 | boolean ne xtDisabled = false; | |||||
| 269 | ||||||
| 270 | if (pageNu mber <= 0) { | |||||
| 271 | toPage = pageSiz e; | |||||
| 272 | } else { | |||||
| 273 | toPage = (pageNu mber + 1) * pageSize ; | |||||
| 274 | } | |||||
| 275 | if (null ! = totalRow s) { | |||||
| 276 | if (to Page == to talRows.in tValue()) { | |||||
| 277 | ne xtDisabled = true; | |||||
| 278 | } | |||||
| 279 | } | |||||
| 280 | paginator. setNextDis abled(next Disabled); | |||||
| 281 | session.se tAttribute ("nextDisa bled", nex tDisabled) ; | |||||
| 282 | ||||||
| 283 | for (Detai ledConsent Directive detailedCo nsentRefer ence : sea rchRespons e.consents ) { | |||||
| 284 | final Map<String , Object> resultMap = new Hash Map<String , Object>( ); | |||||
| 285 | if (de tailedCons entReferen ce != null ) { | |||||
| 286 | Re portDataPr ocessor.ad dSsnToResu ltMap(resu ltMap, det ailedConse ntReferenc e.getSsn() ); | |||||
| 287 | re sultMap.pu t("lastNam e", detail edConsentR eference.g etLastName ()); | |||||
| 288 | re sultMap.pu t("firstNa me", detai ledConsent Reference. getFirstNa me()); | |||||
| 289 | re sultMap.pu t("middleN ame", deta iledConsen tReference .getMiddle Name()); | |||||
| 290 | St ring conse ntTypeName = detaile dConsentRe ference.ge tOptinCons entType(). getName(); | |||||
| 291 | if (consentT ypeName.co ntains("Nw HIN")) { | |||||
| 292 | consentT ypeName = consentTyp eName.repl ace("NwHIN ", Constan ts.getOrga nizationNa me()); | |||||
| 293 | } | |||||
| 294 | re sultMap.pu t("consent TypeName", consentTy peName); | |||||
| 295 | re sultMap.pu t("optInDa te", detai ledConsent Reference. getOptinDa te()); | |||||
| 296 | re sultMap.pu t("expirat ionDate", detailedCo nsentRefer ence.getEx pirationDa te()); | |||||
| 297 | re sultMap.pu t("facilit yName", de tailedCons entReferen ce.getFaci lityName() ); | |||||
| 298 | re sultMap.pu t("userId" , detailed ConsentRef erence.get UserId()); | |||||
| 299 | re sults.add( resultMap) ; | |||||
| 300 | } | |||||
| 301 | } | |||||
| 302 | } | |||||
| 303 | } | |||||
| 304 | } catch (fin al Excepti on ex) { | |||||
| 305 | throw ne w RuntimeE xception(e x); | |||||
| 306 | } | |||||
| 307 | ||||||
| 308 | re turn resul ts; | |||||
| 309 | } | |||||
| 310 | ||||||
| 311 | privat e boolean isPaginato rPresent(H ttpSession session) { | |||||
| 312 | re turn !Null Checker.is NullOrEmpt y(session. getAttribu te("pagina tor")); | |||||
| 313 | } | |||||
| 314 | ||||||
| 315 | public void next (HttpServl etRequest request, | |||||
| 316 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, | |||||
| 317 | IO Exception { | |||||
| 318 | Ht tpSession session = request.ge tSession(f alse); | |||||
| 319 | if (this.isP aginatorPr esent(sess ion)) { | |||||
| 320 | Paginato r paginato r = (Pagin ator) sess ion | |||||
| 321 | .get Attribute( "paginator "); | |||||
| 322 | paginato r.next(req uest); | |||||
| 323 | session. setAttribu te("pagina tor", pagi nator); | |||||
| 324 | session. setAttribu te("expiri ngConsentR eportResul ts", | |||||
| 325 | this .getResult s(session, paginator )); | |||||
| 326 | ||||||
| 327 | this.for ward(reque st, respon se, "show" ); | |||||
| 328 | } else { | |||||
| 329 | this.for ward(reque st, respon se, "nosho w"); | |||||
| 330 | } | |||||
| 331 | } | |||||
| 332 | ||||||
| 333 | public void prev (HttpServl etRequest request, | |||||
| 334 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, | |||||
| 335 | IO Exception { | |||||
| 336 | Ht tpSession session = request.ge tSession(f alse); | |||||
| 337 | if (this.isP aginatorPr esent(sess ion)) { | |||||
| 338 | Paginato r paginato r = (Pagin ator) sess ion | |||||
| 339 | .get Attribute( "paginator "); | |||||
| 340 | paginato r.previous (request); | |||||
| 341 | session. setAttribu te("pagina tor", pagi nator); | |||||
| 342 | session. setAttribu te("expiri ngConsentR eportResul ts", | |||||
| 343 | this .getResult s(session, paginator )); | |||||
| 344 | this.for ward(reque st, respon se, "show" ); | |||||
| 345 | } else { | |||||
| 346 | this.for ward(reque st, respon se, "nosho w"); | |||||
| 347 | } | |||||
| 348 | } | |||||
| 349 | ||||||
| 350 | @Overr ide | |||||
| 351 | protec ted void u nspecified (final Htt pServletRe quest requ est, | |||||
| 352 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, | |||||
| 353 | IO Exception { | |||||
| 354 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 355 | ||||||
| 356 | // sort | |||||
| 357 | fi nal String expiringC onsentSort Value = re quest | |||||
| 358 | .getPara meter("inb oundSortVa lue"); | |||||
| 359 | fi nal String expiringC onsentSort Direction = request | |||||
| 360 | .getPara meter("inb oundSortDi rection"); | |||||
| 361 | se ssion.setA ttribute(" inboundSor tValue", e xpiringCon sentSortVa lue); | |||||
| 362 | se ssion.setA ttribute(" inboundSor tDirection ", | |||||
| 363 | expiring ConsentSor tDirection ); | |||||
| 364 | ||||||
| 365 | if (this.isP aginatorPr esent(sess ion)) { | |||||
| 366 | Paginato r paginato r = (Pagin ator) sess ion.getAtt ribute("pa ginator"); | |||||
| 367 | if (Null Checker.is Empty(pagi nator)) { | |||||
| 368 | pagi nator = ne w Paginato r(0); | |||||
| 369 | sess ion.setAtt ribute("pa ginator", paginator) ; | |||||
| 370 | } | |||||
| 371 | paginato r.reset(); | |||||
| 372 | session. setAttribu te("expiri ngConsentR eportResul ts", | |||||
| 373 | this .getResult s(session, paginator )); | |||||
| 374 | this.for ward(reque st, respon se, "show" ); | |||||
| 375 | } else { | |||||
| 376 | this.for ward(reque st, respon se, "nosho w"); | |||||
| 377 | } | |||||
| 378 | } | |||||
| 379 | ||||||
| 380 | public void view (HttpServl etRequest request, | |||||
| 381 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, | |||||
| 382 | IO Exception { | |||||
| 383 | Ht tpSession session = request.ge tSession(f alse); | |||||
| 384 | fi nal String icn = req uest.getPa rameter("i cn"); | |||||
| 385 | fi nal String documentU niqueId = request | |||||
| 386 | .getPara meter("exp iringConse ntUniqueId "); | |||||
| 387 | fi nal String styleShee tViewType = request | |||||
| 388 | .getPara meter("sty leSheetVie wType"); | |||||
| 389 | ||||||
| 390 | St ring docum ent = null ; | |||||
| 391 | tr y { | |||||
| 392 | document = this.ge tDocumentH elper().ge tDocument( icn, | |||||
| 393 | docu mentUnique Id, UserHe lper.getUs erName(req uest), | |||||
| 394 | this .getCmsHel per().getC ompleteHom eCommunity Id()); | |||||
| 395 | } catch (fin al Adapter Exception ex) { | |||||
| 396 | throw ne w ServletE xception(e x); | |||||
| 397 | } | |||||
| 398 | ||||||
| 399 | se ssion.setA ttribute(" icn", icn) ; | |||||
| 400 | se ssion.setA ttribute(" documentUn iqueId", d ocumentUni queId); | |||||
| 401 | se ssion.setA ttribute(" document", document) ; | |||||
| 402 | se ssion.setA ttribute(" isXmlViewE nabled", t his.getDoc umentHelpe r() | |||||
| 403 | .isXmlVi ewEnabled( )); | |||||
| 404 | ||||||
| 405 | if ("xml".eq uals(style SheetViewT ype)) { | |||||
| 406 | document = documen t | |||||
| 407 | .rep laceAll( | |||||
| 408 | "<?xml-sty lesheet ty pe=\"text/ xsl\" href =\"CCD.xsl \"?>", | |||||
| 409 | ""); | |||||
| 410 | response .setConten tType("tex t/xml;char set=UTF-8" ); | |||||
| 411 | response .getWriter ().write(d ocument); | |||||
| 412 | } else { | |||||
| 413 | // Updat e session in the doc ument | |||||
| 414 | final St ring html = this.get DocumentHe lper().get Html(docum ent, | |||||
| 415 | styl eSheetView Type); | |||||
| 416 | ||||||
| 417 | session. setAttribu te("update dDocument" , html); | |||||
| 418 | this.for ward(reque st, respon se, "showI nboundDocu mentReport Document") ; | |||||
| 419 | } | |||||
| 420 | } | |||||
| 421 | ||||||
| 422 | public void down load(final HttpServl etRequest request, | |||||
| 423 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, | |||||
| 424 | IO Exception { | |||||
| 425 | ||||||
| 426 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 427 | Da te startDa te = (Date ) session. getAttribu te("startD ate"); | |||||
| 428 | Da te endDate = (Date) session.ge tAttribute ("endDate" ); | |||||
| 429 | St ring conse ntTypeName = (String ) session. getAttribu te("consen tTypeName" ); | |||||
| 430 | St ring userI d = (Strin g) session .getAttrib ute("userI d"); | |||||
| 431 | fi nal int pa tientTypes = (Intege r) session .getAttrib ute("patie ntTypes"); | |||||
| 432 | ||||||
| 433 | St ring stati onNumber = (String) session.ge tAttribute ("stationN umbers"); | |||||
| 434 | ||||||
| 435 | Co nsentDirec tiveDetail edExpirati onRequest expiration Request | |||||
| 436 | = new Co nsentDirec tiveDetail edExpirati onRequest( ); | |||||
| 437 | ex pirationRe quest.setS tartDate(s tartDate); | |||||
| 438 | ex pirationRe quest.setE ndDate(end Date); | |||||
| 439 | ex pirationRe quest.setF acilitySta tion(stati onNumber); | |||||
| 440 | ex pirationRe quest.setC onsentType Name(conse ntTypeName ); | |||||
| 441 | ex pirationRe quest.setU serId(user Id); | |||||
| 442 | ex pirationRe quest.setP atientType s(patientT ypes); | |||||
| 443 | ||||||
| 444 | St ring templ ate = this .getMailTe mplateDAO( ).getByLet terType(4L ).getText( ); | |||||
| 445 | ||||||
| 446 | ex pirationRe quest.setT emplate(te mplate); | |||||
| 447 | ||||||
| 448 | fi nal ByteAr rayInputSt ream byteI nputStream | |||||
| 449 | = this.g etCmsHelpe r().getExp iringConse ntReportLe tters(expi rationRequ est); | |||||
| 450 | ||||||
| 451 | re sponse.set ContentTyp e("applica tion/pdf") ; | |||||
| 452 | re sponse.add Header("Co ntent-Disp osition", "attachmen t; filenam e=patient_ letters.pd f"); | |||||
| 453 | ||||||
| 454 | Ou tputStream responseO utStream = response. getOutputS tream(); | |||||
| 455 | ||||||
| 456 | by te[] buffe r = new by te[4096]; | |||||
| 457 | in t bytesRea d; | |||||
| 458 | in t totalByt es = 0; | |||||
| 459 | ||||||
| 460 | wh ile ((byte sRead = by teInputStr eam.read(b uffer)) != -1) { | |||||
| 461 | response OutStream. write(buff er, 0, byt esRead); | |||||
| 462 | totalByt es += byte sRead; | |||||
| 463 | } | |||||
| 464 | ||||||
| 465 | re sponse.set ContentLen gth(totalB ytes); | |||||
| 466 | ||||||
| 467 | by teInputStr eam.close( ); | |||||
| 468 | re sponseOutS tream.flus h(); | |||||
| 469 | ||||||
| 470 | th is.forward (request, response, "success") ; | |||||
| 471 | } | |||||
| 472 | ||||||
| 473 | privat e Facility DAO getFac ilityDAO() { | |||||
| 474 | re turn this. getBean("F acilityDAO ", Facilit yDAO.class ); | |||||
| 475 | } | |||||
| 476 | ||||||
| 477 | privat e MailTemp lateDAO ge tMailTempl ateDAO() { | |||||
| 478 | re turn this. getBean("M ailTemplat eDAO", Mai lTemplateD AO.class); | |||||
| 479 | } | |||||
| 480 | ||||||
| 481 | privat e UserDocu mentDAO ge tUserDocum entDAO() { | |||||
| 482 | re turn this. getBean("U serDocumen tDAO", Use rDocumentD AO.class); | |||||
| 483 | } | |||||
| 484 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.