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.apache.commons.lang.StringUtils;
19 import org.kuali.rice.core.api.mo.common.Versioned;
20 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
21 import org.kuali.rice.krms.api.repository.term.TermResolverDefinition;
22
23 import javax.persistence.Column;
24 import javax.persistence.Entity;
25 import javax.persistence.GeneratedValue;
26 import javax.persistence.Id;
27 import javax.persistence.JoinColumn;
28 import javax.persistence.ManyToOne;
29 import javax.persistence.Table;
30 import javax.persistence.Version;
31 import java.io.Serializable;
32
33 @Entity
34 @Table(name = "KRMS_TERM_RSLVR_PARM_SPEC_T")
35 public class TermResolverParameterSpecificationBo implements Versioned, Serializable {
36
37 private static final long serialVersionUID = 1l;
38
39 @PortableSequenceGenerator(name = "KRMS_TERM_RSLVR_PARM_SPEC_S")
40 @GeneratedValue(generator = "KRMS_TERM_RSLVR_PARM_SPEC_S")
41 @Id
42 @Column(name = "TERM_RSLVR_PARM_SPEC_ID")
43 private String id;
44
45 @Column(name = "NM")
46 private String name;
47
48 @Version
49 @Column(name="VER_NBR", length=8)
50 protected Long versionNumber;
51
52 @ManyToOne()
53 @JoinColumn(name = "TERM_RSLVR_ID", referencedColumnName = "TERM_RSLVR_ID")
54 private TermResolverBo termResolver;
55
56
57
58
59
60
61
62 public static String to(TermResolverParameterSpecificationBo bo) {
63 if (bo == null) {
64 return null;
65 }
66
67 return bo.name;
68 }
69
70
71
72
73
74
75
76
77 public static TermResolverParameterSpecificationBo from(TermResolverDefinition resolver, String name) {
78 if (resolver == null) {
79 return null;
80 }
81
82 if (StringUtils.isBlank(name)) {
83 return null;
84 }
85
86 TermResolverParameterSpecificationBo bo = new TermResolverParameterSpecificationBo();
87
88
89
90 bo.name = name;
91
92 return bo;
93 }
94
95 public String getId() {
96 return id;
97 }
98
99 public void setId(String id) {
100 this.id = id;
101 }
102
103 public String getTermResolverId() {
104 if (termResolver != null) {
105 return termResolver.getId();
106 }
107
108 return null;
109 }
110
111 public String getName() {
112 return name;
113 }
114
115 public void setName(String name) {
116 this.name = name;
117 }
118
119 public Long getVersionNumber() {
120 return versionNumber;
121 }
122
123 public void setVersionNumber(Long versionNumber) {
124 this.versionNumber = versionNumber;
125 }
126
127 public TermResolverBo getTermResolver() {
128 return termResolver;
129 }
130
131 public void setTermResolver(TermResolverBo termResolver) {
132 this.termResolver = termResolver;
133 }
134 }