2013-03-23 16:17:19 +01:00
|
|
|
package com.commafeed.backend.model;
|
2013-03-20 20:33:42 +01:00
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
import javax.persistence.Column;
|
|
|
|
|
import javax.persistence.Entity;
|
2013-04-07 12:01:50 +02:00
|
|
|
import javax.persistence.ManyToMany;
|
2013-03-20 20:33:42 +01:00
|
|
|
import javax.persistence.OneToMany;
|
|
|
|
|
import javax.persistence.Table;
|
|
|
|
|
import javax.persistence.Temporal;
|
|
|
|
|
import javax.persistence.TemporalType;
|
|
|
|
|
|
|
|
|
|
import com.google.common.collect.Sets;
|
|
|
|
|
|
|
|
|
|
@Entity
|
|
|
|
|
@Table(name = "FEEDS")
|
2013-03-21 08:55:53 +01:00
|
|
|
@SuppressWarnings("serial")
|
2013-03-23 01:49:39 +01:00
|
|
|
public class Feed extends AbstractModel {
|
2013-03-20 20:33:42 +01:00
|
|
|
|
2013-04-14 18:28:48 +02:00
|
|
|
/**
|
|
|
|
|
* The url of the feed
|
|
|
|
|
*/
|
2013-03-31 08:45:55 +02:00
|
|
|
@Column(length = 2048, nullable = false)
|
2013-03-20 20:33:42 +01:00
|
|
|
private String url;
|
|
|
|
|
|
2013-04-14 18:28:48 +02:00
|
|
|
@Column(length = 40, nullable = false)
|
|
|
|
|
private String urlHash;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The url of the website, extracted from the feed
|
|
|
|
|
*/
|
2013-04-03 15:53:57 +02:00
|
|
|
@Column(length = 2048)
|
|
|
|
|
private String link;
|
|
|
|
|
|
2013-04-19 11:51:40 +02:00
|
|
|
/**
|
|
|
|
|
* Last time we tried to fetch the feed
|
|
|
|
|
*/
|
2013-03-20 20:33:42 +01:00
|
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
|
|
|
private Date lastUpdated;
|
|
|
|
|
|
2013-06-08 21:47:19 +02:00
|
|
|
/**
|
|
|
|
|
* Last publishedDate value in the feed
|
|
|
|
|
*/
|
|
|
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
|
|
|
private Date lastPublishedDate;
|
|
|
|
|
|
2013-06-10 12:53:46 +02:00
|
|
|
/**
|
|
|
|
|
* date of the last entry of the feed
|
|
|
|
|
*/
|
|
|
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
|
|
|
private Date lastEntryDate;
|
|
|
|
|
|
2013-04-19 11:51:40 +02:00
|
|
|
/**
|
|
|
|
|
* Last time we successfully refreshed the feed
|
|
|
|
|
*/
|
|
|
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
|
|
|
private Date lastUpdateSuccess;
|
|
|
|
|
|
2013-06-10 12:53:46 +02:00
|
|
|
/**
|
|
|
|
|
* error message while retrieving the feed
|
|
|
|
|
*/
|
2013-03-25 12:24:00 +01:00
|
|
|
@Column(length = 1024)
|
|
|
|
|
private String message;
|
|
|
|
|
|
2013-06-10 12:53:46 +02:00
|
|
|
/**
|
|
|
|
|
* times we failed to retrieve the feed
|
|
|
|
|
*/
|
2013-04-09 09:03:52 +02:00
|
|
|
private int errorCount;
|
|
|
|
|
|
2013-06-10 12:53:46 +02:00
|
|
|
/**
|
|
|
|
|
* feed refresh is disabled until this date
|
|
|
|
|
*/
|
2013-04-11 16:50:20 +02:00
|
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
|
|
|
private Date disabledUntil;
|
|
|
|
|
|
2013-06-10 12:53:46 +02:00
|
|
|
/**
|
|
|
|
|
* http header returned by the feed
|
|
|
|
|
*/
|
2013-04-17 12:49:03 +02:00
|
|
|
@Column(length = 64)
|
|
|
|
|
private String lastModifiedHeader;
|
|
|
|
|
|
2013-06-10 12:53:46 +02:00
|
|
|
/**
|
|
|
|
|
* http header returned by the feed
|
|
|
|
|
*/
|
2013-04-19 15:22:39 +02:00
|
|
|
@Column(length = 255)
|
2013-04-17 12:49:03 +02:00
|
|
|
private String etagHeader;
|
|
|
|
|
|
2013-06-10 12:53:46 +02:00
|
|
|
/**
|
|
|
|
|
* average time between entries in the feed
|
|
|
|
|
*/
|
|
|
|
|
private Long averageEntryInterval;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* last hash of the content of the feed xml
|
|
|
|
|
*/
|
2013-06-09 16:22:38 +02:00
|
|
|
@Column(length = 40)
|
|
|
|
|
private String lastContentHash;
|
|
|
|
|
|
2013-04-07 12:01:50 +02:00
|
|
|
@ManyToMany(mappedBy = "feeds")
|
2013-03-20 20:33:42 +01:00
|
|
|
private Set<FeedEntry> entries = Sets.newHashSet();
|
|
|
|
|
|
2013-03-27 11:32:22 +01:00
|
|
|
@OneToMany(mappedBy = "feed")
|
|
|
|
|
private Set<FeedSubscription> subscriptions;
|
|
|
|
|
|
2013-06-10 12:53:46 +02:00
|
|
|
/**
|
|
|
|
|
* detected hub for pubsubhubbub
|
|
|
|
|
*/
|
2013-06-05 21:50:26 +02:00
|
|
|
@Column(length = 2048)
|
|
|
|
|
private String pushHub;
|
|
|
|
|
|
2013-06-10 12:53:46 +02:00
|
|
|
/**
|
|
|
|
|
* detected topic for pubsubhubbub
|
|
|
|
|
*/
|
2013-06-05 21:50:26 +02:00
|
|
|
@Column(length = 2048)
|
|
|
|
|
private String pushTopic;
|
|
|
|
|
|
2013-06-16 11:48:23 +02:00
|
|
|
@Column(name = "push_topic_hash", length = 2048)
|
|
|
|
|
private String pushTopicHash;
|
|
|
|
|
|
2013-06-10 12:53:46 +02:00
|
|
|
/**
|
|
|
|
|
* last time we subscribed for that topic on that hub
|
|
|
|
|
*/
|
2013-06-05 21:50:26 +02:00
|
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
|
|
|
private Date pushLastPing;
|
|
|
|
|
|
2013-03-20 20:33:42 +01:00
|
|
|
public Feed() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Feed(String url) {
|
|
|
|
|
this.url = url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getUrl() {
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setUrl(String url) {
|
|
|
|
|
this.url = url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Date getLastUpdated() {
|
|
|
|
|
return lastUpdated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setLastUpdated(Date lastUpdated) {
|
|
|
|
|
this.lastUpdated = lastUpdated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Set<FeedEntry> getEntries() {
|
|
|
|
|
return entries;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setEntries(Set<FeedEntry> entries) {
|
|
|
|
|
this.entries = entries;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-25 12:24:00 +01:00
|
|
|
public String getMessage() {
|
|
|
|
|
return message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setMessage(String message) {
|
|
|
|
|
this.message = message;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-27 11:32:22 +01:00
|
|
|
public Set<FeedSubscription> getSubscriptions() {
|
|
|
|
|
return subscriptions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setSubscriptions(Set<FeedSubscription> subscriptions) {
|
|
|
|
|
this.subscriptions = subscriptions;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-03 15:53:57 +02:00
|
|
|
public String getLink() {
|
|
|
|
|
return link;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setLink(String link) {
|
|
|
|
|
this.link = link;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-09 09:03:52 +02:00
|
|
|
public int getErrorCount() {
|
|
|
|
|
return errorCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setErrorCount(int errorCount) {
|
|
|
|
|
this.errorCount = errorCount;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-11 16:50:20 +02:00
|
|
|
public Date getDisabledUntil() {
|
|
|
|
|
return disabledUntil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setDisabledUntil(Date disabledUntil) {
|
|
|
|
|
this.disabledUntil = disabledUntil;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-14 18:28:48 +02:00
|
|
|
public String getUrlHash() {
|
|
|
|
|
return urlHash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setUrlHash(String urlHash) {
|
|
|
|
|
this.urlHash = urlHash;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-17 12:49:03 +02:00
|
|
|
public String getLastModifiedHeader() {
|
|
|
|
|
return lastModifiedHeader;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setLastModifiedHeader(String lastModifiedHeader) {
|
|
|
|
|
this.lastModifiedHeader = lastModifiedHeader;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getEtagHeader() {
|
|
|
|
|
return etagHeader;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setEtagHeader(String etagHeader) {
|
|
|
|
|
this.etagHeader = etagHeader;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-19 11:51:40 +02:00
|
|
|
public Date getLastUpdateSuccess() {
|
|
|
|
|
return lastUpdateSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setLastUpdateSuccess(Date lastUpdateSuccess) {
|
|
|
|
|
this.lastUpdateSuccess = lastUpdateSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 21:50:26 +02:00
|
|
|
public String getPushHub() {
|
|
|
|
|
return pushHub;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setPushHub(String pushHub) {
|
|
|
|
|
this.pushHub = pushHub;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getPushTopic() {
|
|
|
|
|
return pushTopic;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setPushTopic(String pushTopic) {
|
|
|
|
|
this.pushTopic = pushTopic;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Date getPushLastPing() {
|
|
|
|
|
return pushLastPing;
|
2013-05-20 14:06:09 +02:00
|
|
|
}
|
|
|
|
|
|
2013-06-05 21:50:26 +02:00
|
|
|
public void setPushLastPing(Date pushLastPing) {
|
|
|
|
|
this.pushLastPing = pushLastPing;
|
2013-05-20 14:06:09 +02:00
|
|
|
}
|
|
|
|
|
|
2013-06-08 21:47:19 +02:00
|
|
|
public Date getLastPublishedDate() {
|
|
|
|
|
return lastPublishedDate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setLastPublishedDate(Date lastPublishedDate) {
|
|
|
|
|
this.lastPublishedDate = lastPublishedDate;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-09 16:22:38 +02:00
|
|
|
public String getLastContentHash() {
|
|
|
|
|
return lastContentHash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setLastContentHash(String lastContentHash) {
|
|
|
|
|
this.lastContentHash = lastContentHash;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-10 12:53:46 +02:00
|
|
|
public Long getAverageEntryInterval() {
|
|
|
|
|
return averageEntryInterval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setAverageEntryInterval(Long averageEntryInterval) {
|
|
|
|
|
this.averageEntryInterval = averageEntryInterval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Date getLastEntryDate() {
|
|
|
|
|
return lastEntryDate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setLastEntryDate(Date lastEntryDate) {
|
|
|
|
|
this.lastEntryDate = lastEntryDate;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-16 11:48:23 +02:00
|
|
|
public String getPushTopicHash() {
|
|
|
|
|
return pushTopicHash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setPushTopicHash(String pushTopicHash) {
|
|
|
|
|
this.pushTopicHash = pushTopicHash;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-20 20:33:42 +01:00
|
|
|
}
|