1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.lum.lu.entity; |
17 | |
|
18 | |
import java.util.Date; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import javax.persistence.AttributeOverride; |
22 | |
import javax.persistence.AttributeOverrides; |
23 | |
import javax.persistence.CascadeType; |
24 | |
import javax.persistence.Column; |
25 | |
import javax.persistence.Embedded; |
26 | |
import javax.persistence.Entity; |
27 | |
import javax.persistence.JoinColumn; |
28 | |
import javax.persistence.JoinTable; |
29 | |
import javax.persistence.ManyToOne; |
30 | |
import javax.persistence.NamedQueries; |
31 | |
import javax.persistence.NamedQuery; |
32 | |
import javax.persistence.OneToMany; |
33 | |
import javax.persistence.OneToOne; |
34 | |
import javax.persistence.Table; |
35 | |
import javax.persistence.Temporal; |
36 | |
import javax.persistence.TemporalType; |
37 | |
import javax.persistence.UniqueConstraint; |
38 | |
|
39 | |
import org.kuali.student.core.entity.Amount; |
40 | |
import org.kuali.student.core.entity.AttributeOwner; |
41 | |
import org.kuali.student.core.entity.TimeAmount; |
42 | |
import org.kuali.student.core.entity.VersionEntity; |
43 | |
|
44 | |
@Entity |
45 | |
@Table(name = "KSLU_CLU", uniqueConstraints={@UniqueConstraint(columnNames={"VER_IND_ID", "SEQ_NUM"})} ) |
46 | |
@NamedQueries( { |
47 | |
|
48 | |
|
49 | |
@NamedQuery(name = "Clu.findCurrentVersionInfo", query = "SELECT " + |
50 | |
"NEW org.kuali.student.core.versionmanagement.dto.VersionDisplayInfo(c.id, c.version.versionIndId, c.version.sequenceNumber, c.version.currentVersionStart, c.version.currentVersionEnd, c.version.versionComment, c.version.versionedFromId) " + |
51 | |
"FROM Clu c " + |
52 | |
"WHERE c.version.versionIndId = :versionIndId " + |
53 | |
"AND c.version.currentVersionStart <= :currentTime AND (c.version.currentVersionEnd > :currentTime OR c.version.currentVersionEnd IS NULL)"), |
54 | |
@NamedQuery(name = "Clu.findCurrentVersionOnDate", query = "SELECT " + |
55 | |
"NEW org.kuali.student.core.versionmanagement.dto.VersionDisplayInfo(c.id, c.version.versionIndId, c.version.sequenceNumber, c.version.currentVersionStart, c.version.currentVersionEnd, c.version.versionComment, c.version.versionedFromId) " + |
56 | |
"FROM Clu c " + |
57 | |
"WHERE c.version.versionIndId = :versionIndId " + |
58 | |
"AND c.version.currentVersionStart <= :date AND (c.version.currentVersionEnd > :date OR c.version.currentVersionEnd IS NULL)"), |
59 | |
@NamedQuery(name = "Clu.findFirstVersion", query = "SELECT " + |
60 | |
"NEW org.kuali.student.core.versionmanagement.dto.VersionDisplayInfo(c.id, c.version.versionIndId, c.version.sequenceNumber, c.version.currentVersionStart, c.version.currentVersionEnd, c.version.versionComment, c.version.versionedFromId) " + |
61 | |
"FROM Clu c " + |
62 | |
"WHERE c.version.versionIndId = :versionIndId " + |
63 | |
"AND c.version.sequenceNumber IN (SELECT MIN(nc.version.sequenceNumber) FROM Clu nc WHERE nc.version.versionIndId = :versionIndId)"), |
64 | |
@NamedQuery(name = "Clu.findLatestVersion", query = "SELECT " + |
65 | |
"NEW org.kuali.student.core.versionmanagement.dto.VersionDisplayInfo(c.id, c.version.versionIndId, c.version.sequenceNumber, c.version.currentVersionStart, c.version.currentVersionEnd, c.version.versionComment, c.version.versionedFromId) " + |
66 | |
"FROM Clu c " + |
67 | |
"WHERE c.version.versionIndId = :versionIndId " + |
68 | |
"AND c.version.sequenceNumber IN (SELECT MAX(nc.version.sequenceNumber) FROM Clu nc WHERE nc.version.versionIndId = :versionIndId)"), |
69 | |
@NamedQuery(name = "Clu.findVersionBySequence", query = "SELECT " + |
70 | |
"NEW org.kuali.student.core.versionmanagement.dto.VersionDisplayInfo(c.id, c.version.versionIndId, c.version.sequenceNumber, c.version.currentVersionStart, c.version.currentVersionEnd, c.version.versionComment, c.version.versionedFromId) " + |
71 | |
"FROM Clu c " + |
72 | |
"WHERE c.version.versionIndId = :versionIndId " + |
73 | |
"AND c.version.sequenceNumber = :sequenceNumber"), |
74 | |
@NamedQuery(name = "Clu.findVersions", query = "SELECT " + |
75 | |
"NEW org.kuali.student.core.versionmanagement.dto.VersionDisplayInfo(c.id, c.version.versionIndId, c.version.sequenceNumber, c.version.currentVersionStart, c.version.currentVersionEnd, c.version.versionComment, c.version.versionedFromId) " + |
76 | |
"FROM Clu c " + |
77 | |
"WHERE c.version.versionIndId = :versionIndId"), |
78 | |
@NamedQuery(name = "Clu.findVersionsInDateRange", query = "SELECT " + |
79 | |
"NEW org.kuali.student.core.versionmanagement.dto.VersionDisplayInfo(c.id, c.version.versionIndId, c.version.sequenceNumber, c.version.currentVersionStart, c.version.currentVersionEnd, c.version.versionComment, c.version.versionedFromId) " + |
80 | |
"FROM Clu c " + |
81 | |
"WHERE c.version.versionIndId = :versionIndId " + |
82 | |
"AND ( (c.version.currentVersionStart >= :from AND c.version.currentVersionStart < :to)" + |
83 | |
" OR (c.version.currentVersionStart < :from AND c.version.currentVersionEnd > :from) )"), |
84 | |
@NamedQuery(name = "Clu.findVersionsBeforeDate", query = "SELECT " + |
85 | |
"NEW org.kuali.student.core.versionmanagement.dto.VersionDisplayInfo(c.id, c.version.versionIndId, c.version.sequenceNumber, c.version.currentVersionStart, c.version.currentVersionEnd, c.version.versionComment, c.version.versionedFromId) " + |
86 | |
"FROM Clu c " + |
87 | |
"WHERE c.version.versionIndId = :versionIndId " + |
88 | |
"AND c.version.currentVersionStart <= :date"), |
89 | |
@NamedQuery(name = "Clu.findVersionsAfterDate", query = "SELECT " + |
90 | |
"NEW org.kuali.student.core.versionmanagement.dto.VersionDisplayInfo(c.id, c.version.versionIndId, c.version.sequenceNumber, c.version.currentVersionStart, c.version.currentVersionEnd, c.version.versionComment, c.version.versionedFromId) " + |
91 | |
"FROM Clu c " + |
92 | |
"WHERE c.version.versionIndId = :versionIndId " + |
93 | |
"AND c.version.currentVersionStart >= :date"), |
94 | |
@NamedQuery(name = "Clu.findLatestClu", query = "SELECT c FROM Clu c WHERE c.version.versionIndId = :versionIndId AND c.version.sequenceNumber IN (SELECT MAX(nc.version.sequenceNumber) FROM Clu nc WHERE nc.version.versionIndId = :versionIndId)"), |
95 | |
@NamedQuery(name = "Clu.findCurrentClu", query = "SELECT c FROM Clu c WHERE c.version.versionIndId = :versionIndId AND c.version.currentVersionStart <= :currentTime AND (c.version.currentVersionEnd > :currentTime OR c.version.currentVersionEnd IS NULL)"), |
96 | |
@NamedQuery(name = "Clu.findClusByIdList", query = "SELECT c FROM Clu c WHERE c.id IN (:idList)"), |
97 | |
@NamedQuery(name = "Clu.getClusByLuType", query = "SELECT c FROM Clu c WHERE c.state = :luState AND c.luType.id = :luTypeKey"), |
98 | |
@NamedQuery(name = "Clu.getClusByRelation", query = "SELECT c FROM Clu c WHERE c.id IN (SELECT ccr.relatedClu.id FROM CluCluRelation ccr WHERE ccr.clu.id = :parentCluId AND ccr.luLuRelationType.id = :luLuRelationTypeKey)") |
99 | |
}) |
100 | 744 | public class Clu extends VersionEntity implements AttributeOwner<CluAttribute> { |
101 | |
|
102 | |
@OneToOne(cascade=CascadeType.ALL) |
103 | |
@JoinColumn(name = "OFFIC_CLU_ID") |
104 | |
private CluIdentifier officialIdentifier; |
105 | |
|
106 | |
@OneToMany(cascade=CascadeType.ALL) |
107 | |
@JoinTable(name = "KSLU_CLU_JN_CLU_IDENT", joinColumns = @JoinColumn(name = "CLU_ID"), inverseJoinColumns = @JoinColumn(name = "ALT_CLU_ID")) |
108 | |
private List<CluIdentifier> alternateIdentifiers; |
109 | |
|
110 | |
@Column(name = "STDY_SUBJ_AREA") |
111 | |
private String studySubjectArea; |
112 | |
|
113 | |
@ManyToOne(cascade=CascadeType.ALL) |
114 | |
@JoinColumn(name = "RT_DESCR_ID") |
115 | |
private LuRichText descr; |
116 | |
|
117 | |
@OneToMany(cascade=CascadeType.ALL, mappedBy = "clu") |
118 | |
private List<CluCampusLocation> campusLocations; |
119 | |
|
120 | |
@OneToMany(cascade=CascadeType.ALL) |
121 | |
@JoinTable(name = "KSLU_CLU_JN_ACCRED", joinColumns = @JoinColumn(name = "CLU_ID"), inverseJoinColumns = @JoinColumn(name = "CLU_ACCRED_ID")) |
122 | |
private List<CluAccreditation> accreditations; |
123 | |
|
124 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "clu") |
125 | |
private List<CluAdminOrg> adminOrgs; |
126 | |
|
127 | |
@ManyToOne(cascade=CascadeType.ALL) |
128 | |
@JoinColumn(name="PRI_INSTR_ID") |
129 | |
private CluInstructor primaryInstructor; |
130 | |
|
131 | |
@OneToMany(cascade=CascadeType.ALL) |
132 | |
@JoinTable(name = "KSLU_CLU_JN_CLU_INSTR", joinColumns = @JoinColumn(name = "CLU_ID"), inverseJoinColumns = @JoinColumn(name = "CLU_INSTR_ID")) |
133 | |
private List<CluInstructor> instructors; |
134 | |
|
135 | |
@Column(name = "EXP_FIRST_ATP") |
136 | |
private String expectedFirstAtp; |
137 | |
|
138 | |
@Column(name = "LAST_ATP") |
139 | |
private String lastAtp; |
140 | |
|
141 | |
@Column(name = "LAST_ADMIT_ATP") |
142 | |
private String lastAdmitAtp; |
143 | |
|
144 | |
@Temporal(TemporalType.TIMESTAMP) |
145 | |
@Column(name = "EFF_DT") |
146 | |
private Date effectiveDate; |
147 | |
|
148 | |
@Temporal(TemporalType.TIMESTAMP) |
149 | |
@Column(name = "EXPIR_DT") |
150 | |
private Date expirationDate; |
151 | |
|
152 | |
@Embedded |
153 | |
@AttributeOverrides({ |
154 | |
@AttributeOverride(name="unitType", column=@Column(name="CLU_INTSTY_TYPE")), |
155 | |
@AttributeOverride(name="unitQuantity", column=@Column(name="CLU_INTSTY_QTY") |
156 | |
)}) |
157 | |
private Amount intensity; |
158 | |
|
159 | |
@Embedded |
160 | |
@Column(name = "STD_DUR") |
161 | |
private TimeAmount stdDuration; |
162 | |
|
163 | |
@Column(name = "CAN_CREATE_LUI") |
164 | |
private boolean canCreateLui; |
165 | |
|
166 | |
@Column(name = "REF_URL") |
167 | |
private String referenceURL; |
168 | |
|
169 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy="clu") |
170 | |
private List<LuCode> luCodes; |
171 | |
|
172 | |
@Column(name = "NEXT_REVIEW_PRD") |
173 | |
private String nextReviewPeriod; |
174 | |
|
175 | |
@Column(name = "IS_ENRL") |
176 | |
private boolean enrollable; |
177 | |
|
178 | |
@OneToMany(cascade=CascadeType.ALL, mappedBy="clu") |
179 | |
private List<CluAtpTypeKey> offeredAtpTypes; |
180 | |
|
181 | |
@Column(name = "HAS_EARLY_DROP_DEDLN") |
182 | |
private boolean hasEarlyDropDeadline; |
183 | |
|
184 | |
@Column(name = "DEF_ENRL_EST") |
185 | |
private int defaultEnrollmentEstimate; |
186 | |
|
187 | |
@Column(name = "DEF_MAX_ENRL") |
188 | |
private int defaultMaximumEnrollment; |
189 | |
|
190 | |
@Column(name = "IS_HAZR_DISBLD_STU") |
191 | |
private boolean hazardousForDisabledStudents; |
192 | |
|
193 | |
@OneToOne(cascade=CascadeType.ALL) |
194 | |
@JoinColumn(name = "FEE_ID") |
195 | |
private CluFee fee; |
196 | |
|
197 | |
@OneToOne(cascade=CascadeType.ALL) |
198 | |
@JoinColumn(name = "ACCT_ID") |
199 | |
private CluAccounting accounting; |
200 | |
|
201 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") |
202 | |
private List<CluAttribute> attributes; |
203 | |
|
204 | |
@ManyToOne |
205 | |
@JoinColumn(name = "LUTYPE_ID") |
206 | |
private LuType luType; |
207 | |
|
208 | |
@Column(name = "ST") |
209 | |
private String state; |
210 | |
|
211 | |
public LuType getLuType() { |
212 | 722 | return luType; |
213 | |
} |
214 | |
|
215 | |
public void setLuType(LuType luType) { |
216 | 237 | this.luType = luType; |
217 | 237 | } |
218 | |
|
219 | |
@Override |
220 | |
public List<CluAttribute> getAttributes() { |
221 | 1262 | return attributes; |
222 | |
} |
223 | |
|
224 | |
@Override |
225 | |
public void setAttributes(List<CluAttribute> attributes) { |
226 | 426 | this.attributes = attributes; |
227 | 426 | } |
228 | |
|
229 | |
public CluIdentifier getOfficialIdentifier() { |
230 | 908 | return officialIdentifier; |
231 | |
} |
232 | |
|
233 | |
public void setOfficialIdentifier(CluIdentifier officialIdentifier) { |
234 | 57 | this.officialIdentifier = officialIdentifier; |
235 | 57 | } |
236 | |
|
237 | |
public List<CluIdentifier> getAlternateIdentifiers() { |
238 | 726 | return alternateIdentifiers; |
239 | |
} |
240 | |
|
241 | |
public void setAlternateIdentifiers(List<CluIdentifier> alternateIdentifiers) { |
242 | 189 | this.alternateIdentifiers = alternateIdentifiers; |
243 | 189 | } |
244 | |
|
245 | |
public String getStudySubjectArea() { |
246 | 551 | return studySubjectArea; |
247 | |
} |
248 | |
|
249 | |
public void setStudySubjectArea(String studySubjectArea) { |
250 | 237 | this.studySubjectArea = studySubjectArea; |
251 | 237 | } |
252 | |
|
253 | |
public LuRichText getDescr() { |
254 | 645 | return descr; |
255 | |
} |
256 | |
|
257 | |
public void setDescr(LuRichText descr) { |
258 | 57 | this.descr = descr; |
259 | 57 | } |
260 | |
|
261 | |
public List<CluInstructor> getInstructors() { |
262 | 1055 | return instructors; |
263 | |
} |
264 | |
|
265 | |
public void setInstructors(List<CluInstructor> instructors) { |
266 | 189 | this.instructors = instructors; |
267 | 189 | } |
268 | |
|
269 | |
public Date getEffectiveDate() { |
270 | 551 | return effectiveDate; |
271 | |
} |
272 | |
|
273 | |
public void setEffectiveDate(Date effectiveDate) { |
274 | 237 | this.effectiveDate = effectiveDate; |
275 | 237 | } |
276 | |
|
277 | |
public Date getExpirationDate() { |
278 | 551 | return expirationDate; |
279 | |
} |
280 | |
|
281 | |
public void setExpirationDate(Date expirationDate) { |
282 | 237 | this.expirationDate = expirationDate; |
283 | 237 | } |
284 | |
|
285 | |
public TimeAmount getStdDuration() { |
286 | 636 | return stdDuration; |
287 | |
} |
288 | |
|
289 | |
public void setStdDuration(TimeAmount stdDuration) { |
290 | 169 | this.stdDuration = stdDuration; |
291 | 169 | } |
292 | |
|
293 | |
public boolean isCanCreateLui() { |
294 | 551 | return canCreateLui; |
295 | |
} |
296 | |
|
297 | |
public void setCanCreateLui(boolean canCreateLui) { |
298 | 237 | this.canCreateLui = canCreateLui; |
299 | 237 | } |
300 | |
|
301 | |
public String getReferenceURL() { |
302 | 551 | return referenceURL; |
303 | |
} |
304 | |
|
305 | |
public void setReferenceURL(String referenceURL) { |
306 | 237 | this.referenceURL = referenceURL; |
307 | 237 | } |
308 | |
|
309 | |
public List<LuCode> getLuCodes() { |
310 | 1161 | return luCodes; |
311 | |
} |
312 | |
|
313 | |
public void setLuCodes(List<LuCode> luCodes) { |
314 | 189 | this.luCodes = luCodes; |
315 | 189 | } |
316 | |
|
317 | |
public String getNextReviewPeriod() { |
318 | 551 | return nextReviewPeriod; |
319 | |
} |
320 | |
|
321 | |
public void setNextReviewPeriod(String nextReviewPeriod) { |
322 | 237 | this.nextReviewPeriod = nextReviewPeriod; |
323 | 237 | } |
324 | |
|
325 | |
public boolean isEnrollable() { |
326 | 551 | return enrollable; |
327 | |
} |
328 | |
|
329 | |
public void setEnrollable(boolean enrollable) { |
330 | 237 | this.enrollable = enrollable; |
331 | 237 | } |
332 | |
|
333 | |
public List<CluAtpTypeKey> getOfferedAtpTypes() { |
334 | 2149 | return offeredAtpTypes; |
335 | |
} |
336 | |
|
337 | |
public void setOfferedAtpTypes(List<CluAtpTypeKey> offeredAtpTypes) { |
338 | 189 | this.offeredAtpTypes = offeredAtpTypes; |
339 | 189 | } |
340 | |
|
341 | |
public boolean isHasEarlyDropDeadline() { |
342 | 551 | return hasEarlyDropDeadline; |
343 | |
} |
344 | |
|
345 | |
public void setHasEarlyDropDeadline(boolean hasEarlyDropDeadline) { |
346 | 237 | this.hasEarlyDropDeadline = hasEarlyDropDeadline; |
347 | 237 | } |
348 | |
|
349 | |
public int getDefaultEnrollmentEstimate() { |
350 | 551 | return defaultEnrollmentEstimate; |
351 | |
} |
352 | |
|
353 | |
public void setDefaultEnrollmentEstimate(int defaultEnrollmentEstimate) { |
354 | 237 | this.defaultEnrollmentEstimate = defaultEnrollmentEstimate; |
355 | 237 | } |
356 | |
|
357 | |
public int getDefaultMaximumEnrollment() { |
358 | 551 | return defaultMaximumEnrollment; |
359 | |
} |
360 | |
|
361 | |
public void setDefaultMaximumEnrollment(int defaultMaximumEnrollment) { |
362 | 237 | this.defaultMaximumEnrollment = defaultMaximumEnrollment; |
363 | 237 | } |
364 | |
|
365 | |
public boolean isHazardousForDisabledStudents() { |
366 | 551 | return hazardousForDisabledStudents; |
367 | |
} |
368 | |
|
369 | |
public void setHazardousForDisabledStudents( |
370 | |
boolean hazardousForDisabledStudents) { |
371 | 237 | this.hazardousForDisabledStudents = hazardousForDisabledStudents; |
372 | 237 | } |
373 | |
|
374 | |
public CluFee getFee() { |
375 | 609 | return fee; |
376 | |
} |
377 | |
|
378 | |
public void setFee(CluFee fee) { |
379 | 36 | this.fee = fee; |
380 | 36 | } |
381 | |
|
382 | |
public CluAccounting getAccounting() { |
383 | 639 | return accounting; |
384 | |
} |
385 | |
|
386 | |
public void setAccounting(CluAccounting accounting) { |
387 | 26 | this.accounting = accounting; |
388 | 26 | } |
389 | |
|
390 | |
public String getState() { |
391 | 551 | return state; |
392 | |
} |
393 | |
|
394 | |
public void setState(String state) { |
395 | 237 | this.state = state; |
396 | 237 | } |
397 | |
|
398 | |
public CluInstructor getPrimaryInstructor() { |
399 | 707 | return primaryInstructor; |
400 | |
} |
401 | |
|
402 | |
public void setPrimaryInstructor(CluInstructor primaryInstructor) { |
403 | 26 | this.primaryInstructor = primaryInstructor; |
404 | 26 | } |
405 | |
|
406 | |
public List<CluCampusLocation> getCampusLocations() { |
407 | 2755 | return campusLocations; |
408 | |
} |
409 | |
|
410 | |
public void setCampusLocations(List<CluCampusLocation> campusLocationList) { |
411 | 189 | this.campusLocations = campusLocationList; |
412 | 189 | } |
413 | |
|
414 | |
public Amount getIntensity() { |
415 | 635 | return intensity; |
416 | |
} |
417 | |
|
418 | |
public void setIntensity(Amount intensity) { |
419 | 126 | this.intensity = intensity; |
420 | 126 | } |
421 | |
|
422 | |
public List<CluAccreditation> getAccreditations() { |
423 | 1589 | return accreditations; |
424 | |
} |
425 | |
|
426 | |
public void setAccreditations(List<CluAccreditation> accreditations) { |
427 | 189 | this.accreditations = accreditations; |
428 | 189 | } |
429 | |
|
430 | |
|
431 | |
public List<CluAdminOrg> getAdminOrgs() { |
432 | 1437 | return adminOrgs; |
433 | |
} |
434 | |
|
435 | |
public void setAdminOrgs(List<CluAdminOrg> adminOrgs) { |
436 | 237 | this.adminOrgs = adminOrgs; |
437 | 237 | } |
438 | |
|
439 | |
public String getExpectedFirstAtp() { |
440 | 551 | return expectedFirstAtp; |
441 | |
} |
442 | |
|
443 | |
public void setExpectedFirstAtp(String expectedFirstAtp) { |
444 | 237 | this.expectedFirstAtp = expectedFirstAtp; |
445 | 237 | } |
446 | |
|
447 | |
public String getLastAtp() { |
448 | 551 | return lastAtp; |
449 | |
} |
450 | |
|
451 | |
public void setLastAtp(String lastAtp) { |
452 | 237 | this.lastAtp = lastAtp; |
453 | 237 | } |
454 | |
|
455 | |
public String getLastAdmitAtp() { |
456 | 551 | return lastAdmitAtp; |
457 | |
} |
458 | |
|
459 | |
public void setLastAdmitAtp(String lastAdmitAtp) { |
460 | 237 | this.lastAdmitAtp = lastAdmitAtp; |
461 | 237 | } |
462 | |
} |