This commit is contained in:
Athou
2013-04-09 09:03:52 +02:00
parent ea8a5def8c
commit 7b9bfeb816
8 changed files with 29 additions and 3 deletions

View File

@@ -66,6 +66,7 @@ public class FeedEntryService extends GenericDAO<FeedEntry> {
feed.setLastUpdated(Calendar.getInstance().getTime());
feed.setMessage(null);
feed.setErrorCount(0);
feedService.update(feed);
}

View File

@@ -49,6 +49,7 @@ public class FeedUpdater {
+ e.getMessage());
feed.setLastUpdated(Calendar.getInstance().getTime());
feed.setMessage("Unable to refresh feed: " + e.getMessage());
feed.setErrorCount(feed.getErrorCount() + 1);
feedService.update(feed);
}
}

View File

@@ -34,6 +34,8 @@ public class Feed extends AbstractModel {
@Column(length = 1024)
private String message;
private int errorCount;
@ManyToMany(mappedBy = "feeds")
private Set<FeedEntry> entries = Sets.newHashSet();
@@ -104,4 +106,12 @@ public class Feed extends AbstractModel {
this.link = link;
}
public int getErrorCount() {
return errorCount;
}
public void setErrorCount(int errorCount) {
this.errorCount = errorCount;
}
}

View File

@@ -9,6 +9,7 @@ import com.google.common.collect.Lists;
public class Entries implements Serializable {
private String name;
private String message;
private int errorCount;
private List<Entry> entries = Lists.newArrayList();
public String getName() {
@@ -35,4 +36,12 @@ public class Entries implements Serializable {
this.message = message;
}
public int getErrorCount() {
return errorCount;
}
public void setErrorCount(int errorCount) {
this.errorCount = errorCount;
}
}

View File

@@ -55,6 +55,7 @@ public class EntriesREST extends AbstractREST {
if (subscription != null) {
entries.setName(subscription.getTitle());
entries.setMessage(subscription.getFeed().getMessage());
entries.setErrorCount(subscription.getFeed().getErrorCount());
List<FeedEntryStatus> unreadEntries = feedEntryStatusService
.getStatuses(subscription.getFeed(), getUser(),