View Javadoc

1   /*
2    * Copyright 2006-2008 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in
5    * compliance with the License. You may obtain a copy of the License at
6    * 
7    * http://www.opensource.org/licenses/ecl2.php
8    * 
9    * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS
10   * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
11   * language governing permissions and limitations under the License.
12   */
13  package org.kuali.rice.kns.lookup.keyvalues;
14  
15  import java.util.ArrayList;
16  import java.util.List;
17  
18  import org.kuali.rice.core.util.KeyLabelPair;
19  import org.kuali.rice.kns.service.KNSServiceLocator;
20  import org.kuali.rice.kns.service.ParameterService;
21  
22  public class ApcValuesFinder extends KeyValuesBase {
23  
24      private String parameterName;
25      private String parameterDetailType;
26      private String parameterNamespace;
27  
28      public String getParameterNamespace() {
29          return this.parameterNamespace;
30      }
31  
32      public void setParameterNamespace(String parameterNamespace) {
33          this.parameterNamespace = parameterNamespace;
34      }
35  
36      public ApcValuesFinder() {
37          super();
38      }
39  
40      public ApcValuesFinder(String parameterNamesapce, String parameterDetailType, String parameterName) {
41      	super();
42      	this.parameterNamespace = parameterNamespace;
43      	this.parameterDetailType = parameterDetailType;
44      	this.parameterName = parameterName;
45      }
46  
47      public String getParameterName() {
48          return parameterName;
49      }
50  
51      public void setParameterName(String parameterName) {
52          this.parameterName = parameterName;
53      }
54  
55      public List getKeyValues() {
56      	ParameterService parameterService = KNSServiceLocator.getParameterService();
57      	List<KeyLabelPair> activeLabels = new ArrayList<KeyLabelPair>();
58      	activeLabels.add(new KeyLabelPair("", ""));
59      	for (String parm : parameterService.getParameterValues(parameterNamespace, parameterDetailType, parameterName)) {
60      	    activeLabels.add(new KeyLabelPair(parm, parm));
61      	}
62      	return activeLabels;
63      }
64  
65      public String getParameterDetailType() {
66          return this.parameterDetailType;
67      }
68  
69      public void setParameterDetailType(String parameterDetailType) {
70          this.parameterDetailType = parameterDetailType;
71      }
72  
73  }