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