1 31 package org.blojsom.blog.database; 32 33 import org.blojsom.blog.Entry; 34 import org.blojsom.blog.Trackback; 35 import org.blojsom.util.BlojsomUtils; 36 37 import java.io.Serializable ; 38 import java.text.SimpleDateFormat ; 39 import java.util.Date ; 40 import java.util.HashMap ; 41 import java.util.Locale ; 42 import java.util.Map ; 43 44 51 public class DatabaseTrackback implements Trackback, Serializable { 52 53 protected Integer _id; 54 protected Integer _blogId; 55 protected Integer _blogEntryId; 56 protected Entry _entry; 57 58 protected String _title; 59 protected String _excerpt; 60 protected String _url; 61 protected String _blogName; 62 protected Date _trackbackDate; 63 protected long _trackbackDateLong; 64 protected Map _metaData; 65 protected String _status; 66 protected String _ip; 67 68 71 public DatabaseTrackback() { 72 } 73 74 79 public void setId(Integer id) { 80 _id = id; 81 } 82 83 88 public Integer getId() { 89 return _id; 90 } 91 92 97 public void setBlogId(Integer blogId) { 98 _blogId = blogId; 99 } 100 101 106 public Integer getBlogId() { 107 return _blogId; 108 } 109 110 115 public Integer getBlogEntryId() { 116 return _blogEntryId; 117 } 118 119 124 public void setBlogEntryId(Integer blogEntryId) { 125 _blogEntryId = blogEntryId; 126 } 127 128 133 public Entry getEntry() { 134 return _entry; 135 } 136 137 142 public void setEntry(Entry entry) { 143 _entry = entry; 144 } 145 146 151 public String getTitle() { 152 return _title; 153 } 154 155 160 public String getEscapedTitle() { 161 return BlojsomUtils.escapeString(_title); 162 } 163 164 169 public void setTitle(String title) { 170 _title = title; 171 } 172 173 178 public String getExcerpt() { 179 return _excerpt; 180 } 181 182 187 public String getEscapedExcerpt() { 188 return BlojsomUtils.escapeString(_excerpt); 189 } 190 191 196 public void setExcerpt(String excerpt) { 197 _excerpt = excerpt; 198 } 199 200 205 public String getUrl() { 206 return _url; 207 } 208 209 214 public String getEscapedUrl() { 215 return BlojsomUtils.escapeString(_url); 216 } 217 218 223 public void setUrl(String url) { 224 _url = url; 225 } 226 227 232 public String getBlogName() { 233 return _blogName; 234 } 235 236 241 public String getEscapedBlogName() { 242 return BlojsomUtils.escapeString(_blogName); 243 } 244 245 250 public Map getMetaData() { 251 if (_metaData == null) { 252 return new HashMap (); 253 } 254 255 return _metaData; 256 } 257 258 263 public void setBlogName(String blogName) { 264 _blogName = blogName; 265 } 266 267 272 public void setTrackbackDateLong(long trackbackDateLong) { 273 _trackbackDateLong = trackbackDateLong; 274 _trackbackDate = new Date (_trackbackDateLong); 275 } 276 277 282 public long getTrackbackDateLong() { 283 return _trackbackDateLong; 284 } 285 286 291 public void setMetaData(Map metaData) { 292 _metaData = metaData; 293 } 294 295 302 public String getDateAsFormat(String format) { 303 return getDateAsFormat(format, null); 304 } 305 306 313 public String getDateAsFormat(String format, Locale locale) { 314 if (_trackbackDate == null || format == null) { 315 return null; 316 } 317 318 SimpleDateFormat sdf; 319 try { 320 if (locale == null) { 321 sdf = new SimpleDateFormat (format); 322 } else { 323 sdf = new SimpleDateFormat (format, locale); 324 } 325 326 return sdf.format(_trackbackDate); 327 } catch (IllegalArgumentException e) { 328 return _trackbackDate.toString(); 329 } 330 } 331 332 337 public Date getTrackbackDate() { 338 return _trackbackDate; 339 } 340 341 346 public void setTrackbackDate(Date trackbackDate) { 347 _trackbackDate = trackbackDate; 348 _trackbackDateLong = _trackbackDate.getTime(); 349 } 350 351 356 public String getIp() { 357 return _ip; 358 } 359 360 365 public void setIp(String ip) { 366 _ip = ip; 367 } 368 369 374 public String getStatus() { 375 return _status; 376 } 377 378 383 public void setStatus(String status) { 384 _status = status; 385 } 386 387 392 public Date getDate() { 393 return _trackbackDate; 394 } 395 396 401 public String getType() { 402 return TRACKBACK_TYPE; 403 } 404 } 405 | Popular Tags |