Produced by Araxis Merge on 9/11/2017 8:05:37 AM Central 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_CIF_2017.4.0.0.zip\MHV_CIF_2017.4.0.0\MHV_CIF_2017.4.0.0\ap_redesign\mhv_source\mhv_admin\mhv-admin-portlet\src\main\java\gov\va\med\mhv\admin\web\util | SortUtil.java | Wed Jul 5 17:41:58 2017 UTC |
2 | MHV_CIF_2017.4.0.0.zip\MHV_CIF_2017.4.0.0\MHV_CIF_2017.4.0.0\ap_redesign\mhv_source\mhv_admin\mhv-admin-portlet\src\main\java\gov\va\med\mhv\admin\web\util | SortUtil.java | Thu Sep 7 18:50:05 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 430 |
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 gov .va.med.mh v.admin.dt o.Employee OrgRoleDTO ; | |
4 | import gov .va.med.mh v.admin.dt o.Employee OrgRoleHis toryDTO; | |
5 | import gov .va.med.mh v.admin.dt o.Employee SearchResu lt; | |
6 | ||
7 | import jav a.util.Com parator; | |
8 | import jav a.util.Lis t; | |
9 | ||
10 | /** | |
11 | * This cl ass contai ns the var ious sort implementa tions requ ried by th e manage v a staff ap plication | |
12 | * @author DN S HODGEJ | |
13 | * | |
14 | */ | |
15 | public cla ss SortUti l { | |
16 | ||
17 | ||
18 | pu blic void imposeDefa ultSortOrd erViewAll( | |
19 | List<E mployeeOrg RoleDTO> e xistingRol eAssignmen ts) { | |
20 | ||
21 | if ( existingRo leAssignme nts != nul l) { | |
22 | ||
23 | existi ngRoleAssi gnments.so rt( new Co mparator<E mployeeOrg RoleDTO>() { | |
24 | ||
25 | @Overrid e | |
26 | public i nt compare (EmployeeO rgRoleDTO o1, Employ eeOrgRoleD TO o2) { | |
27 | int result = 0; | |
28 | ||
29 | if (o1 != null && o2 != null) { | |
30 | ||
31 | // order by active fla g | |
32 | if (o1.getAc tive()!= n ull && | |
33 | o2.g etActive() != null) { | |
34 | ||
35 | resu lt = o2.ge tActive(). compareTo( o1.getActi ve()); | |
36 | ||
37 | } | |
38 | ||
39 | // then by r ole (role name) | |
40 | if (result = = 0 && | |
41 | o1.g etRole() ! = null && | |
42 | o2.g etRole() ! = null && | |
43 | o1.g etRole().g etName() ! = null && | |
44 | o2.g etRole().g etName() ! = null) { | |
45 | ||
46 | resu lt = o1.ge tRole().ge tName().co mpareTo(o2 .getRole() .getName() ); | |
47 | ||
48 | } | |
49 | ||
50 | // then by f ull name | |
51 | if (result = = 0 && | |
52 | o1.g etEmployee () != null && | |
53 | o2.g etEmployee () != null && | |
54 | o1.g etEmployee ().getFull Name() != null && | |
55 | o2.g etEmployee ().getFull Name() != null) { | |
56 | ||
57 | resu lt = o1.ge tEmployee( ).getFullN ame().toLo werCase(). compareTo( o2.getEmpl oyee().get FullName() .toLowerCa se()); | |
58 | ||
59 | } | |
60 | ||
61 | } | |
62 | return res ult; | |
63 | } | |
64 | }); | |
65 | } | |
66 | } | |
67 | ||
68 | ||
69 | ||
70 | pu blic void imposeDefa ultSortOrd erSearch( | |
71 | List<E mployeeSea rchResult> employees ) { | |
72 | ||
73 | if ( employees != null) { | |
74 | ||
75 | employ ees.sort( new Compar ator<Emplo yeeSearchR esult>() { | |
76 | ||
77 | @Overrid e | |
78 | public i nt compare (EmployeeS earchResul t e1, Empl oyeeSearch Result e2) { | |
79 | int result = 0; | |
80 | ||
81 | if (e1 != null && e2 != null) { | |
82 | ||
83 | // order by last name | |
84 | if (e1.getLa stName()!= null && | |
85 | e2.g etLastName () != null ) { | |
86 | ||
87 | resu lt = e1.ge tLastName( ).toLowerC ase().comp areTo(e2.g etLastName ().toLower Case()); | |
88 | ||
89 | } | |
90 | ||
91 | // then by f irst name | |
92 | if (result = = 0 && | |
93 | e1.g etFirstNam e() != nul l && | |
94 | e2.g etFirstNam e() != nul l) { | |
95 | ||
96 | resu lt = e1.ge tFirstName ().toLower Case().com pareTo(e2. getFirstNa me().toLow erCase()); | |
97 | ||
98 | } | |
99 | ||
100 | // then by V ANetworkID (username ) | |
101 | if (result = = 0 && | |
102 | e1.get UserName() != null & & | |
103 | e2.get UserName() != null) { | |
104 | ||
105 | result = e1.getU serName(). toLowerCas e().compar eTo(e2.get UserName() .toLowerCa se()); | |
106 | ||
107 | } | |
108 | ||
109 | } | |
110 | return res ult; | |
111 | } | |
112 | }); | |
113 | } | |
114 | } | |
115 | ||
116 | ||
117 | pu blic void imposeDefa ultSortOrd erManageSt affMember( | |
118 | List<E mployeeOrg RoleDTO> e mployeesCu rrentRoles ) { | |
119 | ||
120 | if ( employeesC urrentRole s != null) { | |
121 | ||
122 | employ eesCurrent Roles.sort ( new Comp arator<Emp loyeeOrgRo leDTO>() { | |
123 | ||
124 | @Overrid e | |
125 | public i nt compare (EmployeeO rgRoleDTO o1, Employ eeOrgRoleD TO o2) { | |
126 | int result = 0; | |
127 | ||
128 | if (o1 != null && o2 != null) { | |
129 | ||
130 | // order by active fla g | |
131 | if (o1.getAc tive() != null && | |
132 | o2.g etActive() != null) { | |
133 | ||
134 | resu lt = o2.ge tActive(). compareTo( o1.getActi ve()); | |
135 | ||
136 | } | |
137 | ||
138 | // then by r ole | |
139 | if (result = = 0 && | |
140 | o1.g etRole() ! = null && | |
141 | o2.g etRole() ! = null && | |
142 | o1.g etRole().g etName() ! = null && | |
143 | o2.g etRole().g etName() ! = null) { | |
144 | ||
145 | resu lt = o1.ge tRole().ge tName().co mpareTo(o2 .getRole() .getName() ); | |
146 | ||
147 | } | |
148 | ||
149 | } | |
150 | return res ult; | |
151 | } | |
152 | }); | |
153 | } | |
154 | ||
155 | } | |
156 | ||
157 | pu blic void imposeDefa ultSortOrd erRoleHist ory( | |
158 | List<E mployeeOrg RoleHistor yDTO> empl oyeesHisto ricalRoles ) { | |
159 | ||
160 | if ( employeesH istoricalR oles != nu ll) { | |
161 | employ eesHistori calRoles.s ort( new C omparator< EmployeeOr gRoleHisto ryDTO>() { | |
162 | ||
163 | @Overrid e | |
164 | public i nt compare (EmployeeO rgRoleHist oryDTO o1, EmployeeO rgRoleHist oryDTO o2) { | |
165 | int result = 0; | |
166 | ||
167 | if (o1 != null && o2 != null) { | |
168 | ||
169 | // order by date | |
170 | if (o1.getMo dification Date()!= n ull && | |
171 | o2.g etModifica tionDate() != null) { | |
172 | ||
173 | resu lt = o2.ge tModificat ionDate(). compareTo( o1.getModi ficationDa te()); | |
174 | ||
175 | } | |
176 | ||
177 | // then by L evel (tyep of organi zation) | |
178 | if (result = = 0 && | |
179 | o1.g etEmployee OrgRoleDTO () != null && | |
180 | o2.g etEmployee OrgRoleDTO () != null && | |
181 | o1.g etEmployee OrgRoleDTO ().getOrga nization() != null & & | |
182 | o2.g etEmployee OrgRoleDTO ().getOrga nization() != null & & | |
183 | o1.g etEmployee OrgRoleDTO ().getOrga nization() .getTypeOf Organizati on() != nu ll && | |
184 | o2.g etEmployee OrgRoleDTO ().getOrga nization() .getTypeOf Organizati on() != nu ll) { | |
185 | ||
186 | Stri ng type1 = o1.getEmp loyeeOrgRo leDTO().ge tOrganizat ion().getT ypeOfOrgan ization(); | |
187 | Stri ng type2 = o2.getEmp loyeeOrgRo leDTO().ge tOrganizat ion().getT ypeOfOrgan ization(); | |
188 | resu lt = type1 .compareTo (type2); | |
189 | ||
190 | } | |
191 | ||
192 | // then by R ole (role name) | |
193 | if (result = = 0 && | |
194 | o1.get EmployeeOr gRoleDTO() != null & & | |
195 | o2.get EmployeeOr gRoleDTO() != null & & | |
196 | o1.get EmployeeOr gRoleDTO() .getRole() != null & & | |
197 | o2.get EmployeeOr gRoleDTO() .getRole() != null & & | |
198 | o1.get EmployeeOr gRoleDTO() .getRole() .getName() != null & & | |
199 | o2.get EmployeeOr gRoleDTO() .getRole() .getName() != null) { | |
200 | ||
201 | String name1 = o 1.getEmplo yeeOrgRole DTO().getR ole().getN ame(); | |
202 | String name2 = o 2.getEmplo yeeOrgRole DTO().getR ole().getN ame(); | |
203 | result = name1.c ompareTo(n ame2); | |
204 | ||
205 | } | |
206 | ||
207 | } | |
208 | return res ult; | |
209 | } | |
210 | }); | |
211 | } | |
212 | ||
213 | } | |
214 | ||
215 | ||
216 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.