1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.lookup.keyvalues; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.Collection; |
20 | |
import java.util.List; |
21 | |
|
22 | |
import org.kuali.rice.core.util.KeyLabelPair; |
23 | |
import org.kuali.rice.kns.bo.Campus; |
24 | |
import org.kuali.rice.kns.service.KNSServiceLocator; |
25 | |
import org.kuali.rice.kns.service.KeyValuesService; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | 0 | public class CampusValuesFinder extends KeyValuesBase { |
33 | |
|
34 | 0 | protected static List<KeyLabelPair> campusCache = null; |
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
@SuppressWarnings("unchecked") |
40 | |
public List<KeyLabelPair> getKeyValues() { |
41 | 0 | if ( campusCache == null ) { |
42 | 0 | synchronized ( this.getClass() ) { |
43 | |
|
44 | 0 | KeyValuesService boService = KNSServiceLocator.getKeyValuesService(); |
45 | 0 | Collection<Campus> codes = (Collection<Campus>)boService.findAll(Campus.class); |
46 | 0 | List<KeyLabelPair> labels = new ArrayList<KeyLabelPair>(); |
47 | 0 | labels.add(new KeyLabelPair("", "")); |
48 | 0 | for ( Campus campus : codes ) { |
49 | 0 | labels.add(new KeyLabelPair(campus.getCampusCode(), campus.getCampusCode() + " - " + campus.getCampusName())); |
50 | |
} |
51 | |
|
52 | 0 | campusCache = labels; |
53 | 0 | } |
54 | |
} |
55 | 0 | return campusCache; |
56 | |
} |
57 | |
|
58 | |
@Override |
59 | |
public void clearInternalCache() { |
60 | 0 | campusCache = null; |
61 | 0 | } |
62 | |
} |