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.labor.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: import org.kuali.module.gl.web.optionfinder.OEGTypeComparator;
29:
30: /**
31: * Entries Finder for Processing Correction Labor Group. Returns a list of correction groups with a process flag set to yes key
32: * value pairs.
33: */
34: public class ProcessingCorrectionLaborGroupEntriesFinder extends
35: KeyValuesBase {
36:
37: /**
38: * @see org.kuali.core.lookup.keyvalues.KeyValuesFinder#getKeyValues()
39: */
40: public List<KeyLabelPair> getKeyValues() {
41: List<KeyLabelPair> activeLabels = new ArrayList<KeyLabelPair>();
42: OriginEntryGroupService originEntryGroupService = SpringContext
43: .getBean(OriginEntryGroupService.class);
44: Collection<OriginEntryGroup> groupList = originEntryGroupService
45: .getAllOriginEntryGroup();
46: List<OriginEntryGroup> sortedGroupList = (List<OriginEntryGroup>) groupList;
47: OEGTypeComparator oegTypeComparator = new OEGTypeComparator();
48: Collections.sort(sortedGroupList, oegTypeComparator);
49:
50: for (OriginEntryGroup oeg : sortedGroupList) {
51: if (oeg.getProcess().booleanValue()
52: & oeg.getSourceCode().startsWith("L")) {
53: activeLabels.add(new KeyLabelPair(oeg.getId()
54: .toString(), oeg.getName()));
55: }
56: }
57:
58: return activeLabels;
59: }
60: }
|