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 | |
@NamedQuery(name = "Proposal.getProposalsByRefernceIds", query = "SELECT DISTINCT p FROM ProposalReference r JOIN r.proposals p WHERE r.objectReferenceId IN (:referenceIds)") |
56 | |
}) |
57 | |
@AttributeOverride(name="id", column=@Column(name="PROPOSAL_ID")) |
58 | 25 | public class Proposal extends MetaEntity implements AttributeOwner<ProposalAttribute> { |
59 | |
|
60 | |
@Column(name="WORKFLOW_ID") |
61 | |
private String workflowId; |
62 | |
|
63 | |
@Column(name="NAME") |
64 | |
private String name; |
65 | |
|
66 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "proposal") |
67 | |
private List<ProposalPerson> proposerPerson; |
68 | |
|
69 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "proposal") |
70 | |
private List<ProposalOrg> proposerOrg; |
71 | |
|
72 | |
@ManyToMany(fetch=FetchType.EAGER) |
73 | |
@JoinTable(name="KSPR_PROPOSAL_JN_REFERENCE", |
74 | |
joinColumns= |
75 | |
@JoinColumn(name="PROPOSAL_ID", referencedColumnName="PROPOSAL_ID"), |
76 | |
inverseJoinColumns= |
77 | |
@JoinColumn(name="REFERENCE_ID", referencedColumnName="REFERENCE_ID") |
78 | |
) |
79 | |
private List<ProposalReference> proposalReference; |
80 | |
|
81 | |
@Column(name = "RATIONALE") |
82 | |
private String rationale; |
83 | |
|
84 | |
@Column(name = "DETAIL_DESC") |
85 | |
private String detailDesc; |
86 | |
|
87 | |
@Temporal(TemporalType.TIMESTAMP) |
88 | |
@Column(name = "EFF_DT") |
89 | |
private Date effectiveDate; |
90 | |
|
91 | |
@Temporal(TemporalType.TIMESTAMP) |
92 | |
@Column(name = "EXPIR_DT") |
93 | |
private Date expirationDate; |
94 | |
|
95 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") |
96 | |
private List<ProposalAttribute> attributes; |
97 | |
|
98 | |
@ManyToOne(optional=true) |
99 | |
@JoinColumn(name = "TYPE") |
100 | |
private ProposalType type; |
101 | |
|
102 | |
@Column(name = "STATE") |
103 | |
private String state; |
104 | |
|
105 | |
public String getName() { |
106 | 15 | return name; |
107 | |
} |
108 | |
|
109 | |
public void setName(String name) { |
110 | 3 | this.name = name; |
111 | 3 | } |
112 | |
|
113 | |
public List<ProposalPerson> getProposerPerson() { |
114 | 56 | return proposerPerson; |
115 | |
} |
116 | |
|
117 | |
public void setProposerPerson(List<ProposalPerson> proposerPerson) { |
118 | 1 | this.proposerPerson = proposerPerson; |
119 | 1 | } |
120 | |
|
121 | |
public List<ProposalOrg> getProposerOrg() { |
122 | 58 | return proposerOrg; |
123 | |
} |
124 | |
|
125 | |
public void setProposerOrg(List<ProposalOrg> proposerOrg) { |
126 | 1 | this.proposerOrg = proposerOrg; |
127 | 1 | } |
128 | |
|
129 | |
|
130 | |
public List<ProposalReference> getProposalReference() { |
131 | 75 | return proposalReference; |
132 | |
} |
133 | |
|
134 | |
public void setProposalReference(List<ProposalReference> proposalReference) { |
135 | 3 | this.proposalReference = proposalReference; |
136 | 3 | } |
137 | |
|
138 | |
public String getRationale() { |
139 | 15 | return rationale; |
140 | |
} |
141 | |
|
142 | |
public void setRationale(String rationale) { |
143 | 3 | this.rationale = rationale; |
144 | 3 | } |
145 | |
|
146 | |
public String getDetailDesc() { |
147 | 15 | return detailDesc; |
148 | |
} |
149 | |
|
150 | |
public void setDetailDesc(String detailDesc) { |
151 | 3 | this.detailDesc = detailDesc; |
152 | 3 | } |
153 | |
|
154 | |
public Date getEffectiveDate() { |
155 | 15 | return effectiveDate; |
156 | |
} |
157 | |
|
158 | |
public void setEffectiveDate(Date effectiveDate) { |
159 | 3 | this.effectiveDate = effectiveDate; |
160 | 3 | } |
161 | |
|
162 | |
public Date getExpirationDate() { |
163 | 15 | return expirationDate; |
164 | |
} |
165 | |
|
166 | |
public void setExpirationDate(Date expirationDate) { |
167 | 3 | this.expirationDate = expirationDate; |
168 | 3 | } |
169 | |
|
170 | |
public ProposalType getType() { |
171 | 15 | return type; |
172 | |
} |
173 | |
|
174 | |
public void setType(ProposalType type) { |
175 | 3 | this.type = type; |
176 | 3 | } |
177 | |
|
178 | |
public String getState() { |
179 | 15 | return state; |
180 | |
} |
181 | |
|
182 | |
public void setState(String state) { |
183 | 3 | this.state = state; |
184 | 3 | } |
185 | |
|
186 | |
@Override |
187 | |
public List<ProposalAttribute> getAttributes() { |
188 | 24 | return attributes; |
189 | |
} |
190 | |
|
191 | |
@Override |
192 | |
public void setAttributes(List<ProposalAttribute> attributes) { |
193 | 4 | this.attributes = attributes; |
194 | 4 | } |
195 | |
|
196 | |
public String getWorkflowId() { |
197 | 15 | return workflowId; |
198 | |
} |
199 | |
|
200 | |
public void setWorkflowId(String workflowId) { |
201 | 3 | this.workflowId = workflowId; |
202 | 3 | } |
203 | |
} |