Produced by Araxis Merge on 12/5/2017 12:06:34 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\AwivClientWebApp\main\src\java\gov\va\med\imaging\awiv\client | AwivHelper.java | Mon Dec 4 21:35:14 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\AwivClientWebApp\main\src\java\gov\va\med\imaging\awiv\client | AwivHelper.java | Mon Dec 4 21:56:47 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 736 |
| 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: Jan 19, 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.awi v.client; | |
| 27 | ||
| 28 | import jav a.util.Dat e; | |
| 29 | import org .apache.lo gging.log4 j.LogManag er; | |
| 30 | import org .apache.lo gging.log4 j.Logger; | |
| 31 | ||
| 32 | import com .google.gw t.user.cli ent.Cookie s; | |
| 33 | import com .google.gw t.user.cli ent.Window ; | |
| 34 | import com .google.gw t.user.cli ent.Window .Location; | |
| 35 | import com .google.gw t.user.cli ent.rpc.As yncCallbac k; | |
| 36 | import com .smartgwt. client.uti l.SC; | |
| 37 | ||
| 38 | import gov .va.med.im aging.awiv .business. AwivServer Informatio n; | |
| 39 | import gov .va.med.im aging.awiv .business. AwivTimer; | |
| 40 | import gov .va.med.im aging.awiv .business. AwivUserIn formation; | |
| 41 | import gov .va.med.im aging.awiv .client.ev ents.AwivT imerRunEve nt; | |
| 42 | import gov .va.med.im aging.awiv .client.ui .widgets.A wivConstan ts; | |
| 43 | import gov .va.med.im aging.awiv .client.ui .widgets.A wivExcepti onHandler; | |
| 44 | import gov .va.med.im aging.awiv .client.ui .widgets.A wivViewerM anager; | |
| 45 | import gov .va.med.im aging.awiv .client.ui .widgets.J avaScriptM ethods; | |
| 46 | import gov .va.med.im aging.awiv .client.ui .widgets.d ialogs.Ses sionExpire dDialog; | |
| 47 | import gov .va.med.im aging.awiv .client.ui .widgets.d ialogs.Tim eoutWarnin gDialog; | |
| 48 | ||
| 49 | /** | |
| 50 | * @author
|
|
| 51 | * | |
| 52 | */ | |
| 53 | public cla ss AwivHel per | |
| 54 | { | |
| 55 | pr ivate stat ic Logger logger = L ogManager. getLogger( ""); | |
| 56 | pr ivate stat ic AwivSer verInforma tion awivS erverInfor mation = n ull; | |
| 57 | ||
| 58 | /* * | |
| 59 | * This is t he proper way to rel oad the AW IV and for ce the use r to authe nticate ag ain. | |
| 60 | * This ensu res the AW IV is clos ed before refreshing the page | |
| 61 | * / | |
| 62 | pu blic stati c void rel oadAwiv() | |
| 63 | { | |
| 64 | Awiv ViewerMana ger.closeA wivViewer( ); | |
| 65 | Java ScriptMeth ods.reload Page(); | |
| 66 | } | |
| 67 | ||
| 68 | // private st atic Timer sessionTi mer = null ; | |
| 69 | pr ivate stat ic AwivTim er session Timer = nu ll; | |
| 70 | ||
| 71 | pr ivate stat ic void st artSession Timer() | |
| 72 | { | |
| 73 | /* | |
| 74 | sess ionTimer = new Timer () | |
| 75 | { | |
| 76 | @Overr ide | |
| 77 | public void run( ) | |
| 78 | { | |
| 79 | TimeoutW arningDial og.show(); | |
| 80 | } | |
| 81 | };*/ | |
| 82 | sess ionTimer = new AwivT imer(new A wivTimerRu nEvent() | |
| 83 | { | |
| 84 | ||
| 85 | @Overr ide | |
| 86 | public void OnTi merRun() | |
| 87 | { | |
| 88 | TimeoutW arningDial og.show(); | |
| 89 | } | |
| 90 | }); | |
| 91 | ||
| 92 | int timeout = 1000 * 60 * getSessi onTimeout( ); | |
| 93 | logg er.info("R estarting session ti mer to '" + timeout + "' ms"); | |
| 94 | sess ionTimer.s cheduleRep eating(tim eout); | |
| 95 | } | |
| 96 | ||
| 97 | pu blic stati c void res etSessionT imer() | |
| 98 | { | |
| 99 | stop SessionTim er(); | |
| 100 | star tSessionTi mer(); | |
| 101 | } | |
| 102 | ||
| 103 | pu blic stati c void sto pSessionTi mer() | |
| 104 | { | |
| 105 | if(s essionTime r != null) | |
| 106 | { | |
| 107 | sessio nTimer.can cel(); | |
| 108 | } | |
| 109 | sess ionTimer = null; | |
| 110 | } | |
| 111 | ||
| 112 | /* * | |
| 113 | * This term inates the session o n the serv er forcing a re-auth entication | |
| 114 | * / | |
| 115 | pu blic stati c void log out() | |
| 116 | { | |
| 117 | Awiv ViewerMana ger.closeA wivViewer( ); | |
| 118 | // c all servic e to inval idate the session | |
| 119 | clea rUserCooki e(); | |
| 120 | User SessionSer viceAsync userServic e = UserSe ssionServi ce.Util.ge tInstance( ); | |
| 121 | user Service.lo gout(new A syncCallba ck<Boolean >() | |
| 122 | { | |
| 123 | @Overr ide | |
| 124 | public void onFa ilure(Thro wable arg0 ) | |
| 125 | { | |
| 126 | //Window .alert("Er ror callin g logout o n server, " + arg0.g etMessage( )); | |
| 127 | // don't do anythi ng, just f orce a log out | |
| 128 | stopSess ionTimer() ; | |
| 129 | reloadAw iv(); | |
| 130 | } | |
| 131 | ||
| 132 | @Overr ide | |
| 133 | public void onSu ccess(Bool ean result ) | |
| 134 | { | |
| 135 | // logou t was succ essful | |
| 136 | stopSess ionTimer() ; | |
| 137 | reloadAw iv(); | |
| 138 | } | |
| 139 | }); | |
| 140 | } | |
| 141 | ||
| 142 | pu blic stati c void cle arUserCook ie() | |
| 143 | { | |
| 144 | //Co okies.remo veCookie(A wivConstan ts.userCoo kieName); | |
| 145 | // s et the coo kie with n o value an d expired in 1970 | |
| 146 | Cook ies.setCoo kie(AwivCo nstants.us erCookieNa me, "", ne w Date(0), null, "/A wiv", fals e); | |
| 147 | } | |
| 148 | ||
| 149 | /* * | |
| 150 | * This meth od pings t he server to keep th e session alive | |
| 151 | * @deprecat ed This me thod is no longer ne eded becau se session s are no l onger used | |
| 152 | * / | |
| 153 | pu blic stati c void pin gServer() | |
| 154 | { | |
| 155 | User SessionSer viceAsync userServic e = UserSe ssionServi ce.Util.ge tInstance( ); | |
| 156 | Awiv Helper.res etSessionT imer(); | |
| 157 | user Service.is SessionSti llActive(n ew AsyncCa llback<Boo lean>() | |
| 158 | { | |
| 159 | @Overr ide | |
| 160 | public void onFa ilure(Thro wable arg0 ) | |
| 161 | { | |
| 162 | if(!Awiv ExceptionH andler.han dleService Exception( arg0)) | |
| 163 | { | |
| 164 | logger.err or("Error determinin g if sessi on is stil l active, " + arg0.g etMessage( )); | |
| 165 | //Window.a lert("Erro r determin ing if ses sion is st ill active , " + arg0 .getMessag e()); | |
| 166 | stopSessio nTimer(); | |
| 167 | AwivViewer Manager.cl oseAwivVie wer(); | |
| 168 | SessionExp iredDialog .DisplaySe ssionExpir edDialog() ; | |
| 169 | } | |
| 170 | } | |
| 171 | ||
| 172 | @Overr ide | |
| 173 | public void onSu ccess(Bool ean result ) | |
| 174 | { | |
| 175 | if(resul t) | |
| 176 | { | |
| 177 | // all is fine, do n othing | |
| 178 | } | |
| 179 | else | |
| 180 | { | |
| 181 | stopSessio nTimer(); | |
| 182 | AwivViewer Manager.cl oseAwivVie wer(); | |
| 183 | SessionExp iredDialog .DisplaySe ssionExpir edDialog() ; | |
| 184 | } | |
| 185 | } | |
| 186 | }); | |
| 187 | } | |
| 188 | ||
| 189 | pu blic stati c boolean isDebugMod e() | |
| 190 | { | |
| 191 | Stri ng debugPa rameter = Window.Loc ation.getP arameter(" debug"); | |
| 192 | bool ean debugE nabled = ( debugParam eter != nu ll && "tru e".equalsI gnoreCase( debugParam eter)); | |
| 193 | retu rn debugEn abled; | |
| 194 | } | |
| 195 | ||
| 196 | /* * | |
| 197 | * Determine if the us er has the necessary keys/perm ission to view patie nt images. | |
| 198 | * @param aw ivUserInfo rmation | |
| 199 | * @return | |
| 200 | * / | |
| 201 | pu blic stati c boolean canUserVie wPatients( AwivUserIn formation awivUserIn formation) | |
| 202 | { | |
| 203 | if(a wivUserInf ormation ! = null) | |
| 204 | { | |
| 205 | if(awi vUserInfor mation.isC laimsAuthe ntication( )) | |
| 206 | { | |
| 207 | logger.i nfo("User is authent icated to the CLAIMS system, a llowed to view patie nt without security keys"); | |
| 208 | return t rue; | |
| 209 | } | |
| 210 | ||
| 211 | // if the user h as the MAG SYSTEM ke y they can view imag es regardl ess of the photo ID key | |
| 212 | if(awi vUserInfor mation.isI magingSyst emUser()) | |
| 213 | return t rue; | |
| 214 | ||
| 215 | // if the user h as this ke y then the y can only view the photo ID i mage | |
| 216 | if(awi vUserInfor mation.use rHasKey(Aw ivConstant s.magPatPh otoOnlySec urityKey)) | |
| 217 | { | |
| 218 | // user has the ke y | |
| 219 | logger.i nfo("User has the '" + AwivCon stants.mag PatPhotoOn lySecurity Key + "', cannot vie w patient images"); | |
| 220 | return f alse; | |
| 221 | } | |
| 222 | return true; | |
| 223 | } | |
| 224 | logg er.info("N ull user i nformation when dete rmining if user can view patie nt - not s ure how th at happene d."); | |
| 225 | retu rn false; | |
| 226 | } | |
| 227 | ||
| 228 | /* * | |
| 229 | * Get the t imeout for the sessi on | |
| 230 | * @return | |
| 231 | * / | |
| 232 | pu blic stati c int getS essionTime out() | |
| 233 | { | |
| 234 | if(a wivServerI nformation == null) | |
| 235 | return AwivConst ants.idleT imeout; | |
| 236 | retu rn awivSer verInforma tion.getId leTimeoutM inutes(); | |
| 237 | } | |
| 238 | ||
| 239 | pu blic stati c void set AwivServer Informatio n(AwivServ erInformat ion awivSe rverInform ation) | |
| 240 | { | |
| 241 | Awiv Helper.awi vServerInf ormation = awivServe rInformati on; | |
| 242 | logg er.info("I dle timeou t set to ' " + AwivHe lper.awivS erverInfor mation.get IdleTimeou tMinutes() + "' minu tes."); | |
| 243 | } | |
| 244 | ||
| 245 | /* * | |
| 246 | * Determine if the us er is usin g an IE br owser | |
| 247 | * @return | |
| 248 | * / | |
| 249 | pu blic stati c boolean isBrowserI E() | |
| 250 | { | |
| 251 | Stri ng userAge nt = JavaS criptMetho ds.getUser Agent(); | |
| 252 | if(u serAgent.c ontains(Aw ivConstant s.ieUserAg ent)) | |
| 253 | { | |
| 254 | return true; | |
| 255 | } | |
| 256 | retu rn false; | |
| 257 | } | |
| 258 | ||
| 259 | /* * | |
| 260 | * Warning m essage to show to th e user whe n they try to view a study wit h an unsup ported bro wser | |
| 261 | * / | |
| 262 | pu blic stati c void dis playUnsupp ortedBrows erWarning( ) | |
| 263 | { | |
| 264 | Stri ng userAge nt = JavaS criptMetho ds.getUser Agent(); | |
| 265 | SC.s ay("Unsupp orted Brow ser", | |
| 266 | "Your br owser <i>" + userAge nt + "</i> is not su pported fo r viewing images, on ly Microso ft Interne t Explorer is suppor ted"); | |
| 267 | } | |
| 268 | ||
| 269 | /* * | |
| 270 | * Warning m essage to display to users who are not a llowed to view a spe cific stud y | |
| 271 | * / | |
| 272 | pu blic stati c void dis playUnallo wedToViewS tudyWarnin g() | |
| 273 | { | |
| 274 | SC.s ay("Cannot View Imag es", | |
| 275 | "You a re not aut horized to view thes e images.< br>Clinica l images r equire the <i>MAGDIS P CLIN</i> key.<br>" ); | |
| 276 | } | |
| 277 | ||
| 278 | /* * | |
| 279 | * Get the U RL of the AWIV using SSL (to u se with re direction) | |
| 280 | * @return | |
| 281 | * / | |
| 282 | pu blic stati c String g etSslUrl() | |
| 283 | { | |
| 284 | Stri ngBuilder url = new StringBuil der(); | |
| 285 | url. append(Awi vConstants .sslHttpPr otocol); | |
| 286 | url. append("// "); | |
| 287 | url. append(Loc ation.getH ostName()) ; | |
| 288 | url. append(":" ); | |
| 289 | url. append(get SslPort()) ; | |
| 290 | url. append(Loc ation.getP ath()); | |
| 291 | retu rn url.toS tring(); | |
| 292 | } | |
| 293 | ||
| 294 | pr ivate stat ic String getSslPort () | |
| 295 | { | |
| 296 | Stri ng sslPort = Cookies .getCookie (AwivConst ants.sslPo rtCookieNa me); | |
| 297 | if(s slPort == null || ss lPort.leng th() <= 0) | |
| 298 | sslPor t = AwivCo nstants.de faultSslPo rt; | |
| 299 | retu rn sslPort ; | |
| 300 | } | |
| 301 | ||
| 302 | pu blic stati c String g etInsuffic ientPermis sionsWarni ngMessage( ) | |
| 303 | { | |
| 304 | Stri ngBuilder sb = new S tringBuild er(); | |
| 305 | sb.a ppend("You do not ha ve suffici ent permis sions to a ccess pati ent data t hrough the AWIV<br>" ); | |
| 306 | sb.a ppend("You must meet one of th e followin g:"); | |
| 307 | sb.a ppend("<ul >"); | |
| 308 | sb.a ppend("<li >Have the MAGDISP CL IN securit y key</li> "); | |
| 309 | sb.a ppend("<li >Have the MAGDISP AD MIN securi ty key</li >"); | |
| 310 | sb.a ppend("<li >Have the MAG PAT PH OTO ONLY s ecurity ke y</li>"); | |
| 311 | sb.a ppend("<li >Be a CLAI MS user</l i>"); | |
| 312 | sb.a ppend("</u l>"); | |
| 313 | ||
| 314 | retu rn sb.toSt ring(); | |
| 315 | } | |
| 316 | ||
| 317 | pu blic stati c String g etUserView ableImageC lass(AwivU serInforma tion awivU serInforma tion) | |
| 318 | { | |
| 319 | Stri ng result = ""; | |
| 320 | if(a wivUserInf ormation.i sClaimsAut henticatio n()) | |
| 321 | return result; / / everythi ng | |
| 322 | /* | |
| 323 | if(a wivUserInf ormation.u serHasKey( AwivConsta nts.magSys temSecurit yKey)) | |
| 324 | return result; / / everythi ng | |
| 325 | */ | |
| 326 | // J MW 3/6/201 2 - the MA G SYSTEM k ey does NO T allow a user to vi ew everyth ing (based on | |
| 327 | // h ow Clinica l Display works). | |
| 328 | if(a wivUserInf ormation.u serHasKey( AwivConsta nts.magDis pAdminSecu rityKey) & & | |
| 329 | awivUser Informatio n.userHasK ey(AwivCon stants.mag DispClinSe curityKey) ) | |
| 330 | { | |
| 331 | // use r has both keys, sho w them eve rything | |
| 332 | return result; | |
| 333 | } | |
| 334 | ||
| 335 | if(a wivUserInf ormation.u serHasKey( AwivConsta nts.magDis pAdminSecu rityKey)) | |
| 336 | { | |
| 337 | result = "ADMIN, ADMIN/CLIN ,CLIN/ADMI N"; | |
| 338 | } | |
| 339 | else if(awivUs erInformat ion.userHa sKey(AwivC onstants.m agDispClin SecurityKe y)) | |
| 340 | { | |
| 341 | result = "CLIN,C LIN/ADMIN, ADMIN/CLIN "; | |
| 342 | } | |
| 343 | retu rn result; | |
| 344 | } | |
| 345 | ||
| 346 | /* * | |
| 347 | * Display t he error m essage in a warning dialog | |
| 348 | * @param er rorDescrip tion Descr iption of the proble m | |
| 349 | * @param t The except ion that c aused the error | |
| 350 | * / | |
| 351 | pu blic stati c void dis playErrorM essage(Str ing errorD escription , Throwabl e t) | |
| 352 | { | |
| 353 | Stri ngBuilder error = ne w StringBu ilder(); | |
| 354 | erro r.append(e rrorDescri ption); | |
| 355 | erro r.append(" , please t ry again. If the err or persist s contact your admin istrator<h r><b>Error Details:< /b><br> " + t.getMes sage()); | |
| 356 | SC.w arn(error. toString() ); | |
| 357 | } | |
| 358 | ||
| 359 | /* * | |
| 360 | * Determine if the us er has the necessary keys to o verride a 'Needs Rev iew' study and view it | |
| 361 | * | |
| 362 | * @param aw ivUserInfo rmation | |
| 363 | * @return | |
| 364 | * / | |
| 365 | pu blic stati c boolean canUserVie wNeedsRevi ewStudies( AwivUserIn formation awivUserIn formation) | |
| 366 | { | |
| 367 | retu rn (awivUs erInformat ion.userHa sKey(AwivC onstants.m agSystemSe curityKey) || | |
| 368 | awivUser Informatio n.userHasK ey(AwivCon stants.mag EditSecuri tyKey)); | |
| 369 | } | |
| 370 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.