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