1 package de.dhbwloe.campusapp.news;
3 import java.text.DateFormat;
4 import java.text.SimpleDateFormat;
6 import java.util.Locale;
7 import java.util.zip.CRC32;
10 * Created by pk910 on 23.01.2016.
12 public class NewsItem {
14 private String sSource;
16 private String sUniqueId;
18 private String sTitle;
19 private String sSummary;
20 private String sContent;
22 private String sCategories;
24 private boolean bIsNew;
26 public NewsItem(int id, String source, long time, String uniqueid, long chksum, String title, String summary, String content, String link, String categories) {
31 sTitle = title.trim();
35 sCategories = categories;
38 public long calculateChkSum() {
39 CRC32 crc = new CRC32();
40 crc.update(sTitle.getBytes());
41 crc.update(sUniqueId.getBytes());
42 crc.update((int)iTime);
43 crc.update(sSummary.getBytes());
45 crc.update(sContent.getBytes());
47 crc.update(sLink.getBytes());
48 if(sCategories != null)
49 crc.update(sCategories.getBytes());
51 long crcvalue = crc.getValue();
56 public long getChkSum() {
60 public void setIsNew(int id) {
65 public boolean getIsNew(boolean reset) {
66 boolean isnew = bIsNew;
76 public String getSource() {
80 public long getTime() {
84 public String getFormatedDate() {
85 return getFormatedDate("dd.MM.yyyy");
88 public String getFormatedDate(String format) {
89 DateFormat df = new SimpleDateFormat("dd.MM.yyyy", Locale.ENGLISH);
90 return df.format(new Date(iTime * 1000));
93 public String getUniqueId() {
97 public String getTitle() {
101 public String getSummary() {
105 public String getContent() {
109 public String getLink() {
113 public String getCategories() {