Produced by Araxis Merge on 3/9/2018 10:32:16 AM 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 | CIF_MHV_2018.2.0.0.zip\CIF_MHV_2018.2.0.0_Sprint2_SM_legacy.zip\mhv_sms_ng\mhv-sm-admin\src\main\java\gov\va\med\mhv\sm\web\actions | ManageStaff.java | Wed Feb 14 06:23:36 2018 UTC |
| 2 | CIF_MHV_2018.2.0.0.zip\CIF_MHV_2018.2.0.0_Sprint2_SM_legacy.zip\mhv_sms_ng\mhv-sm-admin\src\main\java\gov\va\med\mhv\sm\web\actions | ManageStaff.java | Thu Mar 8 19:54:58 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 3414 |
| 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 go v.va.med.m hv.sm.web. actions; | |
| 2 | ||
| 3 | import gov .va.med.mh v.foundati on.service .response. Collection ServiceRes ponse; | |
| 4 | import gov .va.med.mh v.foundati on.service .response. ServiceRes ponse; | |
| 5 | import gov .va.med.mh v.foundati on.util.Lo gSanitizer ; | |
| 6 | import gov .va.med.mh v.sm.ad.AD QueryResul t; | |
| 7 | import gov .va.med.mh v.sm.dao.p roperties. ManageStaf fMemberPro perties; | |
| 8 | import gov .va.med.mh v.sm.dao.U serDao; | |
| 9 | import gov .va.med.mh v.sm.dto.L ocationDss UnitsDTO; | |
| 10 | import gov .va.med.mh v.sm.dto.U serInfoDTO ; | |
| 11 | import gov .va.med.mh v.sm.model .Administr ator; | |
| 12 | import gov .va.med.mh v.sm.model .ClinicalU serType; | |
| 13 | import gov .va.med.mh v.sm.model .Clinician ; | |
| 14 | import gov .va.med.mh v.sm.model .Facility; | |
| 15 | import gov .va.med.mh v.sm.servi ce.UserMan agementSer vice; | |
| 16 | import gov .va.med.mh v.sm.util. UserUtils; | |
| 17 | import gov .va.med.mh v.sm.util. WorkloadUt il; | |
| 18 | import gov .va.med.mh v.sm.wscli ent.adminq ueriessvc. Provider; | |
| 19 | import gov .va.med.mh v.sm.wscli ent.adminq ueriessvc. User; | |
| 20 | import gov .va.med.mh v.sm.wscli ent.adminq ueriessvc. UserNew; | |
| 21 | import gov .va.med.mh v.sm.wscli ent.tiusvc .DSSUnit; | |
| 22 | ||
| 23 | import jav a.io.File; | |
| 24 | import jav a.io.Input Stream; | |
| 25 | import jav a.io.Input StreamRead er; | |
| 26 | import jav a.io.Reade r; | |
| 27 | import jav a.util.Arr ayList; | |
| 28 | import jav a.util.Col lection; | |
| 29 | import jav a.util.Has hMap; | |
| 30 | import jav a.util.Lis t; | |
| 31 | import jav a.util.Map ; | |
| 32 | import jav a.util.Tre eSet; | |
| 33 | ||
| 34 | import org .apache.co mmons.lang .StringUti ls; | |
| 35 | import org .apache.co mmons.logg ing.Log; | |
| 36 | import org .apache.co mmons.logg ing.LogFac tory; | |
| 37 | import org .apache.co mmons.vali dator.Emai lValidator ; | |
| 38 | import org .apache.st ruts2.Serv letActionC ontext; | |
| 39 | import org .owasp.esa pi.ESAPI; | |
| 40 | import org .springfra mework.web .context.W ebApplicat ionContext ; | |
| 41 | import org .springfra mework.web .context.s upport.Web Applicatio nContextUt ils; | |
| 42 | ||
| 43 | import com .opensymph ony.xwork2 .Preparabl e; | |
| 44 | ||
| 45 | public cla ss ManageS taff exten ds BaseSMA dminAction implement s Preparab le { | |
| 46 | ||
| 47 | @S uppressWar nings("unu sed") | |
| 48 | pr ivate stat ic final L og log = L ogFactory. getLog(Man ageStaff.c lass); | |
| 49 | ||
| 50 | pr ivate stat ic final S tring CANC EL = "canc el"; | |
| 51 | pr ivate stat ic final S tring FAIL ED = "fail ed"; | |
| 52 | pr ivate stat ic final S tring SELE CT_STAFF = "selectSt aff"; | |
| 53 | pr ivate stat ic final S tring SEAR CH_RESULTS = "search Results"; | |
| 54 | pr ivate stat ic final S tring QUER Y_RESULTS_ IR = "quer yResults_I R"; | |
| 55 | pr ivate stat ic final S tring BULK _ACTIVATIO N = "bulkA ctivation" ; | |
| 56 | pr ivate stat ic final S tring PATC H29_NATION AL ="NATIO NAL"; | |
| 57 | pr ivate stat ic final S tring PATC H29_FIELD ="FIELD"; | |
| 58 | pr ivate stat ic final S tring ALL_ DSS_UNITS = "*"; | |
| 59 | pr ivate stat ic final S tring DATA _DELIMITER = "|"; | |
| 60 | pr ivate User Management Service us erManageme ntService; | |
| 61 | pr ivate Mana geStaffMem berPropert ies manage StaffMembe rPropertie s; | |
| 62 | pr ivate User Dao userDa o; | |
| 63 | pr ivate Coll ection<Fac ility> vis ns; | |
| 64 | pr ivate Coll ection<Fac ility> fac ilities; | |
| 65 | pr ivate Long visnId; | |
| 66 | pr ivate Long facilityI d; | |
| 67 | pr ivate Stri ng selecte dVisnName; | |
| 68 | pr ivate Stri ng selecte dFacilityN ame; | |
| 69 | pr ivate List <Clinician > clinicia ns; | |
| 70 | pr ivate List <Clinician > selected Users; | |
| 71 | pr ivate List <ClinicalU serType> s taffMember Types; | |
| 72 | // private Ht tpServletR equest req uest; | |
| 73 | pr ivate Stri ng searchC rit; | |
| 74 | pr ivate Stri ng emailAD ; | |
| 75 | pr ivate Stri ng firstNa me; | |
| 76 | pr ivate Stri ng lastNam e; | |
| 77 | pr ivate Stri ng middleN ame; | |
| 78 | pr ivate Stri ng duz; | |
| 79 | pr ivate Stri ng phone; | |
| 80 | pr ivate Stri ng title; | |
| 81 | pr ivate Stri ng email; | |
| 82 | pr ivate Stri ng suffix; | |
| 83 | pr ivate Stri ng prefix; | |
| 84 | pr ivate Stri ng activeF lag; | |
| 85 | pr ivate Stri ng provide rKey; | |
| 86 | pr ivate Stri ng provide rClass; | |
| 87 | pr ivate Stri ng personC lass; | |
| 88 | pr ivate Stri ng[] dssUn its; | |
| 89 | pr ivate Stri ng pcmmFla g; | |
| 90 | pr ivate Stri ng require sCoSigner; | |
| 91 | pr ivate Stri ng network Id; | |
| 92 | pr ivate Long memberTyp eId; | |
| 93 | pr ivate Stri ng memberT ype; | |
| 94 | pr ivate Stri ng firstNa meAD; | |
| 95 | pr ivate Stri ng lastNam eAD; | |
| 96 | pr ivate Stri ng phoneAD ; | |
| 97 | pr ivate Stri ng titleAD ; | |
| 98 | pr ivate Stri ng network IdAD; | |
| 99 | pr ivate Stri ng selectA ction; | |
| 100 | // File uplo ad info fo r bulk act ivation | |
| 101 | pr ivate File upload; | |
| 102 | privat e String u ploadConte ntType; | |
| 103 | privat e String u ploadFileN ame; | |
| 104 | privat e int adde d; // numb er of bulk load staf f members activated. | |
| 105 | privat e static S tring FILE _SIZE_LIMI T_ERROR = "The file you are tr ying to up load excee ds the 2MB limit. " + | |
| 106 | "Please r educe the file size and try ag ain."; | |
| 107 | privat e static i nt FILE_SI ZE_LIMIT_2 MB = 2 * 1 024 * 1024 ; | |
| 108 | pu blic Manag eStaff() { | |
| 109 | supe r(); | |
| 110 | } | |
| 111 | ||
| 112 | ||
| 113 | pu blic void prepare() throws Exc eption { | |
| 114 | supe r.prepare( ); | |
| 115 | WebA pplication Context ct x = WebApp licationCo ntextUtils | |
| 116 | .getWebA pplication Context(Se rvletActio nContext | |
| 117 | .g etServletC ontext()); | |
| 118 | user Management Service = (UserManag ementServi ce) ctx.ge tBean("use rManagemen tService") ; | |
| 119 | mana geStaffMem berPropert ies = (Man ageStaffMe mberProper ties)ctx.g etBean("ma nageStaffM emberPrope rties"); | |
| 120 | user Dao = (Use rDao) ctx. getBean("u serDao"); | |
| 121 | } | |
| 122 | ||
| 123 | ||
| 124 | pu blic Strin g manageSt affMembers () { | |
| 125 | ||
| 126 | clea rSessionAt tr(); | |
| 127 | ||
| 128 | retu rn SUCCESS ; | |
| 129 | } | |
| 130 | ||
| 131 | pu blic Strin g selectEn tryMethod( ) { | |
| 132 | ||
| 133 | if(a ppliedCanc el()){ ret urn CANCEL ; } | |
| 134 | clea rSessionAt tr(); | |
| 135 | faci lities = n ew TreeSet <Facility> (); | |
| 136 | ||
| 137 | if(( selectActi on != null ) && (sele ctAction.e qualsIgnor eCase("Ina ctivate a Staff Memb er"))){ | |
| 138 | setSes sionAttrib ute("activ ationType" ,"inactiva te"); | |
| 139 | return SELECT_ST AFF; | |
| 140 | } | |
| 141 | if(( selectActi on != null ) && (sele ctAction.e qualsIgnor eCase("Rea ctivate a Staff Memb er"))){ | |
| 142 | setSes sionAttrib ute("activ ationType" ,"reactiva te"); | |
| 143 | return SELECT_ST AFF; | |
| 144 | } | |
| 145 | retu rn SUCCESS ; | |
| 146 | } | |
| 147 | ||
| 148 | ||
| 149 | pu blic Strin g selectSe archCrit() { | |
| 150 | ||
| 151 | if(a ppliedCanc el()){ ret urn CANCEL ; } | |
| 152 | clea rSessionAt tr(); | |
| 153 | faci lities = n ew TreeSet <Facility> (); | |
| 154 | if(( selectActi on != null ) && ((sel ectAction. trim()).eq ualsIgnore Case("Bulk Activatio n from CSV File"))){ | |
| 155 | return BULK_ACTI VATION; | |
| 156 | } | |
| 157 | ||
| 158 | retu rn SUCCESS ; | |
| 159 | } | |
| 160 | ||
| 161 | ||
| 162 | pu blic Strin g selectVi sn(){ | |
| 163 | ||
| 164 | getS taffSessio nAttr(); | |
| 165 | ||
| 166 | if(v isnId == - 1L){ | |
| 167 | addAct ionError(" Please sel ect a VISN ."); | |
| 168 | return SELECT_ST AFF; | |
| 169 | } | |
| 170 | ||
| 171 | for( Facility v : getAdmin isteredVis ns()){ | |
| 172 | if(v.g etId().equ als(visnId )){ | |
| 173 | selected VisnName = v.getName (); | |
| 174 | faciliti es = getAd ministered Facilities InVisn(v); | |
| 175 | } | |
| 176 | } | |
| 177 | ||
| 178 | if(S tringUtils .isBlank(s electedVis nName)){ | |
| 179 | addAct ionError(" Please sel ect a VISN ."); | |
| 180 | return SELECT_ST AFF; | |
| 181 | } | |
| 182 | ||
| 183 | setS essionAttr ibute("fac ilities",f acilities) ; | |
| 184 | setS essionAttr ibute("sel ectedVisnN ame",selec tedVisnNam e); | |
| 185 | ||
| 186 | retu rn SELECT_ STAFF; | |
| 187 | ||
| 188 | } | |
| 189 | ||
| 190 | pu blic Strin g selectFa cility(){ | |
| 191 | ||
| 192 | getS taffSessio nAttr(); | |
| 193 | ||
| 194 | // i f the visn hasn't be en selecte d first | |
| 195 | if(S tringUtils .isBlank(s electedVis nName)){ | |
| 196 | addAct ionError(" Please sel ect a VISN ."); | |
| 197 | return SELECT_ST AFF; | |
| 198 | } | |
| 199 | ||
| 200 | // m ake sure a facility has been c hosen | |
| 201 | if(f acilityId == -1){ | |
| 202 | addAct ionError(" Please sel ect a Faci lity."); | |
| 203 | return SELECT_ST AFF; | |
| 204 | } | |
| 205 | ||
| 206 | Stri ng station Number = n ull; | |
| 207 | ||
| 208 | if(f acilities != null){ | |
| 209 | for(Fa cility f: facilities ){ | |
| 210 | if(f.get Id().equal s(facility Id)){ | |
| 211 | selectedFa cilityName = f.getNa me(); | |
| 212 | stationNum ber = f.ge tStationNu mber(); | |
| 213 | } | |
| 214 | } | |
| 215 | } | |
| 216 | ||
| 217 | setS essionAttr ibute("sel ectedFacil ityName",s electedFac ilityName) ; | |
| 218 | setS essionAttr ibute("sta tionNumber ",stationN umber); | |
| 219 | ||
| 220 | retu rn SELECT_ STAFF; | |
| 221 | } | |
| 222 | ||
| 223 | pr ivate Coll ectionServ iceRespons e<UserNew> getPatch2 9VistAProv ider(Strin g lastName ,String fi rstName,St ring stati onNumber,S tring duz) { | |
| 224 | Coll ectionServ iceRespons e<UserNew> collectio nServiceRe sponse=nul l; | |
| 225 | if(n ull!=duz){ | |
| 226 | collec tionServic eResponse = getAdmin Service(). getVistAPr ovider(duz ,stationNu mber); | |
| 227 | if(log .isInfoEna bled()){ | |
| 228 | if(colle ctionServi ceResponse .getCollec tion()!=nu ll){ | |
| 229 | log.info(L ogSanitize r.cleanTex t("ManageS taff=>getP atch29Vist AProvider= >DUZLookup ->DUZ"+duz +"station# "+stationN umber+"Res ponse size =>"+collec tionServic eResponse. getCollect ion().size ())); | |
| 230 | } | |
| 231 | } | |
| 232 | }els e{ | |
| 233 | collec tionServic eResponse = getAdmin Service(). getVistAPr ovider(las tName, fir stName, st ationNumbe r); | |
| 234 | if(log .isInfoEna bled()){ | |
| 235 | if(colle ctionServi ceResponse .getCollec tion()!=nu ll){ | |
| 236 | log.info(L ogSanitize r.cleanTex t("ManageS taff=>getP atch29Vist AProvider= >UserLooku p->LastNam e="+lastNa me+"FirstN ame="+firs tName+"sta tionNumber "+stationN umber+"Res ponse size =>"+collec tionServic eResponse. getCollect ion().size ())); | |
| 237 | } | |
| 238 | } | |
| 239 | } | |
| 240 | retu rn collect ionService Response; | |
| 241 | } | |
| 242 | ||
| 243 | pr ivate Coll ectionServ iceRespons e<User> ge tVistAProv ider(Strin g lastName ,String fi rstName,St ring stati onNumber,S tring duz) { | |
| 244 | Coll ectionServ iceRespons e<User> co llectionSe rviceRespo nse=null; | |
| 245 | if(n ull!=duz){ | |
| 246 | collec tionServic eResponse = getAdmin Service(). findVistaC linician(d uz,station Number); | |
| 247 | if(log .isInfoEna bled()){ | |
| 248 | if(colle ctionServi ceResponse .getCollec tion()!=nu ll){ | |
| 249 | log.info(L ogSanitize r.cleanTex t("ManageS taff=>getV istAProvid er=>DUZLoo kup->DUZ"+ duz+"stati on#"+stati onNumber+" Response s ize=>"+col lectionSer viceRespon se.getColl ection().s ize())); | |
| 250 | } | |
| 251 | } | |
| 252 | }els e{ | |
| 253 | collec tionServic eResponse = getAdmin Service(). findVistaC linician(l astName, f irstName, stationNum ber); | |
| 254 | if(log .isInfoEna bled()){ | |
| 255 | if(colle ctionServi ceResponse .getCollec tion()!=nu ll){ | |
| 256 | log.info(L ogSanitize r.cleanTex t("ManageS taff=>getV istAProvid er=>UserLo okup->Last Name="+las tName+"Fir stName="+f irstName+" station#"+ stationNum ber+"Respo nse size=> "+collecti onServiceR esponse.ge tCollectio n().size() )); | |
| 257 | } | |
| 258 | } | |
| 259 | } | |
| 260 | retu rn collect ionService Response; | |
| 261 | } | |
| 262 | ||
| 263 | ||
| 264 | pr ivate Coll ection<Use rInfoDTO> getVistASt affMembers (String fi rstName,St ring lastN ame,String stationNu mber,Strin g duz){ | |
| 265 | //if (null!=man ageStaffMe mberProper ties.getVi stAPatch29 Status() & & manageSt affMemberP roperties. getVistAPa tch29Statu s().equals IgnoreCase (PATCH29_N ATIONAL)){ | |
| 266 | if(g etVistAPat ch29Status (stationNu mber)){ | |
| 267 | Collec tionServic eResponse< UserNew> r esponse = getPatch29 VistAProvi der(lastNa me,firstNa me,station Number,duz ); | |
| 268 | handle ErrorMessa ges(respon se.getMess ages()); | |
| 269 | return createUse rsInfoList (response, stationNum ber); | |
| 270 | }els e{ | |
| 271 | Collec tionServic eResponse< User> resp onse = get VistAProvi der(lastNa me, firstN ame, stati onNumber,d uz); | |
| 272 | handle ErrorMessa ges(respon se.getMess ages()); | |
| 273 | return createUse rsInfoList (response, stationNum ber); | |
| 274 | } | |
| 275 | } | |
| 276 | ||
| 277 | pr ivate bool ean getVis tAPatch29S tatus(Stri ng station No){ | |
| 278 | if(n ull!=manag eStaffMemb erProperti es.getVist APatch29St atus() && manageStaf fMemberPro perties.ge tVistAPatc h29Status( ).equalsIg noreCase(P ATCH29_NAT IONAL)){ | |
| 279 | return true; | |
| 280 | }els e if(null! =manageSta ffMemberPr operties.g etVistAPat ch29Status () && mana geStaffMem berPropert ies.getVis tAPatch29S tatus().eq ualsIgnore Case(PATCH 29_FIELD)) { | |
| 281 | if(Wor kloadUtil. isCurrentU serIsField Tester(sta tionNo, ma nageStaffM emberPrope rties.getV istAPatch2 9TestingSi tes())){ | |
| 282 | return t rue; | |
| 283 | }else{ | |
| 284 | return f alse; | |
| 285 | } | |
| 286 | } | |
| 287 | retu rn false; | |
| 288 | } | |
| 289 | ||
| 290 | pr ivate Coll ection<Use rInfoDTO> createUser sInfoList( Collection ServiceRes ponse resp onse,Strin g stationN umber){ | |
| 291 | List <UserInfoD TO> userIn foDtoList = new Arra yList<User InfoDTO>() ; | |
| 292 | if(r esponse.ge tCollectio n()!=null && respons e.getColle ction().si ze()!=0 && ((List)re sponse.get Collection ()).get(0) instanceo f UserNew) { | |
| 293 | List<U serNew> st affMembers = (List<U serNew>)re sponse.get Collection (); | |
| 294 | if(log .isInfoEna bled()){ | |
| 295 | log.info ("ManageSt aff=>100 E nsemble Re sponse Ins tance of U serNew for Station:" +stationNu mber+" Siz e: "+(staf fMembers!= null?staff Members.si ze():"0")) ; | |
| 296 | } | |
| 297 | for(Us erNew user Obj:staffM embers){ | |
| 298 | UserInfo DTO userIn foDto= new UserInfoD TO(); | |
| 299 | userInfo Dto.setFir stName(use rObj.getFi rstName()! =null?user Obj.getFir stName():" "); | |
| 300 | userInfo Dto.setLas tName(user Obj.getLas tName()!=n ull?userOb j.getLastN ame():""); | |
| 301 | userInfo Dto.setMid dleName(us erObj.getM iddleName( )!=null?us erObj.getM iddleName( ):""); | |
| 302 | userInfo Dto.setSuf fix(userOb j.getSuffi x()!=null? userObj.ge tSuffix(): ""); | |
| 303 | userInfo Dto.setPre fix(userOb j.getPrefi x()!=null? userObj.ge tPrefix(): ""); | |
| 304 | userInfo Dto.setTit le(userObj .getTitle( )!=null?us erObj.getT itle():"") ; | |
| 305 | userInfo Dto.setWor kPhone(use rObj.getPh one()!=nul l?userObj. getPhone() :""); | |
| 306 | userInfo Dto.setDuz (userObj.g etIEN()!=n ull?userOb j.getIEN() :""); | |
| 307 | userInfo Dto.setAct iveFlag((u serObj.get ActiveFlag ()!=null & & userObj. getActiveF lag().equa lsIgnoreCa se("1"))?" ACTIVE":"I NACTIVE"); | |
| 308 | userInfo Dto.setPro viderKey(( userObj.ge tProviderI ndicator() !=null && userObj.ge tProviderI ndicator() .equalsIgn oreCase("P ROVIDER")) ?"TRUE":"F ALSE"); | |
| 309 | userInfo Dto.setPro viderClass (userObj.g etProvCls( )!=null?us erObj.getP rovCls():" "); | |
| 310 | userInfo Dto.setVis tAPersonCl ass(userOb j.getPersC ls()); | |
| 311 | userInfo Dto.setReq uiresCoSig ner(userOb j.getReqCo sig()!=nul l?userObj. getReqCosi g():""); | |
| 312 | userInfo DtoList.ad d(userInfo Dto); | |
| 313 | } | |
| 314 | } | |
| 315 | else if(respon se.getColl ection()!= null && re sponse.get Collection ().size()! =0 && ((Li st)respons e.getColle ction()).g et(0) inst anceof Use r){ | |
| 316 | List<U ser> staff Members = (List<User >)response .getCollec tion(); | |
| 317 | if(log .isInfoEna bled()){ | |
| 318 | log.info ("ManageSt aff=>200 E nsemble Re sponse Ins tance of U ser for St ation:"+st ationNumbe r+" Size: "+(staffMe mbers!=nul l?staffMem bers.size( ):"0")); | |
| 319 | } | |
| 320 | for(Us er userObj :staffMemb ers){ | |
| 321 | UserInfo DTO userIn foDto= new UserInfoD TO(); | |
| 322 | userInfo Dto.setFir stName(use rObj.getFi rstName()! =null?user Obj.getFir stName():" "); | |
| 323 | userInfo Dto.setLas tName(user Obj.getLas tName()!=n ull?userOb j.getLastN ame():""); | |
| 324 | userInfo Dto.setMid dleName("" ); | |
| 325 | userInfo Dto.setSuf fix(""); | |
| 326 | userInfo Dto.setPre fix(""); | |
| 327 | userInfo Dto.setTit le(userObj .getTitle( )!=null?us erObj.getT itle():"") ; | |
| 328 | userInfo Dto.setWor kPhone(use rObj.getPh one()!=nul l?userObj. getPhone() :""); | |
| 329 | userInfo Dto.setDuz (userObj.g etIEN()!=n ull?userOb j.getIEN() :""); | |
| 330 | userInfo Dto.setPro viderKey(u serObj.get ProviderIn dicator()! =null?"TRU E":"FALSE" ); | |
| 331 | userInfo Dto.setPro viderClass (""); | |
| 332 | userInfo Dto.setReq uiresCoSig ner(""); | |
| 333 | userInfo DtoList.ad d(userInfo Dto); | |
| 334 | } | |
| 335 | } | |
| 336 | retu rn userInf oDtoList; | |
| 337 | } | |
| 338 | ||
| 339 | ||
| 340 | pu blic Strin g searchSt affMembers () { | |
| 341 | if(a ppliedCanc el()){ ret urn CANCEL ; } | |
| 342 | ||
| 343 | getS taffSessio nAttr(); | |
| 344 | if(S tringUtils .isBlank(s electedVis nName)){ | |
| 345 | addAct ionError(" Please sel ect a VISN ."); | |
| 346 | return SELECT_ST AFF; | |
| 347 | } | |
| 348 | ||
| 349 | if(S tringUtils .isBlank(s electedFac ilityName) ){ | |
| 350 | addAct ionError(" Please sel ect a Faci lity."); | |
| 351 | return SELECT_ST AFF; | |
| 352 | } | |
| 353 | //Li st<UserNew > staffMem bers= new ArrayList< UserNew>() ; | |
| 354 | List <UserInfoD TO> staffM embers = n ew ArrayLi st<UserInf oDTO>(); | |
| 355 | clin icians = n ew ArrayLi st<Clinici an>(); | |
| 356 | Clin ician clin = null; | |
| 357 | Stri ng station Number = n ull; | |
| 358 | faci lities = n ew TreeSet <Facility> (); | |
| 359 | ||
| 360 | getS taffSessio nAttr(); | |
| 361 | Stri ng activat ionType = null; | |
| 362 | ||
| 363 | if(( (String)ge tSessionAt tribute("a ctivationT ype")) != null){ | |
| 364 | activa tionType = (String)g etSessionA ttribute(" activation Type"); | |
| 365 | } | |
| 366 | if(( (String)ge tSessionAt tribute("s tationNumb er")) != n ull){ | |
| 367 | statio nNumber = (String)ge tSessionAt tribute("s tationNumb er"); | |
| 368 | } | |
| 369 | ||
| 370 | if(( selectActi on != null ) && (sele ctAction.e qualsIgnor eCase("Sea rch"))){ | |
| 371 | ||
| 372 | if(sea rchCrit == null){ | |
| 373 | addActio nError("Pl ease selec t a radio button."); | |
| 374 | return S ELECT_STAF F; | |
| 375 | } | |
| 376 | if(sta tionNumber == null){ | |
| 377 | ||
| 378 | if(Strin gUtils.isB lank(selec tedVisnNam e)){ | |
| 379 | addActionE rror("Plea se select a VISN."); | |
| 380 | return SEL ECT_STAFF; | |
| 381 | }else{ | |
| 382 | addActionE rror("Plea se select a facility ."); | |
| 383 | return SEL ECT_STAFF; | |
| 384 | } | |
| 385 | } | |
| 386 | ||
| 387 | try{ | |
| 388 | if(searc hCrit.equa lsIgnoreCa se("0")){ | |
| 389 | ||
| 390 | if(lastNam e.trim().e quals("") && firstNa me.trim(). equals("") ){ | |
| 391 | ad dActionErr or("Please enter the First Nam e and Last Name and select the 'Search b y Name' ra dio button ."); | |
| 392 | re turn SELEC T_STAFF; | |
| 393 | } | |
| 394 | ||
| 395 | if(lastNam e.trim().e quals("")) { | |
| 396 | ad dActionErr or("Please enter the Last Name and selec t the 'Sea rch by Nam e' radio b utton."); | |
| 397 | re turn SELEC T_STAFF; | |
| 398 | } | |
| 399 | ||
| 400 | if(firstNa me.trim(). equals("") ){ | |
| 401 | ad dActionErr or("Please enter the First Nam e and sele ct the 'Se arch by Na me' radio button."); | |
| 402 | re turn SELEC T_STAFF; | |
| 403 | } | |
| 404 | ||
| 405 | if(firstNa me.trim(). length() < 2 || last Name.trim( ).length() < 2){ | |
| 406 | ad dActionErr or("Please enter at least firs t 2 charac ters of Fi rst Name a nd Last Na me."); | |
| 407 | re turn SELEC T_STAFF; | |
| 408 | } | |
| 409 | ||
| 410 | if((activa tionType ! = null) && (activati onType.equ alsIgnoreC ase("inact ivate"))){ | |
| 411 | cl inicians = (List<Cli nician>) u serManagem entService .searchFor Clinicians (firstName , lastName , stationN umber, tru e).getColl ection(); | |
| 412 | }else if(( activation Type != nu ll) && (ac tivationTy pe.equalsI gnoreCase( "reactivat e"))){ | |
| 413 | cl inicians = (List<Cli nician>) u serManagem entService .searchFor Clinicians (firstName , lastName , stationN umber, fal se).getCol lection(); | |
| 414 | }else{ | |
| 415 | st affMembers = (List)g etVistASta ffMembers( firstName, lastName,s tationNumb er,null); | |
| 416 | Li st userMan agementSta ffMembers = (List<Cl inician>) userManage mentServic e.searchFo rClinician s(firstNam e, lastNam e, station Number).ge tCollectio n(); | |
| 417 | ||
| 418 | if (staffMemb ers == nul l){ | |
| 419 | addA ctionError ("A search of the Vi stA databa se did not produce a match for the infor mation giv en."); | |
| 420 | retu rn SELECT_ STAFF; | |
| 421 | } | |
| 422 | st affMembers = filterS taffMember s(staffMem bers,userM anagementS taffMember s); | |
| 423 | } | |
| 424 | }else{ | |
| 425 | if((duz == null) || ((duz.trim ()).equals (""))){ | |
| 426 | addActionE rror("Plea se enter D UZ and sel ect 'Searc h by DUZ' radio butt on."); | |
| 427 | return SEL ECT_STAFF; | |
| 428 | } | |
| 429 | ||
| 430 | ||
| 431 | if(duz !=n ull) duz=d uz.trim(); | |
| 432 | if((activa tionType ! = null) && (activati onType.equ alsIgnoreC ase("inact ivate"))){ | |
| 433 | Se rviceRespo nse<Clinic ian> respo nse = user Management Service.ge tClinician ForStation AndDuz(sta tionNumber , duz, tru e); | |
| 434 | cl in = respo nse.getPay load(); | |
| 435 | }else if(( activation Type != nu ll) && (ac tivationTy pe.equalsI gnoreCase( "reactivat e"))){ | |
| 436 | Se rviceRespo nse<Clinic ian> respo nse = user Management Service.ge tClinician ForStation AndDuz(sta tionNumber , duz, fal se); | |
| 437 | cl in = respo nse.getPay load(); | |
| 438 | ||
| 439 | }else{ | |
| 440 | st affMembers = (List)g etVistASta ffMembers( null,null, stationNum ber,duz); | |
| 441 | Cl inician cl inician = userDao.f indAuthCli nicianBySt ationAndDu z(stationN umber,duz) ; | |
| 442 | Ar rayList<Cl inician> u serManagem entStaffMe mbers = ne w ArrayLis t<Clinicia n>(); | |
| 443 | if (clinician !=null) | |
| 444 | user Management StaffMembe rs.add(cli nician); | |
| 445 | ||
| 446 | if (staffMemb ers == nul l){ | |
| 447 | addA ctionError ("A search of the Vi stA databa se did not produce a match for the infor mation giv en."); | |
| 448 | } | |
| 449 | if (userManag ementStaff Members.si ze()!=0) | |
| 450 | staf fMembers = filterSta ffMembers( staffMembe rs,userMan agementSta ffMembers) ; | |
| 451 | } | |
| 452 | ||
| 453 | if(clin!=n ull){ | |
| 454 | cl inicians.a dd(clin); | |
| 455 | } | |
| 456 | } | |
| 457 | }catch (Exception e){ | |
| 458 | if(log.i sErrorEnab led()){ | |
| 459 | log.error( "searchSta ffMembers( )=>Excepti on occured while sea rch Staff Members"+e .getMessag e()); | |
| 460 | e.printSta ckTrace(); | |
| 461 | } | |
| 462 | addActio nError("An unexpecte d error ha s occurred . Please c ontact the Help Desk , if the p roblem per sists."); | |
| 463 | } | |
| 464 | setSes sionAttrib ute("staff Members",s taffMember s); | |
| 465 | setSes sionAttrib ute("clini cians",cli nicians); | |
| 466 | ||
| 467 | ||
| 468 | if((ac tivationTy pe != null ) && ((act ivationTyp e.equalsIg noreCase(" inactivate ")) || (ac tivationTy pe.equalsI gnoreCase( "reactivat e")))){ | |
| 469 | return Q UERY_RESUL TS_IR; | |
| 470 | } | |
| 471 | ||
| 472 | return SUCCESS; | |
| 473 | ||
| 474 | } | |
| 475 | ||
| 476 | try{ | |
| 477 | String cf = getP arameter(" changeFaci lity"); | |
| 478 | if(!St ringUtils. isBlank(cf ) && cf.eq ualsIgnore Case("yes" )){ | |
| 479 | selected FacilityNa me = null; | |
| 480 | } | |
| 481 | }cat ch(Excepti on e){ | |
| 482 | if(log .isErrorEn abled()){ | |
| 483 | log.erro r("Excepti on occurre d in chang eFacility" ); | |
| 484 | } | |
| 485 | } | |
| 486 | ||
| 487 | retu rn SELECT_ STAFF; | |
| 488 | } | |
| 489 | ||
| 490 | /* * | |
| 491 | * filteredS tffMembers | |
| 492 | * @param vi staStaffMe mbers | |
| 493 | * @param us erManageme ntStaffMem bers | |
| 494 | * @return L ist<User> | |
| 495 | * / | |
| 496 | pr ivate List <UserInfoD TO> filter StaffMembe rs(List<Us erInfoDTO> vistaStaf fMembers,L ist<Clinic ian> userM anagementS taffMember s){ | |
| 497 | ||
| 498 | ||
| 499 | Arra yList<User InfoDTO> f ilteredSta ffMembers = new Arra yList<User InfoDTO>() ; | |
| 500 | Arra yList<Stri ng> active Clinicians = new Arr ayList<Str ing>(); | |
| 501 | for( Clinician clinician: userManage mentStaffM embers){ | |
| 502 | if(cli nician.get Duz()!=nul l){ | |
| 503 | activeCl inicians.a dd(clinici an.getDuz( )); | |
| 504 | } | |
| 505 | } | |
| 506 | for( UserInfoDT O user:vis taStaffMem bers){ | |
| 507 | if(!ac tiveClinic ians.conta ins(user.g etDuz())){ | |
| 508 | filtered StaffMembe rs.add(use r); | |
| 509 | } | |
| 510 | } | |
| 511 | retu rn filtere dStaffMemb ers; | |
| 512 | } | |
| 513 | ||
| 514 | pu blic Strin g associat eNetworkId (){ | |
| 515 | ||
| 516 | if(a ppliedCanc el()){ ret urn CANCEL ; } | |
| 517 | User InfoDTO se lectedVist aUser = nu ll; | |
| 518 | try{ | |
| 519 | duz = (getParame ter("ien") == null)? "":getPara meter("ien "); | |
| 520 | if(duz == null){ | |
| 521 | addActio nError("Co uld not fi nd IEN for the selec ted user." ); | |
| 522 | } | |
| 523 | //List <UserNew> searchedUs ers = (Lis t<UserNew> )getSessio nAttribute ("staffMem bers"); | |
| 524 | List<U serInfoDTO > searched Users = (L ist<UserIn foDTO>)get SessionAtt ribute("st affMembers "); | |
| 525 | ||
| 526 | if(sea rchedUsers != null){ | |
| 527 | for(User InfoDTO us erInfoDto: searchedUs ers){ | |
| 528 | if(duz.equ alsIgnoreC ase(userIn foDto.getD uz())){ | |
| 529 | se lectedVist aUser = us erInfoDto; | |
| 530 | } | |
| 531 | } | |
| 532 | } | |
| 533 | ||
| 534 | if(get VistAPatch 29Status(( String)get SessionAtt ribute("st ationNumbe r"))){ | |
| 535 | ServiceRes ponse<Prov ider> pcmm Response = getAdmin Service(). getPcmmPro vider((Str ing)getSes sionAttrib ute("stati onNumber") , duz); | |
| 536 | if(log.isI nfoEnabled ()){ | |
| 537 | lo g.info("as sociateNet workId=>10 0 pcmmResp onse==>"+p cmmRespons e); | |
| 538 | lo g.info("as sociateNet workId=>10 1 pcmmResp onse==>"+p cmmRespons e.getPaylo ad()); | |
| 539 | } | |
| 540 | if(selecte dVistaUser !=null){ | |
| 541 | if (pcmmRespo nse!=null && pcmmRes ponse.getP ayload()!= null && pc mmResponse .getPayloa d().getIEN ()!=null){ | |
| 542 | sele ctedVistaU ser.setPcm mFlag("YES "); | |
| 543 | }e lse{ | |
| 544 | sele ctedVistaU ser.setPcm mFlag("NO" ); | |
| 545 | } | |
| 546 | } | |
| 547 | ||
| 548 | LocationDs sUnitsDTO dssUnitsDT O = getAdm inService( ).getDSSUn itsByClini cAndStatio n((String) getSession Attribute( "stationNu mber"), AL L_DSS_UNIT S, duz, AL L_DSS_UNIT S); | |
| 549 | if(dssUnit sDTO!=null && dssUni tsDTO.getE rror()==nu ll){ | |
| 550 | Li st<DSSUnit > dssUnits = dssUnit sDTO.getDs sUnits(); | |
| 551 | St ringBuilde r strBuild er=new Str ingBuilder (); | |
| 552 | in t count=1; | |
| 553 | fo r(DSSUnit dss:dssUni ts){ | |
| 554 | strB uilder.app end(dss.ge tDSSName() ); | |
| 555 | if(c ount!=dssU nits.size( )) strBuil der.append ("|"); | |
| 556 | coun t++; | |
| 557 | } | |
| 558 | if (selectedV istaUser!= null){ | |
| 559 | sele ctedVistaU ser.setDss Units(strB uilder.toS tring()); | |
| 560 | } | |
| 561 | } | |
| 562 | } | |
| 563 | setSes sionAttrib ute("selec tedVistaUs er",select edVistaUse r); | |
| 564 | setSes sionAttrib ute("duz", duz); | |
| 565 | getUse rInformati on(); | |
| 566 | }cat ch(Excepti on exp1){ | |
| 567 | if(log .isErrorEn abled()){ | |
| 568 | log.erro r("associa teNetworkI d()=>Excep tion occur red while getting se lected use r details. "+exp1); | |
| 569 | } | |
| 570 | } | |
| 571 | ||
| 572 | retu rn SUCCESS ; | |
| 573 | } | |
| 574 | ||
| 575 | ||
| 576 | pu blic void getUserInf ormation() { | |
| 577 | User InfoDTO se lectedVist AUser = (U serInfoDTO )getSessio nAttribute ("selected VistaUser" ); | |
| 578 | if(s electedVis tAUser!=nu ll){ | |
| 579 | firstN ame = sele ctedVistAU ser.getFir stName(); | |
| 580 | lastNa me = selec tedVistAUs er.getLast Name(); | |
| 581 | middle Name = sel ectedVistA User.getMi ddleName() ; | |
| 582 | title = selected VistAUser. getTitle() ; | |
| 583 | phone = selected VistAUser. getWorkPho ne(); | |
| 584 | duz = selectedVi stAUser.ge tDuz(); | |
| 585 | suffix = selecte dVistAUser .getSuffix () ; | |
| 586 | prefix = selecte dVistAUser .getPrefix (); | |
| 587 | active Flag=""; | |
| 588 | if(sel ectedVistA User.getAc tiveFlag() !=null){ | |
| 589 | activeFl ag = selec tedVistAUs er.getActi veFlag().e quals("0") ?"ACTIVE": "INACTIVE" ; | |
| 590 | } | |
| 591 | provid erKey = se lectedVist AUser.getP roviderKey (); | |
| 592 | provid erClass = selectedVi stAUser.ge tProviderC lass(); | |
| 593 | try{ | |
| 594 | if(selec tedVistAUs er.getVist APersonCla ss()!=null && select edVistAUse r.getPerso nClass()== null){ | |
| 595 | if(selecte dVistAUser .getVistAP ersonClass ()[0]!=nul l){ | |
| 596 | St ring perso nClassific ation = Us erUtils.ge tProviderP ersonClass ification( selectedVi stAUser.ge tVistAPers onClass()[ 0]); | |
| 597 | if (personCla ssificatio n!=null) | |
| 598 | sele ctedVistAU ser.setPer sonClass(U serUtils.f ormatPerso nClass(per sonClassif ication)); | |
| 599 | } | |
| 600 | } | |
| 601 | personCl ass = sele ctedVistAU ser.getPer sonClass() ; | |
| 602 | } | |
| 603 | catch( Exception exp2){ | |
| 604 | if(log.i sErrorEnab led()){ | |
| 605 | log.error( "getUserIn formation= >An Error Occured wh ile extrac ting Perso n Class "+ exp2); | |
| 606 | } | |
| 607 | } | |
| 608 | pcmmFl ag =""; | |
| 609 | if(sel ectedVistA User.getPc mmFlag()!= null){ | |
| 610 | pcmmFlag = selecte dVistAUser .getPcmmFl ag(); | |
| 611 | } | |
| 612 | requir esCoSigner = selecte dVistAUser .getRequir esCoSigner (); | |
| 613 | if(sel ectedVistA User.getDs sUnits()!= null && se lectedVist AUser.getD ssUnits(). length()!= 0){ | |
| 614 | dssUnits = StringU tils.split (selectedV istAUser.g etDssUnits (),"|"); | |
| 615 | } | |
| 616 | setSes sionAttrib ute("selec tedVistaUs er",select edVistAUse r); | |
| 617 | } | |
| 618 | } | |
| 619 | ||
| 620 | ||
| 621 | pu blic Strin g verifyWi thADResult s(){ | |
| 622 | getU serInforma tion(); | |
| 623 | if(a ppliedCanc el()){ ret urn CANCEL ; } | |
| 624 | ||
| 625 | if(i sSearchRes ults()) | |
| 626 | { | |
| 627 | return SEARCH_RE SULTS; | |
| 628 | } | |
| 629 | ||
| 630 | getS taffSessio nAttr(); | |
| 631 | ||
| 632 | if(i sNewSearch ()) | |
| 633 | { | |
| 634 | return SELECT_ST AFF; | |
| 635 | } | |
| 636 | ||
| 637 | if(( networkId == null) | | ((networ kId.trim() ).equals(" "))){ | |
| 638 | addAct ionError(" Please ent er the Net work ID.") ; | |
| 639 | return FAILED; | |
| 640 | } | |
| 641 | ||
| 642 | Stri ng station Number = n ull; | |
| 643 | if(( (String)ge tSessionAt tribute("s tationNumb er")) != n ull){ | |
| 644 | statio nNumber = (String)ge tSessionAt tribute("s tationNumb er"); | |
| 645 | } | |
| 646 | ||
| 647 | if ( stationNum ber == nul l) { | |
| 648 | addAct ionError(" Please sel ect a faci lity."); | |
| 649 | return SELECT_ST AFF; | |
| 650 | } | |
| 651 | ||
| 652 | Clin ician exis tingClinic ian = user Dao.findCl inicianByS tationAndU sername(st ationNumbe r, network Id); | |
| 653 | if ( existingCl inician != null) { | |
| 654 | addAct ionError(" Network ID " + | |
| 655 | networkId + | |
| 656 | " is alre ady in use at this s tation by " + | |
| 657 | (existing Clinician. isActive() ? "active " : "inact ive") + | |
| 658 | " staff m ember " + | |
| 659 | existingC linician.g etName()); | |
| 660 | return FAILED; | |
| 661 | } | |
| 662 | ||
| 663 | ADQu eryResult staffADRes ults = nul l; | |
| 664 | firs tNameAD = ""; | |
| 665 | last NameAD = " "; | |
| 666 | phon eAD = ""; | |
| 667 | titl eAD = ""; | |
| 668 | netw orkIdAD = ""; | |
| 669 | emai lAD = ""; | |
| 670 | try{ | |
| 671 | ||
| 672 | Servic eResponse< ADQueryRes ult> respo nse = getA dminServic e().findAD Account(ne tworkId); | |
| 673 | staffA DResults = response. getPayload (); | |
| 674 | if(sta ffADResult s == null) { | |
| 675 | if(log.i sInfoEnabl ed()){ | |
| 676 | log.info(L ogSanitize r.cleanTex t("verifyW ithADResul ts()=>AD R esults: Nu ll for net workId"+ne tworkId)); | |
| 677 | } | |
| 678 | addActio nError("An Email Add ress could not be fo und in Out look using the VistA search re sults."); | |
| 679 | return F AILED; | |
| 680 | }else{ | |
| 681 | firstNam eAD = (sta ffADResult s.getFirst Name() == null)?"":s taffADResu lts.getFir stName(); | |
| 682 | lastName AD = (staf fADResults .getLastNa me() == nu ll)?"":sta ffADResult s.getLastN ame(); | |
| 683 | phoneAD = (staffAD Results.ge tTelephone Number() = = null)?"" :staffADRe sults.getT elephoneNu mber(); | |
| 684 | titleAD = (staffAD Results.ge tTitle() = = null)?"" :staffADRe sults.getT itle(); | |
| 685 | emailAD = (staffAD Results.ge tEmail() = = null)?"" :staffADRe sults.getE mail(); | |
| 686 | setSessi onAttribut e("email", emailAD); | |
| 687 | networkI dAD = netw orkId; | |
| 688 | this.set Email(emai lAD); | |
| 689 | staffADR esults.set UserName(n etworkId); | |
| 690 | } | |
| 691 | }cat ch(Excepti on e){ | |
| 692 | if(log .isErrorEn abled()){ | |
| 693 | log.erro r("verifyW ithADResul ts()=>"+e. getMessage () ); | |
| 694 | e.printS tackTrace( ); | |
| 695 | } | |
| 696 | addAct ionError(" Error occu rred while accessing the activ e director y."); | |
| 697 | } | |
| 698 | ||
| 699 | setS essionAttr ibute("sta ffADResult s",staffAD Results); | |
| 700 | ||
| 701 | retu rn SUCCESS ; | |
| 702 | } | |
| 703 | ||
| 704 | pu blic Strin g assignSt affMemberT ype(){ | |
| 705 | ||
| 706 | ||
| 707 | if(a ppliedCanc el()){ ret urn CANCEL ; } | |
| 708 | getU serInforma tion(); | |
| 709 | getS taffSessio nAttr(); | |
| 710 | ||
| 711 | if(i sNewSearch ()){ retur n SELECT_S TAFF; } | |
| 712 | duz = (String) getSession Attribute( "duz"); | |
| 713 | staf fMemberTyp es = (List <ClinicalU serType>)g etAdminSer vice().get ClinicalUs erTypes(). getCollect ion(); | |
| 714 | retu rn SUCCESS ; | |
| 715 | } | |
| 716 | ||
| 717 | pu blic Strin g activate StaffMembe r(){ | |
| 718 | ||
| 719 | if(a ppliedCanc el()){ ret urn CANCEL ; } | |
| 720 | ||
| 721 | getS taffSessio nAttr(); | |
| 722 | ||
| 723 | if(i sNewSearch ()){ retur n SELECT_S TAFF; } | |
| 724 | ||
| 725 | Clin icalUserTy pe clinica lUserType = null; | |
| 726 | bool ean userTy peSelected = false; | |
| 727 | duz = (String) getSession Attribute( "duz"); | |
| 728 | Stri ng station Number = ( String)get SessionAtt ribute("st ationNumbe r"); | |
| 729 | User InfoDTO se lectedVist aUser = (U serInfoDTO )getSessio nAttribute ("selected VistaUser" ); | |
| 730 | ADQu eryResult adr = (ADQ ueryResult )getSessio nAttribute ("staffADR esults"); | |
| 731 | ||
| 732 | staf fMemberTyp es = (List <ClinicalU serType>)g etAdminSer vice().get ClinicalUs erTypes(). getCollect ion(); | |
| 733 | if(s taffMember Types != n ull){ | |
| 734 | for(Cl inicalUser Type cu: s taffMember Types){ | |
| 735 | if((cu.g etId()).eq uals(membe rTypeId)){ | |
| 736 | clinicalUs erType = c u; | |
| 737 | memberType = cu.getN ame(); | |
| 738 | userTypeSe lected = t rue; | |
| 739 | } | |
| 740 | } | |
| 741 | } | |
| 742 | if(! userTypeSe lected){ | |
| 743 | addAct ionError(" Please sel ect a user type."); | |
| 744 | getUse rInformati on(); | |
| 745 | setSes sionAttrib ute("email ",getEmail ()); | |
| 746 | return FAILED; | |
| 747 | } | |
| 748 | ||
| 749 | if(g etEmail()= =null || g etEmail(). equals("") ){ | |
| 750 | addAct ionError(" Email Addr ess cannot be blank. "); | |
| 751 | return FAILED; | |
| 752 | } | |
| 753 | else | |
| 754 | { | |
| 755 | EmailV alidator e mailValida tor = Emai lValidator .getInstan ce(); | |
| 756 | if(!em ailValidat or.isValid (email)){ | |
| 757 | addActio nError(ESA PI.encoder ().encodeF orHTML(ema il) + " is not a Val id Email A ddress."); | |
| 758 | setEmail (getEmail( )); | |
| 759 | setSessi onAttribut e("email", getEmail() ); | |
| 760 | return F AILED; | |
| 761 | } | |
| 762 | else | |
| 763 | { | |
| 764 | adr.setE mail(getEm ail()); | |
| 765 | setSessi onAttribut e("email", getEmail() ); | |
| 766 | } | |
| 767 | } | |
| 768 | ||
| 769 | Admi nistrator admin = (A dministrat or)getSess ionAttribu te(CURRENT _USER); | |
| 770 | Clin ician clin = null; | |
| 771 | ||
| 772 | try{ | |
| 773 | Servic eResponse< Clinician> response = getAdmin Service(). activateNe wProvider( stationNum ber, selec tedVistaUs er, adr,cl inicalUser Type, admi n); | |
| 774 | clin = response. getPayload (); | |
| 775 | }cat ch(Excepti on exp3){ | |
| 776 | if(log .isErrorEn abled()){ | |
| 777 | log.erro r("activat eStaffMemb er()=>Exce ption occu red while active sta ff member" +exp3); | |
| 778 | } | |
| 779 | } | |
| 780 | ||
| 781 | if ( clin == nu ll){ | |
| 782 | addAct ionError(" An unexpec ted error has occurr ed. Please contact t he Help De sk, if the problem p ersists.") ; | |
| 783 | return FAILED; | |
| 784 | } | |
| 785 | getU serInforma tion(); | |
| 786 | retu rn SUCCESS ; | |
| 787 | } | |
| 788 | ||
| 789 | pu blic Strin g activate AnotherSta ffMember() { | |
| 790 | ||
| 791 | firs tName=null ; | |
| 792 | last Name=null; | |
| 793 | duz= null; | |
| 794 | if(( selectActi on!=null) && ((selec tAction.tr im()).equa lsIgnoreCa se("Done") )){ | |
| 795 | clearS essionAttr (); | |
| 796 | return CANCEL; | |
| 797 | } | |
| 798 | getS taffSessio nAttr(); | |
| 799 | ||
| 800 | retu rn SELECT_ STAFF; | |
| 801 | } | |
| 802 | ||
| 803 | ||
| 804 | pu blic Strin g showMemb erDetails( ){ | |
| 805 | ||
| 806 | if(a ppliedCanc el()){ ret urn CANCEL ; } | |
| 807 | Clin ician clin = null; | |
| 808 | try{ | |
| 809 | duz = (getParame ter("duz") == null)? "":getPara meter("duz "); | |
| 810 | if(duz == null){ | |
| 811 | addActio nError("Co uld not fi nd DUZ for the selec ted user." ); | |
| 812 | } | |
| 813 | List<C linician> searchedUs ers = (Lis t<Clinicia n>)getSess ionAttribu te("clinic ians"); | |
| 814 | if(sea rchedUsers != null){ | |
| 815 | for(Clin ician u:se archedUser s){ | |
| 816 | if(duz.equ alsIgnoreC ase(u.getD uz())){ | |
| 817 | cl in = u; | |
| 818 | } | |
| 819 | } | |
| 820 | } | |
| 821 | if(cli n != null) { | |
| 822 | firstNam e = (clin. getFirstNa me() == nu ll)?"":cli n.getFirst Name(); | |
| 823 | lastName = (clin.g etLastName () == null )?"":clin. getLastNam e(); | |
| 824 | networkI d = (clin. getUsernam e() == nul l)?"":clin .getUserna me(); | |
| 825 | middleNa me = (clin .getMiddle Name() == null)?"":c lin.getMid dleName(); | |
| 826 | title = (clin.getT itle() == null)?"":c lin.getTit le(); | |
| 827 | phone =( clin.getPh one() == n ull)?"":cl in.getPhon e(); | |
| 828 | suffix = (clin.get Suffix() = = null)?"" :clin.getS uffix(); | |
| 829 | prefix = (clin.getP refix() == null)?"": clin.getPr efix(); | |
| 830 | if(clin. getProvide rVistAActi veFlag()!= null) acti veFlag = c lin.getPro viderVistA ActiveFlag ().equals( "0")?"ACTI VE":"INACT IVE"; | |
| 831 | requires CoSigner = clin.getR equiresCos igner(); | |
| 832 | if(clin. getProvide rPcmmFlag( )!=null) p cmmFlag = clin.getPr oviderPcmm Flag().equ als("1")?" YES":"NO"; | |
| 833 | personCl ass = clin .getPerson Class()!=n ull?clin.g etPersonCl ass():""; | |
| 834 | if(clin. getProvide r()!=null) providerK ey = clin. getProvide r().equals IgnoreCase ("1")?"TRU E":"FALSE" ; | |
| 835 | provider Class = cl in.getProv iderClass( ); | |
| 836 | if(clin. getDmmsUni ts()!=null ) dssUnits = StringU tils.split (clin.getD mmsUnits() ,DATA_DELI MITER); | |
| 837 | Clinical UserType c u = (Clini calUserTyp e)clin.get ClinicalUs erType(); | |
| 838 | if(cu != null){ | |
| 839 | memberType = (cu.get Name() == null)?"":c u.getName( ); | |
| 840 | } | |
| 841 | } | |
| 842 | setSes sionAttrib ute("selec tedUser",c lin); | |
| 843 | setSes sionAttrib ute("duz", duz); | |
| 844 | }cat ch(Excepti on e){ | |
| 845 | if(log .isErrorEn abled()){ | |
| 846 | log.erro r("showMem berDetails ()=>Except ion occurr ed while g etting sel ected user details." ); | |
| 847 | e.printS tackTrace( ); | |
| 848 | } | |
| 849 | } | |
| 850 | ||
| 851 | retu rn SUCCESS ; | |
| 852 | ||
| 853 | } | |
| 854 | ||
| 855 | ||
| 856 | pu blic Strin g inactiva teReactiva teMember() { | |
| 857 | ||
| 858 | if(a ppliedCanc el()){ ret urn CANCEL ; } | |
| 859 | ||
| 860 | if(i sSearchRes ults()) | |
| 861 | { | |
| 862 | return SEARCH_RE SULTS; | |
| 863 | } | |
| 864 | ||
| 865 | getS taffSessio nAttr(); | |
| 866 | ||
| 867 | if(i sNewSearch ()){ retur n SELECT_S TAFF; } | |
| 868 | Stri ng activat ionType = (String)ge tSessionAt tribute("a ctivationT ype"); | |
| 869 | try { | |
| 870 | Clinic ian c = (C linician)g etSessionA ttribute(" selectedUs er"); | |
| 871 | if(c ! = null){ | |
| 872 | if((acti vationType != null) && (activa tionType.e qualsIgnor eCase("ina ctivate")) ){ | |
| 873 | c = (Clini cian) user Management Service.in activateRe activateCl inician(c, false).ge tPayload() ; | |
| 874 | }else if ((activati onType != null) && ( activation Type.equal sIgnoreCas e("reactiv ate"))){ | |
| 875 | c = (Clini cian) user Management Service.in activateRe activateCl inician(c, true).get Payload(); | |
| 876 | } | |
| 877 | } | |
| 878 | } ca tch (Excep tion e) { | |
| 879 | log.in fo("Except ion occurr ed while i nactivatin g the sele cted user. "); | |
| 880 | addAct ionError(" Error occu rred while inactivat ing the se lected use r."); | |
| 881 | } | |
| 882 | ||
| 883 | retu rn SUCCESS ; | |
| 884 | ||
| 885 | } | |
| 886 | ||
| 887 | pu blic Strin g inactiva tionReacti vationComp lete(){ | |
| 888 | ||
| 889 | clea rSessionAt tr(); | |
| 890 | retu rn CANCEL; | |
| 891 | ||
| 892 | } | |
| 893 | ||
| 894 | pu blic Strin g bulkActi vation() { | |
| 895 | if(a ppliedCanc el()){ ret urn CANCEL ; } | |
| 896 | clea rSessionAt tr(); | |
| 897 | List <User> sta ffMembers= new Array List<User> (); | |
| 898 | bool ean activa tionSucces s = true; | |
| 899 | try{ | |
| 900 | ||
| 901 | log.in fo(LogSani tizer.clea nText("fil e name: " + uploadFi leName)); | |
| 902 | upload FileName = (uploadFi leName == null)?"":u ploadFileN ame; | |
| 903 | if(upl oadFileNam e.equals(" ")){ | |
| 904 | if(!chec kFileSizeM essage()){ | |
| 905 | addActionE rror("Plea se select a file"); | |
| 906 | } | |
| 907 | return F AILED; | |
| 908 | } | |
| 909 | log.in fo(LogSani tizer.clea nText("Con tent type: " + getUp loadConten tType())); | |
| 910 | Object rawConten t = getUpl oad().toUR L().getCon tent(); | |
| 911 | ||
| 912 | InputS tream is = (InputStr eam)rawCon tent; | |
| 913 | Reader reader = new InputS treamReade r(is); | |
| 914 | String Builder co ntent = ne w StringBu ilder(); | |
| 915 | int re ad = 0; | |
| 916 | while ( read > - 1 ) { | |
| 917 | char[] b uffer = ne w char[102 4]; | |
| 918 | read = r eader.read (buffer); | |
| 919 | content. append(buf fer); | |
| 920 | if(FILE_ SIZE_LIMIT _2MB<conte nt.length( )) { | |
| 921 | addActionE rror(FILE_ SIZE_LIMIT _ERROR); | |
| 922 | return FAI LED; | |
| 923 | } | |
| 924 | } | |
| 925 | if(log .isInfoEna bled()){ | |
| 926 | log.info (LogSaniti zer.cleanT ext("Conte nts:\n" + content.to String().t rim())); | |
| 927 | } | |
| 928 | String fileConte nt = conte nt.toStrin g().trim() ; | |
| 929 | if(fil eContent.l ength() == 0){ | |
| 930 | addActio nError("Th e bulk add ition of u ser record s failed" + | |
| 931 | " because of the follo wing recor ds. " + | |
| 932 | "C orrect the se records and repea t bulk add ition:"); | |
| 933 | ||
| 934 | addActio nError("Li ne 1-incor rectly for matted."); | |
| 935 | addActio nError("No Secure Me ssaging St aff Member s have bee n activate d."); | |
| 936 | return F AILED; | |
| 937 | } | |
| 938 | String [] rows = fileConten t.split("\ r\n"); | |
| 939 | //Vali date the B ulk Record File | |
| 940 | if(val idateBulkR ecordFile( rows)){ | |
| 941 | addActio nError("No Secure Me ssaging St aff Member s have bee n activate d."); | |
| 942 | return F AILED; | |
| 943 | }else{ | |
| 944 | String r ecordType; | |
| 945 | String f irstName; | |
| 946 | String l astName; | |
| 947 | String s tationNumb er; | |
| 948 | added=0; | |
| 949 | int line Number = 0 ; | |
| 950 | for (int i=0; i<ro ws.length; i++){ | |
| 951 | log.info(L ogSanitize r.cleanTex t("Line" + i + ":" + rows[i])) ; | |
| 952 | String row Data = row s[i]; | |
| 953 | String[] f ields = ro wData.spli t(","); | |
| 954 | recordType = fields [0].trim() ; | |
| 955 | firstName = fields[ 1].trim(); | |
| 956 | lastName = fields[2 ].trim(); | |
| 957 | duz = fie lds[3].tri m(); | |
| 958 | stationNum ber = fie lds[4].tri m(); | |
| 959 | networkId = fields[ 5].trim(); | |
| 960 | Long clini calUserTyp eId = Lon g.valueOf( fields[6]. trim()); | |
| 961 | lineNumber = i + 1; | |
| 962 | log.info(L ogSanitize r.cleanTex t("firstNa me= "+firs tName)); | |
| 963 | log.info(L ogSanitize r.cleanTex t("lastNam e= "+lastN ame)); | |
| 964 | log.info(L ogSanitize r.cleanTex t("duz:" + duz.toStr ing())); | |
| 965 | log.info(L ogSanitize r.cleanTex t("station Number:" + stationNu mber.toStr ing())); | |
| 966 | log.info(L ogSanitize r.cleanTex t("clinica lUserTypeI d:" + clin icalUserTy peId.toStr ing())); | |
| 967 | log.info(L ogSanitize r.cleanTex t("network Id:" + net workId.toS tring())); | |
| 968 | boolean is Added = ac tivateBulk StaffMembe r(lineNumb er, duz,st ationNumbe r, clinica lUserTypeI d, network Id, firstN ame, lastN ame); | |
| 969 | if(isAdded ){ | |
| 970 | ad ded++; | |
| 971 | } | |
| 972 | activation Success = activation Success && isAdded; | |
| 973 | } | |
| 974 | } | |
| 975 | }cat ch (java.i o.FileNotF oundExcept ion e) { | |
| 976 | addAct ionError(" The bulk a ddition of user reco rds failed " + | |
| 977 | " because of the fol lowing rec ords. " + | |
| 978 | "Correct t hese recor ds and rep eat bulk a ddition:") ; | |
| 979 | ||
| 980 | addAct ionError(" Line 1-inc orrectly f ormatted." ); | |
| 981 | addAct ionError(" No Secure Messaging Staff Memb ers have b een activa ted."); | |
| 982 | log.er ror(e); | |
| 983 | return FAILED; | |
| 984 | ||
| 985 | } ca tch(Except ion e) { | |
| 986 | log.er ror(e); | |
| 987 | return FAILED; | |
| 988 | } | |
| 989 | ||
| 990 | if(a ctivationS uccess){ | |
| 991 | return SUCCESS; | |
| 992 | }else{ | |
| 993 | retu rn FAILED; | |
| 994 | } | |
| 995 | } | |
| 996 | ||
| 997 | /* * | |
| 998 | * There are two limit s for file upload si ze struts. multipart. maxSize an d maximumS ize in the action | |
| 999 | * intercept or. The pr oblem is f or bug :53 91 providi ng custom message is not easy as the | |
| 1000 | * error mes sage is ha rdcoded in MultiPart Request. I n the foll owing code the excep tion is | |
| 1001 | * trapped a nd replace d with the message a s stated i n specific ation. | |
| 1002 | * / | |
| 1003 | ||
| 1004 | pr ivate bool ean checkF ileSizeMes sage() { | |
| 1005 | bool ean hasSiz eError = f alse; | |
| 1006 | Coll ection<?> tmp = getA ctionError s(); | |
| 1007 | if(t mp!= null) { | |
| 1008 | Collec tion<Strin g> errors = new Arra yList<Stri ng>(); | |
| 1009 | for (O bject o : tmp) { | |
| 1010 | if(o != null){ | |
| 1011 | if (o.toStrin g().contai ns("the re quest was rejected b ecause its size")) { | |
| 1012 | h asSizeErro r = true; | |
| 1013 | e rrors.add( FILE_SIZE_ LIMIT_ERRO R); | |
| 1014 | } e lse { | |
| 1015 | e rrors.add( o.toString ()); | |
| 1016 | } | |
| 1017 | } | |
| 1018 | } | |
| 1019 | ||
| 1020 | setAct ionErrors( errors); | |
| 1021 | } | |
| 1022 | retu rn hasSize Error; | |
| 1023 | } | |
| 1024 | ||
| 1025 | /* | |
| 1026 | * Validate the Bulk R ecord File , it is a Comma Sepa rated Valu es (CSV) f ile where each row i s expected to | |
| 1027 | * have a ce rtain numb er and typ e of field s. Text fi elds are e nclosed in quotes. | |
| 1028 | * BR3902 Th e Bulk Rec ord Schema | |
| 1029 | * Retruns t rue if fil e is not f ormating i s wrong. | |
| 1030 | * C,FNAME,L NAME,DUZ,S TATION_NO, EXTERNAL_U SERNAME,CL INICAL_USE R_TYPE_ID | |
| 1031 | C,JOHN,DOE ,12345,994 ,
|
|
| 1032 | * / | |
| 1033 | pr ivate bool ean valida teBulkReco rdFile(Str ing[] rows ){ | |
| 1034 | //ke ep track o f duplicat es in curr ent file u sers | |
| 1035 | Map currentFil eUsers = n ew HashMap (); | |
| 1036 | ||
| 1037 | bool ean fileFa iled = fal se; | |
| 1038 | for (int i=0; i<rows.len gth; i++){ | |
| 1039 | ||
| 1040 | log.in fo(LogSani tizer.clea nText("Lin e" + i + " :" + rows[ i])); | |
| 1041 | boolea n failed = false; | |
| 1042 | int li neNumber = i + 1; | |
| 1043 | String rowData = rows[i]; | |
| 1044 | String [] fields = rowData. split(",") ; | |
| 1045 | //chec k if this row has al l fields | |
| 1046 | if(fie lds.length == 7){ | |
| 1047 | String l recordType = fields [0].trim() ; | |
| 1048 | //check if Record Type is no t null and maximum l ength is 1 | |
| 1049 | if(lreco rdType== n ull || lre cordType.l ength() >1 ){ | |
| 1050 | failed = t rue; | |
| 1051 | } | |
| 1052 | //check first name | |
| 1053 | String l firstName = fields[ 1].trim(); | |
| 1054 | if(lfirs tName == n ull || lfi rstName.le ngth() >50 ){ | |
| 1055 | failed = t rue; | |
| 1056 | } | |
| 1057 | //check last name | |
| 1058 | String l lastName = fields[2 ].trim(); | |
| 1059 | if(llast Name == nu ll || llas tName.leng th() >50){ | |
| 1060 | failed = t rue; | |
| 1061 | } | |
| 1062 | //check DUZ | |
| 1063 | String l duz = fie lds[3].tri m(); | |
| 1064 | if(lduz == null || lduz.leng th() >20){ | |
| 1065 | failed = t rue; | |
| 1066 | } | |
| 1067 | //check STATION_NO | |
| 1068 | String l stationNum ber = fie lds[4].tri m(); | |
| 1069 | if(lstat ionNumber == null || lstationN umber.leng th() >10){ | |
| 1070 | failed = t rue; | |
| 1071 | } | |
| 1072 | //check EXTERNAL_U SER_NAME | |
| 1073 | String l networkId = fields[ 5].trim(); | |
| 1074 | if(lnetw orkId == n ull || lne tworkId.le ngth() >50 ){ | |
| 1075 | failed = t rue; | |
| 1076 | } | |
| 1077 | //check CLINICAL_U SER_TYPE_I D | |
| 1078 | try{ | |
| 1079 | Long lclin icalUserTy peId = Lo ng.valueOf (fields[6] .trim()); | |
| 1080 | if(lclinic alUserType Id == null ){ | |
| 1081 | fa iled = tru e; | |
| 1082 | } | |
| 1083 | }catch(j ava.lang.N umberForma tException ex){ | |
| 1084 | //the clin ical user type if is not a num ber. | |
| 1085 | failed = t rue; | |
| 1086 | } | |
| 1087 | ||
| 1088 | //if fai led becaus e of forma t | |
| 1089 | if(faile d){ | |
| 1090 | if(!fileFa iled){ | |
| 1091 | fi leFailed = true; | |
| 1092 | ad dActionErr or("The bu lk additio n of user records fa iled" + | |
| 1093 | " beca use of the following records. " + | |
| 1094 | "Corre ct these r ecords and repeat bu lk additio n:"); | |
| 1095 | } | |
| 1096 | addActionE rror("Line " + lineN umber + "- incorrectl y formatte d."); | |
| 1097 | }else{ | |
| 1098 | String tmp StationNum ber = (Str ing)curren tFileUsers .get(lnetw orkId); | |
| 1099 | ||
| 1100 | if(tmpStat ionNumber! =null){ | |
| 1101 | if (tmpStatio nNumber.eq uals(lstat ionNumber) ){ | |
| 1102 | if(! fileFailed ){ | |
| 1103 | fileFa iled = tru e; | |
| 1104 | addAct ionError(" The bulk a ddition of user reco rds failed " + | |
| 1105 | " because of the fol lowing rec ords. " + | |
| 1106 | "Correct t hese recor ds and rep eat bulk a ddition:") ; | |
| 1107 | } | |
| 1108 | addA ctionError ("Line " + lineNumbe r + "- Dup licate Net work ID " +lnetworkI d + | |
| 1109 | " is al ready list ed in this file at t his statio n by" + | |
| 1110 | " staff member " + | |
| 1111 | ESAPI.e ncoder().e ncodeForHT ML(lfirstN ame)+","+E SAPI.encod er().encod eForHTML(l lastName)) ; | |
| 1112 | ||
| 1113 | } | |
| 1114 | ||
| 1115 | ||
| 1116 | }else{ | |
| 1117 | cu rrentFileU sers.put(l networkId, lstationNu mber); | |
| 1118 | } | |
| 1119 | ||
| 1120 | ||
| 1121 | //ensure t hat you ca n never ac tivate new staff mem bers that have the s ame extern al_user_na me and sta tion_no | |
| 1122 | Clinician existingCl inician = userDao.fi ndClinicia nByStation AndUsernam e(lstation Number, ln etworkId); | |
| 1123 | if (existi ngClinicia n != null) { | |
| 1124 | if (!fileFail ed){ | |
| 1125 | file Failed = t rue; | |
| 1126 | addA ctionError ("The bulk addition of user re cords fail ed" + | |
| 1127 | " becaus e of the f ollowing r ecords. " + | |
| 1128 | "Correct these rec ords and r epeat bulk addition: "); | |
| 1129 | } | |
| 1130 | ad dActionErr or("Line " + lineNu mber + "- Network ID " +lnetwo rkId + | |
| 1131 | " is already in use at th is station by " + | |
| 1132 | (exis tingClinic ian.isActi ve() ? "ac tive" : "i nactive") + | |
| 1133 | " sta ff member " + | |
| 1134 | exist ingClinici an.getName ()); | |
| 1135 | ||
| 1136 | } | |
| 1137 | } | |
| 1138 | }else{ | |
| 1139 | if(!file Failed){ | |
| 1140 | fileFailed = true; | |
| 1141 | addActionE rror("The bulk addit ion of use r records failed" + | |
| 1142 | " be cause of t he followi ng records . " + | |
| 1143 | "Cor rect these records a nd repeat bulk addit ion:"); | |
| 1144 | } | |
| 1145 | addActio nError("Li ne " + lin eNumber + "-incorrec tly format ted."); | |
| 1146 | } | |
| 1147 | } | |
| 1148 | retu rn fileFai led; | |
| 1149 | ||
| 1150 | } | |
| 1151 | ||
| 1152 | pu blic boole an activat eBulkStaff Member(int lineNumbe r, String duz,String stationNu mber, Long clinicalU serTypeId, String ne tworkId, S tring firs tName, Str ing lastNa me){ | |
| 1153 | bool ean succes sfullyActi vated = tr ue; | |
| 1154 | ||
| 1155 | Clin ician clin = null; | |
| 1156 | Admi nistrator admin = (A dministrat or)getSess ionAttribu te(CURRENT _USER); | |
| 1157 | log. info("Admi n isNation al???..... ...."+admi n.isNation al()); | |
| 1158 | ||
| 1159 | bool ean permis sion = fal se; | |
| 1160 | ||
| 1161 | //If logged-in user is N ational Ad min, they have right s to manag e the any facility u ser. | |
| 1162 | if(a dmin.isNat ional()){ | |
| 1163 | permis sion = tru e; | |
| 1164 | } | |
| 1165 | ||
| 1166 | // I f logged-i n user is VISN Admin , they hav e rights t o manage a ny facilit ies under the visn. | |
| 1167 | if(a dmin.getVi sns() !=nu ll) { | |
| 1168 | log.in fo("admin. getVisins( )......"+a dmin.getVi sns()); | |
| 1169 | for (F acility vi sn: admin. getVisns() ) | |
| 1170 | { | |
| 1171 | Collecti on<Facilit y> facilit ies = getF acilitySer vice().get Facilities ForVisn(vi sn).getCol lection(); | |
| 1172 | for(Faci lity f1 : facilities ){ | |
| 1173 | log.info(" f1.getId() ...."+f1.g etId()); | |
| 1174 | log.info(" f1.getName ...."+f1.g etName()); | |
| 1175 | log.info(" f1.getStat ionNumber( )......."+ f1.getStat ionNumber( )); | |
| 1176 | if(f1.getS tationNumb er().equal sIgnoreCas e(stationN umber)){ | |
| 1177 | pe rmission = true; | |
| 1178 | br eak; | |
| 1179 | } | |
| 1180 | } | |
| 1181 | } | |
| 1182 | } | |
| 1183 | ||
| 1184 | // I f logged-i n user is Facility A dmin, they have righ ts to mana ge only th e associat ed user fa cilities. | |
| 1185 | for( Facility f :admin.get Facilities ()) { | |
| 1186 | if( f. getStation Number().e qualsIgnor eCase(stat ionNumber) ) { | |
| 1187 | permissi on = true; | |
| 1188 | break; | |
| 1189 | } | |
| 1190 | } | |
| 1191 | ||
| 1192 | log. info("perm ission.... ....."+per mission); | |
| 1193 | ||
| 1194 | ||
| 1195 | if( !permissio n ) { | |
| 1196 | addAct ionError(" Line " + l ineNumber + ": The s taff membe r's facili ty doesn't match a f acility yo u can mana ge."); | |
| 1197 | succes sfullyActi vated = fa lse; | |
| 1198 | } | |
| 1199 | ||
| 1200 | User selectedV istaUser = null; | |
| 1201 | List <User> sta ffMembers= new Array List<User> (); | |
| 1202 | Coll ectionServ iceRespons e<User> re sponse = g etAdminSer vice().fin dVistaClin ician(duz, stationNu mber); | |
| 1203 | hand leErrorMes sages(resp onse.getMe ssages()); | |
| 1204 | staf fMembers = (List<Use r>)respons e.getColle ction(); | |
| 1205 | if(s taffMember s == null) { | |
| 1206 | addAct ionError(" Line " + l ineNumber + ": A sea rch of the VistA dat abase did not produc e a match for the in formation given."); | |
| 1207 | succes sfullyActi vated = fa lse; | |
| 1208 | }els e{ | |
| 1209 | for(Us er u:staff Members){ | |
| 1210 | if(duz.equ alsIgnoreC ase(u.getI EN())){ | |
| 1211 | selectedVi staUser = u; | |
| 1212 | } | |
| 1213 | } | |
| 1214 | } | |
| 1215 | if(s electedVis taUser == null){ | |
| 1216 | addAct ionError(" Line " + l ineNumber + ": A sea rch of the VistA dat abase did not produc e a match for the in formation given."); | |
| 1217 | succes sfullyActi vated = fa lse; | |
| 1218 | } | |
| 1219 | ||
| 1220 | Clin icalUserTy pe clinica lUserType = null; | |
| 1221 | staf fMemberTyp es = (List <ClinicalU serType>)g etAdminSer vice().get ClinicalUs erTypes(). getCollect ion(); | |
| 1222 | if(s taffMember Types != n ull){ | |
| 1223 | for(Cl inicalUser Type cu: s taffMember Types){ | |
| 1224 | if((cu.g etId()).eq uals(clini calUserTyp eId)){ | |
| 1225 | clinicalUs erType = c u; | |
| 1226 | } | |
| 1227 | } | |
| 1228 | } | |
| 1229 | if(c linicalUse rType == n ull){ | |
| 1230 | log.in fo("clinic alUserType : Null"); | |
| 1231 | addAct ionError(" Line " + l ineNumber + ": A sea rch for cl inical use r type cou ld not pro duce a mat ch"); | |
| 1232 | succes sfullyActi vated = fa lse; | |
| 1233 | } | |
| 1234 | ||
| 1235 | ADQu eryResult staffADRes ults = nul l; | |
| 1236 | Serv iceRespons e<ADQueryR esult> fin dADAccount Response = getAdminS ervice().f indADAccou nt(network Id); | |
| 1237 | staf fADResults = findADA ccountResp onse.getPa yload(); | |
| 1238 | if(s taffADResu lts == nul l){ | |
| 1239 | log.in fo("AD Res ults: Null "); | |
| 1240 | addAct ionError(" Line " + l ineNumber + ": An Em ail Addres s could no t be found in Outloo k using th e VistA se arch resul ts."); | |
| 1241 | succes sfullyActi vated = fa lse; | |
| 1242 | }els e{ | |
| 1243 | staffA DResults.s etUserName (networkId ); | |
| 1244 | } | |
| 1245 | ||
| 1246 | if(n ull!=staff ADResults && null!=s taffADResu lts.getFir stName() & & !staffAD Results.ge tFirstName ().equalsI gnoreCase( firstName) ) { | |
| 1247 | ||
| 1248 | log.in fo(LogSani tizer.clea nText("AD firstname didn't mat ch bulk re cord: " + staffADRes ults.getFi rstName() + ", " + f irstName)) ; | |
| 1249 | addAct ionError(" Line " + l ineNumber + ": " + ( lastName== null?"null ":ESAPI.en coder().en codeForHTM L(lastName )) + ", " + ESAPI.en coder().en codeForHTM L(firstNam e) + " is not recogn ized as an Outlook e mail accou nt."); | |
| 1250 | succes sfullyActi vated = fa lse; | |
| 1251 | } | |
| 1252 | ||
| 1253 | if(n ull!=staff ADResults && !staffA DResults.g etLastName ().equalsI gnoreCase( lastName) ) { | |
| 1254 | log.in fo(LogSani tizer.clea nText("AD lastname d idn't matc h bulk rec ord: " + s taffADResu lts.getLas tName() + ", " + las tName)); | |
| 1255 | addAct ionError(" Line " + l ineNumber + ": " + E SAPI.encod er().encod eForHTML(l astName) + ", " + (f irstName== null?"null ":ESAPI.en coder().en codeForHTM L(firstNam e)) + " is not recog nized as a n Outlook email acco unt."); | |
| 1256 | succes sfullyActi vated = fa lse; | |
| 1257 | } | |
| 1258 | ||
| 1259 | if(s taffADResu lts.getEma il()!=null && !staff ADResults. getEmail() .equals("" )){ | |
| 1260 | EmailV alidator e mailValida tor = Emai lValidator .getInstan ce(); | |
| 1261 | if(!em ailValidat or.isValid (staffADRe sults.getE mail())){ | |
| 1262 | addActio nError("Li ne " + lin eNumber + ": Outloo k Email Ad dress is i nvalid."); | |
| 1263 | successf ullyActiva ted = fals e; | |
| 1264 | } | |
| 1265 | } | |
| 1266 | else | |
| 1267 | { | |
| 1268 | addAct ionError(" Line "+ li neNumber + ": Outloo k Email Ad dress can' t be blank ."); | |
| 1269 | succes sfullyActi vated = fa lse; | |
| 1270 | } | |
| 1271 | ||
| 1272 | try { | |
| 1273 | if( tr ue == succ essfullyAc tivated ) { | |
| 1274 | ServiceR esponse<Cl inician> r esponse1 = getAdminS ervice().c reateClini cianAccoun t(stationN umber, sel ectedVista User, staf fADResults , clinical UserType, admin); | |
| 1275 | clin = r esponse1.g etPayload( ); | |
| 1276 | } | |
| 1277 | } ca tch(Except ion e){ | |
| 1278 | succes sfullyActi vated = fa lse; | |
| 1279 | log.er ror( e.get Message() ); | |
| 1280 | } | |
| 1281 | ||
| 1282 | if ( clin == nu ll){ | |
| 1283 | addAct ionError(" Line " + l ineNumber + ": Error occurred while acti vating the account." ); | |
| 1284 | succes sfullyActi vated = fa lse; | |
| 1285 | } | |
| 1286 | ||
| 1287 | retu rn success fullyActiv ated; | |
| 1288 | } | |
| 1289 | ||
| 1290 | pu blic Strin g bulkActi vationComp lete() { | |
| 1291 | ||
| 1292 | clea rSessionAt tr(); | |
| 1293 | if(( selectActi on!=null) && ((selec tAction.tr im()).equa lsIgnoreCa se("Done") )){ | |
| 1294 | return CANCEL; | |
| 1295 | } | |
| 1296 | ||
| 1297 | retu rn SUCCESS ; | |
| 1298 | } | |
| 1299 | ||
| 1300 | ||
| 1301 | pu blic void getStaffSe ssionAttr( ){ | |
| 1302 | ||
| 1303 | if(( (Collectio n<Facility >)getSessi onAttribut e("facilit ies")) != null){ | |
| 1304 | facili ties = (Co llection<F acility>)g etSessionA ttribute(" facilities "); | |
| 1305 | }els e{ | |
| 1306 | facili ties = new ArrayList <Facility> (); | |
| 1307 | } | |
| 1308 | if(( (String)ge tSessionAt tribute("s electedVis nName")) ! = null){ | |
| 1309 | select edVisnName = (String )getSessio nAttribute ("selected VisnName") ; | |
| 1310 | } | |
| 1311 | if(( (String)ge tSessionAt tribute("s electedFac ilityName" )) != null ){ | |
| 1312 | select edFacility Name = (St ring)getSe ssionAttri bute("sele ctedFacili tyName"); | |
| 1313 | } | |
| 1314 | ||
| 1315 | } | |
| 1316 | ||
| 1317 | pu blic void clearSessi onAttr(){ | |
| 1318 | remo veSessionA ttribute(" facilities "); | |
| 1319 | remo veSessionA ttribute(" selectedVi snName"); | |
| 1320 | remo veSessionA ttribute(" selectedFa cilityName "); | |
| 1321 | remo veSessionA ttribute(" stationNum ber"); | |
| 1322 | remo veSessionA ttribute(" staffMembe rs"); | |
| 1323 | remo veSessionA ttribute(" activation Type"); | |
| 1324 | remo veSessionA ttribute(" selectedVi staUser"); | |
| 1325 | } | |
| 1326 | ||
| 1327 | pu blic boole an applied Cancel() { | |
| 1328 | ||
| 1329 | if(( selectActi on!=null) && ((selec tAction.tr im()).equa lsIgnoreCa se("Cancel ")||(selec tAction.tr im().equal sIgnoreCas e("Exit")) )){ | |
| 1330 | clearS essionAttr (); | |
| 1331 | return true; | |
| 1332 | } | |
| 1333 | retu rn false; | |
| 1334 | ||
| 1335 | } | |
| 1336 | ||
| 1337 | pu blic boole an isNewSe arch() { | |
| 1338 | ||
| 1339 | if(( selectActi on!=null) && ((selec tAction.tr im()).equa lsIgnoreCa se("New Se arch"))){ | |
| 1340 | firstN ame=null; | |
| 1341 | lastNa me=null; | |
| 1342 | duz=nu ll; | |
| 1343 | remove SessionAtt ribute("se lectedVist aUser"); | |
| 1344 | return true; | |
| 1345 | } | |
| 1346 | retu rn false; | |
| 1347 | ||
| 1348 | } | |
| 1349 | ||
| 1350 | pu blic boole an isSearc hResults() { | |
| 1351 | if(( selectActi on!=null) && ((selec tAction.tr im()).equa lsIgnoreCa se("Back") )){ | |
| 1352 | return true; | |
| 1353 | } | |
| 1354 | retu rn false; | |
| 1355 | } | |
| 1356 | ||
| 1357 | ||
| 1358 | pu blic void setVisns(C ollection< Facility> visns) { | |
| 1359 | this.v isns = vis ns; | |
| 1360 | } | |
| 1361 | ||
| 1362 | pu blic Colle ction<Faci lity> getV isns() { | |
| 1363 | return visns; | |
| 1364 | } | |
| 1365 | ||
| 1366 | pu blic void setFacilit ies(Collec tion<Facil ity> facil ities) { | |
| 1367 | this.f acilities = faciliti es; | |
| 1368 | } | |
| 1369 | ||
| 1370 | pu blic Colle ction<Faci lity> getF acilities( ) { | |
| 1371 | return this.faci lities; | |
| 1372 | } | |
| 1373 | ||
| 1374 | pu blic void setSelecte dVisnName( String sel ectedVisnN ame) { | |
| 1375 | this.s electedVis nName = se lectedVisn Name; | |
| 1376 | } | |
| 1377 | ||
| 1378 | pu blic Strin g getSelec tedVisnNam e() { | |
| 1379 | return selectedV isnName; | |
| 1380 | } | |
| 1381 | ||
| 1382 | pu blic void setSelecte dFacilityN ame(String selectedF acilityNam e) { | |
| 1383 | this.s electedFac ilityName = selected FacilityNa me; | |
| 1384 | } | |
| 1385 | ||
| 1386 | pu blic Strin g getSelec tedFacilit yName() { | |
| 1387 | return selectedF acilityNam e; | |
| 1388 | } | |
| 1389 | ||
| 1390 | pu blic void setVisnId( Long visnI d) { | |
| 1391 | this.v isnId = vi snId; | |
| 1392 | } | |
| 1393 | ||
| 1394 | pu blic Long getVisnId( ) { | |
| 1395 | return this.visn Id; | |
| 1396 | } | |
| 1397 | ||
| 1398 | pu blic void setFacilit yId(Long f acilityId) { | |
| 1399 | this.f acilityId = facility Id; | |
| 1400 | } | |
| 1401 | ||
| 1402 | pu blic Long getFacilit yId() { | |
| 1403 | return this.faci lityId; | |
| 1404 | } | |
| 1405 | ||
| 1406 | pu blic void setClinici ans(List<C linician> clinicians ) { | |
| 1407 | this.c linicians = clinicia ns; | |
| 1408 | } | |
| 1409 | ||
| 1410 | pu blic List< Clinician> getClinic ians() { | |
| 1411 | return clinician s; | |
| 1412 | } | |
| 1413 | ||
| 1414 | pu blic void setSelectA ction(Stri ng selectA ction) { | |
| 1415 | this .selectAct ion = sele ctAction; | |
| 1416 | } | |
| 1417 | ||
| 1418 | pu blic Strin g getSelec tAction() { | |
| 1419 | retu rn selectA ction; | |
| 1420 | } | |
| 1421 | ||
| 1422 | pu blic void setSelecte dUsers(Lis t<Clinicia n> selecte dUsers) { | |
| 1423 | this.s electedUse rs = selec tedUsers; | |
| 1424 | } | |
| 1425 | ||
| 1426 | pu blic List< Clinician> getSelect edUsers() { | |
| 1427 | return selectedU sers; | |
| 1428 | } | |
| 1429 | ||
| 1430 | pu blic void setSearchC rit(String searchCri t) { | |
| 1431 | this.s earchCrit = searchCr it; | |
| 1432 | } | |
| 1433 | ||
| 1434 | pu blic Strin g getSearc hCrit() { | |
| 1435 | return searchCri t; | |
| 1436 | } | |
| 1437 | ||
| 1438 | pu blic void setDuz(Str ing duz) { | |
| 1439 | this.d uz = duz; | |
| 1440 | } | |
| 1441 | ||
| 1442 | pu blic Strin g getDuz() { | |
| 1443 | return duz; | |
| 1444 | } | |
| 1445 | ||
| 1446 | pu blic void setFirstNa me(String firstName) { | |
| 1447 | this.f irstName = firstName ; | |
| 1448 | } | |
| 1449 | ||
| 1450 | pu blic Strin g getFirst Name() { | |
| 1451 | return firstName ; | |
| 1452 | } | |
| 1453 | ||
| 1454 | pu blic void setLastNam e(String l astName) { | |
| 1455 | this.l astName = lastName; | |
| 1456 | } | |
| 1457 | ||
| 1458 | pu blic Strin g getLastN ame() { | |
| 1459 | return lastName; | |
| 1460 | } | |
| 1461 | ||
| 1462 | pu blic void setPhone(S tring phon e) { | |
| 1463 | this.p hone = pho ne; | |
| 1464 | } | |
| 1465 | ||
| 1466 | pu blic Strin g getPhone () { | |
| 1467 | return phone; | |
| 1468 | } | |
| 1469 | ||
| 1470 | pu blic void setTitle(S tring titl e) { | |
| 1471 | this.t itle = tit le; | |
| 1472 | } | |
| 1473 | ||
| 1474 | pu blic Strin g getTitle () { | |
| 1475 | return title; | |
| 1476 | } | |
| 1477 | ||
| 1478 | pu blic void setNetwork Id(String networkId) { | |
| 1479 | this.n etworkId = networkId ; | |
| 1480 | } | |
| 1481 | ||
| 1482 | pu blic Strin g getNetwo rkId() { | |
| 1483 | return networkId ; | |
| 1484 | } | |
| 1485 | ||
| 1486 | pu blic void setStaffMe mberTypes( List<Clini calUserTyp e> staffMe mberTypes) { | |
| 1487 | this.s taffMember Types = st affMemberT ypes; | |
| 1488 | } | |
| 1489 | ||
| 1490 | pu blic List< ClinicalUs erType> ge tStaffMemb erTypes() { | |
| 1491 | return staffMemb erTypes; | |
| 1492 | } | |
| 1493 | ||
| 1494 | pu blic void setMemberT ypeId(Long memberTyp eId) { | |
| 1495 | this.m emberTypeI d = member TypeId; | |
| 1496 | } | |
| 1497 | ||
| 1498 | pu blic Long getMemberT ypeId() { | |
| 1499 | return memberTyp eId; | |
| 1500 | } | |
| 1501 | ||
| 1502 | pu blic void setMemberT ype(String memberTyp e) { | |
| 1503 | this.m emberType = memberTy pe; | |
| 1504 | } | |
| 1505 | ||
| 1506 | pu blic Strin g getMembe rType() { | |
| 1507 | return memberTyp e; | |
| 1508 | } | |
| 1509 | ||
| 1510 | pu blic void setFirstNa meAD(Strin g firstNam eAD) { | |
| 1511 | this.f irstNameAD = firstNa meAD; | |
| 1512 | } | |
| 1513 | ||
| 1514 | pu blic Strin g getFirst NameAD() { | |
| 1515 | return firstName AD; | |
| 1516 | } | |
| 1517 | ||
| 1518 | pu blic void setLastNam eAD(String lastNameA D) { | |
| 1519 | this.l astNameAD = lastName AD; | |
| 1520 | } | |
| 1521 | ||
| 1522 | pu blic Strin g getLastN ameAD() { | |
| 1523 | return lastNameA D; | |
| 1524 | } | |
| 1525 | ||
| 1526 | pu blic void setPhoneAD (String ph oneAD) { | |
| 1527 | this.p honeAD = p honeAD; | |
| 1528 | } | |
| 1529 | ||
| 1530 | pu blic Strin g getPhone AD() { | |
| 1531 | return phoneAD; | |
| 1532 | } | |
| 1533 | ||
| 1534 | ||
| 1535 | pu blic void setTitleAD (String ti tleAD) { | |
| 1536 | this.t itleAD = t itleAD; | |
| 1537 | } | |
| 1538 | ||
| 1539 | pu blic Strin g getTitle AD() { | |
| 1540 | return titleAD; | |
| 1541 | } | |
| 1542 | ||
| 1543 | pu blic void setNetwork IdAD(Strin g networkI dAD) { | |
| 1544 | this.n etworkIdAD = network IdAD; | |
| 1545 | } | |
| 1546 | ||
| 1547 | pu blic Strin g getNetwo rkIdAD() { | |
| 1548 | return networkId AD; | |
| 1549 | } | |
| 1550 | ||
| 1551 | pu blic Strin g getUploa dContentTy pe() { | |
| 1552 | retu rn uploadC ontentType ; | |
| 1553 | } | |
| 1554 | ||
| 1555 | pu blic void setUploadC ontentType (String co ntentType) { | |
| 1556 | this .uploadCon tentType = contentTy pe; | |
| 1557 | } | |
| 1558 | ||
| 1559 | pu blic File getUpload( ) { | |
| 1560 | retu rn upload; | |
| 1561 | } | |
| 1562 | ||
| 1563 | pu blic void setUpload( File file) { | |
| 1564 | this .upload = file; | |
| 1565 | } | |
| 1566 | ||
| 1567 | pu blic Strin g getUploa dFileName( ) { | |
| 1568 | retu rn uploadF ileName; | |
| 1569 | } | |
| 1570 | ||
| 1571 | pu blic void setUploadF ileName(St ring filen ame) { | |
| 1572 | this .uploadFil eName = fi lename; | |
| 1573 | } | |
| 1574 | ||
| 1575 | pu blic Strin g getEmail AD() { | |
| 1576 | retu rn emailAD ; | |
| 1577 | } | |
| 1578 | ||
| 1579 | pu blic void setEmailAD (String em ailAD) { | |
| 1580 | this .emailAD = emailAD; | |
| 1581 | } | |
| 1582 | ||
| 1583 | pu blic Strin g getEmail () { | |
| 1584 | retu rn email; | |
| 1585 | } | |
| 1586 | ||
| 1587 | pu blic void setEmail(S tring emai l) { | |
| 1588 | this .email = e mail; | |
| 1589 | } | |
| 1590 | ||
| 1591 | pu blic UserD ao getUser Dao() { | |
| 1592 | retu rn userDao ; | |
| 1593 | } | |
| 1594 | ||
| 1595 | pu blic void setUserDao (UserDao u serDao) { | |
| 1596 | this .userDao = userDao; | |
| 1597 | } | |
| 1598 | ||
| 1599 | ||
| 1600 | pu blic int g etAdded() { | |
| 1601 | retu rn added; | |
| 1602 | } | |
| 1603 | ||
| 1604 | ||
| 1605 | pu blic void setAdded(i nt added) { | |
| 1606 | this .added = a dded; | |
| 1607 | } | |
| 1608 | ||
| 1609 | pu blic Strin g getMiddl eName() { | |
| 1610 | retu rn middleN ame; | |
| 1611 | } | |
| 1612 | ||
| 1613 | ||
| 1614 | pu blic void setMiddleN ame(String middleNam e) { | |
| 1615 | this .middleNam e = middle Name; | |
| 1616 | } | |
| 1617 | ||
| 1618 | ||
| 1619 | pu blic Strin g getSuffi x() { | |
| 1620 | retu rn suffix; | |
| 1621 | } | |
| 1622 | ||
| 1623 | ||
| 1624 | pu blic void setSuffix( String suf fix) { | |
| 1625 | this .suffix = suffix; | |
| 1626 | } | |
| 1627 | ||
| 1628 | ||
| 1629 | pu blic Strin g getPrefi x() { | |
| 1630 | retu rn prefix; | |
| 1631 | } | |
| 1632 | ||
| 1633 | ||
| 1634 | pu blic void setPrefix( String pre fix) { | |
| 1635 | this .prefix = prefix; | |
| 1636 | } | |
| 1637 | ||
| 1638 | ||
| 1639 | pu blic Strin g getActiv eFlag() { | |
| 1640 | retu rn activeF lag; | |
| 1641 | } | |
| 1642 | ||
| 1643 | ||
| 1644 | pu blic void setActiveF lag(String activeFla g) { | |
| 1645 | this .activeFla g = active Flag; | |
| 1646 | } | |
| 1647 | ||
| 1648 | ||
| 1649 | pu blic Strin g getProvi derKey() { | |
| 1650 | retu rn provide rKey; | |
| 1651 | } | |
| 1652 | ||
| 1653 | ||
| 1654 | pu blic void setProvide rKey(Strin g provider Key) { | |
| 1655 | this .providerK ey = provi derKey; | |
| 1656 | } | |
| 1657 | ||
| 1658 | ||
| 1659 | pu blic Strin g getProvi derClass() { | |
| 1660 | retu rn provide rClass; | |
| 1661 | } | |
| 1662 | ||
| 1663 | ||
| 1664 | pu blic void setProvide rClass(Str ing provid erClass) { | |
| 1665 | this .providerC lass = pro viderClass ; | |
| 1666 | } | |
| 1667 | ||
| 1668 | ||
| 1669 | pu blic Strin g getPerso nClass() { | |
| 1670 | retu rn personC lass; | |
| 1671 | } | |
| 1672 | ||
| 1673 | ||
| 1674 | pu blic void setPersonC lass(Strin g personCl ass) { | |
| 1675 | this .personCla ss = perso nClass; | |
| 1676 | } | |
| 1677 | ||
| 1678 | ||
| 1679 | pu blic Strin g getPcmmF lag() { | |
| 1680 | retu rn pcmmFla g; | |
| 1681 | } | |
| 1682 | ||
| 1683 | ||
| 1684 | pu blic void setPcmmFla g(String p cmmFlag) { | |
| 1685 | this .pcmmFlag = pcmmFlag ; | |
| 1686 | } | |
| 1687 | ||
| 1688 | ||
| 1689 | pu blic Strin g getRequi resCoSigne r() { | |
| 1690 | retu rn require sCoSigner; | |
| 1691 | } | |
| 1692 | ||
| 1693 | ||
| 1694 | pu blic void setRequire sCoSigner( String req uiresCoSig ner) { | |
| 1695 | this .requiresC oSigner = requiresCo Signer; | |
| 1696 | } | |
| 1697 | ||
| 1698 | pu blic Strin g[] getDss Units() { | |
| 1699 | retu rn dssUnit s; | |
| 1700 | } | |
| 1701 | ||
| 1702 | ||
| 1703 | pu blic void setDssUnit s(String[] dssUnits) { | |
| 1704 | this .dssUnits = dssUnits ; | |
| 1705 | } | |
| 1706 | ||
| 1707 | ||
| 1708 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.