01: /*
02: * Copyright 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.module.gl.web.optionfinder;
17:
18: import java.util.ArrayList;
19: import java.util.Collection;
20: import java.util.Collections;
21: import java.util.List;
22:
23: import org.kuali.core.lookup.keyvalues.KeyValuesBase;
24: import org.kuali.core.web.ui.KeyLabelPair;
25: import org.kuali.kfs.context.SpringContext;
26: import org.kuali.module.gl.bo.OriginEntryGroup;
27: import org.kuali.module.gl.service.OriginEntryGroupService;
28:
29: /**
30: * This class returns a list of correction groups with a process flag set to yes key value pairs.
31: */
32: public class ProcessingCorrectionGroupEntriesFinder extends
33: KeyValuesBase {
34:
35: /**
36: * Returns a list of key-value pairs of origin entry groups with a process flag set to yes. The key is the correction id, and
37: * the value is the name of the origin entry group
38: *
39: * @return a List of key value pair options
40: * @see org.kuali.core.lookup.keyvalues.KeyValuesFinder#getKeyValues()
41: */
42: public List<KeyLabelPair> getKeyValues() {
43: List<KeyLabelPair> activeLabels = new ArrayList<KeyLabelPair>();
44:
45: OriginEntryGroupService originEntryGroupService = SpringContext
46: .getBean(OriginEntryGroupService.class);
47:
48: Collection<OriginEntryGroup> groupList = originEntryGroupService
49: .getAllOriginEntryGroup();
50:
51: List<OriginEntryGroup> sortedGroupList = (List<OriginEntryGroup>) groupList;
52:
53: OEGTypeComparator oegTypeComparator = new OEGTypeComparator();
54: Collections.sort(sortedGroupList, oegTypeComparator);
55:
56: for (OriginEntryGroup oeg : sortedGroupList) {
57: if (oeg.getProcess().booleanValue()
58: & !oeg.getSourceCode().startsWith("L")) {
59: activeLabels.add(new KeyLabelPair(oeg.getId()
60: .toString(), oeg.getName()));
61: }
62: }
63:
64: return activeLabels;
65: }
66:
67: }
|