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