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 org.hibernate.annotations.Fetch; |
19 | |
import org.hibernate.annotations.FetchMode; |
20 | |
import org.hibernate.annotations.GenericGenerator; |
21 | |
import org.hibernate.annotations.Parameter; |
22 | |
import org.kuali.rice.kim.impl.identity.affiliation.EntityAffiliationTypeBo; |
23 | |
import org.kuali.rice.krad.util.ObjectUtils; |
24 | |
|
25 | |
import javax.persistence.CascadeType; |
26 | |
import javax.persistence.Column; |
27 | |
import javax.persistence.Entity; |
28 | |
import javax.persistence.FetchType; |
29 | |
import javax.persistence.GeneratedValue; |
30 | |
import javax.persistence.Id; |
31 | |
import javax.persistence.IdClass; |
32 | |
import javax.persistence.JoinColumn; |
33 | |
import javax.persistence.JoinColumns; |
34 | |
import javax.persistence.ManyToOne; |
35 | |
import javax.persistence.OneToMany; |
36 | |
import javax.persistence.Table; |
37 | |
import javax.persistence.Transient; |
38 | |
import java.util.ArrayList; |
39 | |
import java.util.List; |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
@IdClass(PersonDocumentAffiliationId.class) |
48 | |
@Entity |
49 | |
@Table(name = "KRIM_PND_AFLTN_MT") |
50 | |
public class PersonDocumentAffiliation extends PersonDocumentBoDefaultBase { |
51 | |
private static final long serialVersionUID = 1L; |
52 | |
|
53 | |
@Id |
54 | |
@GeneratedValue(generator="KRIM_ENTITY_AFLTN_ID_S") |
55 | |
@GenericGenerator(name="KRIM_ENTITY_AFLTN_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={ |
56 | |
@Parameter(name="sequence_name",value="KRIM_ENTITY_AFLTN_ID_S"), |
57 | |
@Parameter(name="value_column",value="id") |
58 | |
}) |
59 | |
@Column(name = "ENTITY_AFLTN_ID") |
60 | |
protected String entityAffiliationId; |
61 | |
|
62 | |
@Column(name = "AFLTN_TYP_CD") |
63 | |
protected String affiliationTypeCode; |
64 | |
|
65 | |
@Column(name = "CAMPUS_CD") |
66 | |
protected String campusCode; |
67 | |
|
68 | |
@ManyToOne(targetEntity=EntityAffiliationTypeBo.class, fetch = FetchType.EAGER, cascade = {}) |
69 | |
@JoinColumn(name = "AFLTN_TYP_CD", insertable = false, updatable = false) |
70 | |
protected EntityAffiliationTypeBo affiliationType; |
71 | |
@Transient |
72 | |
protected PersonDocumentEmploymentInfo newEmpInfo; |
73 | |
|
74 | |
@OneToMany(cascade={CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.EAGER) |
75 | |
|
76 | |
@Fetch(value = FetchMode.SELECT) |
77 | |
@JoinColumns({ |
78 | |
@JoinColumn(name="FDOC_NBR",insertable=false,updatable=false), |
79 | |
@JoinColumn(name="ENTITY_AFLTN_ID", insertable=false, updatable=false) |
80 | |
}) |
81 | |
protected List<PersonDocumentEmploymentInfo> empInfos; |
82 | |
|
83 | 0 | public PersonDocumentAffiliation() { |
84 | 0 | empInfos = new ArrayList<PersonDocumentEmploymentInfo>(); |
85 | 0 | setNewEmpInfo(new PersonDocumentEmploymentInfo()); |
86 | 0 | this.active = true; |
87 | 0 | } |
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
public String getAffiliationTypeCode() { |
93 | 0 | if(ObjectUtils.isNull(affiliationTypeCode)) |
94 | 0 | return ""; |
95 | 0 | return affiliationTypeCode; |
96 | |
} |
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
public String getCampusCode() { |
102 | 0 | return campusCode; |
103 | |
} |
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
public String getEntityAffiliationId() { |
109 | 0 | if(ObjectUtils.isNull(entityAffiliationId)) |
110 | 0 | return ""; |
111 | 0 | return entityAffiliationId; |
112 | |
} |
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
public void setAffiliationTypeCode(String affiliationTypeCode) { |
118 | 0 | this.affiliationTypeCode = affiliationTypeCode; |
119 | 0 | } |
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | |
public void setCampusCode(String campusCode) { |
125 | 0 | this.campusCode = campusCode; |
126 | 0 | } |
127 | |
|
128 | |
public void setEntityAffiliationId(String entityAffiliationId) { |
129 | 0 | this.entityAffiliationId = entityAffiliationId; |
130 | 0 | } |
131 | |
|
132 | |
public PersonDocumentEmploymentInfo getNewEmpInfo() { |
133 | 0 | return this.newEmpInfo; |
134 | |
} |
135 | |
|
136 | |
public void setNewEmpInfo(PersonDocumentEmploymentInfo newEmpInfo) { |
137 | 0 | this.newEmpInfo = newEmpInfo; |
138 | 0 | } |
139 | |
|
140 | |
public List<PersonDocumentEmploymentInfo> getEmpInfos() { |
141 | 0 | return this.empInfos; |
142 | |
} |
143 | |
|
144 | |
public void setEmpInfos(List<PersonDocumentEmploymentInfo> empInfos) { |
145 | 0 | this.empInfos = empInfos; |
146 | 0 | } |
147 | |
|
148 | |
public EntityAffiliationTypeBo getAffiliationType() { |
149 | 0 | if(ObjectUtils.isNull(affiliationType)) |
150 | 0 | return null; |
151 | 0 | return this.affiliationType; |
152 | |
} |
153 | |
|
154 | |
public boolean isEmploymentAffiliationType() { |
155 | 0 | if(ObjectUtils.isNull(affiliationType)) |
156 | 0 | return false; |
157 | 0 | return this.affiliationType.isEmploymentAffiliationType(); |
158 | |
} |
159 | |
|
160 | |
public void setAffiliationType(EntityAffiliationTypeBo affiliationType) { |
161 | 0 | this.affiliationType = affiliationType; |
162 | 0 | } |
163 | |
|
164 | |
} |