Produced by Araxis Merge on 9/15/2018 10:46:48 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_2018.4.0.0.zip\2018.4.0.0\admin portal\mhv_source\mhv_admin\mhv-admin-portlet\src\main\java\gov\va\med\mhv\admin\web\util | SortUtil.java | Thu Aug 23 21:11:54 2018 UTC |
| 2 | MHV_2018.4.0.0.zip\2018.4.0.0\admin portal\mhv_source\mhv_admin\mhv-admin-portlet\src\main\java\gov\va\med\mhv\admin\web\util | SortUtil.java | Sat Sep 15 19:04:41 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 386 |
| 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.util; | |
| 2 | ||
| 3 | import jav a.util.Com parator; | |
| 4 | import jav a.util.Lis t; | |
| 5 | import jav a.util.Loc ale; | |
| 6 | ||
| 7 | import gov .va.med.mh v.admin.dt o.Employee OrgRoleDTO ; | |
| 8 | import gov .va.med.mh v.admin.dt o.Employee OrgRoleHis toryDTO; | |
| 9 | import gov .va.med.mh v.admin.dt o.Employee SearchResu lt; | |
| 10 | ||
| 11 | /** | |
| 12 | * This cl ass contai ns the var ious sort implementa tions requ ired by th e Manage | |
| 13 | * VA Staf f portlet | |
| 14 | * | |
| 15 | * @author
|
|
| 16 | * | |
| 17 | */ | |
| 18 | public cla ss SortUti l { | |
| 19 | ||
| 20 | pu blic void imposeDefa ultSortOrd erViewAll( List<Emplo yeeOrgRole DTO> exist ingRoleAss ignments) { | |
| 21 | Loca le.setDefa ult(Locale .ENGLISH); | |
| 22 | ||
| 23 | if ( existingRo leAssignme nts != nul l) { | |
| 24 | ||
| 25 | existi ngRoleAssi gnments.so rt(new Com parator<Em ployeeOrgR oleDTO>() { | |
| 26 | ||
| 27 | @Overrid e | |
| 28 | public i nt compare (EmployeeO rgRoleDTO o1, Employ eeOrgRoleD TO o2) { | |
| 29 | int result = 0; | |
| 30 | ||
| 31 | if (o1 != null && o2 != null) { | |
| 32 | ||
| 33 | // order by active fla g | |
| 34 | if (o1.getAc tive() != null && o2 .getActive () != null ) { | |
| 35 | ||
| 36 | resu lt = o2.ge tActive(). compareTo( o1.getActi ve()); | |
| 37 | ||
| 38 | } | |
| 39 | ||
| 40 | // then by r ole (role name) | |
| 41 | if (result = = 0 && o1. getRole() != null && o2.getRol e() != nul l | |
| 42 | && o1. getRole(). getName() != null && o2.getRol e().getNam e() != nul l) { | |
| 43 | ||
| 44 | resu lt = o1.ge tRole().ge tName().co mpareTo(o2 .getRole() .getName() ); | |
| 45 | ||
| 46 | } | |
| 47 | ||
| 48 | // then by f ull name | |
| 49 | if (result = = 0 && o1. getEmploye e() != nul l && o2.ge tEmployee( ) != null | |
| 50 | && o1. getEmploye e().getFul lName() != null && o 2.getEmplo yee().getF ullName() != null) { | |
| 51 | ||
| 52 | resu lt = o1.ge tEmployee( ).getFullN ame().toLo werCase(Lo cale.ENGLI SH) | |
| 53 | .compare To(o2.getE mployee(). getFullNam e().toLowe rCase(Loca le.ENGLISH )); | |
| 54 | ||
| 55 | } | |
| 56 | ||
| 57 | } | |
| 58 | return res ult; | |
| 59 | } | |
| 60 | }); | |
| 61 | } | |
| 62 | } | |
| 63 | ||
| 64 | pu blic void imposeDefa ultSortOrd erSearch(L ist<Employ eeSearchRe sult> empl oyees) { | |
| 65 | Loca le.setDefa ult(Locale .ENGLISH); | |
| 66 | ||
| 67 | if ( employees != null) { | |
| 68 | ||
| 69 | employ ees.sort(n ew Compara tor<Employ eeSearchRe sult>() { | |
| 70 | ||
| 71 | @Overrid e | |
| 72 | public i nt compare (EmployeeS earchResul t e1, Empl oyeeSearch Result e2) { | |
| 73 | int result = 0; | |
| 74 | ||
| 75 | if (e1 != null && e2 != null) { | |
| 76 | ||
| 77 | // order by last name | |
| 78 | if (e1.getLa stName() ! = null && e2.getLast Name() != null) { | |
| 79 | ||
| 80 | resu lt = e1.ge tLastName( ).toLowerC ase(Locale .ENGLISH). compareTo( e2.getLast Name().toL owerCase(L ocale.ENGL ISH)); | |
| 81 | ||
| 82 | } | |
| 83 | ||
| 84 | // then by f irst name | |
| 85 | if (result = = 0 && e1. getFirstNa me() != nu ll && e2.g etFirstNam e() != nul l) { | |
| 86 | ||
| 87 | resu lt = e1.ge tFirstName ().toLower Case(Local e.ENGLISH) .compareTo (e2.getFir stName().t oLowerCase (Locale.EN GLISH)); | |
| 88 | ||
| 89 | } | |
| 90 | ||
| 91 | // then by V ANetworkID (username ) | |
| 92 | if (result = = 0 && e1. getUserNam e() != nul l && e2.ge tUserName( ) != null) { | |
| 93 | ||
| 94 | resu lt = e1.ge tUserName( ).toLowerC ase(Locale .ENGLISH). compareTo( e2.getUser Name().toL owerCase(L ocale.ENGL ISH)); | |
| 95 | ||
| 96 | } | |
| 97 | ||
| 98 | } | |
| 99 | return res ult; | |
| 100 | } | |
| 101 | }); | |
| 102 | } | |
| 103 | } | |
| 104 | ||
| 105 | pu blic void imposeDefa ultSortOrd erManageSt affMember( List<Emplo yeeOrgRole DTO> emplo yeesCurren tRoles) { | |
| 106 | Loca le.setDefa ult(Locale .ENGLISH); | |
| 107 | ||
| 108 | if ( employeesC urrentRole s != null) { | |
| 109 | ||
| 110 | employ eesCurrent Roles.sort (new Compa rator<Empl oyeeOrgRol eDTO>() { | |
| 111 | ||
| 112 | @Overrid e | |
| 113 | public i nt compare (EmployeeO rgRoleDTO o1, Employ eeOrgRoleD TO o2) { | |
| 114 | int result = 0; | |
| 115 | ||
| 116 | if (o1 != null && o2 != null) { | |
| 117 | ||
| 118 | // order by active fla g | |
| 119 | if (o1.getAc tive() != null && o2 .getActive () != null ) { | |
| 120 | ||
| 121 | resu lt = o2.ge tActive(). compareTo( o1.getActi ve()); | |
| 122 | ||
| 123 | } | |
| 124 | ||
| 125 | // then by r ole | |
| 126 | if (result = = 0 && o1. getRole() != null && o2.getRol e() != nul l | |
| 127 | && o1. getRole(). getName() != null && o2.getRol e().getNam e() != nul l) { | |
| 128 | ||
| 129 | resu lt = o1.ge tRole().ge tName().co mpareTo(o2 .getRole() .getName() ); | |
| 130 | ||
| 131 | } | |
| 132 | ||
| 133 | } | |
| 134 | return res ult; | |
| 135 | } | |
| 136 | }); | |
| 137 | } | |
| 138 | ||
| 139 | } | |
| 140 | ||
| 141 | pu blic void imposeDefa ultSortOrd erRoleHist ory(List<E mployeeOrg RoleHistor yDTO> empl oyeesHisto ricalRoles ) { | |
| 142 | Loca le.setDefa ult(Locale .ENGLISH); | |
| 143 | ||
| 144 | if ( employeesH istoricalR oles != nu ll) { | |
| 145 | employ eesHistori calRoles.s ort(new Co mparator<E mployeeOrg RoleHistor yDTO>() { | |
| 146 | ||
| 147 | @Overrid e | |
| 148 | public i nt compare (EmployeeO rgRoleHist oryDTO o1, EmployeeO rgRoleHist oryDTO o2) { | |
| 149 | int result = 0; | |
| 150 | ||
| 151 | if (o1 != null && o2 != null) { | |
| 152 | ||
| 153 | // order by date | |
| 154 | if (o1.getMo dification Date() != null && o2 .getModifi cationDate () != null ) { | |
| 155 | ||
| 156 | resu lt = o2.ge tModificat ionDate(). compareTo( o1.getModi ficationDa te()); | |
| 157 | ||
| 158 | } | |
| 159 | ||
| 160 | // then by L evel (tyep of organi zation) | |
| 161 | if (result = = 0 && o1. getEmploye eOrgRoleDT O() != nul l && o2.ge tEmployeeO rgRoleDTO( ) != null | |
| 162 | && o1. getEmploye eOrgRoleDT O().getOrg anization( ) != null | |
| 163 | && o2. getEmploye eOrgRoleDT O().getOrg anization( ) != null | |
| 164 | && o1. getEmploye eOrgRoleDT O().getOrg anization( ).getTypeO fOrganizat ion() != n ull | |
| 165 | && o2. getEmploye eOrgRoleDT O().getOrg anization( ).getTypeO fOrganizat ion() != n ull) { | |
| 166 | ||
| 167 | Stri ng type1 = o1.getEmp loyeeOrgRo leDTO().ge tOrganizat ion().getT ypeOfOrgan ization(); | |
| 168 | Stri ng type2 = o2.getEmp loyeeOrgRo leDTO().ge tOrganizat ion().getT ypeOfOrgan ization(); | |
| 169 | resu lt = type1 .compareTo (type2); | |
| 170 | ||
| 171 | } | |
| 172 | ||
| 173 | // then by R ole (role name) | |
| 174 | if (result = = 0 && o1. getEmploye eOrgRoleDT O() != nul l && o2.ge tEmployeeO rgRoleDTO( ) != null | |
| 175 | && o1. getEmploye eOrgRoleDT O().getRol e() != nul l | |
| 176 | && o2. getEmploye eOrgRoleDT O().getRol e() != nul l | |
| 177 | && o1. getEmploye eOrgRoleDT O().getRol e().getNam e() != nul l | |
| 178 | && o2. getEmploye eOrgRoleDT O().getRol e().getNam e() != nul l) { | |
| 179 | ||
| 180 | Stri ng name1 = o1.getEmp loyeeOrgRo leDTO().ge tRole().ge tName(); | |
| 181 | Stri ng name2 = o2.getEmp loyeeOrgRo leDTO().ge tRole().ge tName(); | |
| 182 | resu lt = name1 .compareTo (name2); | |
| 183 | ||
| 184 | } | |
| 185 | ||
| 186 | } | |
| 187 | return res ult; | |
| 188 | } | |
| 189 | }); | |
| 190 | } | |
| 191 | ||
| 192 | } | |
| 193 | ||
| 194 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.