1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.travel.options;
17
18 import edu.sampleu.travel.dataobject.TravelDestination;
19 import org.kuali.rice.core.api.criteria.QueryByCriteria;
20 import org.kuali.rice.core.api.criteria.QueryResults;
21 import org.kuali.rice.core.api.util.ConcreteKeyValue;
22 import org.kuali.rice.core.api.util.KeyValue;
23 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
24 import org.kuali.rice.krad.service.KRADServiceLocator;
25
26 import java.util.ArrayList;
27 import java.util.List;
28
29
30
31
32
33
34 public class TravelDestinationKeyValues extends KeyValuesBase {
35
36 private static final long serialVersionUID = 1L;
37
38 @Override
39 public List<KeyValue> getKeyValues() {
40 List<KeyValue> keyValues = new ArrayList<KeyValue>();
41
42 QueryResults<TravelDestination> bos = KRADServiceLocator.getDataObjectService().findMatching(
43 TravelDestination.class, QueryByCriteria.Builder.create().build());
44
45 keyValues.add(new ConcreteKeyValue("", ""));
46 for (TravelDestination typ : bos.getResults()) {
47 keyValues.add(new ConcreteKeyValue(typ.getTravelDestinationId(), typ.getTravelDestinationName()));
48 }
49
50 return keyValues;
51 }
52
53 }