| 1 | |
package org.kuali.student.enrollment.class1.lpr.model; |
| 2 | |
|
| 3 | |
import java.util.ArrayList; |
| 4 | |
import java.util.Date; |
| 5 | |
import java.util.List; |
| 6 | |
|
| 7 | |
import javax.persistence.CascadeType; |
| 8 | |
import javax.persistence.Column; |
| 9 | |
import javax.persistence.Entity; |
| 10 | |
import javax.persistence.JoinColumn; |
| 11 | |
import javax.persistence.JoinTable; |
| 12 | |
import javax.persistence.ManyToMany; |
| 13 | |
import javax.persistence.OneToMany; |
| 14 | |
import javax.persistence.Table; |
| 15 | |
import javax.persistence.Temporal; |
| 16 | |
import javax.persistence.TemporalType; |
| 17 | |
|
| 18 | |
import org.kuali.student.enrollment.class1.lrc.model.ResultValuesGroupEntity; |
| 19 | |
import org.kuali.student.enrollment.lpr.dto.LuiPersonRelationInfo; |
| 20 | |
import org.kuali.student.enrollment.lpr.infc.LuiPersonRelation; |
| 21 | |
import org.kuali.student.r2.common.dto.AttributeInfo; |
| 22 | |
import org.kuali.student.r2.common.entity.AttributeOwner; |
| 23 | |
import org.kuali.student.r2.common.entity.MetaEntity; |
| 24 | |
import org.kuali.student.r2.common.infc.Attribute; |
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
@Entity |
| 30 | |
@Table(name = "KSEN_LPR") |
| 31 | |
public class LuiPersonRelationEntity extends MetaEntity implements AttributeOwner<LuiPersonRelationAttributeEntity> { |
| 32 | |
|
| 33 | |
@Column(name = "PERSONID") |
| 34 | |
private String personId; |
| 35 | |
|
| 36 | |
@Column(name = "LUIID") |
| 37 | |
private String luiId; |
| 38 | |
|
| 39 | |
|
| 40 | |
@Column(name = "COMMITMENTPERCENT") |
| 41 | |
private Float commitmentPercent; |
| 42 | |
|
| 43 | |
@Temporal(TemporalType.TIMESTAMP) |
| 44 | |
private Date effectiveDate; |
| 45 | |
|
| 46 | |
@Temporal(TemporalType.TIMESTAMP) |
| 47 | |
private Date expirationDate; |
| 48 | |
|
| 49 | |
@Column(name = "LPR_TYPE") |
| 50 | |
private String personRelationTypeId; |
| 51 | |
|
| 52 | |
@Column(name = "LPR_STATE") |
| 53 | |
private String personRelationStateId; |
| 54 | |
|
| 55 | |
|
| 56 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") |
| 57 | |
private List<LuiPersonRelationAttributeEntity> attributes; |
| 58 | |
|
| 59 | 0 | public LuiPersonRelationEntity() {} |
| 60 | |
|
| 61 | |
public LuiPersonRelationEntity(LuiPersonRelation dto) { |
| 62 | 0 | super(dto); |
| 63 | 0 | this.setEffectiveDate(dto.getEffectiveDate()); |
| 64 | 0 | this.setExpirationDate(dto.getExpirationDate()); |
| 65 | 0 | this.setId(dto.getId()); |
| 66 | 0 | this.setLuiId(dto.getLuiId()); |
| 67 | 0 | this.setPersonId(dto.getPersonId()); |
| 68 | 0 | this.setPersonRelationTypeId(dto.getTypeKey()); |
| 69 | 0 | fromDto(dto); |
| 70 | 0 | } |
| 71 | |
|
| 72 | |
public void fromDto(LuiPersonRelation dto){ |
| 73 | 0 | this.setCommitmentPercent(dto.getCommitmentPercent()); |
| 74 | 0 | this.setExpirationDate(dto.getExpirationDate()); |
| 75 | 0 | this.setEffectiveDate(dto.getEffectiveDate()); |
| 76 | 0 | this.setPersonRelationStateId(dto.getStateKey()); |
| 77 | 0 | this.setAttributes(new ArrayList<LuiPersonRelationAttributeEntity>()); |
| 78 | 0 | if (null != dto.getAttributes()) { |
| 79 | 0 | for (Attribute att : dto.getAttributes()) { |
| 80 | 0 | this.getAttributes().add(new LuiPersonRelationAttributeEntity(att)); |
| 81 | |
} |
| 82 | |
} |
| 83 | 0 | } |
| 84 | |
|
| 85 | |
public String getPersonId() { |
| 86 | 0 | return personId; |
| 87 | |
} |
| 88 | |
|
| 89 | |
public void setPersonId(String personId) { |
| 90 | 0 | this.personId = personId; |
| 91 | 0 | } |
| 92 | |
|
| 93 | |
public String getLuiId() { |
| 94 | 0 | return luiId; |
| 95 | |
} |
| 96 | |
|
| 97 | |
public void setLuiId(String luiId) { |
| 98 | 0 | this.luiId = luiId; |
| 99 | 0 | } |
| 100 | |
|
| 101 | |
public Float getCommitmentPercent() { |
| 102 | 0 | return commitmentPercent; |
| 103 | |
} |
| 104 | |
|
| 105 | |
public void setCommitmentPercent(Float commitmentPercent) { |
| 106 | 0 | this.commitmentPercent = commitmentPercent; |
| 107 | 0 | } |
| 108 | |
|
| 109 | |
public Date getEffectiveDate() { |
| 110 | 0 | return effectiveDate; |
| 111 | |
} |
| 112 | |
|
| 113 | |
public void setEffectiveDate(Date effectiveDate) { |
| 114 | 0 | this.effectiveDate = effectiveDate; |
| 115 | 0 | } |
| 116 | |
|
| 117 | |
public Date getExpirationDate() { |
| 118 | 0 | return expirationDate; |
| 119 | |
} |
| 120 | |
|
| 121 | |
public void setExpirationDate(Date expirationDate) { |
| 122 | 0 | this.expirationDate = expirationDate; |
| 123 | 0 | } |
| 124 | |
|
| 125 | |
public String getPersonRelationTypeId() { |
| 126 | 0 | return personRelationTypeId; |
| 127 | |
} |
| 128 | |
|
| 129 | |
public void setPersonRelationTypeId(String personRelationTypeId) { |
| 130 | 0 | this.personRelationTypeId = personRelationTypeId; |
| 131 | 0 | } |
| 132 | |
|
| 133 | |
public String getPersonRelationStateId() { |
| 134 | 0 | return personRelationStateId; |
| 135 | |
} |
| 136 | |
|
| 137 | |
public void setPersonRelationStateId(String personRelationStateId) { |
| 138 | 0 | this.personRelationStateId = personRelationStateId; |
| 139 | 0 | } |
| 140 | |
|
| 141 | |
|
| 142 | |
|
| 143 | |
|
| 144 | |
|
| 145 | |
|
| 146 | |
|
| 147 | |
|
| 148 | |
|
| 149 | |
@Override |
| 150 | |
public List<LuiPersonRelationAttributeEntity> getAttributes() { |
| 151 | 0 | return attributes; |
| 152 | |
} |
| 153 | |
|
| 154 | |
@Override |
| 155 | |
public void setAttributes(List<LuiPersonRelationAttributeEntity> attributes) { |
| 156 | 0 | this.attributes = attributes; |
| 157 | 0 | } |
| 158 | |
|
| 159 | |
public LuiPersonRelationInfo toDto() { |
| 160 | 0 | LuiPersonRelationInfo lprInfo = new LuiPersonRelationInfo(); |
| 161 | 0 | lprInfo.setId(getId()); |
| 162 | 0 | lprInfo.setLuiId(luiId); |
| 163 | 0 | lprInfo.setCommitmentPercent(commitmentPercent); |
| 164 | 0 | lprInfo.setPersonId(personId); |
| 165 | 0 | lprInfo.setEffectiveDate(effectiveDate); |
| 166 | 0 | lprInfo.setExpirationDate(expirationDate); |
| 167 | 0 | lprInfo.setTypeKey(personRelationTypeId); |
| 168 | 0 | lprInfo.setStateKey(personRelationStateId); |
| 169 | |
|
| 170 | |
|
| 171 | |
|
| 172 | |
|
| 173 | |
|
| 174 | |
|
| 175 | |
|
| 176 | |
|
| 177 | |
|
| 178 | |
|
| 179 | |
|
| 180 | 0 | lprInfo.setMeta(super.toDTO()); |
| 181 | 0 | List<AttributeInfo> atts = new ArrayList<AttributeInfo>(); |
| 182 | 0 | if (getAttributes() != null) { |
| 183 | 0 | for (LuiPersonRelationAttributeEntity att : getAttributes()) { |
| 184 | 0 | AttributeInfo attInfo = att.toDto(); |
| 185 | 0 | atts.add(attInfo); |
| 186 | 0 | } |
| 187 | |
} |
| 188 | 0 | lprInfo.setAttributes(atts); |
| 189 | |
|
| 190 | 0 | return lprInfo; |
| 191 | |
} |
| 192 | |
} |