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