1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.coreservice.impl.style;
17
18 import org.kuali.rice.coreservice.api.style.Style;
19 import org.kuali.rice.coreservice.api.style.StyleContract;
20 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
21 import org.kuali.rice.krad.data.jpa.converters.Boolean01BigDecimalConverter;
22 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
23
24 import javax.persistence.Column;
25 import javax.persistence.Convert;
26 import javax.persistence.Entity;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.Id;
29 import javax.persistence.NamedQuery;
30 import javax.persistence.Table;
31
32
33
34
35
36
37
38 @Entity
39 @Table(name="KRCR_STYLE_T")
40 @NamedQuery(name="StyleBo.findAllStyleNames",
41 query="SELECT sb.name FROM StyleBo sb where sb.active=true"
42 )
43 public class StyleBo extends PersistableBusinessObjectBase implements StyleContract {
44
45 private static final long serialVersionUID = 2020611019976731725L;
46
47 @Id
48 @Column(name="STYLE_ID")
49 @GeneratedValue(generator = "KREW_EDL_S")
50 @PortableSequenceGenerator(name = "KREW_EDL_S")
51 private String id;
52
53 @Column(name="NM")
54 private String name;
55
56 @Column(name="XML")
57 private String xmlContent;
58
59 @Column(name="ACTV_IND")
60 @Convert(converter=Boolean01BigDecimalConverter.class)
61 boolean active = true;
62
63 @Override
64 public String getId() {
65 return id;
66 }
67
68 public void setId(String id) {
69 this.id = id;
70 }
71
72 @Override
73 public String getName() {
74 return name;
75 }
76
77 public void setName(String name) {
78 this.name = name;
79 }
80
81 @Override
82 public String getXmlContent() {
83 return xmlContent;
84 }
85
86 public void setXmlContent(String xmlContent) {
87 this.xmlContent = xmlContent;
88 }
89
90 @Override
91 public boolean isActive() {
92 return active;
93 }
94
95 public void setActive(boolean active) {
96 this.active = active;
97 }
98
99
100
101
102
103
104
105 public static Style to(StyleBo styleBo) {
106 if (styleBo == null) {
107 return null;
108 }
109 return Style.Builder.create(styleBo).build();
110 }
111
112
113
114
115
116
117
118 public static StyleBo from(Style style) {
119 if (style == null) {
120 return null;
121 }
122 StyleBo styleBo = new StyleBo();
123 styleBo.setId(style.getId());
124 styleBo.setName(style.getName());
125 styleBo.setXmlContent(style.getXmlContent());
126 styleBo.setActive(style.isActive());
127 styleBo.setVersionNumber(style.getVersionNumber());
128 styleBo.setObjectId(style.getObjectId());
129 return styleBo;
130 }
131
132 }
133