| 1 | |
package org.kuali.student.enrollment.class1.lui.model; |
| 2 | |
|
| 3 | |
import java.util.ArrayList; |
| 4 | |
import java.util.List; |
| 5 | |
|
| 6 | |
import javax.persistence.CascadeType; |
| 7 | |
import javax.persistence.Column; |
| 8 | |
import javax.persistence.Entity; |
| 9 | |
import javax.persistence.OneToMany; |
| 10 | |
import javax.persistence.Table; |
| 11 | |
|
| 12 | |
import org.kuali.student.enrollment.courseoffering.dto.OfferingInstructorInfo; |
| 13 | |
import org.kuali.student.enrollment.courseoffering.infc.OfferingInstructor; |
| 14 | |
import org.kuali.student.r2.common.dto.AttributeInfo; |
| 15 | |
import org.kuali.student.r2.common.entity.AttributeOwner; |
| 16 | |
import org.kuali.student.r2.common.entity.MetaEntity; |
| 17 | |
import org.kuali.student.r2.common.infc.Attribute; |
| 18 | |
@Deprecated |
| 19 | |
@Entity |
| 20 | |
@Table(name = "KSEN_LUI_INSTR") |
| 21 | |
public class LuiInstructorEntity extends MetaEntity implements AttributeOwner<LuiAttributeEntity>{ |
| 22 | |
@Column(name = "ORG_ID") |
| 23 | |
private String orgId; |
| 24 | |
|
| 25 | |
@Column(name = "PERS_ID") |
| 26 | |
private String personId; |
| 27 | |
|
| 28 | |
@Column(name = "PERS_OVRID") |
| 29 | |
private String personInfoOverride; |
| 30 | |
|
| 31 | |
@Column(name = "PERCT_EFFT") |
| 32 | |
private Float percentageEffort; |
| 33 | |
|
| 34 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") |
| 35 | |
private List<LuiAttributeEntity> attributes; |
| 36 | |
|
| 37 | 0 | public LuiInstructorEntity(){} |
| 38 | |
|
| 39 | |
public LuiInstructorEntity(OfferingInstructor luiInstructor){ |
| 40 | 0 | super(luiInstructor); |
| 41 | |
try{ |
| 42 | 0 | this.setId(luiInstructor.getId()); |
| 43 | 0 | this.setPersonId(luiInstructor.getPersonId()); |
| 44 | 0 | this.setPercentageEffort(luiInstructor.getPercentageEffort()); |
| 45 | |
|
| 46 | 0 | this.setAttributes(new ArrayList<LuiAttributeEntity>()); |
| 47 | 0 | if (null != luiInstructor.getAttributes()) { |
| 48 | 0 | for (Attribute att : luiInstructor.getAttributes()) { |
| 49 | 0 | LuiAttributeEntity attEntity = new LuiAttributeEntity(att); |
| 50 | 0 | this.getAttributes().add(attEntity); |
| 51 | 0 | } |
| 52 | |
} |
| 53 | 0 | } catch (Exception e){ |
| 54 | 0 | e.printStackTrace(); |
| 55 | 0 | } |
| 56 | 0 | } |
| 57 | |
|
| 58 | |
public OfferingInstructorInfo toDto(){ |
| 59 | 0 | OfferingInstructorInfo obj = new OfferingInstructorInfo(); |
| 60 | 0 | obj.setId(getId()); |
| 61 | 0 | obj.setPersonId(personId); |
| 62 | 0 | obj.setPercentageEffort(percentageEffort); |
| 63 | 0 | obj.setMeta(super.toDTO()); |
| 64 | |
|
| 65 | 0 | List<AttributeInfo> atts = new ArrayList<AttributeInfo>(); |
| 66 | 0 | for (LuiAttributeEntity att : getAttributes()) { |
| 67 | 0 | AttributeInfo attInfo = att.toDto(); |
| 68 | 0 | atts.add(attInfo); |
| 69 | 0 | } |
| 70 | 0 | obj.setAttributes(atts); |
| 71 | |
|
| 72 | 0 | return obj; |
| 73 | |
} |
| 74 | |
|
| 75 | |
public String getOrgId() { |
| 76 | 0 | return orgId; |
| 77 | |
} |
| 78 | |
|
| 79 | |
public void setOrgId(String orgId) { |
| 80 | 0 | this.orgId = orgId; |
| 81 | 0 | } |
| 82 | |
|
| 83 | |
public String getPersonId() { |
| 84 | 0 | return personId; |
| 85 | |
} |
| 86 | |
|
| 87 | |
public void setPersonId(String personId) { |
| 88 | 0 | this.personId = personId; |
| 89 | 0 | } |
| 90 | |
|
| 91 | |
public String getPersonInfoOverride() { |
| 92 | 0 | return personInfoOverride; |
| 93 | |
} |
| 94 | |
|
| 95 | |
public void setPersonInfoOverride(String personInfoOverride) { |
| 96 | 0 | this.personInfoOverride = personInfoOverride; |
| 97 | 0 | } |
| 98 | |
|
| 99 | |
public Float getPercentageEffort() { |
| 100 | 0 | return percentageEffort; |
| 101 | |
} |
| 102 | |
|
| 103 | |
public void setPercentageEffort(Float percentageEffort) { |
| 104 | 0 | this.percentageEffort = percentageEffort; |
| 105 | 0 | } |
| 106 | |
|
| 107 | |
@Override |
| 108 | |
public void setAttributes(List<LuiAttributeEntity> attributes) { |
| 109 | 0 | this.attributes = attributes; |
| 110 | 0 | } |
| 111 | |
|
| 112 | |
@Override |
| 113 | |
public List<LuiAttributeEntity> getAttributes() { |
| 114 | 0 | return attributes; |
| 115 | |
} |
| 116 | |
|
| 117 | |
} |