1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.gl.web.util;
17
18 import java.io.File;
19 import java.util.Comparator;
20 import java.util.Date;
21
22 import org.apache.commons.lang.StringUtils;
23
24
25
26
27 public class OriginEntryFileComparator implements Comparator<File> {
28
29 public int compare(File o1, File o2) {
30 String fileName1 = o1.getName();
31 String fileName2 = o2.getName();
32
33
34 fileName1 = StringUtils.substringBefore(fileName1, ".");
35 fileName2 = StringUtils.substringBefore(fileName2, ".");
36
37 int c = fileName1.compareTo(fileName2);
38 if (c != 0) {
39 return c;
40 }
41
42 Date fileDate1 = new Date(o1.lastModified());
43 Date fileDate2 = new Date(o2.lastModified());
44
45 return fileDate1.compareTo(fileDate2);
46 }
47
48 }