1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.businessobject.options;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.kuali.ole.sys.context.SpringContext;
22 import org.kuali.rice.core.api.util.ConcreteKeyValue;
23 import org.kuali.rice.core.api.util.KeyValue;
24 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
25 import org.kuali.rice.location.api.state.State;
26 import org.kuali.rice.location.api.state.StateService;
27
28 public class StateCodeValuesFinder extends KeyValuesBase {
29
30
31
32
33 public List getKeyValues() {
34
35 List<State> codes = SpringContext.getBean(StateService.class).findAllStatesInCountry("US");
36 List<KeyValue> labels = new ArrayList<KeyValue>();
37 labels.add(new ConcreteKeyValue("", ""));
38 for (State state : codes) {
39 if(state.isActive()) {
40 labels.add(new ConcreteKeyValue(state.getCode(), state.getCode()));
41 }
42 }
43
44 return labels;
45 }
46 }