forked from Archives/Athou_commafeed
refactored tree, no more dropdown for feed editing
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package com.commafeed.frontend.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.commafeed.backend.model.FeedCategory;
|
||||
import com.commafeed.backend.model.FeedSubscription;
|
||||
import com.wordnik.swagger.annotations.ApiClass;
|
||||
import com.wordnik.swagger.annotations.ApiProperty;
|
||||
|
||||
@@ -15,6 +18,23 @@ import com.wordnik.swagger.annotations.ApiProperty;
|
||||
@ApiClass("User information")
|
||||
public class Subscription implements Serializable {
|
||||
|
||||
public static Subscription build(FeedSubscription subscription,
|
||||
long unreadCount) {
|
||||
FeedCategory category = subscription.getCategory();
|
||||
Subscription sub = new Subscription();
|
||||
sub.setId(subscription.getId());
|
||||
sub.setName(subscription.getTitle());
|
||||
sub.setMessage(subscription.getFeed().getMessage());
|
||||
sub.setErrorCount(subscription.getFeed().getErrorCount());
|
||||
sub.setFeedUrl(subscription.getFeed().getUrl());
|
||||
sub.setFeedLink(subscription.getFeed().getLink());
|
||||
sub.setLastRefresh(subscription.getFeed().getLastUpdated());
|
||||
sub.setUnread(unreadCount);
|
||||
sub.setCategoryId(category == null ? null : String.valueOf(category
|
||||
.getId()));
|
||||
return sub;
|
||||
}
|
||||
|
||||
@ApiProperty(value = "subscription id", required = true)
|
||||
private Long id;
|
||||
|
||||
@@ -27,12 +47,21 @@ public class Subscription implements Serializable {
|
||||
@ApiProperty(value = "error count", required = true)
|
||||
private int errorCount;
|
||||
|
||||
@ApiProperty(value = "last time the feed was refreshed", required = true)
|
||||
private Date lastRefresh;
|
||||
|
||||
@ApiProperty(value = "this subscription's feed url", required = true)
|
||||
private String feedUrl;
|
||||
|
||||
@ApiProperty(value = "this subscription's website url", required = true)
|
||||
private String feedLink;
|
||||
|
||||
@ApiProperty(value = "unread count", required = true)
|
||||
private long unread;
|
||||
|
||||
@ApiProperty(value = "category id")
|
||||
private String categoryId;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -81,4 +110,28 @@ public class Subscription implements Serializable {
|
||||
this.errorCount = errorCount;
|
||||
}
|
||||
|
||||
public String getFeedLink() {
|
||||
return feedLink;
|
||||
}
|
||||
|
||||
public void setFeedLink(String feedLink) {
|
||||
this.feedLink = feedLink;
|
||||
}
|
||||
|
||||
public Date getLastRefresh() {
|
||||
return lastRefresh;
|
||||
}
|
||||
|
||||
public void setLastRefresh(Date lastRefresh) {
|
||||
this.lastRefresh = lastRefresh;
|
||||
}
|
||||
|
||||
public String getCategoryId() {
|
||||
return categoryId;
|
||||
}
|
||||
|
||||
public void setCategoryId(String categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user