aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/service
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java/com/juick/service')
-rw-r--r--juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java5
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java30
-rw-r--r--juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java3
-rw-r--r--juick-server/src/main/java/com/juick/service/UserServiceImpl.java4
-rw-r--r--juick-server/src/main/java/com/juick/service/search/SphinxSearchServiceImpl.java4
-rw-r--r--juick-server/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java2
6 files changed, 25 insertions, 23 deletions
diff --git a/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java b/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java
index 0f043292..df748526 100644
--- a/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java
@@ -1,6 +1,7 @@
package com.juick.service;
import com.juick.server.helpers.ApplicationStatus;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
@@ -96,7 +97,7 @@ public class CrosspostServiceImpl extends BaseJdbcService implements CrosspostSe
uid);
return list.isEmpty() ?
- "" : list.get(0);
+ StringUtils.EMPTY : list.get(0);
}
@Transactional(readOnly = true)
@@ -108,7 +109,7 @@ public class CrosspostServiceImpl extends BaseJdbcService implements CrosspostSe
uid);
return list.isEmpty() ?
- "" : list.get(0);
+ StringUtils.EMPTY : list.get(0);
}
@Transactional(readOnly = true)
diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
index 88167be8..1ad29d00 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -107,7 +107,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
int mid = holder.getKey().intValue();
if (mid > 0) {
- String tagsNames = "";
+ String tagsNames = StringUtils.EMPTY;
if (CollectionUtils.isNotEmpty(tags)) {
StringBuilder tasNamesBuilder = new StringBuilder();
@@ -364,7 +364,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT m.message_id FROM messages m WHERE " +
(before > 0 ?
- " m.message_id < :before AND " : "") +
+ " m.message_id < :before AND " : StringUtils.EMPTY) +
" m.hidden = 0 AND (m.privacy > 0" +
(visitorUid > 1 ?
" OR m.user_id = :visitorUid) AND NOT EXISTS (" +
@@ -389,7 +389,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"ON ((tags.synonym_id = :tid OR tags.tag_id = :tid) AND tags.tag_id = messages_tags.tag_id)) " +
"INNER JOIN messages USING(message_id) WHERE " +
(before > 0 ?
- " messages.message_id < :before AND " : "") +
+ " messages.message_id < :before AND " : StringUtils.EMPTY) +
"(messages.privacy > 0 OR messages.user_id = :visitorUid) ORDER BY message_id DESC LIMIT :cnt",
sqlParameterSource,
Integer.class);
@@ -407,7 +407,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"SELECT messages.message_id FROM messages_tags " +
"INNER JOIN messages USING(message_id) WHERE messages_tags.tag_id IN (" + tids + ") " +
(before > 0 ?
- " AND messages.message_id < :before " : "") +
+ " AND messages.message_id < :before " : StringUtils.EMPTY) +
" AND (messages.privacy > 0 OR messages.user_id = :visitorUid) " +
"ORDER BY messages.message_id DESC LIMIT :cnt",
sqlParameterSource,
@@ -425,7 +425,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT message_id FROM messages WHERE place_id = :placeId " +
(before > 0 ?
- " AND message_id < :before " : "") +
+ " AND message_id < :before " : StringUtils.EMPTY) +
" AND (privacy > 0 OR user_id = :visitorUid) ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -443,13 +443,13 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
" INNER JOIN subscr_users ON (subscr_users.suser_id = :uid AND subscr_users.user_id = messages.user_id) " +
" WHERE " +
(before > 0 ?
- " message_id < :before AND " : "") +
+ " message_id < :before AND " : StringUtils.EMPTY) +
" (privacy >= 0 OR (privacy >= -2 AND privacy <= -1" +
" AND EXISTS (SELECT 1 FROM wl_users w WHERE w.wl_user_id = :uid and w.user_id = messages.user_id)))) " +
" UNION " +
" (SELECT message_id FROM messages WHERE user_id=:uid " +
(before > 0 ?
- " AND message_id < :before " : "") +
+ " AND message_id < :before " : StringUtils.EMPTY) +
") ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -467,7 +467,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList
("SELECT message_id FROM messages WHERE user_id = :uid AND privacy < 0" +
(before > 0 ?
- " AND message_id < :before " : "") +
+ " AND message_id < :before " : StringUtils.EMPTY) +
"ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -500,7 +500,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"SELECT f.message_id FROM favorites f WHERE " +
"EXISTS (SELECT 1 FROM subscr_users s WHERE s.suser_id = :uid and f.user_id = s.user_id)" +
(before > 0 ?
- " AND f.message_id < :before " : "") +
+ " AND f.message_id < :before " : StringUtils.EMPTY) +
"ORDER BY f.message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -516,7 +516,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT m.message_id FROM messages m WHERE m.privacy > 0 " +
(before > 0 ?
- " AND m.message_id < :before " : "") +
+ " AND m.message_id < :before " : StringUtils.EMPTY) +
" AND m.popular > 0 AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :vid and b.bl_user_id = m.user_id) " +
" ORDER BY m.message_id DESC LIMIT 20",
sqlParameterSource,
@@ -533,7 +533,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT m.message_id FROM messages m WHERE (m.privacy > 0 OR m.user_id = :vid) " +
(before > 0 ?
- " AND m.message_id < :before " : "") +
+ " AND m.message_id < :before " : StringUtils.EMPTY) +
" AND m.attach IS NOT NULL " +
" AND NOT EXISTS (SELECT 1 from users u WHERE u.banned = 1 and u.id = m.user_id) " +
" AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :vid and b.bl_user_id = m.user_id) " +
@@ -566,7 +566,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT message_id FROM messages WHERE user_id = :uid" +
(before > 0 ?
- " AND message_id < :before" : "") +
+ " AND message_id < :before" : StringUtils.EMPTY) +
" AND privacy >= :privacy ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -585,7 +585,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"SELECT messages.message_id FROM messages_tags INNER JOIN messages " +
" USING (message_id) WHERE messages.user_id = :uid AND messages_tags.tag_id = :tid " +
(before > 0 ?
- " AND messages.message_id < :before " : "") +
+ " AND messages.message_id < :before " : StringUtils.EMPTY) +
" AND messages.privacy >= :privacy ORDER BY messages.message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -602,7 +602,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"SELECT message_id FROM favorites " +
" WHERE user_id = :uid " +
(before > 0 ?
- " AND message_id < :before " : "") +
+ " AND message_id < :before " : StringUtils.EMPTY) +
" ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -619,7 +619,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT message_id FROM messages WHERE user_id = :uid " +
(before > 0 ?
- " AND message_id < :before " : "") +
+ " AND message_id < :before " : StringUtils.EMPTY) +
" AND privacy >= :privacy AND attach IS NOT NULL ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
diff --git a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
index decfe59d..4082e1ef 100644
--- a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java
@@ -3,6 +3,7 @@ package com.juick.service;
import com.juick.Tag;
import com.juick.User;
import com.juick.server.helpers.NotifyOpts;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.stereotype.Repository;
@@ -47,7 +48,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip
"SELECT jids.jid FROM subscr_users INNER JOIN jids " +
"ON (subscr_users.user_id = :uid AND subscr_users.suser_id = jids.user_id) WHERE jids.active = 1 " +
(friendsonly ?
- " AND EXISTS (SELECT 1 FROM wl_users w WHERE w.user_id = :uid and jids.user_id = w.wl_user_id)" : ""),
+ " AND EXISTS (SELECT 1 FROM wl_users w WHERE w.user_id = :uid and jids.user_id = w.wl_user_id)" : StringUtils.EMPTY),
new MapSqlParameterSource("uid", uid),
String.class);
}
diff --git a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
index b3430254..f226b402 100644
--- a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
@@ -357,7 +357,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
if (ret > 0)
return newHash;
}
- return "";
+ return StringUtils.EMPTY;
}
@Transactional(readOnly = true)
@@ -649,7 +649,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
"SELECT hash FROM mail WHERE user_id = ?",
String.class,
user.getUid());
- return list.isEmpty() ? "" : list.get(0) + "@mail.juick.com";
+ return list.isEmpty() ? StringUtils.EMPTY : list.get(0) + "@mail.juick.com";
}
@Transactional
diff --git a/juick-server/src/main/java/com/juick/service/search/SphinxSearchServiceImpl.java b/juick-server/src/main/java/com/juick/service/search/SphinxSearchServiceImpl.java
index de0a101f..161e0fb2 100644
--- a/juick-server/src/main/java/com/juick/service/search/SphinxSearchServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/search/SphinxSearchServiceImpl.java
@@ -49,7 +49,7 @@ public class SphinxSearchServiceImpl implements SearchService {
return namedParameterSearchJdbcTemplate.queryForList(
"SELECT id AS message_id FROM messages WHERE MATCH(:search) " +
(messageIdBefore > 0 ?
- " AND id < :before " : "") +
+ " AND id < :before " : StringUtils.EMPTY) +
" ORDER BY id DESC LIMIT :limit",
sqlParameterSource,
Integer.class);
@@ -69,7 +69,7 @@ public class SphinxSearchServiceImpl implements SearchService {
return namedParameterSearchJdbcTemplate.queryForList(
"SELECT id AS message_id FROM messages WHERE user_id = :userId AND MATCH(:search) " +
(messageIdBefore > 0 ?
- " AND id < :before " : "") +
+ " AND id < :before " : StringUtils.EMPTY) +
" ORDER BY id DESC LIMIT :limit",
sqlParameterSource,
Integer.class);
diff --git a/juick-server/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java b/juick-server/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java
index ec44baa0..1fb2c6a3 100644
--- a/juick-server/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java
+++ b/juick-server/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java
@@ -104,6 +104,6 @@ public class CookieSimpleHashRememberMeServices extends AbstractRememberMeServic
@Override
protected String encodeCookie(String[] cookieTokens) {
- return cookieTokens != null && cookieTokens.length > 0 ? cookieTokens[0] : "";
+ return cookieTokens != null && cookieTokens.length > 0 ? cookieTokens[0] : StringUtils.EMPTY;
}
}