From 7203299e6ec544d36f4889e02b946bb9b6061f09 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 17 Apr 2021 08:39:21 +0300 Subject: Cleanup deprecated usage of third-party libraries --- .../java/com/juick/service/MessagesServiceImpl.java | 18 +++++++++--------- src/main/java/com/juick/service/UserServiceImpl.java | 4 +--- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'src/main/java/com/juick/service') 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 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 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 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 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 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; } -- cgit v1.2.3