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.core.entity.AttributeOwner; |
38 | |
import org.kuali.student.core.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 | 25 | 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 | 15 | return name; |
106 | |
} |
107 | |
|
108 | |
public void setName(String name) { |
109 | 3 | this.name = name; |
110 | 3 | } |
111 | |
|
112 | |
public List<ProposalPerson> getProposerPerson() { |
113 | 48 | return proposerPerson; |
114 | |
} |
115 | |
|
116 | |
public void setProposerPerson(List<ProposalPerson> proposerPerson) { |
117 | 1 | this.proposerPerson = proposerPerson; |
118 | 1 | } |
119 | |
|
120 | |
public List<ProposalOrg> getProposerOrg() { |
121 | 48 | return proposerOrg; |
122 | |
} |
123 | |
|
124 | |
public void setProposerOrg(List<ProposalOrg> proposerOrg) { |
125 | 4 | this.proposerOrg = proposerOrg; |
126 | 4 | } |
127 | |
|
128 | |
|
129 | |
public List<ProposalReference> getProposalReference() { |
130 | 75 | return proposalReference; |
131 | |
} |
132 | |
|
133 | |
public void setProposalReference(List<ProposalReference> proposalReference) { |
134 | 3 | this.proposalReference = proposalReference; |
135 | 3 | } |
136 | |
|
137 | |
public String getRationale() { |
138 | 15 | return rationale; |
139 | |
} |
140 | |
|
141 | |
public void setRationale(String rationale) { |
142 | 3 | this.rationale = rationale; |
143 | 3 | } |
144 | |
|
145 | |
public String getDetailDesc() { |
146 | 15 | return detailDesc; |
147 | |
} |
148 | |
|
149 | |
public void setDetailDesc(String detailDesc) { |
150 | 3 | this.detailDesc = detailDesc; |
151 | 3 | } |
152 | |
|
153 | |
public Date getEffectiveDate() { |
154 | 15 | return effectiveDate; |
155 | |
} |
156 | |
|
157 | |
public void setEffectiveDate(Date effectiveDate) { |
158 | 3 | this.effectiveDate = effectiveDate; |
159 | 3 | } |
160 | |
|
161 | |
public Date getExpirationDate() { |
162 | 15 | return expirationDate; |
163 | |
} |
164 | |
|
165 | |
public void setExpirationDate(Date expirationDate) { |
166 | 3 | this.expirationDate = expirationDate; |
167 | 3 | } |
168 | |
|
169 | |
public ProposalType getType() { |
170 | 15 | return type; |
171 | |
} |
172 | |
|
173 | |
public void setType(ProposalType type) { |
174 | 3 | this.type = type; |
175 | 3 | } |
176 | |
|
177 | |
public String getState() { |
178 | 15 | return state; |
179 | |
} |
180 | |
|
181 | |
public void setState(String state) { |
182 | 3 | this.state = state; |
183 | 3 | } |
184 | |
|
185 | |
@Override |
186 | |
public List<ProposalAttribute> getAttributes() { |
187 | 24 | return attributes; |
188 | |
} |
189 | |
|
190 | |
@Override |
191 | |
public void setAttributes(List<ProposalAttribute> attributes) { |
192 | 4 | this.attributes = attributes; |
193 | 4 | } |
194 | |
|
195 | |
public String getWorkflowId() { |
196 | 15 | return workflowId; |
197 | |
} |
198 | |
|
199 | |
public void setWorkflowId(String workflowId) { |
200 | 3 | this.workflowId = workflowId; |
201 | 3 | } |
202 | |
} |