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;
|
|
|
|
|
|
2013-06-19 18:44:56 +02:00
|
|
|
import javax.persistence.Cacheable;
|
2013-07-24 15:39:20 +02:00
|
|
|
import javax.persistence.CascadeType;
|
2013-03-20 20:33:42 +01:00
|
|
|
import javax.persistence.Column;
|
|
|
|
|
import javax.persistence.Entity;
|
|
|
|
|
import javax.persistence.OneToMany;
|
|
|
|
|
import javax.persistence.Table;
|
|
|
|
|
import javax.persistence.Temporal;
|
|
|
|
|
import javax.persistence.TemporalType;
|
|
|
|
|
|
2013-08-11 14:01:16 +02:00
|
|
|
import lombok.Getter;
|
|
|
|
|
import lombok.Setter;
|
2013-08-11 12:09:05 +02:00
|
|
|
|
2013-06-19 18:44:56 +02:00
|
|
|
import org.hibernate.annotations.Cache;
|
|
|
|
|
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
|
|
|
|
|
2013-03-20 20:33:42 +01:00
|
|
|
@Entity
|
|
|
|
|
@Table(name = "FEEDS")
|
2013-03-21 08:55:53 +01:00
|
|
|
@SuppressWarnings("serial")
|
2013-06-19 18:44:56 +02:00
|
|
|
@Cacheable
|
|
|
|
|
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
2013-08-11 14:01:16 +02:00
|
|
|
@Getter
|
|
|
|
|
@Setter
|
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-07-02 14:33:53 +02:00
|
|
|
@Column(length = 2048, nullable = false)
|
|
|
|
|
private String normalizedUrl;
|
2013-07-04 21:32:34 +02:00
|
|
|
|
2013-07-02 14:33:53 +02:00
|
|
|
@Column(length = 40, nullable = false)
|
|
|
|
|
private String normalizedUrlHash;
|
2013-04-14 18:28:48 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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-07-24 15:39:20 +02:00
|
|
|
@OneToMany(mappedBy = "feed", cascade = CascadeType.REMOVE)
|
|
|
|
|
private Set<FeedEntry> entries;
|
2013-03-20 20:33:42 +01:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|