1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.impl.identity.principal |
17 | |
|
18 | |
import javax.persistence.Entity |
19 | |
import javax.persistence.Table |
20 | |
import javax.persistence.Id |
21 | |
import javax.persistence.Column |
22 | |
import org.hibernate.annotations.Type |
23 | |
import org.kuali.rice.kim.api.identity.principal.PrincipalContract |
24 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase |
25 | |
import org.kuali.rice.kim.api.identity.principal.Principal |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
@Entity |
31 | |
@Table(name="KRIM_PRNCPL_T") |
32 | |
class PrincipalBo extends PersistableBusinessObjectBase implements PrincipalContract { |
33 | |
private static final long serialVersionUID = 4480581610252159267L; |
34 | |
|
35 | |
@Id |
36 | |
@Column(name="PRNCPL_ID", columnDefinition="VARCHAR(40)") |
37 | |
String principalId; |
38 | |
|
39 | |
@Column(name="PRNCPL_NM") |
40 | |
String principalName; |
41 | |
|
42 | |
@Column(name="ENTITY_ID") |
43 | |
String entityId; |
44 | |
|
45 | |
@Column(name="PRNCPL_PSWD") |
46 | |
String password; |
47 | |
|
48 | |
@Column(name="ACTV_IND") |
49 | |
@Type(type="yes_no") |
50 | |
boolean active; |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
static Principal to(PrincipalBo bo) { |
58 | 0 | if (bo == null) { return null } |
59 | 0 | return Principal.Builder.create(bo).build() |
60 | |
} |
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
static PrincipalBo from(Principal immutable) { |
68 | 0 | if (immutable == null) {return null} |
69 | |
|
70 | 0 | PrincipalBo bo = new PrincipalBo() |
71 | 0 | bo.active = immutable.active |
72 | 0 | bo.principalId = immutable.principalId |
73 | 0 | bo.entityId = immutable.entityId |
74 | 0 | bo.principalName = immutable.principalName |
75 | 0 | bo.password = immutable.password |
76 | 0 | bo.active = immutable.active |
77 | 0 | bo.versionNumber = immutable.versionNumber |
78 | 0 | bo.objectId = immutable.objectId |
79 | |
|
80 | 0 | return bo; |
81 | |
} |
82 | |
} |