store and expose entry categories (#727)

This commit is contained in:
Athou
2015-05-03 09:17:54 +02:00
parent e8769d09a8
commit efa38d5ee9
8 changed files with 26 additions and 1 deletions

View File

@@ -86,6 +86,8 @@ public class FeedParser {
FeedEntryContent content = new FeedEntryContent();
content.setContent(getContent(item));
content.setCategories(FeedUtils.truncate(
item.getCategories().stream().map(c -> c.getName()).collect(Collectors.joining(", ")), 4096));
content.setTitle(getTitle(item));
content.setAuthor(StringUtils.trimToNull(item.getAuthor()));
SyndEnclosure enclosure = Iterables.getFirst(item.getEnclosures(), null);

View File

@@ -43,6 +43,9 @@ public class FeedEntryContent extends AbstractModel {
@Column(length = 255)
private String enclosureType;
@Column(length = 4096)
private String categories;
@OneToMany(mappedBy = "content")
private Set<FeedEntry> entries;

View File

@@ -89,6 +89,7 @@ public class FeedEntryFilteringService {
context.set("content", entry.getContent().getContent() == null ? "" : Jsoup.parse(entry.getContent().getContent()).text()
.toLowerCase());
context.set("url", entry.getUrl() == null ? "" : entry.getUrl().toLowerCase());
context.set("categories", entry.getContent().getCategories() == null ? "" : entry.getContent().getCategories().toLowerCase());
Callable<Object> callable = script.callable(context);
Future<Object> future = executor.submit(callable);

View File

@@ -56,6 +56,7 @@ public class Entry implements Serializable {
entry.setAuthor(content.getAuthor());
entry.setEnclosureUrl(content.getEnclosureUrl());
entry.setEnclosureType(content.getEnclosureType());
entry.setCategories(content.getCategories());
}
return entry;
@@ -95,6 +96,9 @@ public class Entry implements Serializable {
@ApiModelProperty("entry content")
private String content;
@ApiModelProperty("comma-separated list of categories")
private String categories;
@ApiModelProperty("wether entry content and title are rtl")
private boolean rtl;