| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kim.bo.entity.impl; |
| 17 | |
|
| 18 | |
import org.hibernate.annotations.Fetch; |
| 19 | |
import org.hibernate.annotations.FetchMode; |
| 20 | |
import org.kuali.rice.kim.bo.entity.KimEntity; |
| 21 | |
import org.kuali.rice.kns.util.ObjectUtils; |
| 22 | |
import org.springframework.util.AutoPopulatingList; |
| 23 | |
|
| 24 | |
import javax.persistence.*; |
| 25 | |
import java.util.ArrayList; |
| 26 | |
import java.util.List; |
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | 0 | @SuppressWarnings("unchecked") |
| 36 | |
@Entity |
| 37 | |
@Table(name = "KRIM_ENTITY_T") |
| 38 | 0 | public class KimEntityImpl extends KimInactivatableEntityDataBase implements KimEntity { |
| 39 | |
|
| 40 | |
private static final long serialVersionUID = 1L; |
| 41 | |
|
| 42 | |
@Id |
| 43 | |
@Column(name = "ENTITY_ID") |
| 44 | |
protected String entityId; |
| 45 | |
|
| 46 | 0 | @OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }) |
| 47 | |
@Fetch(value = FetchMode.SELECT) |
| 48 | |
@JoinColumn(name = "ENTITY_ID", insertable = false, updatable = false) |
| 49 | |
protected List<KimEntityNameImpl> names = new AutoPopulatingList(KimEntityNameImpl.class); |
| 50 | |
|
| 51 | 0 | @OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }) |
| 52 | |
@Fetch(value = FetchMode.SELECT) |
| 53 | |
@JoinColumn(name = "ENTITY_ID", insertable = false, updatable = false) |
| 54 | |
protected List<KimPrincipalImpl> principals = new AutoPopulatingList(KimPrincipalImpl.class); |
| 55 | |
|
| 56 | 0 | @OneToMany(fetch=FetchType.EAGER,cascade={CascadeType.ALL}) |
| 57 | |
@Fetch(value = FetchMode.SELECT) |
| 58 | |
@JoinColumn(name="ENTITY_ID", insertable = false, updatable = false) |
| 59 | |
protected List<KimEntityExternalIdentifierImpl> externalIdentifiers = new AutoPopulatingList(KimEntityExternalIdentifierImpl.class); |
| 60 | |
|
| 61 | |
@Fetch(value = FetchMode.SELECT) |
| 62 | |
@OneToMany(fetch=FetchType.EAGER,cascade={CascadeType.ALL}) |
| 63 | |
@JoinColumn(name="ENTITY_ID", insertable = false, updatable = false) |
| 64 | |
protected List<KimEntityAffiliationImpl> affiliations; |
| 65 | |
|
| 66 | 0 | @OneToMany(fetch=FetchType.EAGER, cascade={CascadeType.ALL}) |
| 67 | |
@Fetch(value = FetchMode.SELECT) |
| 68 | |
@JoinColumn(name="ENTITY_ID", insertable = false, updatable = false) |
| 69 | |
protected List<KimEntityEmploymentInformationImpl> employmentInformation = new AutoPopulatingList(KimEntityEmploymentInformationImpl.class); |
| 70 | |
|
| 71 | 0 | @OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }) |
| 72 | |
@Fetch(value = FetchMode.SELECT) |
| 73 | |
@JoinColumn(name = "ENTITY_ID", insertable = false, updatable = false) |
| 74 | |
protected List<KimEntityEntityTypeImpl> entityTypes = new AutoPopulatingList(KimEntityEntityTypeImpl.class); |
| 75 | |
|
| 76 | |
@OneToOne(targetEntity=KimEntityPrivacyPreferencesImpl.class, fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.REFRESH}) |
| 77 | |
@JoinColumn(name = "ENTITY_ID", insertable = false, updatable = false) |
| 78 | |
protected KimEntityPrivacyPreferencesImpl privacyPreferences; |
| 79 | |
|
| 80 | |
@OneToOne(targetEntity=KimEntityBioDemographicsImpl.class, fetch = FetchType.EAGER, cascade = { }) |
| 81 | |
@JoinColumn(name = "ENTITY_ID", insertable = false, updatable = false) |
| 82 | |
protected KimEntityBioDemographicsImpl bioDemographics; |
| 83 | |
|
| 84 | 0 | @OneToMany(targetEntity = KimEntityCitizenshipImpl.class, fetch = FetchType.EAGER, cascade = { CascadeType.ALL }) |
| 85 | |
@Fetch(value = FetchMode.SELECT) |
| 86 | |
@JoinColumn(name = "ENTITY_ID", insertable = false, updatable = false) |
| 87 | |
protected List<KimEntityCitizenshipImpl> citizenships = new AutoPopulatingList(KimEntityCitizenshipImpl.class); |
| 88 | |
|
| 89 | 0 | @OneToMany(targetEntity = KimEntityEthnicityImpl.class, fetch = FetchType.EAGER, cascade = { CascadeType.ALL }) |
| 90 | |
@Fetch(value = FetchMode.SELECT) |
| 91 | |
@JoinColumn(name = "ENTITY_ID", insertable = false, updatable = false) |
| 92 | |
protected List<KimEntityEthnicityImpl> ethnicities = new AutoPopulatingList(KimEntityEthnicityImpl.class); |
| 93 | |
|
| 94 | 0 | @OneToMany(targetEntity = KimEntityResidencyImpl.class, fetch = FetchType.EAGER, cascade = { CascadeType.ALL }) |
| 95 | |
@Fetch(value = FetchMode.SELECT) |
| 96 | |
@JoinColumn(name = "ENTITY_ID", insertable = false, updatable = false) |
| 97 | |
protected List<KimEntityResidencyImpl> residencies = new AutoPopulatingList(KimEntityResidencyImpl.class); |
| 98 | |
|
| 99 | 0 | @OneToMany(targetEntity = KimEntityVisaImpl.class, fetch = FetchType.EAGER, cascade = { CascadeType.ALL }) |
| 100 | |
@Fetch(value = FetchMode.SELECT) |
| 101 | |
@JoinColumn(name = "ENTITY_ID", insertable = false, updatable = false) |
| 102 | |
protected List<KimEntityVisaImpl> visas = new AutoPopulatingList(KimEntityVisaImpl.class); |
| 103 | |
|
| 104 | |
|
| 105 | |
|
| 106 | |
|
| 107 | |
public String getEntityId() { |
| 108 | 0 | return this.entityId; |
| 109 | |
} |
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
public void setEntityId(String entityId) { |
| 116 | 0 | this.entityId = entityId; |
| 117 | 0 | } |
| 118 | |
|
| 119 | |
|
| 120 | |
|
| 121 | |
|
| 122 | |
public List<KimEntityEntityTypeImpl> getEntityTypes() { |
| 123 | 0 | return this.entityTypes; |
| 124 | |
} |
| 125 | |
|
| 126 | |
|
| 127 | |
|
| 128 | |
|
| 129 | |
|
| 130 | |
public void setEntityTypes(List<KimEntityEntityTypeImpl> entityTypes) { |
| 131 | 0 | this.entityTypes = entityTypes; |
| 132 | 0 | } |
| 133 | |
|
| 134 | |
|
| 135 | |
|
| 136 | |
|
| 137 | |
public List<KimEntityExternalIdentifierImpl> getExternalIdentifiers() { |
| 138 | 0 | return this.externalIdentifiers; |
| 139 | |
} |
| 140 | |
|
| 141 | |
|
| 142 | |
|
| 143 | |
|
| 144 | |
|
| 145 | |
public void setExternalIdentifiers(List<KimEntityExternalIdentifierImpl> externalIdentifiers) { |
| 146 | 0 | this.externalIdentifiers = externalIdentifiers; |
| 147 | 0 | } |
| 148 | |
|
| 149 | |
|
| 150 | |
|
| 151 | |
|
| 152 | |
public KimEntityPrivacyPreferencesImpl getPrivacyPreferences() { |
| 153 | 0 | if (ObjectUtils.isNull(this.privacyPreferences)) { |
| 154 | 0 | return null; |
| 155 | |
} |
| 156 | 0 | return this.privacyPreferences; |
| 157 | |
} |
| 158 | |
|
| 159 | |
|
| 160 | |
|
| 161 | |
|
| 162 | |
|
| 163 | |
public void setPrivacyPreferences(KimEntityPrivacyPreferencesImpl privacyPreferences) { |
| 164 | 0 | this.privacyPreferences = privacyPreferences; |
| 165 | 0 | } |
| 166 | |
|
| 167 | |
|
| 168 | |
|
| 169 | |
|
| 170 | |
public KimEntityBioDemographicsImpl getBioDemographics() { |
| 171 | 0 | if (ObjectUtils.isNull(this.bioDemographics)) { |
| 172 | 0 | return null; |
| 173 | |
} |
| 174 | 0 | return this.bioDemographics; |
| 175 | |
} |
| 176 | |
|
| 177 | |
|
| 178 | |
|
| 179 | |
|
| 180 | |
|
| 181 | |
public void setBioDemographics(KimEntityBioDemographicsImpl bioDemographics) { |
| 182 | 0 | this.bioDemographics = bioDemographics; |
| 183 | 0 | } |
| 184 | |
|
| 185 | |
|
| 186 | |
|
| 187 | |
|
| 188 | |
public List<KimEntityAffiliationImpl> getAffiliations() { |
| 189 | 0 | if (this.affiliations == null) { |
| 190 | 0 | return new ArrayList<KimEntityAffiliationImpl>(); |
| 191 | |
} |
| 192 | 0 | return this.affiliations; |
| 193 | |
} |
| 194 | |
|
| 195 | |
|
| 196 | |
|
| 197 | |
|
| 198 | |
|
| 199 | |
public void setAffiliations(List<KimEntityAffiliationImpl> affiliations) { |
| 200 | 0 | this.affiliations = affiliations; |
| 201 | 0 | } |
| 202 | |
|
| 203 | |
|
| 204 | |
|
| 205 | |
|
| 206 | |
public List<KimEntityEmploymentInformationImpl> getEmploymentInformation() { |
| 207 | 0 | return this.employmentInformation; |
| 208 | |
} |
| 209 | |
|
| 210 | |
|
| 211 | |
|
| 212 | |
|
| 213 | |
|
| 214 | |
public void setEmploymentInformation(List<KimEntityEmploymentInformationImpl> employmentInformation) { |
| 215 | 0 | this.employmentInformation = employmentInformation; |
| 216 | 0 | } |
| 217 | |
|
| 218 | |
|
| 219 | |
|
| 220 | |
|
| 221 | |
public List<KimPrincipalImpl> getPrincipals() { |
| 222 | 0 | return principals; |
| 223 | |
} |
| 224 | |
|
| 225 | |
|
| 226 | |
|
| 227 | |
|
| 228 | |
|
| 229 | |
public KimEntityEntityTypeImpl getEntityType(String entityTypeCode) { |
| 230 | 0 | for ( KimEntityEntityTypeImpl entType : entityTypes ) { |
| 231 | 0 | if ( entType.getEntityTypeCode().equals( entityTypeCode ) ) { |
| 232 | 0 | return entType; |
| 233 | |
} |
| 234 | |
} |
| 235 | 0 | return null; |
| 236 | |
} |
| 237 | |
|
| 238 | |
|
| 239 | |
|
| 240 | |
|
| 241 | |
|
| 242 | |
|
| 243 | |
public KimEntityAffiliationImpl getDefaultAffiliation() { |
| 244 | 0 | return (KimEntityAffiliationImpl)getDefaultItem( affiliations ); |
| 245 | |
} |
| 246 | |
|
| 247 | |
|
| 248 | |
|
| 249 | |
|
| 250 | |
|
| 251 | |
|
| 252 | |
public KimEntityExternalIdentifierImpl getEntityExternalIdentifier(String externalIdentifierTypeCode) { |
| 253 | 0 | for ( KimEntityExternalIdentifierImpl id : externalIdentifiers ) { |
| 254 | 0 | if ( id.getExternalIdentifierTypeCode().equals( externalIdentifierTypeCode ) ) { |
| 255 | 0 | return id; |
| 256 | |
} |
| 257 | |
} |
| 258 | 0 | return null; |
| 259 | |
} |
| 260 | |
|
| 261 | |
|
| 262 | |
|
| 263 | |
|
| 264 | |
|
| 265 | |
|
| 266 | |
public KimEntityEmploymentInformationImpl getPrimaryEmployment() { |
| 267 | 0 | for ( KimEntityEmploymentInformationImpl emp : employmentInformation ) { |
| 268 | 0 | if ( emp.isActive() && emp.isPrimary() ) { |
| 269 | 0 | return emp; |
| 270 | |
} |
| 271 | |
} |
| 272 | 0 | return null; |
| 273 | |
} |
| 274 | |
|
| 275 | |
public List<KimEntityNameImpl> getNames() { |
| 276 | 0 | return this.names; |
| 277 | |
} |
| 278 | |
|
| 279 | |
public void setNames(List<KimEntityNameImpl> names) { |
| 280 | 0 | this.names = names; |
| 281 | 0 | } |
| 282 | |
|
| 283 | |
|
| 284 | |
|
| 285 | |
|
| 286 | |
|
| 287 | |
|
| 288 | |
public KimEntityNameImpl getDefaultName() { |
| 289 | 0 | return (KimEntityNameImpl)getDefaultItem( names ); |
| 290 | |
} |
| 291 | |
|
| 292 | |
|
| 293 | |
|
| 294 | |
|
| 295 | |
public List<KimEntityCitizenshipImpl> getCitizenships() { |
| 296 | 0 | return this.citizenships; |
| 297 | |
} |
| 298 | |
|
| 299 | |
|
| 300 | |
|
| 301 | |
|
| 302 | |
public void setCitizenships(List<KimEntityCitizenshipImpl> citizenships) { |
| 303 | 0 | this.citizenships = citizenships; |
| 304 | 0 | } |
| 305 | |
|
| 306 | |
|
| 307 | |
|
| 308 | |
|
| 309 | |
public List<KimEntityEthnicityImpl> getEthnicities() { |
| 310 | 0 | return this.ethnicities; |
| 311 | |
} |
| 312 | |
|
| 313 | |
|
| 314 | |
|
| 315 | |
|
| 316 | |
public void setEthnicities(List<KimEntityEthnicityImpl> ethnicities) { |
| 317 | 0 | this.ethnicities = ethnicities; |
| 318 | 0 | } |
| 319 | |
|
| 320 | |
|
| 321 | |
|
| 322 | |
|
| 323 | |
public List<KimEntityResidencyImpl> getResidencies() { |
| 324 | 0 | return this.residencies; |
| 325 | |
} |
| 326 | |
|
| 327 | |
|
| 328 | |
|
| 329 | |
|
| 330 | |
public void setResidencies(List<KimEntityResidencyImpl> residencies) { |
| 331 | 0 | this.residencies = residencies; |
| 332 | 0 | } |
| 333 | |
|
| 334 | |
|
| 335 | |
|
| 336 | |
|
| 337 | |
public List<KimEntityVisaImpl> getVisas() { |
| 338 | 0 | return this.visas; |
| 339 | |
} |
| 340 | |
|
| 341 | |
|
| 342 | |
|
| 343 | |
|
| 344 | |
public void setVisas(List<KimEntityVisaImpl> visas) { |
| 345 | 0 | this.visas = visas; |
| 346 | 0 | } |
| 347 | |
|
| 348 | |
public void setPrincipals(List<KimPrincipalImpl> principals) { |
| 349 | 0 | this.principals = principals; |
| 350 | 0 | } |
| 351 | |
} |