1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.impl.repository;
17
18 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
19 import org.kuali.rice.krms.api.repository.term.TermParameterDefinition;
20 import org.kuali.rice.krms.api.repository.term.TermParameterDefinitionContract;
21
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.Id;
26 import javax.persistence.JoinColumn;
27 import javax.persistence.ManyToOne;
28 import javax.persistence.Table;
29 import javax.persistence.Version;
30 import java.io.Serializable;
31
32 @Entity
33 @Table(name = "KRMS_TERM_PARM_T")
34 public class TermParameterBo implements TermParameterDefinitionContract, Serializable {
35
36 private static final long serialVersionUID = 1l;
37
38 public static final String TERM_PARM_SEQ_NAME = "KRMS_TERM_PARM_S";
39
40 @PortableSequenceGenerator(name = TERM_PARM_SEQ_NAME)
41 @GeneratedValue(generator = TERM_PARM_SEQ_NAME)
42 @Id
43 @Column(name = "TERM_PARM_ID")
44 private String id;
45
46 @Column(name = "NM")
47 private String name;
48
49 @Column(name = "VAL")
50 private String value;
51
52 @Version
53 @Column(name="VER_NBR", length=8)
54 protected Long versionNumber;
55
56 @ManyToOne()
57 @JoinColumn(name = "TERM_ID", referencedColumnName = "TERM_ID")
58 private TermBo term;
59
60
61
62
63
64
65
66 public static TermParameterDefinition to(TermParameterBo bo) {
67 if (bo == null) {
68 return null;
69 }
70
71 return TermParameterDefinition.Builder.create(bo).build();
72 }
73
74
75
76
77
78
79
80 public static TermParameterBo from(TermParameterDefinition im) {
81 if (im == null) {
82 return null;
83 }
84
85 TermParameterBo bo = new TermParameterBo();
86 bo.id = im.getId();
87
88
89
90 bo.name = im.getName();
91 bo.value = im.getValue();
92 bo.setVersionNumber(im.getVersionNumber());
93
94 return bo;
95 }
96
97 public String getId() {
98 return id;
99 }
100
101 public void setId(String id) {
102 this.id = id;
103 }
104
105 public String getTermId() {
106 if (term != null) {
107 return term.getId();
108 }
109
110 return null;
111 }
112
113 public String getName() {
114 return name;
115 }
116
117 public void setName(String name) {
118 this.name = name;
119 }
120
121 public String getValue() {
122 return value;
123 }
124
125 public void setValue(String value) {
126 this.value = value;
127 }
128
129 public Long getVersionNumber() {
130 return versionNumber;
131 }
132
133 public void setVersionNumber(Long versionNumber) {
134 this.versionNumber = versionNumber;
135 }
136
137 public TermBo getTerm() {
138 return term;
139 }
140
141 public void setTerm(TermBo term) {
142 this.term = term;
143 }
144 }