001/*
002 * Copyright 2007 The Kuali Foundation
003 * 
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * 
008 * http://www.opensource.org/licenses/ecl2.php
009 * 
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.ole.module.purap.businessobject.options;
017
018import org.kuali.ole.module.purap.PurapConstants.CreditMemoStatuses;
019import org.kuali.rice.core.api.util.ConcreteKeyValue;
020import org.kuali.rice.krad.keyvalues.KeyValuesBase;
021
022import java.util.*;
023
024/**
025 * Value Finder for Credit Memo Statuses.
026 */
027public class CreditMemoStatusValuesFinder extends KeyValuesBase {
028
029    /**
030     * Overide this method to sort the PO statuses for proper display.
031     *
032     * @see org.kuali.ole.module.purap.businessobject.options.PurApStatusKeyValuesBase#getKeyValues()
033     */
034    public List getKeyValues() {
035        // get all CM statuses
036        HashMap<String, String> keyValues = CreditMemoStatuses.getAllAppDocStatuses();
037        SortedSet<String> sortedKeys = new TreeSet<String>(keyValues.keySet());
038
039        // generate output
040        List labels = new ArrayList();
041        for (String sortedKey : sortedKeys) {
042            labels.add(new ConcreteKeyValue(sortedKey, sortedKey));
043        }
044        return labels;
045    }
046
047}