use lombok data instead of getters and setters

This commit is contained in:
Athou
2013-08-11 12:09:05 +02:00
parent 7b1bb9072e
commit e1be05711b
11 changed files with 53 additions and 841 deletions

View File

@@ -8,12 +8,15 @@ import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.TableGenerator;
import lombok.Data;
/**
* Abstract model for all entities, defining id and table generator
*
*/
@SuppressWarnings("serial")
@MappedSuperclass
@Data
public abstract class AbstractModel implements Serializable {
@Id
@@ -25,13 +28,4 @@ public abstract class AbstractModel implements Serializable {
valueColumnName = "sequence_next_hi_value",
allocationSize = 1000)
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}

View File

@@ -7,6 +7,9 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.log4j.Level;
@Entity
@@ -14,6 +17,8 @@ import org.apache.log4j.Level;
@SuppressWarnings("serial")
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@Data
@EqualsAndHashCode(callSuper = true)
public class ApplicationSettings extends AbstractModel {
private String publicUrl;
@@ -37,186 +42,7 @@ public class ApplicationSettings extends AbstractModel {
private boolean crawlingPaused;
private int keepStatusDays = 0;
private int refreshIntervalMinutes = 5;
@Column(length = 255)
private String announcement;
/* getters and setters below */
public String getPublicUrl() {
return publicUrl;
}
public void setPublicUrl(String publicUrl) {
this.publicUrl = publicUrl;
}
public boolean isAllowRegistrations() {
return allowRegistrations;
}
public void setAllowRegistrations(boolean allowRegistrations) {
this.allowRegistrations = allowRegistrations;
}
public String getGoogleClientId() {
return googleClientId;
}
public void setGoogleClientId(String googleClientId) {
this.googleClientId = googleClientId;
}
public String getGoogleClientSecret() {
return googleClientSecret;
}
public void setGoogleClientSecret(String googleClientSecret) {
this.googleClientSecret = googleClientSecret;
}
public int getBackgroundThreads() {
return backgroundThreads;
}
public void setBackgroundThreads(int backgroundThreads) {
this.backgroundThreads = backgroundThreads;
}
public String getSmtpHost() {
return smtpHost;
}
public void setSmtpHost(String smtpHost) {
this.smtpHost = smtpHost;
}
public int getSmtpPort() {
return smtpPort;
}
public void setSmtpPort(int smtpPort) {
this.smtpPort = smtpPort;
}
public boolean isSmtpTls() {
return smtpTls;
}
public void setSmtpTls(boolean smtpTls) {
this.smtpTls = smtpTls;
}
public String getSmtpUserName() {
return smtpUserName;
}
public void setSmtpUserName(String smtpUserName) {
this.smtpUserName = smtpUserName;
}
public String getSmtpPassword() {
return smtpPassword;
}
public void setSmtpPassword(String smtpPassword) {
this.smtpPassword = smtpPassword;
}
public String getGoogleAnalyticsTrackingCode() {
return googleAnalyticsTrackingCode;
}
public void setGoogleAnalyticsTrackingCode(String googleAnalyticsTrackingCode) {
this.googleAnalyticsTrackingCode = googleAnalyticsTrackingCode;
}
public String getAnnouncement() {
return announcement;
}
public void setAnnouncement(String announcement) {
this.announcement = announcement;
}
public boolean isFeedbackButton() {
return feedbackButton;
}
public void setFeedbackButton(boolean feedbackButton) {
this.feedbackButton = feedbackButton;
}
public boolean isPubsubhubbub() {
return pubsubhubbub;
}
public void setPubsubhubbub(boolean pubsubhubbub) {
this.pubsubhubbub = pubsubhubbub;
}
public boolean isHeavyLoad() {
return heavyLoad;
}
public void setHeavyLoad(boolean heavyLoad) {
this.heavyLoad = heavyLoad;
}
public int getDatabaseUpdateThreads() {
return databaseUpdateThreads;
}
public void setDatabaseUpdateThreads(int databaseUpdateThreads) {
this.databaseUpdateThreads = databaseUpdateThreads;
}
public String getLogLevel() {
return logLevel;
}
public void setLogLevel(String logLevel) {
this.logLevel = logLevel;
}
public boolean isImageProxyEnabled() {
return imageProxyEnabled;
}
public void setImageProxyEnabled(boolean imageProxyEnabled) {
this.imageProxyEnabled = imageProxyEnabled;
}
public int getQueryTimeout() {
return queryTimeout;
}
public void setQueryTimeout(int queryTimeout) {
this.queryTimeout = queryTimeout;
}
public boolean isCrawlingPaused() {
return crawlingPaused;
}
public void setCrawlingPaused(boolean crawlingPaused) {
this.crawlingPaused = crawlingPaused;
}
public int getKeepStatusDays() {
return keepStatusDays;
}
public void setKeepStatusDays(int keepStatusDays) {
this.keepStatusDays = keepStatusDays;
}
public int getRefreshIntervalMinutes() {
return refreshIntervalMinutes;
}
public void setRefreshIntervalMinutes(int refreshIntervalMinutes) {
this.refreshIntervalMinutes = refreshIntervalMinutes;
}
}

View File

@@ -12,6 +12,9 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@@ -20,6 +23,8 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
@SuppressWarnings("serial")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Data
@EqualsAndHashCode(callSuper = true)
public class Feed extends AbstractModel {
/**
@@ -132,165 +137,4 @@ public class Feed extends AbstractModel {
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 String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Set<FeedSubscription> getSubscriptions() {
return subscriptions;
}
public void setSubscriptions(Set<FeedSubscription> subscriptions) {
this.subscriptions = subscriptions;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public int getErrorCount() {
return errorCount;
}
public void setErrorCount(int errorCount) {
this.errorCount = errorCount;
}
public Date getDisabledUntil() {
return disabledUntil;
}
public void setDisabledUntil(Date disabledUntil) {
this.disabledUntil = disabledUntil;
}
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;
}
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;
}
public void setPushLastPing(Date pushLastPing) {
this.pushLastPing = pushLastPing;
}
public Date getLastPublishedDate() {
return lastPublishedDate;
}
public void setLastPublishedDate(Date lastPublishedDate) {
this.lastPublishedDate = lastPublishedDate;
}
public String getLastContentHash() {
return lastContentHash;
}
public void setLastContentHash(String lastContentHash) {
this.lastContentHash = lastContentHash;
}
public Long getAverageEntryInterval() {
return averageEntryInterval;
}
public void setAverageEntryInterval(Long averageEntryInterval) {
this.averageEntryInterval = averageEntryInterval;
}
public Date getLastEntryDate() {
return lastEntryDate;
}
public void setLastEntryDate(Date lastEntryDate) {
this.lastEntryDate = lastEntryDate;
}
public String getPushTopicHash() {
return pushTopicHash;
}
public void setPushTopicHash(String pushTopicHash) {
this.pushTopicHash = pushTopicHash;
}
public String getNormalizedUrl() {
return normalizedUrl;
}
public void setNormalizedUrl(String normalizedUrl) {
this.normalizedUrl = normalizedUrl;
}
public String getNormalizedUrlHash() {
return normalizedUrlHash;
}
public void setNormalizedUrlHash(String normalizedUrlHash) {
this.normalizedUrlHash = normalizedUrlHash;
}
public Set<FeedEntry> getEntries() {
return entries;
}
public void setEntries(Set<FeedEntry> entries) {
this.entries = entries;
}
}

View File

@@ -11,16 +11,19 @@ import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import com.google.common.collect.Sets;
@Entity
@Table(name = "FEEDCATEGORIES")
@SuppressWarnings("serial")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Data
@EqualsAndHashCode(callSuper = true)
public class FeedCategory extends AbstractModel {
@Column(length = 128, nullable = false)
@@ -45,63 +48,4 @@ public class FeedCategory extends AbstractModel {
private Integer position;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public FeedCategory getParent() {
return parent;
}
public void setParent(FeedCategory parent) {
this.parent = parent;
}
public Set<FeedSubscription> getSubscriptions() {
if (subscriptions == null) {
return Sets.newHashSet();
}
return subscriptions;
}
public void setSubscriptions(Set<FeedSubscription> subscriptions) {
this.subscriptions = subscriptions;
}
public Set<FeedCategory> getChildren() {
return children;
}
public void setChildren(Set<FeedCategory> children) {
this.children = children;
}
public boolean isCollapsed() {
return collapsed;
}
public void setCollapsed(boolean collapsed) {
this.collapsed = collapsed;
}
public Integer getPosition() {
return position;
}
public void setPosition(Integer position) {
this.position = position;
}
}

View File

@@ -16,6 +16,9 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@@ -24,6 +27,8 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
@SuppressWarnings("serial")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Data
@EqualsAndHashCode(callSuper = true)
public class FeedEntry extends AbstractModel {
@Column(length = 2048, nullable = false)
@@ -51,67 +56,4 @@ public class FeedEntry extends AbstractModel {
@OneToMany(mappedBy = "entry", cascade = CascadeType.REMOVE)
private Set<FeedEntryStatus> statuses;
public String getGuid() {
return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public Set<FeedEntryStatus> getStatuses() {
return statuses;
}
public void setStatuses(Set<FeedEntryStatus> statuses) {
this.statuses = statuses;
}
public Date getInserted() {
return inserted;
}
public void setInserted(Date inserted) {
this.inserted = inserted;
}
public FeedEntryContent getContent() {
return content;
}
public void setContent(FeedEntryContent content) {
this.content = content;
}
public String getGuidHash() {
return guidHash;
}
public void setGuidHash(String guidHash) {
this.guidHash = guidHash;
}
public Feed getFeed() {
return feed;
}
public void setFeed(Feed feed) {
this.feed = feed;
}
}

View File

@@ -9,6 +9,9 @@ import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@@ -17,6 +20,8 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
@SuppressWarnings("serial")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Data
@EqualsAndHashCode(callSuper = true)
public class FeedEntryContent extends AbstractModel {
@Column(length = 2048)
@@ -44,68 +49,4 @@ public class FeedEntryContent extends AbstractModel {
@OneToMany(mappedBy = "content")
private Set<FeedEntry> entries;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getEnclosureUrl() {
return enclosureUrl;
}
public void setEnclosureUrl(String enclosureUrl) {
this.enclosureUrl = enclosureUrl;
}
public String getEnclosureType() {
return enclosureType;
}
public void setEnclosureType(String enclosureType) {
this.enclosureType = enclosureType;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContentHash() {
return contentHash;
}
public void setContentHash(String contentHash) {
this.contentHash = contentHash;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public Set<FeedEntry> getEntries() {
return entries;
}
public void setEntries(Set<FeedEntry> entries) {
this.entries = entries;
}
public String getTitleHash() {
return titleHash;
}
public void setTitleHash(String titleHash) {
this.titleHash = titleHash;
}
}

View File

@@ -13,6 +13,9 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@@ -21,6 +24,8 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
@SuppressWarnings("serial")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Data
@EqualsAndHashCode(callSuper = true)
public class FeedEntryStatus extends AbstractModel {
@ManyToOne(fetch = FetchType.LAZY)
@@ -64,68 +69,4 @@ public class FeedEntryStatus extends AbstractModel {
setEntryUpdated(entry.getUpdated());
}
public FeedSubscription getSubscription() {
return subscription;
}
public void setSubscription(FeedSubscription subscription) {
this.subscription = subscription;
}
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;
}
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;
}
public boolean isMarkable() {
return markable;
}
public void setMarkable(boolean markable) {
this.markable = markable;
}
}

View File

@@ -12,6 +12,9 @@ import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@@ -20,6 +23,8 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
@SuppressWarnings("serial")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Data
@EqualsAndHashCode(callSuper = true)
public class FeedSubscription extends AbstractModel {
@ManyToOne(fetch = FetchType.LAZY)
@@ -44,52 +49,4 @@ public class FeedSubscription extends AbstractModel {
private Integer position;
public Feed getFeed() {
return feed;
}
public void setFeed(Feed feed) {
this.feed = feed;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public FeedCategory getCategory() {
return category;
}
public void setCategory(FeedCategory category) {
this.category = category;
}
public Set<FeedEntryStatus> getStatuses() {
return statuses;
}
public void setStatuses(Set<FeedEntryStatus> statuses) {
this.statuses = statuses;
}
public Integer getPosition() {
return position;
}
public void setPosition(Integer position) {
this.position = position;
}
}

View File

@@ -13,6 +13,9 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@@ -23,6 +26,8 @@ import com.google.common.collect.Sets;
@SuppressWarnings("serial")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Data
@EqualsAndHashCode(callSuper = true)
public class User extends AbstractModel {
@Column(length = 32, nullable = false, unique = true)
@@ -61,100 +66,4 @@ public class User extends AbstractModel {
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
private Set<FeedSubscription> subscriptions;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public byte[] getPassword() {
return password;
}
public void setPassword(byte[] password) {
this.password = password;
}
public byte[] getSalt() {
return salt;
}
public void setSalt(byte[] salt) {
this.salt = salt;
}
public Set<UserRole> getRoles() {
return roles;
}
public void setRoles(Set<UserRole> roles) {
this.roles = roles;
}
public boolean isDisabled() {
return disabled;
}
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Date getLastLogin() {
return lastLogin;
}
public void setLastLogin(Date lastLogin) {
this.lastLogin = lastLogin;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getRecoverPasswordToken() {
return recoverPasswordToken;
}
public void setRecoverPasswordToken(String recoverPasswordToken) {
this.recoverPasswordToken = recoverPasswordToken;
}
public Date getRecoverPasswordTokenDate() {
return recoverPasswordTokenDate;
}
public void setRecoverPasswordTokenDate(Date recoverPasswordTokenDate) {
this.recoverPasswordTokenDate = recoverPasswordTokenDate;
}
public Set<FeedSubscription> getSubscriptions() {
return subscriptions;
}
public void setSubscriptions(Set<FeedSubscription> subscriptions) {
this.subscriptions = subscriptions;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
}

View File

@@ -10,6 +10,9 @@ import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@@ -18,6 +21,8 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
@SuppressWarnings("serial")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Data
@EqualsAndHashCode(callSuper = true)
public class UserRole extends AbstractModel {
public static enum Role {
@@ -41,20 +46,4 @@ public class UserRole extends AbstractModel {
this.role = role;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
}

View File

@@ -12,6 +12,9 @@ import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@@ -20,6 +23,8 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
@SuppressWarnings("serial")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Data
@EqualsAndHashCode(callSuper = true)
public class UserSettings extends AbstractModel {
@XmlRootElement
@@ -67,84 +72,4 @@ public class UserSettings extends AbstractModel {
@Column(length = Integer.MAX_VALUE)
private String customCss;
public ReadingMode getReadingMode() {
return readingMode;
}
public void setReadingMode(ReadingMode readingMode) {
this.readingMode = readingMode;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getCustomCss() {
return customCss;
}
public void setCustomCss(String customCss) {
this.customCss = customCss;
}
public ReadingOrder getReadingOrder() {
return readingOrder;
}
public void setReadingOrder(ReadingOrder readingOrder) {
this.readingOrder = readingOrder;
}
public boolean isShowRead() {
return showRead;
}
public void setShowRead(boolean showRead) {
this.showRead = showRead;
}
public boolean isSocialButtons() {
return socialButtons;
}
public void setSocialButtons(boolean socialButtons) {
this.socialButtons = socialButtons;
}
public ViewMode getViewMode() {
return viewMode;
}
public void setViewMode(ViewMode viewMode) {
this.viewMode = viewMode;
}
public boolean isScrollMarks() {
return scrollMarks;
}
public void setScrollMarks(boolean scrollMarks) {
this.scrollMarks = scrollMarks;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
}