1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.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 | |
import org.kuali.rice.core.api.parameter.EvaluationOperator |
29 | |
import org.kuali.rice.core.api.parameter.ParameterContract |
30 | |
import org.kuali.rice.core.impl.component.ComponentBo |
31 | |
import org.kuali.rice.core.impl.namespace.NamespaceBo |
32 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase |
33 | |
import org.kuali.rice.core.impl.component.DerivedComponentBo |
34 | |
|
35 | |
@IdClass(ParameterId.class) |
36 | |
@Entity |
37 | |
@Table(name = "KRCR_PARM_T") |
38 | |
public class ParameterBo extends PersistableBusinessObjectBase implements ParameterContract { |
39 | |
|
40 | |
private static final long serialVersionUID = 1L; |
41 | |
|
42 | |
@Id |
43 | |
@Column(name = "NMSPC_CD") |
44 | |
def String namespaceCode |
45 | |
|
46 | |
@Id |
47 | |
@Column(name = "CMPNT_CD") |
48 | |
def String componentCode |
49 | |
|
50 | |
@Id |
51 | |
@Column(name = "PARM_NM") |
52 | |
def String name |
53 | |
|
54 | |
@Id |
55 | |
@Column(name = "APPL_ID") |
56 | |
def String applicationId |
57 | |
|
58 | |
@Column(name = "VAL") |
59 | |
def String value |
60 | |
|
61 | |
@Column(name = "PARM_DESC_TXT", length = 2048) |
62 | |
def String description |
63 | |
|
64 | |
@Column(name = "PARM_TYP_CD") |
65 | |
def String parameterTypeCode |
66 | |
|
67 | |
@Column(name = "EVAL_OPRTR_CD") |
68 | |
def String evaluationOperatorCode |
69 | |
|
70 | |
@ManyToOne(fetch = FetchType.LAZY) |
71 | |
@JoinColumn(name = "NMSPC_CD", insertable = false, updatable = false) |
72 | |
def NamespaceBo namespace |
73 | |
|
74 | |
@OneToOne(fetch = FetchType.LAZY) |
75 | |
@JoinColumn(name = "PARM_TYP_CD", insertable = false, updatable = false) |
76 | |
def ParameterTypeBo parameterType |
77 | |
|
78 | |
@OneToOne(fetch = FetchType.LAZY) |
79 | |
@JoinColumn(name = "PARM_TYP_CD", insertable = false, updatable = false) |
80 | |
def ComponentBo component |
81 | |
|
82 | |
@OneToOne(fetch = FetchType.LAZY) |
83 | |
@JoinColumn(name = "PARM_TYP_CD", insertable = false, updatable = false) |
84 | |
def DerivedComponentBo derivedComponent |
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
static org.kuali.rice.core.api.parameter.Parameter to(ParameterBo bo) { |
92 | 0 | if (bo == null) { |
93 | 0 | return null |
94 | |
} |
95 | |
|
96 | 0 | return org.kuali.rice.core.api.parameter.Parameter.Builder.create(bo).build(); |
97 | |
} |
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
static ParameterBo from(org.kuali.rice.core.api.parameter.Parameter im) { |
105 | 0 | if (im == null) { |
106 | 0 | return null |
107 | |
} |
108 | |
|
109 | 0 | ParameterBo bo = new ParameterBo() |
110 | 0 | bo.namespaceCode = im.namespaceCode |
111 | 0 | bo.componentCode = im.componentCode |
112 | 0 | bo.name = im.name |
113 | 0 | bo.applicationId = im.applicationId |
114 | 0 | bo.value = im.value |
115 | 0 | bo.description = im.description |
116 | 0 | bo.parameterTypeCode = im.parameterType.code |
117 | 0 | bo.evaluationOperatorCode = im.evaluationOperator.code |
118 | |
|
119 | 0 | bo.parameterType = ParameterTypeBo.from(im.parameterType) |
120 | 0 | bo.versionNumber = im.versionNumber |
121 | 0 | bo.objectId = im.objectId; |
122 | |
|
123 | 0 | return bo |
124 | |
} |
125 | |
|
126 | |
@Override |
127 | |
ParameterTypeBo getParameterType() { |
128 | 0 | return parameterType |
129 | |
} |
130 | |
|
131 | |
@Override |
132 | |
EvaluationOperator getEvaluationOperator() { |
133 | 0 | return EvaluationOperator.fromCode(evaluationOperatorCode); |
134 | |
} |
135 | |
} |
136 | |
|