forked from Archives/Athou_commafeed
store and expose entry categories (#727)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user