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.KFSConstants;
26: import org.kuali.kfs.context.SpringContext;
27: import org.kuali.module.gl.bo.OriginEntryGroup;
28: import org.kuali.module.gl.service.OriginEntryGroupService;
29: import org.kuali.module.gl.web.optionfinder.OEGTypeComparator;
30:
31: /**
32: * Entries Finder for Labor Balance Type Code. Returns a list of key values of Labor Origin Entry Groups for LLCP.
33: */
34: public class CorrectionLaborGroupEntriesFinder extends KeyValuesBase {
35:
36: /**
37: * @see org.kuali.keyvalues.KeyValuesFinder#getKeyValues()
38: */
39: public List getKeyValues() {
40: List activeLabels = new ArrayList();
41: OriginEntryGroupService originEntryGroupService = SpringContext
42: .getBean(OriginEntryGroupService.class);
43: Collection<OriginEntryGroup> groupList = originEntryGroupService
44: .getAllOriginEntryGroup();
45: List<OriginEntryGroup> sortedGroupList = (List) groupList;
46: OEGTypeComparator oegTypeComparator = new OEGTypeComparator();
47: Collections.sort(sortedGroupList, oegTypeComparator);
48:
49: String groupException = "";
50: for (int i = 0; i < KFSConstants.LLCP_GROUP_FILTER_EXCEPTION.length; i++) {
51: groupException += KFSConstants.LLCP_GROUP_FILTER_EXCEPTION[i]
52: + " ";
53: }
54:
55: for (OriginEntryGroup oeg : sortedGroupList) {
56: if (oeg.getSourceCode().startsWith("L")
57: && !groupException.contains(oeg.getSourceCode())) {
58: activeLabels.add(new KeyLabelPair(oeg.getId()
59: .toString(), oeg.getName()));
60: }
61:
62: }
63:
64: return activeLabels;
65: }
66: }
|