aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-04-17 08:39:21 +0300
committerGravatar Vitaly Takmazov2021-04-17 08:39:21 +0300
commit7203299e6ec544d36f4889e02b946bb9b6061f09 (patch)
treec816307ba3c0b48475fdb32b93ceb91d862c924b /src/main/java/com/juick/service
parent7412ab820803908297db14ec8f9c8e9e1d339003 (diff)
Cleanup deprecated usage of third-party libraries
Diffstat (limited to 'src/main/java/com/juick/service')
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java18
-rw-r--r--src/main/java/com/juick/service/UserServiceImpl.java4
2 files changed, 10 insertions, 12 deletions
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index b3b51bcc..eee40512 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2020, Juick
+ * Copyright (C) 2008-2021, Juick
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -334,8 +334,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
public boolean isReadOnly(final int mid) {
List<Integer> list = getJdbcTemplate().queryForList(
"SELECT readonly FROM messages WHERE message_id = ?",
- new Object[]{mid},
- Integer.class);
+ Integer.class,
+ mid);
return !list.isEmpty() && list.get(0) == 1;
}
@@ -345,8 +345,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
public boolean isSubscribed(final int uid, final int mid) {
List<Integer> list = getJdbcTemplate().queryForList(
"SELECT 1 FROM subscr_messages WHERE suser_id = ? AND message_id = ?",
- new Object[]{uid, mid},
- Integer.class);
+ Integer.class,
+ uid, mid);
return !list.isEmpty() && list.get(0) == 1;
}
@@ -356,8 +356,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
public int getMessagePrivacy(final int mid) {
List<Integer> list = getJdbcTemplate().queryForList(
"SELECT privacy FROM messages WHERE message_id = ?",
- new Object[]{mid},
- Integer.class);
+ Integer.class,
+ mid);
return list.isEmpty() ? -4 : list.get(0);
}
@@ -473,13 +473,13 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
List<User> list = getJdbcTemplate().query(
"SELECT messages.user_id, users.nick "
+ "FROM messages INNER JOIN users ON messages.user_id = users.id WHERE messages.message_id = ?",
- new Object[]{mid},
(rs, num) -> {
User res = new User();
res.setUid(rs.getInt(1));
res.setName(rs.getString(2));
return res;
- });
+ },
+ mid);
return list.isEmpty() ?
null : list.get(0);
diff --git a/src/main/java/com/juick/service/UserServiceImpl.java b/src/main/java/com/juick/service/UserServiceImpl.java
index a86b22a6..7d215260 100644
--- a/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/src/main/java/com/juick/service/UserServiceImpl.java
@@ -428,9 +428,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
List<Integer> list = getJdbcTemplate().queryForList(
"SELECT 1 FROM bl_users WHERE (user_id = ? AND bl_user_id = ?) "
+ "OR (user_id = ? AND bl_user_id = ?)",
- new Object[]{uid, uid2, uid2, uid},
- Integer.class);
-
+ Integer.class, uid, uid2, uid2, uid);
return !list.isEmpty() && list.get(0) == 1;
}