| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.student.core.proposal.entity; |
| 17 | |
|
| 18 | |
import java.util.Date; |
| 19 | |
import java.util.List; |
| 20 | |
|
| 21 | |
import javax.persistence.AttributeOverride; |
| 22 | |
import javax.persistence.CascadeType; |
| 23 | |
import javax.persistence.Column; |
| 24 | |
import javax.persistence.Entity; |
| 25 | |
import javax.persistence.FetchType; |
| 26 | |
import javax.persistence.JoinColumn; |
| 27 | |
import javax.persistence.JoinTable; |
| 28 | |
import javax.persistence.ManyToMany; |
| 29 | |
import javax.persistence.ManyToOne; |
| 30 | |
import javax.persistence.NamedQueries; |
| 31 | |
import javax.persistence.NamedQuery; |
| 32 | |
import javax.persistence.OneToMany; |
| 33 | |
import javax.persistence.Table; |
| 34 | |
import javax.persistence.Temporal; |
| 35 | |
import javax.persistence.TemporalType; |
| 36 | |
|
| 37 | |
import org.kuali.student.common.entity.AttributeOwner; |
| 38 | |
import org.kuali.student.common.entity.MetaEntity; |
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
@Entity |
| 47 | |
@Table(name = "KSPR_PROPOSAL") |
| 48 | |
@NamedQueries( { |
| 49 | |
@NamedQuery(name = "Proposal.getProposalsByIdList", query = "SELECT p FROM Proposal p WHERE p.id IN (:idList)"), |
| 50 | |
@NamedQuery(name = "Proposal.getProposalsByProposalType", query = "SELECT DISTINCT p FROM Proposal p WHERE p.type.id = :proposalTypeId"), |
| 51 | |
@NamedQuery(name = "Proposal.getProposalsByReference", query = "SELECT r.proposals FROM ProposalReference r WHERE r.objectReferenceId = :referenceId AND r.type.id = :referenceTypeId"), |
| 52 | |
@NamedQuery(name = "Proposal.getProposalsByState", query = "SELECT DISTINCT p FROM Proposal p WHERE p.state = :proposalState AND p.type.id = :proposalTypeId"), |
| 53 | |
@NamedQuery(name = "Proposal.getProposalByWorkflowId", query = "SELECT DISTINCT p FROM Proposal p WHERE p.workflowId = :workflowId"), |
| 54 | |
@NamedQuery(name = "Proposal.getProposalTypesForReferenceType", query = "SELECT DISTINCT p.type FROM ProposalReference r JOIN r.proposals p WHERE r.type.id = :referenceTypeId") |
| 55 | |
}) |
| 56 | |
@AttributeOverride(name="id", column=@Column(name="PROPOSAL_ID")) |
| 57 | 0 | public class Proposal extends MetaEntity implements AttributeOwner<ProposalAttribute> { |
| 58 | |
|
| 59 | |
@Column(name="WORKFLOW_ID") |
| 60 | |
private String workflowId; |
| 61 | |
|
| 62 | |
@Column(name="NAME") |
| 63 | |
private String name; |
| 64 | |
|
| 65 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "proposal") |
| 66 | |
private List<ProposalPerson> proposerPerson; |
| 67 | |
|
| 68 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "proposal") |
| 69 | |
private List<ProposalOrg> proposerOrg; |
| 70 | |
|
| 71 | |
@ManyToMany(fetch=FetchType.EAGER) |
| 72 | |
@JoinTable(name="KSPR_PROPOSAL_JN_REFERENCE", |
| 73 | |
joinColumns= |
| 74 | |
@JoinColumn(name="PROPOSAL_ID", referencedColumnName="PROPOSAL_ID"), |
| 75 | |
inverseJoinColumns= |
| 76 | |
@JoinColumn(name="REFERENCE_ID", referencedColumnName="REFERENCE_ID") |
| 77 | |
) |
| 78 | |
private List<ProposalReference> proposalReference; |
| 79 | |
|
| 80 | |
@Column(name = "RATIONALE") |
| 81 | |
private String rationale; |
| 82 | |
|
| 83 | |
@Column(name = "DETAIL_DESC") |
| 84 | |
private String detailDesc; |
| 85 | |
|
| 86 | |
@Temporal(TemporalType.TIMESTAMP) |
| 87 | |
@Column(name = "EFF_DT") |
| 88 | |
private Date effectiveDate; |
| 89 | |
|
| 90 | |
@Temporal(TemporalType.TIMESTAMP) |
| 91 | |
@Column(name = "EXPIR_DT") |
| 92 | |
private Date expirationDate; |
| 93 | |
|
| 94 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") |
| 95 | |
private List<ProposalAttribute> attributes; |
| 96 | |
|
| 97 | |
@ManyToOne(optional=true) |
| 98 | |
@JoinColumn(name = "TYPE") |
| 99 | |
private ProposalType type; |
| 100 | |
|
| 101 | |
@Column(name = "STATE") |
| 102 | |
private String state; |
| 103 | |
|
| 104 | |
public String getName() { |
| 105 | 0 | return name; |
| 106 | |
} |
| 107 | |
|
| 108 | |
public void setName(String name) { |
| 109 | 0 | this.name = name; |
| 110 | 0 | } |
| 111 | |
|
| 112 | |
public List<ProposalPerson> getProposerPerson() { |
| 113 | 0 | return proposerPerson; |
| 114 | |
} |
| 115 | |
|
| 116 | |
public void setProposerPerson(List<ProposalPerson> proposerPerson) { |
| 117 | 0 | this.proposerPerson = proposerPerson; |
| 118 | 0 | } |
| 119 | |
|
| 120 | |
public List<ProposalOrg> getProposerOrg() { |
| 121 | 0 | return proposerOrg; |
| 122 | |
} |
| 123 | |
|
| 124 | |
public void setProposerOrg(List<ProposalOrg> proposerOrg) { |
| 125 | 0 | this.proposerOrg = proposerOrg; |
| 126 | 0 | } |
| 127 | |
|
| 128 | |
|
| 129 | |
public List<ProposalReference> getProposalReference() { |
| 130 | 0 | return proposalReference; |
| 131 | |
} |
| 132 | |
|
| 133 | |
public void setProposalReference(List<ProposalReference> proposalReference) { |
| 134 | 0 | this.proposalReference = proposalReference; |
| 135 | 0 | } |
| 136 | |
|
| 137 | |
public String getRationale() { |
| 138 | 0 | return rationale; |
| 139 | |
} |
| 140 | |
|
| 141 | |
public void setRationale(String rationale) { |
| 142 | 0 | this.rationale = rationale; |
| 143 | 0 | } |
| 144 | |
|
| 145 | |
public String getDetailDesc() { |
| 146 | 0 | return detailDesc; |
| 147 | |
} |
| 148 | |
|
| 149 | |
public void setDetailDesc(String detailDesc) { |
| 150 | 0 | this.detailDesc = detailDesc; |
| 151 | 0 | } |
| 152 | |
|
| 153 | |
public Date getEffectiveDate() { |
| 154 | 0 | return effectiveDate; |
| 155 | |
} |
| 156 | |
|
| 157 | |
public void setEffectiveDate(Date effectiveDate) { |
| 158 | 0 | this.effectiveDate = effectiveDate; |
| 159 | 0 | } |
| 160 | |
|
| 161 | |
public Date getExpirationDate() { |
| 162 | 0 | return expirationDate; |
| 163 | |
} |
| 164 | |
|
| 165 | |
public void setExpirationDate(Date expirationDate) { |
| 166 | 0 | this.expirationDate = expirationDate; |
| 167 | 0 | } |
| 168 | |
|
| 169 | |
public ProposalType getType() { |
| 170 | 0 | return type; |
| 171 | |
} |
| 172 | |
|
| 173 | |
public void setType(ProposalType type) { |
| 174 | 0 | this.type = type; |
| 175 | 0 | } |
| 176 | |
|
| 177 | |
public String getState() { |
| 178 | 0 | return state; |
| 179 | |
} |
| 180 | |
|
| 181 | |
public void setState(String state) { |
| 182 | 0 | this.state = state; |
| 183 | 0 | } |
| 184 | |
|
| 185 | |
@Override |
| 186 | |
public List<ProposalAttribute> getAttributes() { |
| 187 | 0 | return attributes; |
| 188 | |
} |
| 189 | |
|
| 190 | |
@Override |
| 191 | |
public void setAttributes(List<ProposalAttribute> attributes) { |
| 192 | 0 | this.attributes = attributes; |
| 193 | 0 | } |
| 194 | |
|
| 195 | |
public String getWorkflowId() { |
| 196 | 0 | return workflowId; |
| 197 | |
} |
| 198 | |
|
| 199 | |
public void setWorkflowId(String workflowId) { |
| 200 | 0 | this.workflowId = workflowId; |
| 201 | 0 | } |
| 202 | |
} |