1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.coreservice.impl.parameter;
17
18
19 import javax.persistence.Column;
20 import javax.persistence.Entity;
21 import javax.persistence.FetchType;
22 import javax.persistence.Id;
23 import javax.persistence.IdClass;
24 import javax.persistence.JoinColumn;
25 import javax.persistence.ManyToOne;
26 import javax.persistence.OneToOne;
27 import javax.persistence.Table;
28
29 import org.kuali.rice.coreservice.api.parameter.EvaluationOperator;
30 import org.kuali.rice.coreservice.framework.parameter.ParameterEbo;
31 import org.kuali.rice.coreservice.impl.component.ComponentBo;
32 import org.kuali.rice.coreservice.impl.component.DerivedComponentBo;
33 import org.kuali.rice.coreservice.impl.namespace.NamespaceBo;
34 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
35
36 @IdClass(ParameterId.class)
37 @Entity
38 @Table(name = "KRCR_PARM_T")
39 public class ParameterBo extends PersistableBusinessObjectBase implements ParameterEbo {
40
41 private static final long serialVersionUID = 1L;
42
43 @Id
44 @Column(name = "NMSPC_CD")
45 private String namespaceCode;
46
47 @Id
48 @Column(name = "CMPNT_CD")
49 private String componentCode;
50
51 @Id
52 @Column(name = "PARM_NM")
53 private String name;
54
55 @Id
56 @Column(name = "APPL_ID")
57 private String applicationId;
58
59 @Column(name = "VAL")
60 private String value;
61
62 @Column(name = "PARM_DESC_TXT", length = 2048)
63 private String description;
64
65 @Column(name = "PARM_TYP_CD")
66 private String parameterTypeCode;
67
68 @Column(name = "EVAL_OPRTR_CD")
69 private String evaluationOperatorCode;
70
71 @ManyToOne(fetch = FetchType.LAZY)
72 @JoinColumn(name = "NMSPC_CD", insertable = false, updatable = false)
73 private NamespaceBo namespace;
74
75 @OneToOne(fetch = FetchType.LAZY)
76 @JoinColumn(name = "PARM_TYP_CD", insertable = false, updatable = false)
77 private ParameterTypeBo parameterType;
78
79 @OneToOne(fetch = FetchType.LAZY)
80 @JoinColumn(name = "PARM_TYP_CD", insertable = false, updatable = false)
81 private ComponentBo component;
82
83 @OneToOne(fetch = FetchType.LAZY)
84 @JoinColumn(name = "PARM_TYP_CD", insertable = false, updatable = false)
85 private DerivedComponentBo derivedComponent;
86
87
88
89
90
91
92 public static org.kuali.rice.coreservice.api.parameter.Parameter to(ParameterBo bo) {
93 if (bo == null) {
94 return null;
95 }
96
97 return org.kuali.rice.coreservice.api.parameter.Parameter.Builder.create(bo).build();
98 }
99
100
101
102
103
104
105 public static ParameterBo from(org.kuali.rice.coreservice.api.parameter.Parameter im) {
106 if (im == null) {
107 return null;
108 }
109
110 ParameterBo bo = new ParameterBo();
111 bo.setNamespaceCode(im.getNamespaceCode());
112 bo.setComponentCode(im.getComponentCode());
113 bo.setName(im.getName());
114 bo.setApplicationId(im.getApplicationId());
115 bo.setValue(im.getValue());
116 bo.setDescription(im.getDescription());
117 bo.setParameterTypeCode(im.getParameterType().getCode());
118 if(null != im.getEvaluationOperator()){
119 bo.setEvaluationOperatorCode(im.getEvaluationOperator().getCode());
120 }
121 bo.setParameterType(ParameterTypeBo.from(im.getParameterType()));
122 bo.setVersionNumber(im.getVersionNumber());
123 bo.setObjectId(im.getObjectId());
124 return bo;
125 }
126
127 @Override
128 public ParameterTypeBo getParameterType() {
129 return this.parameterType;
130 }
131
132 @Override
133 public EvaluationOperator getEvaluationOperator() {
134 return EvaluationOperator.fromCode(evaluationOperatorCode);
135 }
136
137 @Override
138 public String getNamespaceCode() {
139 return namespaceCode;
140 }
141
142 public void setNamespaceCode(String namespaceCode) {
143 this.namespaceCode = namespaceCode;
144 }
145
146 @Override
147 public String getComponentCode() {
148 return componentCode;
149 }
150
151 public void setComponentCode(String componentCode) {
152 this.componentCode = componentCode;
153 }
154
155 @Override
156 public String getName() {
157 return name;
158 }
159
160 public void setName(String name) {
161 this.name = name;
162 }
163
164 @Override
165 public String getApplicationId() {
166 return applicationId;
167 }
168
169 public void setApplicationId(String applicationId) {
170 this.applicationId = applicationId;
171 }
172
173 @Override
174 public String getValue() {
175 return value;
176 }
177
178 public void setValue(String value) {
179 this.value = value;
180 }
181
182 @Override
183 public String getDescription() {
184 return description;
185 }
186
187 public void setDescription(String description) {
188 this.description = description;
189 }
190
191 public String getParameterTypeCode() {
192 return parameterTypeCode;
193 }
194
195 public void setParameterTypeCode(String parameterTypeCode) {
196 this.parameterTypeCode = parameterTypeCode;
197 }
198
199 public void setParameterType(ParameterTypeBo parameterType) {
200 this.parameterType = parameterType;
201 }
202
203 public String getEvaluationOperatorCode() {
204 return evaluationOperatorCode;
205 }
206
207 public void setEvaluationOperatorCode(String evaluationOperatorCode) {
208 this.evaluationOperatorCode = evaluationOperatorCode;
209 }
210
211 public NamespaceBo getNamespace() {
212 return namespace;
213 }
214
215 public void setNamespace(NamespaceBo namespace) {
216 this.namespace = namespace;
217 }
218
219 public ComponentBo getComponent() {
220 return component;
221 }
222
223 public void setComponent(ComponentBo component) {
224 this.component = component;
225 }
226
227 public DerivedComponentBo getDerivedComponent() {
228 return derivedComponent;
229 }
230
231 public void setDerivedComponent(DerivedComponentBo derivedComponent) {
232 this.derivedComponent = derivedComponent;
233 }
234
235 }
236