persist entry author

This commit is contained in:
Athou
2013-05-19 06:47:37 +02:00
parent bf8f25af92
commit f59198e018
4 changed files with 29 additions and 0 deletions

View File

@@ -60,6 +60,7 @@ public class FeedParser {
entry.setGuidHash(DigestUtils.sha1Hex(item.getUri()));
entry.setUrl(item.getLink());
entry.setUpdated(validateDate(getUpdateDate(item)));
entry.setAuthor(item.getAuthor());
FeedEntryContent content = new FeedEntryContent();
content.setContent(getContent(item));

View File

@@ -43,6 +43,9 @@ public class FeedEntry extends AbstractModel {
@Column(length = 2048)
private String url;
@Column(length = 128)
private String author;
@Temporal(TemporalType.TIMESTAMP)
@Index(name = "inserted_index")
private Date inserted;
@@ -118,4 +121,12 @@ public class FeedEntry extends AbstractModel {
this.guidHash = guidHash;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}

View File

@@ -65,6 +65,11 @@ public class FeedUpdateService {
content.setTitle(title.substring(0,
Math.min(2048, title.length())));
}
String author = entry.getAuthor();
if (author != null) {
entry.setAuthor(author.substring(0,
Math.min(128, author.length())));
}
entry.setInserted(Calendar.getInstance().getTime());
entry.getFeeds().add(feed);

View File

@@ -30,6 +30,7 @@ public class Entry implements Serializable {
entry.setGuid(feedEntry.getGuid());
entry.setTitle(feedEntry.getContent().getTitle());
entry.setContent(feedEntry.getContent().getContent());
entry.setAuthor(feedEntry.getAuthor());
entry.setEnclosureUrl(status.getEntry().getContent().getEnclosureUrl());
entry.setEnclosureType(status.getEntry().getContent()
.getEnclosureType());
@@ -73,6 +74,9 @@ public class Entry implements Serializable {
@ApiProperty("entry content")
private String content;
@ApiProperty("entry author")
private String author;
@ApiProperty("entry enclosure url, if any")
private String enclosureUrl;
@@ -215,4 +219,12 @@ public class Entry implements Serializable {
this.feedLink = feedLink;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}