2013-03-23 16:17:19 +01:00
|
|
|
package com.commafeed.backend.model;
|
2013-03-21 16:22:58 +01:00
|
|
|
|
2013-06-19 18:44:56 +02:00
|
|
|
import javax.persistence.Cacheable;
|
2013-03-29 11:51:27 +01:00
|
|
|
import javax.persistence.Column;
|
2013-03-21 16:22:58 +01:00
|
|
|
import javax.persistence.Entity;
|
|
|
|
|
import javax.persistence.EnumType;
|
|
|
|
|
import javax.persistence.Enumerated;
|
2013-05-15 16:26:18 +02:00
|
|
|
import javax.persistence.FetchType;
|
2013-03-23 23:36:21 +01:00
|
|
|
import javax.persistence.JoinColumn;
|
2013-04-04 11:36:24 +02:00
|
|
|
import javax.persistence.Lob;
|
2013-03-23 23:14:14 +01:00
|
|
|
import javax.persistence.OneToOne;
|
2013-03-21 16:22:58 +01:00
|
|
|
import javax.persistence.Table;
|
|
|
|
|
|
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-21 16:22:58 +01:00
|
|
|
@Entity
|
2013-03-22 23:04:02 +01:00
|
|
|
@Table(name = "USERSETTINGS")
|
2013-03-21 16:22:58 +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 UserSettings extends AbstractModel {
|
2013-03-21 16:22:58 +01:00
|
|
|
|
|
|
|
|
public enum ReadingMode {
|
2013-03-23 23:14:14 +01:00
|
|
|
all, unread
|
2013-03-21 16:22:58 +01:00
|
|
|
}
|
|
|
|
|
|
2013-04-10 10:28:48 +02:00
|
|
|
public enum ReadingOrder {
|
|
|
|
|
asc, desc
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-04 21:12:51 +02:00
|
|
|
public enum ViewMode {
|
|
|
|
|
title, expanded
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-15 16:26:18 +02:00
|
|
|
@OneToOne(fetch = FetchType.LAZY)
|
2013-05-23 16:16:05 +02:00
|
|
|
@JoinColumn(name = "user_id", nullable = false, unique = true)
|
2013-03-21 16:22:58 +01:00
|
|
|
private User user;
|
|
|
|
|
|
|
|
|
|
@Enumerated(EnumType.STRING)
|
2013-03-29 11:51:27 +01:00
|
|
|
@Column(nullable = false)
|
2013-03-21 16:22:58 +01:00
|
|
|
private ReadingMode readingMode;
|
|
|
|
|
|
2013-04-10 10:28:48 +02:00
|
|
|
@Enumerated(EnumType.STRING)
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
|
private ReadingOrder readingOrder;
|
|
|
|
|
|
2013-05-04 21:12:51 +02:00
|
|
|
@Enumerated(EnumType.STRING)
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
|
private ViewMode viewMode;
|
|
|
|
|
|
2013-06-16 13:19:42 +02:00
|
|
|
@Column(name = "user_lang", length = 4)
|
2013-05-11 22:49:33 +02:00
|
|
|
private String language;
|
|
|
|
|
|
2013-04-12 09:57:18 +02:00
|
|
|
private boolean showRead;
|
2013-05-05 19:35:07 +02:00
|
|
|
private boolean scrollMarks;
|
2013-05-01 18:06:18 +02:00
|
|
|
private boolean socialButtons;
|
|
|
|
|
|
2013-05-28 22:40:54 +02:00
|
|
|
@Column(length = 32)
|
|
|
|
|
private String theme;
|
|
|
|
|
|
2013-04-04 11:36:24 +02:00
|
|
|
@Lob
|
|
|
|
|
@Column(length = Integer.MAX_VALUE)
|
|
|
|
|
private String customCss;
|
|
|
|
|
|
2013-03-21 16:22:58 +01:00
|
|
|
}
|