Produced by Araxis Merge on 9/24/2019 1:38:08 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 | PCL-5_v1_build_8.zip\v1_build 8\Unredacted\spp_mha_web-development.zip\spp_mha_web-development\mha-web\src\main\java\com\va\med\mha\vista\connection | VistaConnection.java | Wed Jul 31 17:35:31 2019 UTC |
| 2 | PCL-5_v1_build_8.zip\v1_build 8\Unredacted\spp_mha_web-development.zip\spp_mha_web-development\mha-web\src\main\java\com\va\med\mha\vista\connection | VistaConnection.java | Mon Sep 23 20:15:56 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 582 |
| Changed | 1 | 2 |
| 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 | package co m.va.med.m ha.vista.c onnection; | |
| 2 | ||
| 3 | import com .va.med.mh a.util.cal lback.MhaW ebCallback HandlerWra pper; | |
| 4 | import gov .va.med.ex ception.Fo undationsE xception; | |
| 5 | import gov .va.med.vi stalink.ad apter.cci. VistaLinkC onnection; | |
| 6 | import gov .va.med.vi stalink.ad apter.cci. VistaLinkC onnectionF actory; | |
| 7 | import gov .va.med.vi stalink.ad apter.spi. VistaLinkC onnectionI mpl; | |
| 8 | import gov .va.med.vi stalink.ad apter.spi. VistaLinkM anagedConn ection; | |
| 9 | import gov .va.med.vi stalink.rp c.RpcReque st; | |
| 10 | import gov .va.med.vi stalink.rp c.RpcRespo nse; | |
| 11 | import gov .va.med.vi stalink.se curity.Vis taKernelPr incipalImp l; | |
| 12 | import gov .va.med.vi stalink.se curity.Vis taLoginMod ule; | |
| 13 | import gov .va.med.vi stalink.se curity.Vis taLoginMod uleExcepti on; | |
| 14 | ||
| 15 | import jav ax.resourc e.Resource Exception; | |
| 16 | import jav ax.securit y.auth.Sub ject; | |
| 17 | import jav ax.securit y.auth.log in.LoginEx ception; | |
| 18 | import jav ax.validat ion.constr aints.NotN ull; | |
| 19 | import jav a.util.Has hMap; | |
| 20 | import jav a.util.Has htable; | |
| 21 | import jav a.util.Map ; | |
| 22 | import jav a.util.log ging.Level ; | |
| 23 | import jav a.util.log ging.Logge r; | |
| 24 | ||
| 25 | /** These are the ob jects in t he VistaCo nnectionSe rvice that are ignit ed/signed- in | |
| 26 | * on serv er start u p. There i s 1 full V istaConnec tion per d ivision th at has alr eady | |
| 27 | * been co nnected an d signed i n. See Sta rtupInit.j ava for mo re details */ | |
| 28 | public cla ss VistaCo nnection { | |
| 29 | ||
| 30 | privat e static f inal Logge r LOGGER = Logger.ge tLogger(Vi staConnect ion.class. getName()) ; | |
| 31 | ||
| 32 | privat e boolean connected; | |
| 33 | ||
| 34 | privat e VistaLog inModule l oginModule ; | |
| 35 | ||
| 36 | privat e Subject subject; | |
| 37 | ||
| 38 | privat e VistaKer nelPrincip alImpl use rPrincipal ; | |
| 39 | ||
| 40 | privat e String d ivisionNam e; | |
| 41 | ||
| 42 | privat e String c onnectionN ame; | |
| 43 | ||
| 44 | privat e int stat ionNumber; | |
| 45 | ||
| 46 | privat e String i pAddress; | |
| 47 | ||
| 48 | privat e String p ort; | |
| 49 | ||
| 50 | privat e String a ccessPin; | |
| 51 | ||
| 52 | privat e String v erifyPin; | |
| 53 | ||
| 54 | privat e VistaLin kConnectio n vistaLin kConnectio n; | |
| 55 | ||
| 56 | privat e boolean signedIn; | |
| 57 | ||
| 58 | public VistaConn ection() { | |
| 59 | co nnected = false; | |
| 60 | lo ginModule = new Vist aLoginModu le(); | |
| 61 | su bject = ne w Subject( ); | |
| 62 | si gnedIn = f alse; | |
| 63 | di visionName = ""; | |
| 64 | } | |
| 65 | ||
| 66 | privat e boolean connect() { | |
| 67 | Ma p<String, String> ja asOptions = new Hash Map<String , String>( ); | |
| 68 | Ma p<String, String> ja asSharedSt ate = new HashMap<St ring, Stri ng>(); // Needed for the login Module con structor | |
| 69 | ||
| 70 | ja asOptions. put(VistaL oginModule .SERVER_AD DRESS_KEY, this.ipAd dress); | |
| 71 | ja asOptions. put(VistaL oginModule .SERVER_PO RT_KEY, th is.port); | |
| 72 | ||
| 73 | ja asOptions. put(VistaL oginModule .SERVER_AD DRESS_KEY_ V1, this.i pAddress); | |
| 74 | ja asOptions. put(VistaL oginModule .SERVER_PO RT_KEY_V1, this.port ); | |
| 75 | ||
| 76 | Mh aWebCallba ckHandlerW rapper cal lBackHandl er = new M haWebCallb ackHandler Wrapper(ac cessPin, v erifyPin, ""); | |
| 77 | ||
| 78 | ||
| 79 | lo ginModule. initialize (subject, callBackHa ndler.getC allBackHan dlerInstan ce(), jaas SharedStat e, | |
| 80 | jaas Options); | |
| 81 | tr y { | |
| 82 | loginMod ule.login( ); | |
| 83 | connecte d = true; | |
| 84 | loginMod ule.commit (); | |
| 85 | ||
| 86 | } catch (Log inExceptio n e) { | |
| 87 | LOGGER.l og(Level.W ARNING, "F ailed to c onnect "+ this.ipAdd ress + ":" + this.po rt +" to V istaLink l oginModule .login() i n VistaCon nection.ja va", e); | |
| 88 | } | |
| 89 | re turn this. connected; | |
| 90 | } | |
| 91 | ||
| 92 | /** In itiates a connection to VistaL ink for a dedicated Vista conn ection */ | |
| 93 | public boolean c onnect(Str ing ipStri ng, String portStrin g, String accessPin, String ve rifyPin) { | |
| 94 | th is.ipAddre ss = ipStr ing; | |
| 95 | th is.port = portString ; | |
| 96 | th is.accessP in = acces sPin; | |
| 97 | th is.verifyP in = verif yPin; | |
| 98 | re turn this. connect(); | |
| 99 | } | |
| 100 | ||
| 101 | public boolean s ignIn() { | |
| 102 | tr y { | |
| 103 | if (this .connected ) { | |
| 104 | Hash table<Stri ng, String > response Data = new Hashtable <>(); | |
| 105 | responseDa ta.put("KE Y_DOMAIN_N AME", " UR L "); // 0 | |
| 106 | resp onseData.p ut("KEY_LA NGUAGE", " "); // 1 | |
| 107 | resp onseData.p ut("KEY_NA ME_PREFIX" , ""); // 2 | |
| 108 | resp onseData.p ut("KEY_DI VISION_IEN ", "21789" ); // 3 | |
| 109 | resp onseData.p ut("KEY_NA ME_DISPLAY ", "Jason Wilson"); // 4 | |
| 110 | resp onseData.p ut("KEY_DU Z", "1095" ); // 5 | |
| 111 | resp onseData.p ut("KEY_SE RVICE_SECT ION", "INF ORMATION S YSTEMS CEN TER"); // 6 | |
| 112 | resp onseData.p ut("KEY_NA ME_MIDDLE" , ""); // 7 | |
| 113 | resp onseData.p ut("KEY_NA ME_FAMILYL AST", "WIL SON"); // 8 | |
| 114 | resp onseData.p ut("KEY_NA ME_NEWPERS ON01", "WI LSON,JASON "); // 9 | |
| 115 | resp onseData.p ut("KEY_TI TLE", ""); // 10 | |
| 116 | resp onseData.p ut("KEY_DT IME", "400 0"); // 11 | |
| 117 | resp onseData.p ut("KEY_NA ME_SUFFIX" , ""); // 12 | |
| 118 | resp onseData.p ut("KEY_NA ME_DEGREE" , ""); // 13 | |
| 119 | resp onseData.p ut("KEY_DI VISION_STA TION_NUMBE R", "960") ; // 14 | |
| 120 | resp onseData.p ut("KEY_DI VISION_STA TION_NAME" , "SPPNXT FO-SLC"); // 15 | |
| 121 | resp onseData.p ut("KEY_NA ME_GIVENFI RST", "JAS ON"); // 1 6 | |
| 122 | resp onseData.p ut("KEY_VP ID", ""); // 17 | |
| 123 | // th is.userPri ncipal = n ew VistaKe rnelPrinci palImpl(re sponseData .getUserDe mographics Hashtable( )); | |
| 124 | this .userPrinc ipal = Vis taKernelPr incipalImp l.getKerne lPrincipal (this.subj ect); | |
| 125 | // s tart sessi on | |
| 126 | this .signedIn = true; | |
| 127 | this .setDivisi onName(); | |
| 128 | this .setDivisi onNumber() ; | |
| 129 | this .setConnec tionName() ; | |
| 130 | this .setVistaL inkConnect ion(); | |
| 131 | retu rn true; | |
| 132 | } | |
| 133 | } catch(Foun dationsExc eption fe) { | |
| 134 | LOGGER.l og(Level.W ARNING, "F oundations Exception on sign i n", fe); | |
| 135 | } | |
| 136 | re turn fals e; | |
| 137 | } | |
| 138 | ||
| 139 | // Log s in, sets variables for the V istaConnec tion objec t, then cl oses the c onnection | |
| 140 | public boolean s etConnecti onAndClose (String ip Address, S tring port , String a ccessPin, String ver ifyPin) { | |
| 141 | re turn this. connect(ip Address, p ort, acces sPin, veri fyPin) && this.signI n() && thi s.closeCon nection(); | |
| 142 | } | |
| 143 | ||
| 144 | /** Ex ecute RPC directly f rom the co nnection | |
| 145 | * Thi s is a sta te-less co nnection * */ | |
| 146 | public RpcRespon se execute RPC(RpcReq uest rpcRe quest) { | |
| 147 | Rp cResponse response = null; | |
| 148 | bo olean conn ected = th is.connect AndSignIn( ); | |
| 149 | if (connected && this.v istaLinkCo nnection ! = null) { | |
| 150 | try { | |
| 151 | resp onse = thi s.vistaLin kConnectio n.executeR PC(rpcRequ est); | |
| 152 | } | |
| 153 | catch(Fo undationsE xception f e) { | |
| 154 | LOGGER.war ning("Coul d not exec ute RCP at : " + "\n " + fe); | |
| 155 | } | |
| 156 | } | |
| 157 | th is.closeCo nnection() ; | |
| 158 | re turn respo nse; | |
| 159 | } | |
| 160 | ||
| 161 | privat e boolean connectAnd SignIn() { | |
| 162 | re turn this. connect() && this.si gnIn(); | |
| 163 | } | |
| 164 | ||
| 165 | privat e void res et() { | |
| 166 | co nnected = false; | |
| 167 | lo ginModule = new Vist aLoginModu le(); | |
| 168 | su bject = ne w Subject( ); | |
| 169 | si gnedIn = f alse; | |
| 170 | us erPrincipa l = null; | |
| 171 | vi staLinkCon nection = null; | |
| 172 | } | |
| 173 | ||
| 174 | privat e boolean closeConne ction() { | |
| 175 | if (this.vist aLinkConne ction != n ull) { | |
| 176 | try { | |
| 177 | this .vistaLink Connection .close(); | |
| 178 | this .signedIn = false; | |
| 179 | this .reset(); | |
| 180 | retu rn true; | |
| 181 | } catch (ResourceE xception r e) { | |
| 182 | LOGG ER.warning ("Could no t close Vi staLinkCon nection at " + this. stationNum ber); | |
| 183 | } | |
| 184 | } | |
| 185 | re turn false ; | |
| 186 | } | |
| 187 | ||
| 188 | public String ge tDivisionN ame() { | |
| 189 | re turn divis ionName; | |
| 190 | } | |
| 191 | ||
| 192 | /**Par ses the us erPrincipa l as a str ing to get the full division n ame with n umber **/ | |
| 193 | privat e void set DivisionNa me() { | |
| 194 | St ring divNa me = ""; | |
| 195 | tr y { | |
| 196 | divName = this.use rPrincipal .toString( ).substrin g(this.use rPrincipal .toString( ).indexOf( "Division: ") + 10); | |
| 197 | divName = divName. substring( 0, divName .indexOf(" Timeout:" )); | |
| 198 | } catch(Inde xOutOfBoun dsExceptio n e) { | |
| 199 | LOGGER.w arning("Co uld not ex tract divi son name f rom connec tion: " + this.userP rincipal.t oString() | |
| 200 | + "\n" + e ); | |
| 201 | } | |
| 202 | th is.divisio nName = di vName; | |
| 203 | } | |
| 204 | ||
| 205 | public String ge tConnectio nName() { | |
| 206 | re turn conne ctionName; | |
| 207 | } | |
| 208 | ||
| 209 | /**Par ses the us erPrincipa l as a str ing to get the full division n ame with n umber **/ | |
| 210 | privat e void set Connection Name() { | |
| 211 | St ring conne ctionName = ""; | |
| 212 | tr y { | |
| 213 | connecti onName = t his.userPr incipal.to String().s ubstring(t his.userPr incipal.to String().i ndexOf("Na me:") + 7) ; | |
| 214 | connecti onName = c onnectionN ame.substr ing(0, con nectionNam e.indexOf( " Division :")); | |
| 215 | } catch(Inde xOutOfBoun dsExceptio n e) { | |
| 216 | LOGGER.w arning("Co uld not ex tract conn ection nam e from con nection: " + this.us erPrincipa l.toString () | |
| 217 | + "\n" + e ); | |
| 218 | } | |
| 219 | th is.connect ionName = connection Name; | |
| 220 | } | |
| 221 | ||
| 222 | privat e void set VistaLinkC onnection( ) { | |
| 223 | if (userPrinc ipal != nu ll) { | |
| 224 | this.vis taLinkConn ection = t his.userPr incipal.ge tAuthentic atedConnec tion(); | |
| 225 | } | |
| 226 | } | |
| 227 | ||
| 228 | public VistaLink Connection getVistaL inkConnect ion() { | |
| 229 | re turn vista LinkConnec tion; | |
| 230 | } | |
| 231 | ||
| 232 | public int getSt ationNumbe r() { | |
| 233 | re turn stati onNumber; | |
| 234 | } | |
| 235 | ||
| 236 | public void setD ivisionNum ber() { | |
| 237 | th is.station Number = I nteger.par seInt(getS tationNumF romName(th is.divisio nName)); | |
| 238 | } | |
| 239 | ||
| 240 | public static St ring getSt ationNumFr omName(Str ing name) { | |
| 241 | re turn name. replaceAll ("[\\D]", ""); | |
| 242 | } | |
| 243 | ||
| 244 | public static bo olean stat ionStringI sValid(Str ing statio nStr) { | |
| 245 | tr y { | |
| 246 | int stat ionInt; | |
| 247 | stationI nt = Integ er.parseIn t(stationS tr); | |
| 248 | if(stati onInt >= 0 && statio nInt <= 99 9) { | |
| 249 | retu rn true; | |
| 250 | } | |
| 251 | } catch (Num berFormatE xception n fe) { | |
| 252 | return f alse; | |
| 253 | } | |
| 254 | re turn false ; | |
| 255 | } | |
| 256 | ||
| 257 | public boolean i sSignedIn( ) { | |
| 258 | re turn signe dIn; | |
| 259 | } | |
| 260 | ||
| 261 | public boolean i sConnected () { | |
| 262 | re turn conne cted; | |
| 263 | } | |
| 264 | ||
| 265 | public VistaKern elPrincipa lImpl getU serPrincip al() { | |
| 266 | re turn user Principal; | |
| 267 | } | |
| 268 | ||
| 269 | public VistaLogi nModule ge tLoginModu le() { | |
| 270 | re turn login Module; | |
| 271 | } | |
| 272 | ||
| 273 | public Subject g etSubject( ) { | |
| 274 | re turn subje ct; | |
| 275 | } | |
| 276 | ||
| 277 | public String ge tIpAddress () { | |
| 278 | re turn ipAdd ress; | |
| 279 | } | |
| 280 | ||
| 281 | public String ge tPort() { | |
| 282 | re turn port; | |
| 283 | } | |
| 284 | ||
| 285 | public String ge tAccessPin () { | |
| 286 | re turn acces sPin; | |
| 287 | } | |
| 288 | ||
| 289 | public String ge tVerifyPin () { | |
| 290 | re turn verif yPin; | |
| 291 | } | |
| 292 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.