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;
|
|
|
|
|
|
2013-04-13 01:24:28 +02:00
|
|
|
import org.hibernate.annotations.Index;
|
|
|
|
|
|
2013-03-20 20:33:42 +01:00
|
|
|
import com.google.common.collect.Sets;
|
|
|
|
|
|
|
|
|
|
@Entity
|
|
|
|
|
@Table(name = "FEEDS")
|
2013-05-24 15:16:29 +02:00
|
|
|
@org.hibernate.annotations.Table(appliesTo = "FEEDS", indexes = { @Index(name = "disabled_lastupdated_index", columnNames = {
|
|
|
|
|
"disabledUntil", "lastUpdated" }), })
|
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)
|
|
|
|
|
@Index(name = "urlHash_index")
|
|
|
|
|
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)
|
2013-04-13 01:24:28 +02:00
|
|
|
@Index(name = "lastupdated_index")
|
2013-03-20 20:33:42 +01:00
|
|
|
private Date lastUpdated;
|
|
|
|
|
|
2013-04-19 11:51:40 +02:00
|
|
|
/**
|
|
|
|
|
* Last time we successfully refreshed the feed
|
|
|
|
|
*/
|
|
|
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
|
|
|
private Date lastUpdateSuccess;
|
|
|
|
|
|
2013-03-25 12:24:00 +01:00
|
|
|
@Column(length = 1024)
|
|
|
|
|
private String message;
|
|
|
|
|
|
2013-04-09 09:03:52 +02:00
|
|
|
private int errorCount;
|
|
|
|
|
|
2013-04-11 16:50:20 +02:00
|
|
|
@Temporal(TemporalType.TIMESTAMP)
|
2013-04-13 01:24:28 +02:00
|
|
|
@Index(name = "disableduntil_index")
|
2013-04-11 16:50:20 +02:00
|
|
|
private Date disabledUntil;
|
|
|
|
|
|
2013-04-17 12:49:03 +02:00
|
|
|
@Column(length = 64)
|
|
|
|
|
private String lastModifiedHeader;
|
|
|
|
|
|
2013-04-19 15:22:39 +02:00
|
|
|
@Column(length = 255)
|
2013-04-17 12:49:03 +02:00
|
|
|
private String etagHeader;
|
|
|
|
|
|
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-05 21:50:26 +02:00
|
|
|
@Column(length = 2048)
|
|
|
|
|
private String pushHub;
|
|
|
|
|
|
|
|
|
|
@Column(length = 2048)
|
|
|
|
|
@Index(name = "topic_index")
|
|
|
|
|
private String pushTopic;
|
|
|
|
|
|
|
|
|
|
@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-03-20 20:33:42 +01:00
|
|
|
}
|