1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.mobility.feedback.entity;
17
18 import java.io.Serializable;
19 import java.sql.Timestamp;
20
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.GenerationType;
25 import javax.persistence.Id;
26 import javax.persistence.Table;
27 import javax.persistence.Version;
28
29 @Entity
30 @Table(name="KME_FDBCK_T")
31 public class Feedback implements Serializable {
32
33 private static final long serialVersionUID = 7273789153652061359L;
34
35 @Id
36 @GeneratedValue(strategy = GenerationType.TABLE)
37 @Column(name="ID")
38 private Long feedbackId;
39
40 @Column(name="PST_TS")
41 private Timestamp postedTimestamp;
42
43 @Column(name="TXT")
44 private String noteText;
45
46 @Column(name="CMPS")
47 private String campus;
48
49 @Column(name="AFFL")
50 private String affiliation;
51
52 @Column(name="DVC_TYP")
53 private String deviceType;
54
55 @Column(name="UA")
56 private String userAgent;
57
58 @Column(name="SRVC")
59 private String service;
60
61 @Column(name="EMAIL")
62 private String email;
63
64 @Column(name="USR_ID")
65 private String userId;
66
67 @Version
68 @Column(name="VER_NBR")
69 protected Long versionNumber;
70
71 public Feedback() {}
72
73 public String getNoteTextShort() {
74 if (this.getNoteText() != null) {
75 return this.getNoteText().length() > 50 ? this.getNoteText().substring(0, 50) + "..." : this.getNoteText();
76 }
77 return "";
78 }
79
80 public String getNoteFormatted() {
81 return this.getNoteText().replaceAll("\\n", "<br/>");
82 }
83
84 public Long getFeedbackId() {
85 return feedbackId;
86 }
87
88 public void setFeedbackId(Long feedbackId) {
89 this.feedbackId = feedbackId;
90 }
91
92 public Timestamp getPostedTimestamp() {
93 return postedTimestamp;
94 }
95
96 public void setPostedTimestamp(Timestamp postedTimestamp) {
97 this.postedTimestamp = postedTimestamp;
98 }
99
100 public String getNoteText() {
101 if (noteText != null) {
102 return noteText;
103 }
104 return "";
105 }
106
107 public String getNoteTextExport() {
108 if (noteText != null) {
109 String text = new String(noteText);
110 text = text.replaceAll("\t", " ");
111 text = text.replaceAll("\r", " ");
112 text = text.replaceAll("\n", " ");
113 return text;
114 }
115 return "";
116 }
117
118 public void setNoteText(String noteText) {
119 this.noteText = noteText;
120 }
121
122 public Long getVersionNumber() {
123 return versionNumber;
124 }
125
126 public void setVersionNumber(Long versionNumber) {
127 this.versionNumber = versionNumber;
128 }
129
130 public String getCampus() {
131 return campus;
132 }
133
134 public void setCampus(String campus) {
135 this.campus = campus;
136 }
137
138 public String getAffiliation() {
139 return affiliation;
140 }
141
142 public void setAffiliation(String affiliation) {
143 this.affiliation = affiliation;
144 }
145
146 public String getDeviceType() {
147 return deviceType;
148 }
149
150 public void setDeviceType(String deviceType) {
151 this.deviceType = deviceType;
152 }
153
154 public String getUserAgent() {
155 return userAgent;
156 }
157
158 public void setUserAgent(String userAgent) {
159 this.userAgent = userAgent;
160 }
161
162 public String getService() {
163 return service;
164 }
165
166 public void setService(String service) {
167 this.service = service;
168 }
169
170 public String getEmail() {
171 return email;
172 }
173
174 public void setEmail(String email) {
175 this.email = email;
176 }
177
178 public String getUserId() {
179 return userId;
180 }
181
182 public void setUserId(String userId) {
183 this.userId = userId;
184 }
185
186 @Override
187 public String toString() {
188 String newline = "\r\n";
189 String str = "Campus: "+ this.getCampus();
190 str = str + newline + "Affiliation: " + this.getAffiliation();
191 str = str + newline + "User Id: " + this.getUserId();
192 str = str + newline + "Email: " + this.getEmail();
193 str = str + newline + "Device: " + this.getDeviceType();
194 str = str + newline + "User Agent: " + this.getUserAgent();
195 str = str + newline + "Timestamp: " + this.getPostedTimestamp();
196 str = str + newline + "Service: " + this.getService();
197 str = str + newline + newline + this.getNoteTextExport();
198 return str;
199 }
200 }