1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.digglike.business;
35
36 import fr.paris.lutece.util.date.DateUtil;
37 import fr.paris.lutece.util.xml.XmlUtil;
38
39 import java.sql.Timestamp;
40
41 import java.util.List;
42 import java.util.Locale;
43
44 import javax.servlet.http.HttpServletRequest;
45
46
47
48
49
50
51
52 public class CommentSubmit
53 {
54 public static final int STATE_DISABLE = 0;
55 public static final int STATE_ENABLE = 1;
56 private static final String TAG_DIGG_SUBMIT_COMMENT = "digg-submit-comment";
57 private static final String TAG_DIGG_SUBMIT_COMMENT_DATE = "digg-submit-comment-date";
58 private static final String TAG_DIGG_SUBMIT_COMMENT_VALUE = "digg-submit-comment-value";
59 private static final String TAG_DIGGS_SUBMIT_COMMENTS = "digg-submit-comments";
60 private int _nIdCommentSubmit;
61 private DiggSubmit _diggSubmit;
62 private Timestamp _tDateComment;
63 private String _strValue;
64 private boolean _nActive;
65 private String _strLuteceUserKey;
66 private boolean _bOfficialAnswer;
67 private List<CommentSubmit> _listComments;
68 private int _nIdParent;
69 private Timestamp _tDateModify;
70
71
72
73
74
75 public int getIdCommentSubmit( )
76 {
77 return _nIdCommentSubmit;
78 }
79
80
81
82
83
84 public void setIdCommentSubmit( int idCommentSubmit )
85 {
86 _nIdCommentSubmit = idCommentSubmit;
87 }
88
89
90
91
92
93 public DiggSubmit getDiggSubmit( )
94 {
95 return _diggSubmit;
96 }
97
98
99
100
101
102 public void setDiggSubmit( DiggSubmit diggSubmit )
103 {
104 _diggSubmit = diggSubmit;
105 }
106
107
108
109
110
111 public Timestamp getDateComment( )
112 {
113 return _tDateComment;
114 }
115
116
117
118
119
120 public void setDateComment( Timestamp commentDate )
121 {
122 _tDateComment = commentDate;
123 }
124
125
126
127
128
129 public String getValue( )
130 {
131 return _strValue;
132 }
133
134
135
136
137
138 public void setValue( String value )
139 {
140 _strValue = value;
141 }
142
143
144
145
146
147 public boolean isActive( )
148 {
149 return _nActive;
150 }
151
152
153
154
155
156 public void setActive( boolean active )
157 {
158 _nActive = active;
159 }
160
161
162
163
164
165 public String getLuteceUserKey( )
166 {
167 return _strLuteceUserKey;
168 }
169
170
171
172
173
174
175 public void setLuteceUserKey( String luteceUserKey )
176 {
177 _strLuteceUserKey = luteceUserKey;
178 }
179
180
181
182
183 public void setOfficialAnswer( Boolean bOfficialAnswer )
184 {
185 this._bOfficialAnswer = bOfficialAnswer;
186 }
187
188
189
190
191 public Boolean isOfficialAnswer( )
192 {
193 return _bOfficialAnswer;
194 }
195
196
197
198
199 public void setComments( List<CommentSubmit> listComments )
200 {
201 this._listComments = listComments;
202 }
203
204
205
206
207 public List<CommentSubmit> getComments( )
208 {
209 return _listComments;
210 }
211
212
213
214
215 public void setIdParent( int nIdParent )
216 {
217 this._nIdParent = nIdParent;
218 }
219
220
221
222
223 public int getIdParent( )
224 {
225 return _nIdParent;
226 }
227
228
229
230
231
232 public Timestamp getDateModify( )
233 {
234 return _tDateModify;
235 }
236
237
238
239
240
241 public void setDateModify( Timestamp lastCommentDate )
242 {
243 _tDateModify = lastCommentDate;
244 }
245
246
247
248
249
250
251
252
253 public String getXml( HttpServletRequest request, Locale locale )
254 {
255 StringBuffer strXml = new StringBuffer( );
256 XmlUtil.beginElement( strXml, TAG_DIGG_SUBMIT_COMMENT );
257
258 XmlUtil.addElementHtml( strXml, TAG_DIGG_SUBMIT_COMMENT_DATE,
259 DateUtil.getDateString( getDateComment( ), locale ) );
260 XmlUtil.addElementHtml( strXml, TAG_DIGG_SUBMIT_COMMENT_VALUE, getValue( ) );
261
262 XmlUtil.beginElement( strXml, TAG_DIGGS_SUBMIT_COMMENTS );
263
264 if ( ( getComments( ) != null ) && ( getComments( ).size( ) != 0 ) )
265 {
266 for ( CommentSubmit commentSubmit : getComments( ) )
267 {
268 strXml.append( commentSubmit.getXml( request, locale ) );
269 }
270 }
271
272 XmlUtil.endElement( strXml, TAG_DIGGS_SUBMIT_COMMENTS );
273
274 XmlUtil.endElement( strXml, TAG_DIGG_SUBMIT_COMMENT );
275
276 return strXml.toString( );
277 }
278 }