1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.core.comment.entity; |
17 | |
|
18 | |
import java.util.Date; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import javax.persistence.CascadeType; |
22 | |
import javax.persistence.Column; |
23 | |
import javax.persistence.Entity; |
24 | |
import javax.persistence.JoinColumn; |
25 | |
import javax.persistence.ManyToOne; |
26 | |
import javax.persistence.NamedQueries; |
27 | |
import javax.persistence.NamedQuery; |
28 | |
import javax.persistence.OneToMany; |
29 | |
import javax.persistence.Table; |
30 | |
import javax.persistence.Temporal; |
31 | |
import javax.persistence.TemporalType; |
32 | |
|
33 | |
import org.kuali.student.core.entity.AttributeOwner; |
34 | |
import org.kuali.student.core.entity.MetaEntity; |
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
@Entity |
43 | |
@Table(name = "KSCO_COMMENT") |
44 | |
@NamedQueries( { |
45 | |
@NamedQuery(name = "Comment.getComments", query = "SELECT comment FROM Comment comment JOIN comment.reference r1 WHERE r1.referenceId =:refId AND r1.referenceType.id =:refTypeId ORDER BY comment.meta.updateTime DESC"), |
46 | |
@NamedQuery(name = "Comment.getComment", query = "SELECT comment FROM Comment comment JOIN comment.reference r1 WHERE r1.referenceId =:refId AND r1.referenceType.id =:refTypeId"), |
47 | |
@NamedQuery(name = "Comment.getCommentsByType", query = "SELECT comment FROM Comment comment JOIN comment.reference r1 WHERE r1.referenceId =:refId AND r1.referenceType.id =:refTypeId AND comment.type.id =:commentTypeId"), |
48 | |
@NamedQuery(name = "Comment.getCommentsByRefId", query="SELECT comment FROM Comment comment JOIN comment.reference r1 WHERE r1.referenceId =:refId")}) |
49 | 14 | public class Comment extends MetaEntity implements AttributeOwner<CommentAttribute> { |
50 | |
private static final long serialVersionUID = 1L; |
51 | |
|
52 | |
@ManyToOne(cascade = CascadeType.ALL) |
53 | |
@JoinColumn(name = "RT_DESCR_ID") |
54 | |
private CommentRichText commentText; |
55 | |
|
56 | |
@ManyToOne |
57 | |
@JoinColumn(name = "REFERENCE") |
58 | |
private Reference reference; |
59 | |
|
60 | |
@Temporal(TemporalType.TIMESTAMP) |
61 | |
@Column(name = "EFF_DT") |
62 | |
private Date effectiveDate; |
63 | |
|
64 | |
@Temporal(TemporalType.TIMESTAMP) |
65 | |
@Column(name = "EXPIR_DT") |
66 | |
private Date expirationDate; |
67 | |
|
68 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") |
69 | |
private List<CommentAttribute> attributes; |
70 | |
|
71 | |
@ManyToOne |
72 | |
@JoinColumn(name = "TYPE") |
73 | |
private CommentType type; |
74 | |
|
75 | |
@Column(name = "STATE") |
76 | |
private String state; |
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
public CommentRichText getCommentText() { |
82 | 11 | return commentText; |
83 | |
} |
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | |
public void setCommentText(CommentRichText commentText) { |
89 | 5 | this.commentText = commentText; |
90 | 5 | } |
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
public void setReference(Reference reference) { |
96 | 5 | this.reference = reference; |
97 | 5 | } |
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
public Reference getReference() { |
103 | 0 | return reference; |
104 | |
} |
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
public Date getEffectiveDate() { |
110 | 11 | return effectiveDate; |
111 | |
} |
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
public void setEffectiveDate(Date effectiveDate) { |
117 | 5 | this.effectiveDate = effectiveDate; |
118 | 5 | } |
119 | |
|
120 | |
|
121 | |
|
122 | |
|
123 | |
public Date getExpirationDate() { |
124 | 11 | return expirationDate; |
125 | |
} |
126 | |
|
127 | |
|
128 | |
|
129 | |
|
130 | |
public void setExpirationDate(Date expirationDate) { |
131 | 5 | this.expirationDate = expirationDate; |
132 | 5 | } |
133 | |
|
134 | |
|
135 | |
@Override |
136 | |
public List<CommentAttribute> getAttributes() { |
137 | 38 | return attributes; |
138 | |
} |
139 | |
|
140 | |
@Override |
141 | |
public void setAttributes(List<CommentAttribute> attributes) { |
142 | 13 | this.attributes = attributes; |
143 | 13 | } |
144 | |
|
145 | |
|
146 | |
|
147 | |
|
148 | |
public CommentType getType() { |
149 | 11 | return type; |
150 | |
} |
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
public void setType(CommentType type) { |
156 | 5 | this.type = type; |
157 | 5 | } |
158 | |
|
159 | |
|
160 | |
|
161 | |
|
162 | |
public String getState() { |
163 | 11 | return state; |
164 | |
} |
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
public void setState(String state) { |
170 | 5 | this.state = state; |
171 | 5 | } |
172 | |
|
173 | |
} |