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.PurchaseOrderStatuses; 019import org.kuali.rice.core.api.util.ConcreteKeyValue; 020import org.kuali.rice.krad.keyvalues.KeyValuesBase; 021 022import java.util.ArrayList; 023import java.util.List; 024import java.util.SortedSet; 025import java.util.TreeSet; 026 027/** 028 * Value Finder for Purchase Order Statuses. 029 */ 030public class PurchaseOrderStatusValuesFinder extends KeyValuesBase { 031 032 /** 033 * Overide this method to sort the PO statuses for proper display. 034 * 035 * @see org.kuali.ole.module.purap.businessobject.options.PurApStatusKeyValuesBase#getKeyValues() 036 */ 037 public List getKeyValues() { 038 // get all PO statuses 039 SortedSet<String> incompleteCodes = new TreeSet<String>(PurchaseOrderStatuses.INCOMPLETE_STATUSES); 040 SortedSet<String> completeCodes = new TreeSet<String>(PurchaseOrderStatuses.COMPLETE_STATUSES); 041 042 // generate output 043 List labels = new ArrayList(); 044 045 labels.add(new ConcreteKeyValue("INCOMPLETE", "INCOMPLETE STATUSES")); 046 for (String status : incompleteCodes) { 047 labels.add(new ConcreteKeyValue(status, "- " + status)); 048 } 049 050 labels.add(new ConcreteKeyValue("COMPLETE", "COMPLETE STATUSES")); 051 for (String status : completeCodes) { 052 labels.add(new ConcreteKeyValue(status, "- " + status)); 053 } 054 055 return labels; 056 } 057 058}