Post RSS entries within one transaction

This also fixes a bug where new feeds was not added properly.
This commit is contained in:
Torsten Grote
2016-08-24 12:39:04 -03:00
parent e10f68b496
commit 72fb4e9bc7
5 changed files with 89 additions and 43 deletions

View File

@@ -29,6 +29,9 @@ public interface BlogManager {
/** Stores a local blog post. */
void addLocalPost(BlogPost p) throws DbException;
/** Stores a local blog post. */
void addLocalPost(Transaction txn, BlogPost p) throws DbException;
/** Returns the blog with the given ID. */
Blog getBlog(GroupId g) throws DbException;

View File

@@ -110,4 +110,25 @@ public class Feed {
return lastEntryTime;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o instanceof Feed) {
Feed f = (Feed) o;
return url.equals(f.url) && blogId.equals(f.getBlogId()) &&
equalsWithNull(title, f.getTitle()) &&
equalsWithNull(description, f.getDescription()) &&
equalsWithNull(author, f.getAuthor()) &&
added == f.getAdded() &&
updated == f.getUpdated() &&
lastEntryTime == f.getLastEntryTime();
}
return false;
}
private boolean equalsWithNull(Object a, Object b) {
if (a == b) return true;
if (a == null || b==null) return false;
return a.equals(b);
}
}