01: /*
02: * Copyright 2006-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.core.lookup.keyvalues;
17:
18: import java.util.ArrayList;
19: import java.util.Collections;
20: import java.util.List;
21:
22: import org.kuali.core.bo.ParameterNamespace;
23: import org.kuali.core.service.KeyValuesService;
24: import org.kuali.core.web.ui.KeyLabelPair;
25: import org.kuali.rice.KNSServiceLocator;
26:
27: /**
28: * This class...
29: *
30: *
31: */
32: public class ParameterNamespaceValuesFinder extends KeyValuesBase {
33:
34: private static ParameterNamespaceComparator comparator = new ParameterNamespaceComparator();
35:
36: public List<KeyLabelPair> getKeyValues() {
37:
38: // get a list of all CampusTypes
39: KeyValuesService boService = KNSServiceLocator
40: .getKeyValuesService();
41: List<ParameterNamespace> bos = (List) boService
42: .findAll(ParameterNamespace.class);
43:
44: // sort using comparator.
45: Collections.sort(bos, comparator);
46:
47: // create a new list (code, descriptive-name)
48: List<KeyLabelPair> labels = new ArrayList<KeyLabelPair>(bos
49: .size());
50:
51: for (ParameterNamespace bo : bos) {
52: labels.add(new KeyLabelPair(bo.getParameterNamespaceCode(),
53: bo.getCodeAndDescription()));
54: }
55:
56: return labels;
57: }
58: }
|