1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.impl.common.delegate |
17 | |
|
18 | |
import javax.persistence.CascadeType |
19 | |
import javax.persistence.Column |
20 | |
import javax.persistence.Entity |
21 | |
import javax.persistence.FetchType |
22 | |
import javax.persistence.Id |
23 | |
import javax.persistence.JoinColumn |
24 | |
import javax.persistence.OneToMany |
25 | |
import javax.persistence.Table |
26 | |
import org.hibernate.annotations.Fetch |
27 | |
import org.hibernate.annotations.FetchMode |
28 | |
import org.hibernate.annotations.Type |
29 | |
import org.kuali.rice.kim.api.common.delegate.DelegateType |
30 | |
import org.kuali.rice.kim.api.common.delegate.DelegateTypeContract |
31 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase |
32 | |
import org.springframework.util.AutoPopulatingList |
33 | |
import org.kuali.rice.core.api.delegation.DelegationType |
34 | |
|
35 | |
@Entity |
36 | |
@Table(name = "KRIM_DLGN_T") |
37 | |
public class DelegateTypeBo extends PersistableBusinessObjectBase implements DelegateTypeContract { |
38 | |
private static final long serialVersionUID = 1L; |
39 | |
|
40 | |
@Id |
41 | |
@Column(name = "DLGN_ID") |
42 | |
String delegationId; |
43 | |
|
44 | |
@Column(name = "ROLE_ID") |
45 | |
String roleId; |
46 | |
|
47 | |
@Type(type = "yes_no") |
48 | |
@Column(name = "ACTV_IND") |
49 | |
boolean active = true; |
50 | |
|
51 | |
@Column(name = "KIM_TYP_ID") |
52 | |
String kimTypeId; |
53 | |
|
54 | |
@Column(name = "DLGN_TYP_CD") |
55 | |
String delegationTypeCode; |
56 | |
|
57 | |
@OneToMany(targetEntity = DelegateMemberBo.class, cascade = [CascadeType.ALL], fetch = FetchType.EAGER) |
58 | |
@Fetch(value = FetchMode.SELECT) |
59 | |
@JoinColumn(name = "DLGN_ID", insertable = false, updatable = false) |
60 | 0 | List<DelegateMemberBo> members = new AutoPopulatingList(DelegateMemberBo.class); |
61 | |
|
62 | |
public void setDelegationType(DelegationType type) { |
63 | 0 | this.delegationTypeCode = type.getCode(); |
64 | |
} |
65 | |
|
66 | |
public DelegationType getDelegationType() { |
67 | 0 | return DelegationType.fromCode(this.delegationTypeCode); |
68 | |
} |
69 | |
|
70 | |
public static DelegateType to(DelegateTypeBo bo) { |
71 | 0 | return DelegateType.Builder.create(bo).build() |
72 | |
} |
73 | |
|
74 | |
public static DelegateTypeBo from(DelegateType immutable) { |
75 | 0 | return new DelegateTypeBo( |
76 | |
delegationId: immutable.delegationId, |
77 | |
roleId: immutable.roleId, |
78 | |
active: immutable.active, |
79 | |
kimTypeId: immutable.kimTypeId, |
80 | |
delegationTypeCode: immutable.delegationTypeCode, |
81 | |
); |
82 | |
} |
83 | |
} |