Produced by Araxis Merge on 3/24/2017 5:17:17 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 | MHV_2017.2.0.0 Code In Flight.zip\Admin Portal Redesign\mhv_admin\mhv-admin-portlet\src\main\java\gov\va\med\mhv\admin\web\controller | ManageVAStaffController.java | Fri Feb 10 18:05:28 2017 UTC |
| 2 | MHV_2017.2.0.0 Code In Flight.zip\Admin Portal Redesign\mhv_admin\mhv-admin-portlet\src\main\java\gov\va\med\mhv\admin\web\controller | ManageVAStaffController.java | Fri Mar 24 17:57:34 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 420 |
| 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.admin.w eb.control ler; | |
| 2 | ||
| 3 | import gov .va.med.mh v.admin.dt o.Employee DTO; | |
| 4 | import gov .va.med.mh v.admin.dt o.Employee OrgRoleDTO ; | |
| 5 | import gov .va.med.mh v.admin.dt o.Employee OrgRoleHis toryDTO; | |
| 6 | import gov .va.med.mh v.admin.dt o.Employee SearchResu lt; | |
| 7 | import gov .va.med.mh v.admin.se rvice.vast aff.AdminU serService ; | |
| 8 | import gov .va.med.mh v.admin.se rvice.vast aff.Employ eeRoleMana gementServ ice; | |
| 9 | import gov .va.med.mh v.admin.se rvice.vast aff.Employ eeSearchSe rvice; | |
| 10 | import gov .va.med.mh v.admin.we b.formbean .ManagedSt affMember; | |
| 11 | import gov .va.med.mh v.admin.we b.formbean .SearchRes ultsFormBe an; | |
| 12 | import gov .va.med.mh v.admin.we b.util.Ses sionUtil; | |
| 13 | import gov .va.med.mh v.admin.we b.util.Spr ingContext ; | |
| 14 | import gov .va.med.mh v.common.a pi.excepti on.MHVExce ption; | |
| 15 | ||
| 16 | import jav a.util.Lis t; | |
| 17 | ||
| 18 | import jav ax.faces.a pplication .FacesMess age; | |
| 19 | import jav ax.faces.b ean.Manage dBean; | |
| 20 | import jav ax.faces.b ean.Manage dProperty; | |
| 21 | import jav ax.faces.b ean.Reques tScoped; | |
| 22 | import jav ax.faces.c ontext.Fac esContext; | |
| 23 | ||
| 24 | import org .apache.lo gging.log4 j.LogManag er; | |
| 25 | import org .apache.lo gging.log4 j.Logger; | |
| 26 | import org .springfra mework.bea ns.BeansEx ception; | |
| 27 | ||
| 28 | @ManagedBe an(name="s taffContro ller") | |
| 29 | @RequestSc oped | |
| 30 | public cla ss ManageV AStaffCont roller ext ends Manag eVAStaffAb stractCont roller { | |
| 31 | ||
| 32 | pr ivate stat ic Logger log = LogM anager.get Logger(Man ageVAStaff Controller .class); | |
| 33 | ||
| 34 | ||
| 35 | @M anagedProp erty(value ="#{staffS earchResul ts}") | |
| 36 | Se archResult sFormBean searchResu lts; | |
| 37 | ||
| 38 | pu blic Strin g manageSt affMember( EmployeeOr gRoleDTO e mployeeOrg ) { | |
| 39 | retu rn this.ma nageStaffM ember(empl oyeeOrg.ge tEmployee( ).getUserN ame()); | |
| 40 | } | |
| 41 | ||
| 42 | pu blic Strin g manageSt affMember( EmployeeSe archResult employeeR esult) { | |
| 43 | retu rn this.ma nageStaffM ember(empl oyeeResult .getUserNa me()); | |
| 44 | } | |
| 45 | ||
| 46 | pu blic Strin g manageSt affMember( String use rName) { | |
| 47 | if ( userName = = null) { | |
| 48 | userNa me = Faces Context.ge tCurrentIn stance().g etExternal Context(). getRequest ParameterM ap().get(" userName") ; | |
| 49 | } | |
| 50 | ||
| 51 | try { | |
| 52 | System .out.print ln("userNa me = " + u serName); | |
| 53 | if (us erName != null) { | |
| 54 | ManagedS taffMember staffMemb er = new M anagedStaf fMember(); | |
| 55 | ||
| 56 | // get e mployee fr om Active Directory (i.e. Exis tence Chec k) | |
| 57 | Employee SearchServ ice employ eeSearchSe rvice = (E mployeeSea rchService ) SpringCo ntext.getA pplication Context(). getBean("e mployeeSea rchService Proxy"); | |
| 58 | // TODO: Remove H ard Coded username | |
| 59 | List<Emplo yeeSearchR esult> emp loyeeSearc hResults = employeeS earchServi ce.searchB yUserName( " DN S DavidA"); | |
| 60 | if (empl oyeeSearch Results == null || e mployeeSea rchResults .size() == 0) { | |
| 61 | FacesConte xt.getCurr entInstanc e().addMes sage("No s earch resu lts.", new FacesMess age("User not found. ")); | |
| 62 | } | |
| 63 | else { / / OK, the user exist s and is p ermitted | |
| 64 | EmployeeSe archResult employee = employee SearchResu lts.get(0) ; | |
| 65 | //get empl oyee data from local database | |
| 66 | EmployeeRo leManageme ntService employeeRo leService = (Employe eRoleManag ementServi ce) Spring Context.ge tApplicati onContext( ).getBean( "employeeR oleManagem entService Proxy"); | |
| 67 | List<Emplo yeeSearchR esult> emp loyeeList = employee RoleServic e.getEmplo yeeByUserN ame(userNa me); | |
| 68 | if (employ eeList == null || em ployeeList .size() == 0) { | |
| 69 | } | |
| 70 | else if (e mployeeLis t.size() > 1) { | |
| 71 | Fa cesContext .getCurren tInstance( ).addMessa ge("More t han 1 reco rd returne d.", new F acesMessag e("Unexpec ted result s from ser vice.")); | |
| 72 | } | |
| 73 | else { | |
| 74 | Em ployeeSear chResult e mployeeToM anage = em ployeeList .get(0); | |
| 75 | st affMember. setEmploye eToManage( employeeTo Manage); | |
| 76 | } | |
| 77 | ||
| 78 | } | |
| 79 | ||
| 80 | searchRe sults.setM anaged(sta ffMember); | |
| 81 | // also load the r ole histor y | |
| 82 | getRoleH istory(); | |
| 83 | // also load the c omments (b y loading the employ ee object which cont ains the c omments) | |
| 84 | getEmplo yee(userNa me); | |
| 85 | } | |
| 86 | } ca tch (Beans Exception e) { | |
| 87 | FacesC ontext.get CurrentIns tance().ad dMessage(" Framework Error.", n ew FacesMe ssage("Une xpected er ror.")); | |
| 88 | log.er ror("Error in employ eeRoleMana gementServ iceProxy.g etEmployee OrgRolesAs signedToEm ployeeByNa me() - Sea rching Pro xy 'employ eeRoleMana gementServ iceProxy'" , e); | |
| 89 | } ca tch (MHVEx ception e) { | |
| 90 | FacesC ontext.get CurrentIns tance().ad dMessage(" Applicatio n Error.", new Faces Message("U nexpected error.")); | |
| 91 | log.er ror("Error in employ eeRoleMana gementServ iceProxy.g etEmployee OrgRolesAs signedToEm ployeeByNa me() - Sea rching Pro xy 'employ eeRoleMana gementServ iceProxy'" , e); | |
| 92 | } | |
| 93 | ||
| 94 | retu rn "manage -staff-rol es?faces-r edirect=tr ue"; | |
| 95 | } | |
| 96 | ||
| 97 | pu blic List< EmployeeOr gRoleHisto ryDTO> get RoleHistor y() { | |
| 98 | Syst em.out.pri ntln("Gett ing Role H istory!"); | |
| 99 | List <EmployeeO rgRoleHist oryDTO> ro leHistorie sForEmploy ee = searc hResults.g etManaged( ).getRoleH istoriesFo rEmployee( ); | |
| 100 | if ( roleHistor iesForEmpl oyee == nu ll) { | |
| 101 | System .out.print ln("fetchi ng..."); | |
| 102 | System .out.print ln(searchR esults.get Managed(). getEmploye eToManage( ).getId()) ; | |
| 103 | try { | |
| 104 | Long emp loyeeId = searchResu lts.getMan aged().get EmployeeTo Manage().g etId(); | |
| 105 | Employee RoleManage mentServic e employee RoleServic e = (Emplo yeeRoleMan agementSer vice) Spri ngContext. getApplica tionContex t().getBea n("employe eRoleManag ementServi ceProxy"); | |
| 106 | roleHist oriesForEm ployee = e mployeeRol eService.g etRoleHist oriesForEm ployee(emp loyeeId); | |
| 107 | System.o ut.println ("fetched! "); | |
| 108 | searchRe sults.getM anaged().s etRoleHist oriesForEm ployee(rol eHistories ForEmploye e); | |
| 109 | System.o ut.println ("Set!"); | |
| 110 | System.o ut.println ("Count: " + roleHis toriesForE mployee.si ze()); | |
| 111 | } catc h (Excepti on e) { | |
| 112 | System.o ut.println ("Exceptio n!!!!!!!!! "); | |
| 113 | FacesCon text.getCu rrentInsta nce().addM essage("Ap plication Error.", n ew FacesMe ssage("Une xpected er ror.")); | |
| 114 | log.erro r("Error i n employee RoleManage mentServic eProxy.get EmployeeOr gRolesAssi gnedToEmpl oyeeByName () - Searc hing Proxy 'employee RoleManage mentServic eProxy'", e); | |
| 115 | } | |
| 116 | } | |
| 117 | retu rn roleHis toriesForE mployee; | |
| 118 | } | |
| 119 | ||
| 120 | pu blic Searc hResultsFo rmBean get SearchResu lts() { | |
| 121 | retu rn searchR esults; | |
| 122 | } | |
| 123 | ||
| 124 | pu blic void setSearchR esults(Sea rchResults FormBean s earchResul ts) { | |
| 125 | this .searchRes ults = sea rchResults ; | |
| 126 | } | |
| 127 | ||
| 128 | /* * | |
| 129 | * This meth od looks u p the Empl oyeeDTO ob ject and r emembers i t for the user under managemen t. It pla ces it in the | |
| 130 | * searchRes ults bean that is se ssion memo ry for all managemen t for a si ngle user. | |
| 131 | * | |
| 132 | * @param us erName | |
| 133 | * @return | |
| 134 | * / | |
| 135 | pu blic Emplo yeeDTO get Employee(S tring user Name) { | |
| 136 | Empl oyeeDTO em ployee = s earchResul ts.getMana ged().getM anagedEmpl oyee(); | |
| 137 | try { | |
| 138 | AdminU serService adminUser Service = (AdminUser Service) S pringConte xt.getAppl icationCon text().get Bean("admi nUserServi ceProxy"); | |
| 139 | employ ee = admin UserServic e.findEmpl oyeeByUser Name(userN ame); | |
| 140 | search Results.ge tManaged() .setManage dEmployee( employee); | |
| 141 | } ca tch (Beans Exception e) { | |
| 142 | FacesC ontext.get CurrentIns tance().ad dMessage(" Applicatio n Error.", new Faces Message("U nexpected error.")); | |
| 143 | log.er ror("Error in adminU serService .getEmploy ee()", e); | |
| 144 | throw e; | |
| 145 | } ca tch (MHVEx ception e) { | |
| 146 | FacesC ontext.get CurrentIns tance().ad dMessage(" Applicatio n Error.", new Faces Message("U nexpected error.")); | |
| 147 | log.er ror("Error in adminU serService .getEmploy ee()", e); | |
| 148 | } | |
| 149 | retu rn employe e; | |
| 150 | } | |
| 151 | ||
| 152 | pu blic Strin g activate Role(Emplo yeeOrgRole DTO role) { | |
| 153 | ||
| 154 | Syst em.out.pri ntln("Call ed activat eRole(role )"); | |
| 155 | ||
| 156 | try { | |
| 157 | role.s etActive(B oolean.TRU E); | |
| 158 | Employ eeRoleMana gementServ ice servic e = (Emplo yeeRoleMan agementSer vice) Spri ngContext. getApplica tionContex t().getBea n("employe eRoleManag ementServi ceProxy"); | |
| 159 | servic e.updateEm ployeeOrga nizationRo le(Session Util.getCu rrentUser( ).getEmplo yeeId(), r ole); | |
| 160 | } ca tch (Beans Exception e) { | |
| 161 | FacesC ontext.get CurrentIns tance().ad dMessage(" Applicatio n Error.", new Faces Message("U nexpected error.")); | |
| 162 | log.er ror("Error in manage VAStaffCon troller.ac tivateRole ", e); | |
| 163 | } ca tch (MHVEx ception e) { | |
| 164 | FacesC ontext.get CurrentIns tance().ad dMessage(" Applicatio n Error.", new Faces Message("U nexpected error.")); | |
| 165 | log.er ror("Error in manage VAStaffCon troller.ac tivateRole ", e); | |
| 166 | } | |
| 167 | ||
| 168 | retu rn ""; | |
| 169 | } | |
| 170 | ||
| 171 | pu blic Strin g deactiva teRole(Emp loyeeOrgRo leDTO role ) { | |
| 172 | ||
| 173 | Syst em.out.pri ntln("Call ed deactiv ateRole(ro le)"); | |
| 174 | ||
| 175 | try { | |
| 176 | role.s etActive(B oolean.FAL SE); | |
| 177 | Employ eeRoleMana gementServ ice servic e = (Emplo yeeRoleMan agementSer vice) Spri ngContext. getApplica tionContex t().getBea n("employe eRoleManag ementServi ceProxy"); | |
| 178 | servic e.updateEm ployeeOrga nizationRo le(Session Util.getCu rrentUser( ).getEmplo yeeId(), r ole); | |
| 179 | } ca tch (Beans Exception e) { | |
| 180 | FacesC ontext.get CurrentIns tance().ad dMessage(" Applicatio n Error.", new Faces Message("U nexpected error.")); | |
| 181 | log.er ror("Error in manage VAStaffCon troller.ac tivateRole ", e); | |
| 182 | } ca tch (MHVEx ception e) { | |
| 183 | FacesC ontext.get CurrentIns tance().ad dMessage(" Applicatio n Error.", new Faces Message("U nexpected error.")); | |
| 184 | log.er ror("Error in manage VAStaffCon troller.ac tivateRole ", e); | |
| 185 | } | |
| 186 | ||
| 187 | retu rn ""; | |
| 188 | } | |
| 189 | ||
| 190 | pu blic Strin g saveComm ent() { | |
| 191 | Stri ng result = ""; | |
| 192 | try { | |
| 193 | String comment = searchRes ults.getMa naged().ge tManagedEm ployee().g etComments (); | |
| 194 | System .out.print ln("Update d Comment: " + comme nt); | |
| 195 | ||
| 196 | AdminU serService adminUser Service = (AdminUser Service) S pringConte xt.getAppl icationCon text().get Bean("admi nUserServi ceProxy"); | |
| 197 | Employ eeDTO empl oyeeDTO = adminUser Service.sa veEmployee (searchRes ults.getMa naged().ge tManagedEm ployee()); | |
| 198 | search Results.ge tManaged() .setManage dEmployee( employeeDT O); //upda te the att ached Empl oyee | |
| 199 | ||
| 200 | FacesC ontext.get CurrentIns tance().ad dMessage(n ull, new F acesMessag e("The emp loyee has been succe ssfully ed ited.")); | |
| 201 | } ca tch (Beans Exception e) { | |
| 202 | FacesC ontext.get CurrentIns tance().ad dMessage(" Applicatio n Error.", new Faces Message("U nexpected error.")); | |
| 203 | log.er ror("Error in adminU serService .saveComme nt()", e); | |
| 204 | } ca tch (MHVEx ception e) { | |
| 205 | FacesC ontext.get CurrentIns tance().ad dMessage(" Applicatio n Error.", new Faces Message("U nexpected error.")); | |
| 206 | log.er ror("Error in adminU serService .saveComme nt()", e); | |
| 207 | } | |
| 208 | ||
| 209 | retu rn result; | |
| 210 | } | |
| 211 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.