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