1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.businessobject.options;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.kuali.ole.sys.context.SpringContext;
22 import org.kuali.rice.core.api.util.ConcreteKeyValue;
23 import org.kuali.rice.coreservice.framework.parameter.ParameterService;
24 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
25
26
27
28
29
30 public class ParameterValuesFinder extends KeyValuesBase {
31 private Class componentClass;
32 private String parameterName;
33 private boolean insertBlankRow = true;
34
35 public ParameterValuesFinder() {
36 }
37
38 public ParameterValuesFinder(Class componentClass, String parameterName) {
39 this.componentClass = componentClass;
40 this.parameterName = parameterName;
41 }
42
43 public List getKeyValues() {
44 List keyLabels = new ArrayList();
45 List<String> parameterValues = new ArrayList<String>( SpringContext.getBean(ParameterService.class).getParameterValuesAsString(this.componentClass, this.parameterName) );
46 if (insertBlankRow) {
47 keyLabels.add(new ConcreteKeyValue("", ""));
48 }
49 if (parameterValues != null) {
50 for (String parameterValue : parameterValues) {
51 keyLabels.add(new ConcreteKeyValue(parameterValue, parameterValue));
52 }
53 }
54 return keyLabels;
55 }
56
57
58
59
60
61
62 public boolean shouldInsertBlankRow() {
63 return insertBlankRow;
64 }
65
66
67
68
69
70
71 public void setInsertBlankRow(boolean insertBlankRow) {
72 this.insertBlankRow = insertBlankRow;
73 }
74
75
76
77
78
79
80 public Class getComponentClass() {
81 return componentClass;
82 }
83
84
85
86
87
88
89 public String getParameterName() {
90 return parameterName;
91 }
92
93
94
95
96
97
98 public void setComponentClass(Class componentClass) {
99 this.componentClass = componentClass;
100 }
101
102
103
104
105
106
107 public void setParameterName(String parameterName) {
108 this.parameterName = parameterName;
109 }
110
111
112 }