1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.core.atp.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.Entity; |
26 | |
import javax.persistence.JoinColumn; |
27 | |
import javax.persistence.ManyToOne; |
28 | |
import javax.persistence.NamedQueries; |
29 | |
import javax.persistence.NamedQuery; |
30 | |
import javax.persistence.OneToMany; |
31 | |
import javax.persistence.Table; |
32 | |
import javax.persistence.Temporal; |
33 | |
import javax.persistence.TemporalType; |
34 | |
|
35 | |
import org.kuali.student.core.entity.AttributeOwner; |
36 | |
import org.kuali.student.core.entity.MetaEntity; |
37 | |
|
38 | |
@Entity |
39 | |
@Table(name = "KSAP_DT_RANGE") |
40 | |
@NamedQueries({ |
41 | |
@NamedQuery(name="DateRange.findDateRangesByAtp", query="SELECT dateRange FROM DateRange dateRange WHERE dateRange.atp.id = :atpId"), |
42 | |
@NamedQuery(name="DateRange.findDateRangesByDate", query="SELECT dateRange FROM DateRange dateRange WHERE dateRange.startDate <= :searchDate AND dateRange.endDate >= :searchDate") |
43 | |
}) |
44 | |
@AttributeOverrides({ |
45 | |
@AttributeOverride(name="id", column=@Column(name="DATERANGE_KEY"))}) |
46 | 7 | public class DateRange extends MetaEntity implements AttributeOwner<DateRangeAttribute> { |
47 | |
|
48 | |
@Column(name = "NAME") |
49 | |
private String name; |
50 | |
|
51 | |
@ManyToOne(cascade=CascadeType.ALL) |
52 | |
@JoinColumn(name = "RT_DESCR_ID") |
53 | |
private AtpRichText descr; |
54 | |
|
55 | |
@ManyToOne |
56 | |
@JoinColumn(name = "ATP_ID") |
57 | |
private Atp atp; |
58 | |
|
59 | |
@Temporal(TemporalType.TIMESTAMP) |
60 | |
@Column(name="START_DT") |
61 | |
private Date startDate; |
62 | |
|
63 | |
@Temporal(TemporalType.TIMESTAMP) |
64 | |
@Column(name="END_DT") |
65 | |
private Date endDate; |
66 | |
|
67 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") |
68 | |
private List<DateRangeAttribute> attributes; |
69 | |
|
70 | |
@ManyToOne |
71 | |
@JoinColumn(name = "DT_RANGE_TYPE_ID") |
72 | |
private DateRangeType type; |
73 | |
|
74 | |
@Column(name="STATE") |
75 | |
private String state; |
76 | |
|
77 | |
public String getName() { |
78 | 4 | return name; |
79 | |
} |
80 | |
|
81 | |
public void setName(String name) { |
82 | 3 | this.name = name; |
83 | 3 | } |
84 | |
|
85 | |
public AtpRichText getDescr() { |
86 | 4 | return descr; |
87 | |
} |
88 | |
|
89 | |
public void setDescr(AtpRichText descr) { |
90 | 3 | this.descr = descr; |
91 | 3 | } |
92 | |
|
93 | |
public Atp getAtp() { |
94 | 4 | return atp; |
95 | |
} |
96 | |
|
97 | |
public void setAtp(Atp atp) { |
98 | 3 | this.atp = atp; |
99 | 3 | } |
100 | |
|
101 | |
public Date getStartDate() { |
102 | 4 | return startDate; |
103 | |
} |
104 | |
|
105 | |
public void setStartDate(Date startDate) { |
106 | 3 | this.startDate = startDate; |
107 | 3 | } |
108 | |
|
109 | |
public Date getEndDate() { |
110 | 4 | return endDate; |
111 | |
} |
112 | |
|
113 | |
public void setEndDate(Date endDate) { |
114 | 3 | this.endDate = endDate; |
115 | 3 | } |
116 | |
|
117 | |
public List<DateRangeAttribute> getAttributes() { |
118 | 10 | return attributes; |
119 | |
} |
120 | |
|
121 | |
public void setAttributes(List<DateRangeAttribute> attributes) { |
122 | 4 | this.attributes = attributes; |
123 | 4 | } |
124 | |
|
125 | |
public DateRangeType getType() { |
126 | 4 | return type; |
127 | |
} |
128 | |
|
129 | |
public void setType(DateRangeType type) { |
130 | 3 | this.type = type; |
131 | 3 | } |
132 | |
|
133 | |
public String getState() { |
134 | 4 | return state; |
135 | |
} |
136 | |
|
137 | |
public void setState(String state) { |
138 | 2 | this.state = state; |
139 | 2 | } |
140 | |
|
141 | |
} |