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