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-10-13 10:49:44 +02:00
|
|
|
import java.util.List;
|
2013-07-14 05:48:47 +02:00
|
|
|
|
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-07-23 15:27:56 +02:00
|
|
|
import javax.persistence.Transient;
|
2013-03-20 20:33:42 +01:00
|
|
|
|
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-10-20 17:12:53 +02:00
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
|
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-08-11 14:01:16 +02:00
|
|
|
@Getter
|
|
|
|
|
@Setter
|
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-23 15:27:56 +02:00
|
|
|
@Transient
|
|
|
|
|
private boolean markable;
|
2013-10-13 10:49:44 +02:00
|
|
|
|
|
|
|
|
@Transient
|
2013-10-20 17:12:53 +02:00
|
|
|
private List<FeedEntryTag> tags = Lists.newArrayList();
|
2013-07-23 15:27:56 +02:00
|
|
|
|
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() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-25 09:17:33 +02:00
|
|
|
public FeedEntryStatus(User user, FeedSubscription subscription, FeedEntry entry) {
|
2013-07-14 05:48:47 +02:00
|
|
|
setUser(user);
|
|
|
|
|
setSubscription(subscription);
|
|
|
|
|
setEntry(entry);
|
|
|
|
|
setEntryInserted(entry.getInserted());
|
|
|
|
|
setEntryUpdated(entry.getUpdated());
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-20 20:33:42 +01:00
|
|
|
}
|