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.sys.OLEConstants;
19  import org.kuali.rice.core.api.util.ConcreteKeyValue;
20  import org.kuali.rice.kew.doctype.ApplicationDocumentStatus;
21  import org.kuali.rice.kew.doctype.bo.DocumentType;
22  import org.kuali.rice.kew.service.KEWServiceLocator;
23  import org.kuali.rice.krad.keyvalues.KeyValuesBase;
24  
25  import java.util.ArrayList;
26  import java.util.List;
27  
28  public class OlePurchaseOrderStatusFinder extends KeyValuesBase {
29      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OlePurchaseOrderStatusFinder.class);
30  
31      @Override
32      public List getKeyValues() {
33          LOG.debug("Inside getKeyValues of OlePurchaseOrderStatusFinder");
34          DocumentType documentType = KEWServiceLocator.getDocumentTypeService().findByNameCaseInsensitive(
35                  OLEConstants.FinancialDocumentTypeCodes.PURCHASE_ORDER);
36          List<ApplicationDocumentStatus> applicationDocumentStatus = documentType.getValidApplicationStatuses();
37          List labels = new ArrayList();
38          labels.add(new ConcreteKeyValue("", ""));
39          for (ApplicationDocumentStatus status : applicationDocumentStatus) {
40              labels.add(new ConcreteKeyValue(status.getStatusName(), status.getStatusName()));
41          }
42          return labels;
43      }
44  
45  }