Produced by Araxis Merge on 12/5/2017 12:06:48 PM Central Standard 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 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ROIWebApp\main\src\java\gov\va\med\imaging\roi\web | ROIDisclosureServlet.java | Mon Dec 4 21:35:06 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ROIWebApp\main\src\java\gov\va\med\imaging\roi\web | ROIDisclosureServlet.java | Mon Dec 4 22:05:30 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 402 |
| Changed | 2 | 4 |
| Inserted | 0 | 0 |
| 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 | /** | |
| 2 | * | |
| 3 | Package: MAG - Vis tA Imaging | |
| 4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
| 5 | Date Cre ated: Apr 3, 2012 | |
| 6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
| 7 | Developer:
|
|
| 8 | Descript ion: | |
| 9 | ||
| 10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 11 | ;; Property of the US Government . | |
| 12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
| 13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
| 14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
| 15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
| 16 | ;; telephon e (301) 73 4-0100. | |
| 17 | ;; | |
| 18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
| 19 | ;; a Class I I medical device. A s such, it may not b e changed | |
| 20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
| 21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
| 22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
| 23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 24 | ||
| 25 | */ | |
| 26 | package go v.va.med.i maging.roi .web; | |
| 27 | ||
| 28 | import gov .va.med.Pa tientIdent ifier; | |
| 29 | import gov .va.med.Pa tientIdent ifierType; | |
| 30 | import gov .va.med.im aging.GUID ; | |
| 31 | import gov .va.med.im aging.chan nels.Abstr actBytePum p.TRANSFER _TYPE; | |
| 32 | import gov .va.med.im aging.chan nels.ByteS treamPump; | |
| 33 | import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on; | |
| 34 | import gov .va.med.im aging.core .interface s.exceptio ns.ImageNo tFoundExce ption; | |
| 35 | import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception; | |
| 36 | import gov .va.med.im aging.core .interface s.exceptio ns.Securit yCredentia lsExpiredE xception; | |
| 37 | import gov .va.med.im aging.roi. ROIFacadeC ontext; | |
| 38 | import gov .va.med.im aging.tran sactioncon text.Trans actionCont ext; | |
| 39 | import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ; | |
| 40 | ||
| 41 | import jav a.io.IOExc eption; | |
| 42 | import jav a.io.Input Stream; | |
| 43 | import jav a.io.Outpu tStream; | |
| 44 | ||
| 45 | import jav ax.servlet .ServletEx ception; | |
| 46 | import jav ax.servlet .http.Http Servlet; | |
| 47 | import jav ax.servlet .http.Http ServletReq uest; | |
| 48 | import jav ax.servlet .http.Http ServletRes ponse; | |
| 49 | ||
| 50 | import org .apache.lo gging.log4 j.LogManag er; | |
| 51 | import org .apache.lo gging.log4 j.Logger; | |
| 52 | ||
| 53 | /** | |
| 54 | * @author
|
|
| 55 | * | |
| 56 | */ | |
| 57 | public cla ss ROIDisc losureServ let | |
| 58 | extends Ht tpServlet | |
| 59 | { | |
| 60 | pr ivate stat ic final l ong serial VersionUID = -596012 6495688450 60L; | |
| 61 | pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(ROID isclosureS ervlet.cla ss); | |
| 62 | pr otected Lo gger getLo gger() | |
| 63 | { | |
| 64 | retu rn logger; | |
| 65 | } | |
| 66 | ||
| 67 | pr ivate fina l String z ipApplicat ionMimeTyp e = "appli cation/zip "; | |
| 68 | ||
| 69 | @O verride | |
| 70 | pr otected vo id doGet(H ttpServlet Request re quest, Htt pServletRe sponse res ponse) | |
| 71 | th rows Servl etExceptio n, IOExcep tion | |
| 72 | { | |
| 73 | Tran sactionCon text trans actionCont ext = Tran sactionCon textFactor y.get(); | |
| 74 | tran sactionCon text.setRe questType( "ROI WebAp p V1 getDi sclosure") ; | |
| 75 | Stri ng patient Id = reque st.getPara meter("pat ientId"); | |
| 76 | Stri ng patient Identifier TypeString = request .getParame ter("patie ntIdentifi erType"); | |
| 77 | Pati entIdentif ierType pa tientIdent ifierType = null; | |
| 78 | if(p atientIden tifierType String != null && pa tientIdent ifierTypeS tring.leng th() > 0) | |
| 79 | patien tIdentifie rType = Pa tientIdent ifierType. valueOf(pa tientIdent ifierTypeS tring); | |
| 80 | Pati entIdentif ier patien tIdentifie r = null; | |
| 81 | if(p atientIden tifierType != null) | |
| 82 | patien tIdentifie r = new Pa tientIdent ifier(pati entId, pat ientIdenti fierType); | |
| 83 | else | |
| 84 | { | |
| 85 | // ass umes that patientId contains t he identif ier type, if not the n ICN is a ssumed | |
| 86 | patien tIdentifie r = Patien tIdentifie r.fromStri ng(patient Id); | |
| 87 | } | |
| 88 | Stri ng guidStr ing = requ est.getPar ameter("gu id"); | |
| 89 | ||
| 90 | GUID guid = ne w GUID(gui dString); | |
| 91 | ||
| 92 | tran sactionCon text.setPa tientID(pa tientId); | |
| 93 | tran sactionCon text.setUr n(guidStri ng); | |
| 94 | tran sactionCon text.setQu eryFilter( "n/a"); | |
| 95 | resp onse.setCo ntentType( zipApplica tionMimeTy pe); | |
| 96 | resp onse.setHe ader("Cont ent-Dispos ition", "a ttachment; filename= \"" + guid String + " .zip" + "\ ""); | |
| 97 | Outp utStream o utStream = response. getOutputS tream(); | |
| 98 | ||
| 99 | try | |
| 100 | { | |
| 101 | long b ytesTransf erred = st reamROIDis closure(pa tientIdent ifier, gui d, outStre am); | |
| 102 | transa ctionConte xt.setEntr iesReturne d( bytesTr ansferred= =0 ? 0 : 1 ); | |
| 103 | transa ctionConte xt.setFaca deBytesSen t(bytesTra nsferred); | |
| 104 | transa ctionConte xt.setResp onseCode(H ttpServlet Response.S C_OK + "") ; | |
| 105 | } | |
| 106 | catc h(ImageSer vletExcept ion isX) | |
| 107 | { | |
| 108 | String msg = isX .getMessag e(); | |
| 109 | logger .error(msg ); | |
| 110 | transa ctionConte xt.setResp onseCode(i sX.getResp onseCode() + ""); | |
| 111 | transa ctionConte xt.setErro rMessage(m sg); | |
| 112 | respon se.sendErr or(isX.get ResponseCo de(), isX. getMessage ()); | |
| 113 | } | |
| 114 | catc h(Security Credential sExpiredEx ception sc eX) | |
| 115 | { | |
| 116 | String msg = "Se curityCred entials ex pired: " + sceX.getM essage(); | |
| 117 | // log ging of er ror alread y done | |
| 118 | // jus t need to set approp riate erro r code | |
| 119 | transa ctionConte xt.setResp onseCode(H ttpServlet Response.S C_PRECONDI TION_FAILE D + ""); | |
| 120 | transa ctionConte xt.setErro rMessage(m sg); | |
| 121 | respon se.sendErr or(HttpSer vletRespon se.SC_PREC ONDITION_F AILED, msg ); | |
| 122 | } | |
| 123 | } | |
| 124 | ||
| 125 | pr otected lo ng streamR OIDisclosu re( | |
| 126 | Patien tIdentifie r patientI dentifier, | |
| 127 | GUID g uid, | |
| 128 | Output Stream out Stream) | |
| 129 | th rows IOExc eption, Se curityCred entialsExp iredExcept ion, Image ServletExc eption | |
| 130 | { | |
| 131 | Tran sactionCon text trans actionCont ext = Tran sactionCon textFactor y.get(); | |
| 132 | long bytesTran sferred = 0; | |
| 133 | try | |
| 134 | { | |
| 135 | InputS tream roiD isclosureS tream = | |
| 136 | ROIFacad eContext.g etRoiFacad eRouter(). getROIDisc losure(pat ientIdenti fier, guid ); | |
| 137 | ||
| 138 | if (ro iDisclosur eStream == null) | |
| 139 | { | |
| 140 | String m essage = " No ROI dis closure fo r [" + gui d + "]."; | |
| 141 | Transact ionContext Factory.ge t().setErr orMessage( message); | |
| 142 | getLogge r().debug( message); | |
| 143 | throw ne w ImageSer vletExcept ion(HttpSe rvletRespo nse.SC_NOT _FOUND, me ssage); | |
| 144 | } | |
| 145 | else // SUCCE SS (SC_OK) -- 200 | |
| 146 | { | |
| 147 | String m essage = " Pushing RO I disclosu re for [" + guid + " ]."; | |
| 148 | getLogge r().debug( message); | |
| 149 | ||
| 150 | ByteStre amPump pum p = ByteSt reamPump.g etByteStre amPump(TRA NSFER_TYPE .FileToNet work); | |
| 151 | ||
| 152 | bytesTra nsferred = pump.xfer (roiDisclo sureStream , outStrea m); | |
| 153 | roiDiscl osureStrea m.close(); | |
| 154 | } | |
| 155 | } | |
| 156 | catc h (ImageNo tFoundExce ption inle ) | |
| 157 | { | |
| 158 | String message = "ROI disc losure for [" + guid + "] not found."; | |
| 159 | getLog ger().debu g(message) ; | |
| 160 | transa ctionConte xt.setExce ptionClass Name(inle. getClass() .getSimple Name()); | |
| 161 | throw new ImageS ervletExce ption(Http ServletRes ponse.SC_N OT_FOUND, message); | |
| 162 | } | |
| 163 | catc h(MethodEx ception mX ) | |
| 164 | { | |
| 165 | String message = | |
| 166 | "Interna l server e rror in ge tting ROI disclosure for [" + guid + "] \n" + | |
| 167 | mX.getMe ssage(); | |
| 168 | getLog ger().debu g(message) ; | |
| 169 | transa ctionConte xt.setExce ptionClass Name(mX.ge tClass().g etSimpleNa me()); | |
| 170 | throw new ImageS ervletExce ption(Http ServletRes ponse.SC_I NTERNAL_SE RVER_ERROR , message) ; | |
| 171 | } | |
| 172 | catc h(Connecti onExceptio n mX) | |
| 173 | { | |
| 174 | String message = | |
| 175 | "Interna l server e rror in ge tting ROI disclosure for [" + guid + "] \n" + | |
| 176 | mX.getMe ssage(); | |
| 177 | getLog ger().debu g(message) ; | |
| 178 | transa ctionConte xt.setExce ptionClass Name(mX.ge tClass().g etSimpleNa me()); | |
| 179 | throw new ImageS ervletExce ption(Http ServletRes ponse.SC_B AD_GATEWAY , message) ; | |
| 180 | } | |
| 181 | retu rn bytesTr ansferred; | |
| 182 | } | |
| 183 | ||
| 184 | ||
| 185 | pu blic class ImageServ letExcepti on | |
| 186 | ex tends Exce ption | |
| 187 | { | |
| 188 | priv ate static final lon g serialVe rsionUID = 1L; | |
| 189 | priv ate final int respon seCode; | |
| 190 | ||
| 191 | Imag eServletEx ception(in t response Code, Stri ng message ) | |
| 192 | { | |
| 193 | supe r(message) ; | |
| 194 | this .responseC ode = resp onseCode; | |
| 195 | } | |
| 196 | ||
| 197 | publ ic int get ResponseCo de() | |
| 198 | { | |
| 199 | retu rn respons eCode; | |
| 200 | } | |
| 201 | } | |
| 202 | ||
| 203 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.