2013-03-23 16:17:19 +01:00
|
|
|
package com.commafeed.backend.model;
|
2013-03-20 20:33:42 +01:00
|
|
|
|
2013-07-14 05:48:47 +02:00
|
|
|
import java.util.Date;
|
|
|
|
|
|
2013-06-19 18:44:56 +02:00
|
|
|
import javax.persistence.Cacheable;
|
2013-03-20 20:33:42 +01:00
|
|
|
import javax.persistence.Column;
|
|
|
|
|
import javax.persistence.Entity;
|
2013-05-15 16:26:18 +02:00
|
|
|
import javax.persistence.FetchType;
|
2013-03-29 11:51:27 +01:00
|
|
|
import javax.persistence.JoinColumn;
|
2013-03-20 20:33:42 +01:00
|
|
|
import javax.persistence.ManyToOne;
|
|
|
|
|
import javax.persistence.Table;
|
2013-07-14 05:48:47 +02:00
|
|
|
import javax.persistence.Temporal;
|
|
|
|
|
import javax.persistence.TemporalType;
|
2013-03-20 20:33:42 +01: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 = "FEEDENTRYSTATUSES")
|
2013-03-21 08:55:53 +01:00
|
|
|
@SuppressWarnings("serial")
|
2013-06-19 18:44:56 +02:00
|
|
|
@Cacheable
|
|
|
|
|
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
2013-03-23 01:49:39 +01:00
|
|
|
public class FeedEntryStatus extends AbstractModel {
|
2013-03-20 20:33:42 +01:00
|
|
|
|
2013-05-15 16:26:18 +02:00
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
2013-03-29 11:51:27 +01:00
|
|
|
@JoinColumn(nullable = false)
|
2013-04-08 13:06:53 +02:00
|
|
|
private FeedSubscription subscription;
|
2013-03-20 20:33:42 +01:00
|
|
|
|
2013-05-15 16:26:18 +02:00
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
2013-03-29 11:51:27 +01:00
|
|
|
@JoinColumn(nullable = false)
|
2013-03-20 20:33:42 +01:00
|
|
|
private FeedEntry entry;
|
|
|
|
|
|
|
|
|
|
@Column(name = "read_status")
|
|
|
|
|
private boolean read;
|
|
|
|
|
private boolean starred;
|
|
|
|
|
|
2013-07-14 05:48:47 +02:00
|
|
|
/**
|
|
|
|
|
* Denormalization starts here
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
|
|
|
|
@JoinColumn(nullable = false)
|
|
|
|
|
private User user;
|
|
|
|
|
|
|
|
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
|
|
|
private Date entryInserted;
|
|
|
|
|
|
|
|
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
|
|
|
private Date entryUpdated;
|
|
|
|
|
|
|
|
|
|
public FeedEntryStatus() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public FeedEntryStatus(User user, FeedSubscription subscription, FeedEntry entry) {
|
|
|
|
|
setUser(user);
|
|
|
|
|
setSubscription(subscription);
|
|
|
|
|
setEntry(entry);
|
|
|
|
|
setEntryInserted(entry.getInserted());
|
|
|
|
|
setEntryUpdated(entry.getUpdated());
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-08 13:06:53 +02:00
|
|
|
public FeedSubscription getSubscription() {
|
|
|
|
|
return subscription;
|
2013-03-20 20:33:42 +01:00
|
|
|
}
|
|
|
|
|
|
2013-04-08 13:06:53 +02:00
|
|
|
public void setSubscription(FeedSubscription subscription) {
|
|
|
|
|
this.subscription = subscription;
|
2013-03-20 20:33:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public FeedEntry getEntry() {
|
|
|
|
|
return entry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setEntry(FeedEntry entry) {
|
|
|
|
|
this.entry = entry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isRead() {
|
|
|
|
|
return read;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setRead(boolean read) {
|
|
|
|
|
this.read = read;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isStarred() {
|
|
|
|
|
return starred;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setStarred(boolean starred) {
|
|
|
|
|
this.starred = starred;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-14 05:48:47 +02:00
|
|
|
public Date getEntryInserted() {
|
|
|
|
|
return entryInserted;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setEntryInserted(Date entryInserted) {
|
|
|
|
|
this.entryInserted = entryInserted;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Date getEntryUpdated() {
|
|
|
|
|
return entryUpdated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setEntryUpdated(Date entryUpdated) {
|
|
|
|
|
this.entryUpdated = entryUpdated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public User getUser() {
|
|
|
|
|
return user;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setUser(User user) {
|
|
|
|
|
this.user = user;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-20 20:33:42 +01:00
|
|
|
}
|