1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.bo.ui;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import javax.persistence.CascadeType;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.Id;
26 import javax.persistence.JoinColumn;
27 import javax.persistence.JoinColumns;
28 import javax.persistence.ManyToOne;
29 import javax.persistence.OneToMany;
30 import javax.persistence.Table;
31 import javax.persistence.Transient;
32
33 import org.eclipse.persistence.annotations.JoinFetch;
34 import org.eclipse.persistence.annotations.JoinFetchType;
35 import org.kuali.rice.kim.impl.identity.affiliation.EntityAffiliationTypeBo;
36 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
37
38
39
40
41
42
43
44 @Entity
45 @Table(name = "KRIM_PND_AFLTN_MT")
46 public class PersonDocumentAffiliation extends PersonDocumentBoDefaultBase {
47
48 private static final long serialVersionUID = 1L;
49
50 @PortableSequenceGenerator(name = "KRIM_ENTITY_AFLTN_ID_S")
51 @GeneratedValue(generator = "KRIM_ENTITY_AFLTN_ID_S")
52 @Id
53 @Column(name = "ENTITY_AFLTN_ID")
54 protected String entityAffiliationId;
55
56 @Column(name = "AFLTN_TYP_CD")
57 protected String affiliationTypeCode;
58
59 @Column(name = "CAMPUS_CD")
60 protected String campusCode;
61
62 @JoinFetch(value= JoinFetchType.OUTER)
63 @ManyToOne(targetEntity = EntityAffiliationTypeBo.class, cascade = { CascadeType.REFRESH })
64 @JoinColumn(name = "AFLTN_TYP_CD", referencedColumnName = "AFLTN_TYP_CD", insertable = false, updatable = false)
65 protected EntityAffiliationTypeBo affiliationType;
66
67 @Transient
68 protected PersonDocumentEmploymentInfo newEmpInfo;
69
70 @JoinFetch(value= JoinFetchType.OUTER)
71 @OneToMany(targetEntity = PersonDocumentEmploymentInfo.class, cascade = { CascadeType.REFRESH, CascadeType.PERSIST })
72 @JoinColumns({
73 @JoinColumn(name = "FDOC_NBR", referencedColumnName = "FDOC_NBR", insertable = false, updatable = false),
74 @JoinColumn(name = "ENTITY_AFLTN_ID", referencedColumnName = "ENTITY_AFLTN_ID", insertable = false, updatable = false) })
75 protected List<PersonDocumentEmploymentInfo> empInfos;
76
77 public PersonDocumentAffiliation() {
78 empInfos = new ArrayList<PersonDocumentEmploymentInfo>();
79 setNewEmpInfo(new PersonDocumentEmploymentInfo());
80 }
81
82
83
84
85 public String getAffiliationTypeCode() {
86 if (affiliationTypeCode == null) {
87 return "";
88 }
89 return affiliationTypeCode;
90 }
91
92
93
94
95 public String getCampusCode() {
96 return campusCode;
97 }
98
99
100
101
102 public String getEntityAffiliationId() {
103 if (entityAffiliationId == null) {
104 return "";
105 }
106 return entityAffiliationId;
107 }
108
109
110
111
112 public void setAffiliationTypeCode(String affiliationTypeCode) {
113 this.affiliationTypeCode = affiliationTypeCode;
114 }
115
116
117
118
119 public void setCampusCode(String campusCode) {
120 this.campusCode = campusCode;
121 }
122
123 public void setEntityAffiliationId(String entityAffiliationId) {
124 this.entityAffiliationId = entityAffiliationId;
125 }
126
127 public PersonDocumentEmploymentInfo getNewEmpInfo() {
128 return this.newEmpInfo;
129 }
130
131 public void setNewEmpInfo(PersonDocumentEmploymentInfo newEmpInfo) {
132 this.newEmpInfo = newEmpInfo;
133 }
134
135 public List<PersonDocumentEmploymentInfo> getEmpInfos() {
136 return this.empInfos;
137 }
138
139 public void setEmpInfos(List<PersonDocumentEmploymentInfo> empInfos) {
140 this.empInfos = empInfos;
141 }
142
143 public EntityAffiliationTypeBo getAffiliationType() {
144 return this.affiliationType;
145 }
146
147 public boolean isEmploymentAffiliationType() {
148 if (affiliationType == null) {
149 return false;
150 }
151 return this.affiliationType.isEmploymentAffiliationType();
152 }
153
154 public void setAffiliationType(EntityAffiliationTypeBo affiliationType) {
155 this.affiliationType = affiliationType;
156 }
157 }