forked from Archives/Athou_commafeed
fix modernizer warnings
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.commafeed.backend.cache;
|
package com.commafeed.backend.cache;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -18,7 +19,6 @@ import com.commafeed.frontend.model.Category;
|
|||||||
import com.commafeed.frontend.model.UnreadCount;
|
import com.commafeed.frontend.model.UnreadCount;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -30,7 +30,7 @@ public class RedisCacheService extends CacheService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getLastEntries(Feed feed) {
|
public List<String> getLastEntries(Feed feed) {
|
||||||
List<String> list = Lists.newArrayList();
|
List<String> list = new ArrayList<>();
|
||||||
try (Jedis jedis = pool.getResource()) {
|
try (Jedis jedis = pool.getResource()) {
|
||||||
String key = buildRedisEntryKey(feed);
|
String key = buildRedisEntryKey(feed);
|
||||||
Set<String> members = jedis.smembers(key);
|
Set<String> members = jedis.smembers(key);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.commafeed.backend.dao;
|
package com.commafeed.backend.dao;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -27,7 +28,6 @@ import com.commafeed.backend.model.User;
|
|||||||
import com.commafeed.backend.model.UserSettings.ReadingOrder;
|
import com.commafeed.backend.model.UserSettings.ReadingOrder;
|
||||||
import com.commafeed.frontend.model.UnreadCount;
|
import com.commafeed.frontend.model.UnreadCount;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Ordering;
|
import com.google.common.collect.Ordering;
|
||||||
import com.mysema.query.BooleanBuilder;
|
import com.mysema.query.BooleanBuilder;
|
||||||
import com.mysema.query.Tuple;
|
import com.mysema.query.Tuple;
|
||||||
@@ -216,7 +216,7 @@ public class FeedEntryStatusDAO extends GenericDAO<FeedEntryStatus> {
|
|||||||
List<FeedEntryStatus> placeholders = set.asList();
|
List<FeedEntryStatus> placeholders = set.asList();
|
||||||
int size = placeholders.size();
|
int size = placeholders.size();
|
||||||
if (size < offset) {
|
if (size < offset) {
|
||||||
return Lists.newArrayList();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
placeholders = placeholders.subList(Math.max(offset, 0), size);
|
placeholders = placeholders.subList(Math.max(offset, 0), size);
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ public class FeedEntryStatusDAO extends GenericDAO<FeedEntryStatus> {
|
|||||||
if (onlyIds) {
|
if (onlyIds) {
|
||||||
statuses = placeholders;
|
statuses = placeholders;
|
||||||
} else {
|
} else {
|
||||||
statuses = Lists.newArrayList();
|
statuses = new ArrayList<>();
|
||||||
for (FeedEntryStatus placeholder : placeholders) {
|
for (FeedEntryStatus placeholder : placeholders) {
|
||||||
Long statusId = placeholder.getId();
|
Long statusId = placeholder.getId();
|
||||||
FeedEntry entry = feedEntryDAO.findById(placeholder.getEntry().getId());
|
FeedEntry entry = feedEntryDAO.findById(placeholder.getEntry().getId());
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.commafeed.backend.feed;
|
package com.commafeed.backend.feed;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -7,8 +8,6 @@ import lombok.RequiredArgsConstructor;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A keyword used in a search query
|
* A keyword used in a search query
|
||||||
*/
|
*/
|
||||||
@@ -24,7 +23,7 @@ public class FeedEntryKeyword {
|
|||||||
private final Mode mode;
|
private final Mode mode;
|
||||||
|
|
||||||
public static List<FeedEntryKeyword> fromQueryString(String keywords) {
|
public static List<FeedEntryKeyword> fromQueryString(String keywords) {
|
||||||
List<FeedEntryKeyword> list = Lists.newArrayList();
|
List<FeedEntryKeyword> list = new ArrayList<>();
|
||||||
if (keywords != null) {
|
if (keywords != null) {
|
||||||
for (String keyword : StringUtils.split(keywords)) {
|
for (String keyword : StringUtils.split(keywords)) {
|
||||||
boolean not = false;
|
boolean not = false;
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.commafeed.backend.feed;
|
package com.commafeed.backend.feed;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -17,9 +20,6 @@ import com.codahale.metrics.MetricRegistry;
|
|||||||
import com.commafeed.CommaFeedConfiguration;
|
import com.commafeed.CommaFeedConfiguration;
|
||||||
import com.commafeed.backend.dao.FeedDAO;
|
import com.commafeed.backend.dao.FeedDAO;
|
||||||
import com.commafeed.backend.model.Feed;
|
import com.commafeed.backend.model.Feed;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Queues;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class FeedQueues {
|
public class FeedQueues {
|
||||||
@@ -27,9 +27,9 @@ public class FeedQueues {
|
|||||||
private final FeedDAO feedDAO;
|
private final FeedDAO feedDAO;
|
||||||
private final CommaFeedConfiguration config;
|
private final CommaFeedConfiguration config;
|
||||||
|
|
||||||
private Queue<FeedRefreshContext> addQueue = Queues.newConcurrentLinkedQueue();
|
private Queue<FeedRefreshContext> addQueue = new ConcurrentLinkedQueue<>();
|
||||||
private Queue<FeedRefreshContext> takeQueue = Queues.newConcurrentLinkedQueue();
|
private Queue<FeedRefreshContext> takeQueue = new ConcurrentLinkedQueue<>();
|
||||||
private Queue<Feed> giveBackQueue = Queues.newConcurrentLinkedQueue();
|
private Queue<Feed> giveBackQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
private Meter refill;
|
private Meter refill;
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ public class FeedQueues {
|
|||||||
private void refill() {
|
private void refill() {
|
||||||
refill.mark();
|
refill.mark();
|
||||||
|
|
||||||
List<FeedRefreshContext> contexts = Lists.newArrayList();
|
List<FeedRefreshContext> contexts = new ArrayList<>();
|
||||||
int batchSize = Math.min(100, 3 * config.getApplicationSettings().getBackgroundThreads());
|
int batchSize = Math.min(100, 3 * config.getApplicationSettings().getBackgroundThreads());
|
||||||
|
|
||||||
// add feeds we got from the add() method
|
// add feeds we got from the add() method
|
||||||
@@ -117,7 +117,7 @@ public class FeedQueues {
|
|||||||
|
|
||||||
// set the disabledDate as we use it in feedDAO to decide what to refresh next. We also use a map to remove
|
// set the disabledDate as we use it in feedDAO to decide what to refresh next. We also use a map to remove
|
||||||
// duplicates.
|
// duplicates.
|
||||||
Map<Long, FeedRefreshContext> map = Maps.newLinkedHashMap();
|
Map<Long, FeedRefreshContext> map = new LinkedHashMap<>();
|
||||||
for (FeedRefreshContext context : contexts) {
|
for (FeedRefreshContext context : contexts) {
|
||||||
Feed feed = context.getFeed();
|
Feed feed = context.getFeed();
|
||||||
feed.setDisabledUntil(DateUtils.addMinutes(new Date(), config.getApplicationSettings().getRefreshIntervalMinutes()));
|
feed.setDisabledUntil(DateUtils.addMinutes(new Date(), config.getApplicationSettings().getRefreshIntervalMinutes()));
|
||||||
@@ -135,7 +135,7 @@ public class FeedQueues {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update all feeds in the database
|
// update all feeds in the database
|
||||||
List<Feed> feeds = Lists.newArrayList();
|
List<Feed> feeds = new ArrayList<>();
|
||||||
for (FeedRefreshContext context : map.values()) {
|
for (FeedRefreshContext context : map.values()) {
|
||||||
feeds.add(context.getFeed());
|
feeds.add(context.getFeed());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.commafeed.backend.feed;
|
|||||||
|
|
||||||
import io.dropwizard.lifecycle.Managed;
|
import io.dropwizard.lifecycle.Managed;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -36,7 +37,6 @@ import com.commafeed.backend.model.FeedSubscription;
|
|||||||
import com.commafeed.backend.model.User;
|
import com.commafeed.backend.model.User;
|
||||||
import com.commafeed.backend.service.FeedUpdateService;
|
import com.commafeed.backend.service.FeedUpdateService;
|
||||||
import com.commafeed.backend.service.PubSubService;
|
import com.commafeed.backend.service.PubSubService;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.util.concurrent.Striped;
|
import com.google.common.util.concurrent.Striped;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -113,7 +113,7 @@ public class FeedRefreshUpdater implements Managed {
|
|||||||
feed.setMessage("Feed has no entries");
|
feed.setMessage("Feed has no entries");
|
||||||
} else {
|
} else {
|
||||||
List<String> lastEntries = cache.getLastEntries(feed);
|
List<String> lastEntries = cache.getLastEntries(feed);
|
||||||
List<String> currentEntries = Lists.newArrayList();
|
List<String> currentEntries = new ArrayList<>();
|
||||||
|
|
||||||
List<FeedSubscription> subscriptions = null;
|
List<FeedSubscription> subscriptions = null;
|
||||||
for (FeedEntry entry : entries) {
|
for (FeedEntry entry : entries) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.io.StringReader;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -34,7 +35,6 @@ import com.commafeed.backend.feed.FeedEntryKeyword.Mode;
|
|||||||
import com.commafeed.backend.model.FeedEntry;
|
import com.commafeed.backend.model.FeedEntry;
|
||||||
import com.commafeed.backend.model.FeedSubscription;
|
import com.commafeed.backend.model.FeedSubscription;
|
||||||
import com.commafeed.frontend.model.Entry;
|
import com.commafeed.frontend.model.Entry;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.ibm.icu.text.CharsetDetector;
|
import com.ibm.icu.text.CharsetDetector;
|
||||||
import com.ibm.icu.text.CharsetMatch;
|
import com.ibm.icu.text.CharsetMatch;
|
||||||
import com.steadystate.css.parser.CSSOMParser;
|
import com.steadystate.css.parser.CSSOMParser;
|
||||||
@@ -231,7 +231,7 @@ public class FeedUtils {
|
|||||||
String rule = "";
|
String rule = "";
|
||||||
CSSOMParser parser = new CSSOMParser();
|
CSSOMParser parser = new CSSOMParser();
|
||||||
try {
|
try {
|
||||||
List<String> rules = Lists.newArrayList();
|
List<String> rules = new ArrayList<>();
|
||||||
CSSStyleDeclaration decl = parser.parseStyleDeclaration(new InputSource(new StringReader(orig)));
|
CSSStyleDeclaration decl = parser.parseStyleDeclaration(new InputSource(new StringReader(orig)));
|
||||||
|
|
||||||
for (int i = 0; i < decl.getLength(); i++) {
|
for (int i = 0; i < decl.getLength(); i++) {
|
||||||
@@ -256,7 +256,7 @@ public class FeedUtils {
|
|||||||
String rule = "";
|
String rule = "";
|
||||||
CSSOMParser parser = new CSSOMParser();
|
CSSOMParser parser = new CSSOMParser();
|
||||||
try {
|
try {
|
||||||
List<String> rules = Lists.newArrayList();
|
List<String> rules = new ArrayList<>();
|
||||||
CSSStyleDeclaration decl = parser.parseStyleDeclaration(new InputSource(new StringReader(orig)));
|
CSSStyleDeclaration decl = parser.parseStyleDeclaration(new InputSource(new StringReader(orig)));
|
||||||
|
|
||||||
for (int i = 0; i < decl.getLength(); i++) {
|
for (int i = 0; i < decl.getLength(); i++) {
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
package com.commafeed.backend.feed;
|
package com.commafeed.backend.feed;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
public class HtmlEntities {
|
public class HtmlEntities {
|
||||||
public static final Map<String, String> NUMERIC_MAPPING = Collections.unmodifiableMap(loadMap());
|
public static final Map<String, String> NUMERIC_MAPPING = Collections.unmodifiableMap(loadMap());
|
||||||
|
|
||||||
private static synchronized Map<String, String> loadMap() {
|
private static synchronized Map<String, String> loadMap() {
|
||||||
Map<String, String> map = Maps.newLinkedHashMap();
|
Map<String, String> map = new LinkedHashMap<>();
|
||||||
map.put("Á", "Á");
|
map.put("Á", "Á");
|
||||||
map.put("á", "á");
|
map.put("á", "á");
|
||||||
map.put("Â", "Â");
|
map.put("Â", "Â");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.commafeed.backend.model;
|
package com.commafeed.backend.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -16,8 +17,6 @@ import javax.persistence.Transient;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "FEEDENTRYSTATUSES")
|
@Table(name = "FEEDENTRYSTATUSES")
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@@ -41,7 +40,7 @@ public class FeedEntryStatus extends AbstractModel {
|
|||||||
private boolean markable;
|
private boolean markable;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private List<FeedEntryTag> tags = Lists.newArrayList();
|
private List<FeedEntryTag> tags = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denormalization starts here
|
* Denormalization starts here
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.commafeed.backend.model;
|
package com.commafeed.backend.model;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
@@ -19,7 +20,6 @@ import org.apache.commons.lang3.time.DateUtils;
|
|||||||
import org.hibernate.annotations.Cascade;
|
import org.hibernate.annotations.Cascade;
|
||||||
|
|
||||||
import com.commafeed.backend.model.UserRole.Role;
|
import com.commafeed.backend.model.UserRole.Role;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "USERS")
|
@Table(name = "USERS")
|
||||||
@@ -61,7 +61,7 @@ public class User extends AbstractModel {
|
|||||||
@OneToMany(mappedBy = "user", cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
|
@OneToMany(mappedBy = "user", cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
|
||||||
@Cascade({ org.hibernate.annotations.CascadeType.PERSIST, org.hibernate.annotations.CascadeType.SAVE_UPDATE,
|
@Cascade({ org.hibernate.annotations.CascadeType.PERSIST, org.hibernate.annotations.CascadeType.SAVE_UPDATE,
|
||||||
org.hibernate.annotations.CascadeType.REMOVE })
|
org.hibernate.annotations.CascadeType.REMOVE })
|
||||||
private Set<UserRole> roles = Sets.newHashSet();
|
private Set<UserRole> roles = new HashSet<>();
|
||||||
|
|
||||||
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
|
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
|
||||||
private Set<FeedSubscription> subscriptions;
|
private Set<FeedSubscription> subscriptions;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.commafeed.backend.service;
|
package com.commafeed.backend.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -17,7 +18,6 @@ import com.commafeed.backend.model.FeedEntry;
|
|||||||
import com.commafeed.backend.model.FeedEntryStatus;
|
import com.commafeed.backend.model.FeedEntryStatus;
|
||||||
import com.commafeed.backend.model.FeedSubscription;
|
import com.commafeed.backend.model.FeedSubscription;
|
||||||
import com.commafeed.backend.model.User;
|
import com.commafeed.backend.model.User;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
@RequiredArgsConstructor(onConstructor = @__({ @Inject }))
|
@RequiredArgsConstructor(onConstructor = @__({ @Inject }))
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -80,7 +80,7 @@ public class FeedEntryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void markList(List<FeedEntryStatus> statuses, Date olderThan) {
|
private void markList(List<FeedEntryStatus> statuses, Date olderThan) {
|
||||||
List<FeedEntryStatus> list = Lists.newArrayList();
|
List<FeedEntryStatus> list = new ArrayList<>();
|
||||||
for (FeedEntryStatus status : statuses) {
|
for (FeedEntryStatus status : statuses) {
|
||||||
if (!status.isRead()) {
|
if (!status.isRead()) {
|
||||||
Date inserted = status.getEntry().getInserted();
|
Date inserted = status.getEntry().getInserted();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.commafeed.backend.service;
|
package com.commafeed.backend.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -26,7 +27,6 @@ import com.commafeed.backend.feed.FeedQueues;
|
|||||||
import com.commafeed.backend.feed.FeedUtils;
|
import com.commafeed.backend.feed.FeedUtils;
|
||||||
import com.commafeed.backend.model.Feed;
|
import com.commafeed.backend.model.Feed;
|
||||||
import com.commafeed.frontend.resource.PubSubHubbubCallbackREST;
|
import com.commafeed.frontend.resource.PubSubHubbubCallbackREST;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends push subscription requests. Callback is handled by {@link PubSubHubbubCallbackREST}
|
* Sends push subscription requests. Callback is handled by {@link PubSubHubbubCallbackREST}
|
||||||
@@ -57,7 +57,7 @@ public class PubSubService {
|
|||||||
log.debug("sending new pubsub subscription to {} for {}", hub, topic);
|
log.debug("sending new pubsub subscription to {} for {}", hub, topic);
|
||||||
|
|
||||||
HttpPost post = new HttpPost(hub);
|
HttpPost post = new HttpPost(hub);
|
||||||
List<NameValuePair> nvp = Lists.newArrayList();
|
List<NameValuePair> nvp = new ArrayList<>();
|
||||||
nvp.add(new BasicNameValuePair("hub.callback", publicUrl + "/rest/push/callback"));
|
nvp.add(new BasicNameValuePair("hub.callback", publicUrl + "/rest/push/callback"));
|
||||||
nvp.add(new BasicNameValuePair("hub.topic", topic));
|
nvp.add(new BasicNameValuePair("hub.topic", topic));
|
||||||
nvp.add(new BasicNameValuePair("hub.mode", "subscribe"));
|
nvp.add(new BasicNameValuePair("hub.mode", "subscribe"));
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.commafeed.frontend.model;
|
package com.commafeed.frontend.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.wordnik.swagger.annotations.ApiModel;
|
import com.wordnik.swagger.annotations.ApiModel;
|
||||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
@@ -24,10 +24,10 @@ public class Category implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty("category children categories")
|
@ApiModelProperty("category children categories")
|
||||||
private List<Category> children = Lists.newArrayList();
|
private List<Category> children = new ArrayList<>();
|
||||||
|
|
||||||
@ApiModelProperty("category feeds")
|
@ApiModelProperty("category feeds")
|
||||||
private List<Subscription> feeds = Lists.newArrayList();
|
private List<Subscription> feeds = new ArrayList<>();
|
||||||
|
|
||||||
@ApiModelProperty("wether the category is expanded or collapsed")
|
@ApiModelProperty("wether the category is expanded or collapsed")
|
||||||
private boolean expanded;
|
private boolean expanded;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.commafeed.frontend.model;
|
package com.commafeed.frontend.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.wordnik.swagger.annotations.ApiModel;
|
import com.wordnik.swagger.annotations.ApiModel;
|
||||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public class Entries implements Serializable {
|
|||||||
private int limit;
|
private int limit;
|
||||||
|
|
||||||
@ApiModelProperty("list of entries")
|
@ApiModelProperty("list of entries")
|
||||||
private List<Entry> entries = Lists.newArrayList();
|
private List<Entry> entries = new ArrayList<>();
|
||||||
|
|
||||||
@ApiModelProperty("if true, the unread flag was ignored in the request, all entries are returned regardless of their read status")
|
@ApiModelProperty("if true, the unread flag was ignored in the request, all entries are returned regardless of their read status")
|
||||||
private boolean ignoredReadStatus;
|
private boolean ignoredReadStatus;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.commafeed.frontend.resource;
|
|||||||
|
|
||||||
import io.dropwizard.hibernate.UnitOfWork;
|
import io.dropwizard.hibernate.UnitOfWork;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -36,7 +37,6 @@ import com.commafeed.frontend.auth.SecurityCheck;
|
|||||||
import com.commafeed.frontend.model.UserModel;
|
import com.commafeed.frontend.model.UserModel;
|
||||||
import com.commafeed.frontend.model.request.IDRequest;
|
import com.commafeed.frontend.model.request.IDRequest;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.wordnik.swagger.annotations.Api;
|
import com.wordnik.swagger.annotations.Api;
|
||||||
import com.wordnik.swagger.annotations.ApiOperation;
|
import com.wordnik.swagger.annotations.ApiOperation;
|
||||||
@@ -136,7 +136,7 @@ public class AdminREST {
|
|||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Get all users", notes = "Get all users", response = UserModel.class, responseContainer = "List")
|
@ApiOperation(value = "Get all users", notes = "Get all users", response = UserModel.class, responseContainer = "List")
|
||||||
public Response getUsers(@SecurityCheck(Role.ADMIN) User user) {
|
public Response getUsers(@SecurityCheck(Role.ADMIN) User user) {
|
||||||
Map<Long, UserModel> users = Maps.newHashMap();
|
Map<Long, UserModel> users = new HashMap<>();
|
||||||
for (UserRole role : userRoleDAO.findAll()) {
|
for (UserRole role : userRoleDAO.findAll()) {
|
||||||
User u = role.getUser();
|
User u = role.getUser();
|
||||||
Long key = u.getId();
|
Long key = u.getId();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -59,7 +60,6 @@ import com.commafeed.frontend.model.request.CategoryModificationRequest;
|
|||||||
import com.commafeed.frontend.model.request.CollapseRequest;
|
import com.commafeed.frontend.model.request.CollapseRequest;
|
||||||
import com.commafeed.frontend.model.request.IDRequest;
|
import com.commafeed.frontend.model.request.IDRequest;
|
||||||
import com.commafeed.frontend.model.request.MarkRequest;
|
import com.commafeed.frontend.model.request.MarkRequest;
|
||||||
import com.google.common.base.Optional;
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.rometools.rome.feed.synd.SyndFeed;
|
import com.rometools.rome.feed.synd.SyndFeed;
|
||||||
@@ -132,7 +132,7 @@ public class CategoryREST {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ALL.equals(id)) {
|
if (ALL.equals(id)) {
|
||||||
entries.setName(Optional.fromNullable(tag).or("All"));
|
entries.setName(Optional.ofNullable(tag).orElse("All"));
|
||||||
List<FeedSubscription> subs = feedSubscriptionDAO.findAll(user);
|
List<FeedSubscription> subs = feedSubscriptionDAO.findAll(user);
|
||||||
removeExcludedSubscriptions(subs, excludedIds);
|
removeExcludedSubscriptions(subs, excludedIds);
|
||||||
List<FeedEntryStatus> list = feedEntryStatusDAO.findBySubscriptions(user, subs, unreadOnly, entryKeywords, newerThanDate,
|
List<FeedEntryStatus> list = feedEntryStatusDAO.findBySubscriptions(user, subs, unreadOnly, entryKeywords, newerThanDate,
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ public class URLCanonicalizer {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuffer sb = new StringBuffer(100);
|
final StringBuilder sb = new StringBuilder(100);
|
||||||
for (Map.Entry<String, String> pair : sortedParamMap.entrySet()) {
|
for (Map.Entry<String, String> pair : sortedParamMap.entrySet()) {
|
||||||
final String key = pair.getKey().toLowerCase();
|
final String key = pair.getKey().toLowerCase();
|
||||||
if (key.equals("jsessionid") || key.equals("phpsessid") || key.equals("aspsessionid")) {
|
if (key.equals("jsessionid") || key.equals("phpsessid") || key.equals("aspsessionid")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user