1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.impl.identity.affiliation |
17 | |
|
18 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase |
19 | |
import org.kuali.rice.kim.api.identity.affiliation.EntityAffiliationContract |
20 | |
import javax.persistence.Id |
21 | |
import javax.persistence.Column |
22 | |
import javax.persistence.ManyToOne |
23 | |
import javax.persistence.JoinColumn |
24 | |
import javax.persistence.FetchType |
25 | |
import org.hibernate.annotations.Type |
26 | |
import org.kuali.rice.kim.api.identity.affiliation.EntityAffiliation |
27 | |
|
28 | |
|
29 | |
public class EntityAffiliationBo extends PersistableBusinessObjectBase implements EntityAffiliationContract { |
30 | |
private static final long serialVersionUID = 1L; |
31 | |
|
32 | |
@Id |
33 | |
@Column(name = "ENTITY_AFLTN_ID") |
34 | |
String id; |
35 | |
|
36 | |
@Column(name = "ENTITY_ID") |
37 | |
String entityId; |
38 | |
|
39 | |
@Column(name = "AFLTN_TYP_CD") |
40 | |
String affiliationTypeCode; |
41 | |
|
42 | |
@Column(name = "CAMPUS_CD") |
43 | |
String campusCode; |
44 | |
|
45 | |
@ManyToOne(targetEntity=EntityAffiliationTypeBo.class, fetch=FetchType.EAGER, cascade = []) |
46 | |
@JoinColumn(name = "AFLTN_TYP_CD", insertable = false, updatable = false) |
47 | |
EntityAffiliationTypeBo affiliationType; |
48 | |
|
49 | |
@Type(type="yes_no") |
50 | |
@Column(name="DFLT_IND") |
51 | |
boolean defaultValue; |
52 | |
|
53 | |
@Type(type="yes_no") |
54 | |
@Column(name="ACTV_IND") |
55 | |
boolean active; |
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
static EntityAffiliation to(EntityAffiliationBo bo) { |
63 | 0 | if (bo == null) { return null } |
64 | 1 | return EntityAffiliation.Builder.create(bo).build() |
65 | |
} |
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
static EntityAffiliationBo from(EntityAffiliation immutable) { |
73 | 0 | if (immutable == null) {return null} |
74 | |
|
75 | 1 | EntityAffiliationBo bo = new EntityAffiliationBo() |
76 | 1 | bo.active = immutable.active |
77 | 1 | if (immutable.affiliationType != null) { |
78 | 0 | bo.affiliationTypeCode = immutable.affiliationType.code |
79 | 0 | bo.affiliationType = EntityAffiliationTypeBo.from(immutable.affiliationType) |
80 | |
} |
81 | |
|
82 | 1 | bo.id = immutable.id |
83 | 1 | bo.campusCode = immutable.campusCode |
84 | 1 | bo.entityId = immutable.entityId |
85 | 1 | bo.active = immutable.active |
86 | 1 | bo.defaultValue = immutable.defaultValue |
87 | 1 | bo.versionNumber = immutable.versionNumber |
88 | |
|
89 | 1 | return bo; |
90 | |
} |
91 | |
|
92 | |
|
93 | |
@Override |
94 | |
EntityAffiliationTypeBo getAffiliationType() { |
95 | 1 | return this.affiliationType |
96 | |
} |
97 | |
|
98 | |
} |