1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.gl.businessobject.options;
17
18 import java.io.File;
19 import java.util.ArrayList;
20 import java.util.Arrays;
21 import java.util.Collections;
22 import java.util.Date;
23 import java.util.List;
24
25 import org.kuali.ole.gl.service.OriginEntryGroupService;
26 import org.kuali.ole.gl.web.util.OriginEntryFileComparator;
27 import org.kuali.ole.sys.context.SpringContext;
28 import org.kuali.rice.core.api.datetime.DateTimeService;
29 import org.kuali.rice.core.api.util.ConcreteKeyValue;
30 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
31
32
33
34
35 public class CorrectionGroupEntriesFinder extends KeyValuesBase {
36
37
38
39
40
41
42
43 public List getKeyValues() {
44 List activeLabels = new ArrayList();
45
46 OriginEntryGroupService originEntryGroupService = SpringContext.getBean(OriginEntryGroupService.class);
47 File[] fileList = originEntryGroupService.getAllFileInBatchDirectory();
48
49 List<File> sortedFileList = Arrays.asList(fileList);
50 Collections.sort(sortedFileList, new OriginEntryFileComparator());
51
52 for (File file : sortedFileList) {
53 String fileName = file.getName();
54
55
56 Date date = new Date(file.lastModified());
57 String timeInfo = "(" + SpringContext.getBean(DateTimeService.class).toDateTimeString(date) + ")";
58 String sizeInfo = "(" + (new Long(file.length())).toString() + ")";
59
60 activeLabels.add(new ConcreteKeyValue(fileName, timeInfo + " " + fileName + " " + sizeInfo));
61 }
62
63 return activeLabels;
64 }
65
66 }