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.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
25 import org.kuali.rice.kim.api.identity.principal.Principal;
26 import org.kuali.rice.kim.api.identity.principal.PrincipalContract;
27 import org.kuali.rice.krad.bo.DataObjectBase;
28 import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
29 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
30
31
32
33
34 @Entity
35 @Table(name = "KRIM_PRNCPL_T")
36 public class PrincipalBo extends DataObjectBase implements PrincipalContract {
37 private static final long serialVersionUID = 1L;
38
39 @PortableSequenceGenerator(name = "KRIM_PRNCPL_ID_S")
40 @GeneratedValue(generator = "KRIM_PRNCPL_ID_S")
41 @Id
42 @Column(name = "PRNCPL_ID")
43 private String principalId;
44
45 @Column(name = "PRNCPL_NM")
46 private String principalName;
47
48 @Column(name = "ENTITY_ID")
49 private String entityId;
50
51 @Column(name = "PRNCPL_PSWD")
52 private String password;
53
54 @Column(name = "ACTV_IND")
55 @Convert(converter = BooleanYNConverter.class)
56 private boolean active;
57
58 public static Principal to(PrincipalBo bo) {
59 if (bo == null) {
60 return null;
61 }
62 return Principal.Builder.create(bo).build();
63 }
64
65
66
67
68
69
70
71 public static PrincipalBo from(Principal immutable) {
72 if (immutable == null) {
73 return null;
74 }
75 PrincipalBo bo = new PrincipalBo();
76 bo.active = immutable.isActive();
77 bo.principalId = immutable.getPrincipalId();
78 bo.entityId = immutable.getEntityId();
79 bo.principalName = immutable.getPrincipalName();
80 bo.active = immutable.isActive();
81 bo.setVersionNumber(immutable.getVersionNumber());
82 bo.setObjectId(immutable.getObjectId());
83 return bo;
84 }
85
86 @Override
87 public String getPrincipalId() {
88 return principalId;
89 }
90
91 public void setPrincipalId(String principalId) {
92 this.principalId = principalId;
93 }
94
95 @Override
96 public String getPrincipalName() {
97 return principalName;
98 }
99
100 public void setPrincipalName(String principalName) {
101 this.principalName = principalName;
102 }
103
104 @Override
105 public String getEntityId() {
106 return entityId;
107 }
108
109 public void setEntityId(String entityId) {
110 this.entityId = entityId;
111 }
112
113 public String getPassword() {
114 return password;
115 }
116
117 public void setPassword(String password) {
118 this.password = password;
119 }
120
121 public boolean getActive() {
122 return active;
123 }
124
125 @Override
126 public boolean isActive() {
127 return active;
128 }
129
130 public void setActive(boolean active) {
131 this.active = active;
132 }
133 }