View Javadoc
1   /*
2    * Copyright 2013 The Kuali Foundation.
3    *
4    * Licensed under the Educational Community License, Version 1.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl1.php
9    *
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.ole.select.businessobject.options;
17  
18  import org.kuali.ole.select.businessobject.OleReceiptStatus;
19  import org.kuali.ole.sys.OLEConstants;
20  import org.kuali.ole.sys.context.SpringContext;
21  import org.kuali.rice.core.api.util.ConcreteKeyValue;
22  import org.kuali.rice.core.api.util.KeyValue;
23  import org.kuali.rice.krad.keyvalues.KeyValuesBase;
24  import org.kuali.rice.krad.service.KeyValuesService;
25  
26  import java.util.*;
27  
28  public class OleLineItemReceivingReceiptStatusValuesFinder extends KeyValuesBase {
29  
30      @Override
31      public List<KeyValue> getKeyValues() {
32          // TODO Auto-generated method stub
33          List labels = new ArrayList();
34          Map<String, Object> receiptStatusDocTypMap = new HashMap<String, Object>();
35          receiptStatusDocTypMap.put(OLEConstants.RCPT_STS_DOC_TYP, OLEConstants.RCV_RCPT_STS_DOC_TYP);
36          KeyValuesService boService = SpringContext.getBean(KeyValuesService.class);
37          Collection receiptStatusCollection = boService.findMatching(OleReceiptStatus.class, receiptStatusDocTypMap);
38          labels.add(new ConcreteKeyValue("", ""));
39          for (Iterator iter = receiptStatusCollection.iterator(); iter.hasNext(); ) {
40              OleReceiptStatus oleReceiptStatus = (OleReceiptStatus) iter.next();
41              labels.add(new ConcreteKeyValue(oleReceiptStatus.getReceiptStatusId().toString(), oleReceiptStatus
42                      .getReceiptStatus()));
43          }
44          return labels;
45      }
46  
47  }