Change blog descriptor format to include RSS feed flag

This now also handles the case where an RSS blog is deleted via the blog
deletion option and not the feed management.
This commit is contained in:
Torsten Grote
2017-04-10 18:57:14 -03:00
parent 58b9efb24c
commit d40a058ef5
12 changed files with 77 additions and 48 deletions

View File

@@ -13,16 +13,22 @@ import javax.annotation.concurrent.Immutable;
public class Blog extends BaseGroup implements Shareable {
private final Author author;
private final boolean rssFeed;
public Blog(Group group, Author author) {
public Blog(Group group, Author author, boolean rssFeed) {
super(group);
this.author = author;
this.rssFeed = rssFeed;
}
public Author getAuthor() {
return author;
}
public boolean isRssFeed() {
return rssFeed;
}
@Override
public boolean equals(Object o) {
return o instanceof Blog && super.equals(o);

View File

@@ -13,6 +13,11 @@ public interface BlogFactory {
*/
Blog createBlog(Author author);
/**
* Creates a RSS feed blog for a given author.
*/
Blog createFeedBlog(Author author);
/**
* Parses a blog with the given Group
*/

View File

@@ -93,21 +93,9 @@ public class Feed {
if (this == o) return true;
if (o instanceof Feed) {
Feed f = (Feed) o;
return url.equals(f.url) && blog.equals(f.blog) &&
equalsWithNull(title, f.title) &&
equalsWithNull(description, f.description) &&
equalsWithNull(author, f.author) &&
added == f.added &&
updated == f.updated &&
lastEntryTime == f.lastEntryTime;
return blog.equals(f.blog);
}
return false;
}
private boolean equalsWithNull(@Nullable Object a, @Nullable Object b) {
if (a == b) return true;
if (a == null || b == null) return false;
return a.equals(b);
}
}