| 1 | |
package org.kuali.student.enrollment.class1.lui.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.OneToMany; |
| 11 | |
import javax.persistence.Table; |
| 12 | |
import javax.persistence.Temporal; |
| 13 | |
import javax.persistence.TemporalType; |
| 14 | |
|
| 15 | |
import org.kuali.student.r2.common.dto.AttributeInfo; |
| 16 | |
import org.kuali.student.r2.common.entity.AttributeOwner; |
| 17 | |
import org.kuali.student.r2.common.entity.MetaEntity; |
| 18 | |
import org.kuali.student.r2.common.infc.Attribute; |
| 19 | |
import org.kuali.student.r2.lum.clu.dto.AffiliatedOrgInfo; |
| 20 | |
import org.kuali.student.r2.lum.clu.infc.AffiliatedOrg; |
| 21 | |
|
| 22 | |
@Entity |
| 23 | |
@Table(name = "KSEN_LUI_AFFILIATED_ORG") |
| 24 | |
public class LuiAffiliatedOrgEntity extends MetaEntity implements AttributeOwner<LuiAffiliatedOrgAttributeEntity>{ |
| 25 | |
|
| 26 | |
@Column(name = "AFFILIATED_ORG_TYPE", nullable = false) |
| 27 | |
private String type; |
| 28 | |
|
| 29 | |
@Column(name = "AFFILIATED_ORG_STATE", nullable = false) |
| 30 | |
private String state; |
| 31 | |
|
| 32 | |
@Temporal(TemporalType.TIMESTAMP) |
| 33 | |
@Column(name = "EFF_DT") |
| 34 | |
private Date effectiveDate; |
| 35 | |
|
| 36 | |
@Temporal(TemporalType.TIMESTAMP) |
| 37 | |
@Column(name = "EXPIR_DT") |
| 38 | |
private Date expirationDate; |
| 39 | |
|
| 40 | |
@Column(name = "PERCENTAGE") |
| 41 | |
private Long percentage; |
| 42 | |
|
| 43 | |
@Column(name = "ORG_ID", nullable = false) |
| 44 | |
private String orgId; |
| 45 | |
|
| 46 | |
@Column(name = "EXPENDITURE_ID") |
| 47 | |
private String expenditureId; |
| 48 | |
|
| 49 | |
@Column(name = "REVENUE_ID") |
| 50 | |
private String revenueId; |
| 51 | |
|
| 52 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") |
| 53 | |
private List<LuiAffiliatedOrgAttributeEntity> attributes; |
| 54 | |
|
| 55 | 0 | public LuiAffiliatedOrgEntity() {} |
| 56 | |
|
| 57 | |
public LuiAffiliatedOrgEntity(AffiliatedOrg affiliatedOrg) { |
| 58 | |
|
| 59 | 0 | super(affiliatedOrg); |
| 60 | 0 | this.setId(affiliatedOrg.getId()); |
| 61 | 0 | this.setType(affiliatedOrg.getTypeKey()); |
| 62 | 0 | this.setState(affiliatedOrg.getStateKey()); |
| 63 | 0 | this.setEffectiveDate(affiliatedOrg.getEffectiveDate()); |
| 64 | 0 | this.setExpirationDate(affiliatedOrg.getExpirationDate()); |
| 65 | |
|
| 66 | 0 | this.setOrgId(affiliatedOrg.getOrgId()); |
| 67 | 0 | this.setPercentage(affiliatedOrg.getPercentage()); |
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | 0 | this.setAttributes(new ArrayList<LuiAffiliatedOrgAttributeEntity>()); |
| 72 | 0 | if (null != affiliatedOrg.getAttributes()) { |
| 73 | 0 | for (Attribute att : affiliatedOrg.getAttributes()) { |
| 74 | 0 | LuiAffiliatedOrgAttributeEntity attEntity = new LuiAffiliatedOrgAttributeEntity(att); |
| 75 | 0 | this.getAttributes().add(attEntity); |
| 76 | 0 | } |
| 77 | |
} |
| 78 | 0 | } |
| 79 | |
|
| 80 | |
public AffiliatedOrgInfo toDto() { |
| 81 | |
|
| 82 | 0 | AffiliatedOrgInfo obj = new AffiliatedOrgInfo(); |
| 83 | 0 | obj.setId(this.getId()); |
| 84 | 0 | obj.setTypeKey(this.getType()); |
| 85 | 0 | obj.setStateKey(this.getState()); |
| 86 | 0 | obj.setEffectiveDate(this.getEffectiveDate()); |
| 87 | 0 | obj.setExpirationDate(this.getExpirationDate()); |
| 88 | |
|
| 89 | 0 | obj.setOrgId(this.getOrgId()); |
| 90 | 0 | obj.setPercentage(this.getPercentage()); |
| 91 | |
|
| 92 | |
|
| 93 | |
|
| 94 | |
|
| 95 | 0 | List<AttributeInfo> atts = new ArrayList<AttributeInfo>(); |
| 96 | 0 | for (LuiAffiliatedOrgAttributeEntity att : getAttributes()) { |
| 97 | 0 | AttributeInfo attInfo = att.toDto(); |
| 98 | 0 | atts.add(attInfo); |
| 99 | 0 | } |
| 100 | 0 | obj.setAttributes(atts); |
| 101 | |
|
| 102 | 0 | obj.setMeta(super.toDTO()); |
| 103 | |
|
| 104 | 0 | return obj; |
| 105 | |
|
| 106 | |
} |
| 107 | |
|
| 108 | |
public String getType() { |
| 109 | 0 | return type; |
| 110 | |
} |
| 111 | |
|
| 112 | |
public void setType(String type) { |
| 113 | 0 | this.type = type; |
| 114 | 0 | } |
| 115 | |
|
| 116 | |
public String getState() { |
| 117 | 0 | return state; |
| 118 | |
} |
| 119 | |
|
| 120 | |
public void setState(String state) { |
| 121 | 0 | this.state = state; |
| 122 | 0 | } |
| 123 | |
|
| 124 | |
public Date getEffectiveDate() { |
| 125 | 0 | return effectiveDate; |
| 126 | |
} |
| 127 | |
|
| 128 | |
public void setEffectiveDate(Date effectiveDate) { |
| 129 | 0 | this.effectiveDate = effectiveDate; |
| 130 | 0 | } |
| 131 | |
|
| 132 | |
public Date getExpirationDate() { |
| 133 | 0 | return expirationDate; |
| 134 | |
} |
| 135 | |
|
| 136 | |
public void setExpirationDate(Date expirationDate) { |
| 137 | 0 | this.expirationDate = expirationDate; |
| 138 | 0 | } |
| 139 | |
|
| 140 | |
public Long getPercentage() { |
| 141 | 0 | return percentage; |
| 142 | |
} |
| 143 | |
|
| 144 | |
public void setPercentage(Long percentage) { |
| 145 | 0 | this.percentage = percentage; |
| 146 | 0 | } |
| 147 | |
|
| 148 | |
public String getOrgId() { |
| 149 | 0 | return orgId; |
| 150 | |
} |
| 151 | |
|
| 152 | |
public void setOrgId(String orgId) { |
| 153 | 0 | this.orgId = orgId; |
| 154 | 0 | } |
| 155 | |
|
| 156 | |
public String getExpenditureId() { |
| 157 | 0 | return expenditureId; |
| 158 | |
} |
| 159 | |
|
| 160 | |
public void setExpenditureId(String expenditureId) { |
| 161 | 0 | this.expenditureId = expenditureId; |
| 162 | 0 | } |
| 163 | |
|
| 164 | |
public String getRevenueId() { |
| 165 | 0 | return revenueId; |
| 166 | |
} |
| 167 | |
|
| 168 | |
public void setRevenueId(String revenueId) { |
| 169 | 0 | this.revenueId = revenueId; |
| 170 | 0 | } |
| 171 | |
|
| 172 | |
@Override |
| 173 | |
public void setAttributes(List<LuiAffiliatedOrgAttributeEntity> attributes) { |
| 174 | 0 | this.attributes = attributes; |
| 175 | 0 | } |
| 176 | |
|
| 177 | |
@Override |
| 178 | |
public List<LuiAffiliatedOrgAttributeEntity> getAttributes() { |
| 179 | 0 | return attributes; |
| 180 | |
} |
| 181 | |
|
| 182 | |
} |