1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.impl.role;
17
18 import javax.persistence.Column;
19 import javax.persistence.Convert;
20 import javax.persistence.Entity;
21 import javax.persistence.GeneratedValue;
22 import javax.persistence.Id;
23 import javax.persistence.Table;
24 import javax.persistence.Transient;
25
26 import org.kuali.rice.kim.api.role.Role;
27 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
28 import org.kuali.rice.kim.api.type.KimTypeInfoService;
29 import org.kuali.rice.kim.framework.role.RoleEbo;
30 import org.kuali.rice.kim.impl.type.KimTypeBo;
31 import org.kuali.rice.krad.bo.DataObjectBase;
32 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
33 import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
34 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
35
36
37
38
39
40
41
42
43 @Entity
44 @Table(name = "KRIM_ROLE_T")
45 public class RoleBoLite extends DataObjectBase implements RoleEbo {
46 private static final long serialVersionUID = 1L;
47
48 @PortableSequenceGenerator(name = "KRIM_ROLE_ID_S")
49 @GeneratedValue(generator = "KRIM_ROLE_ID_S")
50 @Id
51 @Column(name = "ROLE_ID")
52 private String id;
53
54 @Column(name = "ROLE_NM")
55 private String name;
56
57 @Column(name = "DESC_TXT")
58 private String description;
59
60 @Column(name = "ACTV_IND")
61 @Convert(converter = BooleanYNConverter.class)
62 private boolean active;
63
64 @Column(name = "KIM_TYP_ID")
65 private String kimTypeId;
66
67 @Column(name = "NMSPC_CD")
68 private String namespaceCode;
69
70 @Transient
71 private String principalName;
72
73 @Transient
74 private String groupNamespaceCode;
75
76 @Transient
77 private String groupName;
78
79 @Transient
80 private String permNamespaceCode;
81
82 @Transient
83 private String permName;
84
85 @Transient
86 private String permTmplNamespaceCode;
87
88 @Transient
89 private String permTmplName;
90
91 @Transient
92 private String respNamespaceCode;
93
94 @Transient
95 private String respName;
96
97 @Transient
98 private String respTmplNamespaceCode;
99
100 @Transient
101 private String respTmplName;
102
103 @Transient
104 private transient KimTypeInfoService kimTypeInfoService;
105
106 public KimTypeBo getKimRoleType() {
107 return KimTypeBo.from(getTypeInfoService().getKimType(kimTypeId));
108 }
109
110 protected KimTypeInfoService getTypeInfoService() {
111 if (kimTypeInfoService == null) {
112 kimTypeInfoService = KimApiServiceLocator.getKimTypeInfoService();
113 }
114 return kimTypeInfoService;
115 }
116
117 public static Role to(RoleBoLite bo) {
118 if (bo == null) {
119 return null;
120 }
121 return Role.Builder.create(bo).build();
122 }
123
124 public static RoleBo from(Role immutable) {
125 if (immutable == null) {
126 return null;
127 }
128 RoleBo bo = new RoleBo();
129 bo.setId(immutable.getId());
130 bo.setName(immutable.getName());
131 bo.setNamespaceCode(immutable.getNamespaceCode());
132 bo.setDescription(immutable.getDescription());
133 bo.setKimTypeId(immutable.getKimTypeId());
134 bo.setActive(immutable.isActive());
135 bo.setVersionNumber(immutable.getVersionNumber());
136 bo.setObjectId(immutable.getObjectId());
137 return bo;
138 }
139
140 public String getId() {
141 return id;
142 }
143
144 public void setId(String id) {
145 this.id = id;
146 }
147
148 public String getName() {
149 return name;
150 }
151
152 public void setName(String name) {
153 this.name = name;
154 }
155
156 public String getDescription() {
157 return description;
158 }
159
160 public void setDescription(String description) {
161 this.description = description;
162 }
163
164 public boolean getActive() {
165 return active;
166 }
167
168 public boolean isActive() {
169 return active;
170 }
171
172 public void setActive(boolean active) {
173 this.active = active;
174 }
175
176 public String getKimTypeId() {
177 return kimTypeId;
178 }
179
180 public void setKimTypeId(String kimTypeId) {
181 this.kimTypeId = kimTypeId;
182 }
183
184 public String getNamespaceCode() {
185 return namespaceCode;
186 }
187
188 public void setNamespaceCode(String namespaceCode) {
189 this.namespaceCode = namespaceCode;
190 }
191
192 public String getPrincipalName() {
193 return principalName;
194 }
195
196 public void setPrincipalName(String principalName) {
197 this.principalName = principalName;
198 }
199
200 public String getGroupNamespaceCode() {
201 return groupNamespaceCode;
202 }
203
204 public void setGroupNamespaceCode(String groupNamespaceCode) {
205 this.groupNamespaceCode = groupNamespaceCode;
206 }
207
208 public String getGroupName() {
209 return groupName;
210 }
211
212 public void setGroupName(String groupName) {
213 this.groupName = groupName;
214 }
215
216 public String getPermNamespaceCode() {
217 return permNamespaceCode;
218 }
219
220 public void setPermNamespaceCode(String permNamespaceCode) {
221 this.permNamespaceCode = permNamespaceCode;
222 }
223
224 public String getPermName() {
225 return permName;
226 }
227
228 public void setPermName(String permName) {
229 this.permName = permName;
230 }
231
232 public String getPermTmplNamespaceCode() {
233 return permTmplNamespaceCode;
234 }
235
236 public void setPermTmplNamespaceCode(String permTmplNamespaceCode) {
237 this.permTmplNamespaceCode = permTmplNamespaceCode;
238 }
239
240 public String getPermTmplName() {
241 return permTmplName;
242 }
243
244 public void setPermTmplName(String permTmplName) {
245 this.permTmplName = permTmplName;
246 }
247
248 public String getRespNamespaceCode() {
249 return respNamespaceCode;
250 }
251
252 public void setRespNamespaceCode(String respNamespaceCode) {
253 this.respNamespaceCode = respNamespaceCode;
254 }
255
256 public String getRespName() {
257 return respName;
258 }
259
260 public void setRespName(String respName) {
261 this.respName = respName;
262 }
263
264 public String getRespTmplNamespaceCode() {
265 return respTmplNamespaceCode;
266 }
267
268 public void setRespTmplNamespaceCode(String respTmplNamespaceCode) {
269 this.respTmplNamespaceCode = respTmplNamespaceCode;
270 }
271
272 public String getRespTmplName() {
273 return respTmplName;
274 }
275
276 public void setRespTmplName(String respTmplName) {
277 this.respTmplName = respTmplName;
278 }
279
280 @Override
281 public void refresh() {
282 }
283 }