From 696a99b872896cb549b594359d176932706827ce Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Sat, 29 Oct 2016 15:26:02 +0100 Subject: [PATCH] Refactor some parameter names to make method function more obvious --- .../core/report/data/ReportRepository.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java index 1336ed555..b2a32161e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java @@ -160,11 +160,11 @@ public class ReportRepository /** * Gets the ids of unhandled reports that the supplied user is allowed to handle. * - * @param accountId the id of the account carrying out the search + * @param handlerId the id of the account carrying out the search * @param devMode if true, allows various restrictions to be bypassed * @return the ids of unhandled reports the supplied account is allowed to handle */ - public CompletableFuture> getUnhandledReports(int accountId, ReportCategory category, Region region, boolean devMode) + public CompletableFuture> getUnhandledReports(int handlerId, ReportCategory category, Region region, boolean devMode) { CompletableFuture> future = CompletableFuture.supplyAsync(() -> { @@ -176,11 +176,11 @@ public class ReportRepository preparedStatement.setShort(1, category.getId()); preparedStatement.setString(2, region.name()); preparedStatement.setBoolean(3, devMode); - preparedStatement.setInt(4, accountId); - preparedStatement.setInt(5, accountId); - preparedStatement.setInt(6, accountId); + preparedStatement.setInt(4, handlerId); + preparedStatement.setInt(5, handlerId); + preparedStatement.setInt(6, handlerId); preparedStatement.setBoolean(7, devMode); - preparedStatement.setInt(8, accountId); + preparedStatement.setInt(8, handlerId); ResultSet resultSet = preparedStatement.executeQuery(); while (resultSet.next()) @@ -207,10 +207,10 @@ public class ReportRepository /** * Gets a list containing the ids of reports the account is handling - * @param accountId the id of the account + * @param handlerId the id of the account * @return a list containing the ids of reports being handled */ - public CompletableFuture> getReportsHandling(int accountId) + public CompletableFuture> getReportsHandling(int handlerId) { CompletableFuture> future = CompletableFuture.supplyAsync(() -> { @@ -219,7 +219,7 @@ public class ReportRepository try (Connection connection = DBPool.getAccount().getConnection()) { PreparedStatement preparedStatement = connection.prepareStatement(GET_REPORTS_HANDLING); - preparedStatement.setInt(1, accountId); + preparedStatement.setInt(1, handlerId); ResultSet resultSet = preparedStatement.executeQuery(); @@ -397,7 +397,7 @@ public class ReportRepository return null; } - public CompletableFuture> getOngoingReports(int accountId) + public CompletableFuture> getOngoingReports(int suspectId) { CompletableFuture> future = CompletableFuture.supplyAsync(() -> { @@ -405,7 +405,7 @@ public class ReportRepository { List reports = new ArrayList<>(); PreparedStatement preparedStatement = connection.prepareStatement(GET_ONGOING_REPORT); - preparedStatement.setInt(1, accountId); + preparedStatement.setInt(1, suspectId); ResultSet resultSet = preparedStatement.executeQuery(); while (resultSet.next()) @@ -441,21 +441,21 @@ public class ReportRepository future.exceptionally(throwable -> { - _logger.log(Level.SEVERE, "Error getting ongoing report for account: " + accountId + ".", throwable); + _logger.log(Level.SEVERE, "Error getting ongoing report for account: " + suspectId + ".", throwable); return null; }); return future; } - public CompletableFuture> getOngoingReports(int accountId, ReportCategory category) + public CompletableFuture> getOngoingReports(int suspectId, ReportCategory category) { CompletableFuture> future = CompletableFuture.supplyAsync(() -> { try (Connection connection = DBPool.getAccount().getConnection()) { PreparedStatement preparedStatement = connection.prepareStatement(GET_ONGOING_REPORT_CATEGORY); - preparedStatement.setInt(1, accountId); + preparedStatement.setInt(1, suspectId); preparedStatement.setInt(2, category.getId()); ResultSet resultSet = preparedStatement.executeQuery(); @@ -475,7 +475,7 @@ public class ReportRepository future.exceptionally(throwable -> { - _logger.log(Level.SEVERE, "Error fetching ongoing report for account: " + accountId + ", category: " + category + ".", throwable); + _logger.log(Level.SEVERE, "Error fetching ongoing report for account: " + suspectId + ", category: " + category + ".", throwable); return new ArrayList<>(); }); @@ -512,13 +512,13 @@ public class ReportRepository return reportMessages; } - public CompletableFuture getResultCount(int accountId, ReportResultType resultType) + public CompletableFuture getResultCount(int reporterId, ReportResultType resultType) { CompletableFuture future = CompletableFuture.supplyAsync(() -> { try (Connection connection = DBPool.getAccount().getConnection()) { PreparedStatement preparedStatement = connection.prepareStatement(GET_USER_RESULT_COUNT); - preparedStatement.setInt(1, accountId); + preparedStatement.setInt(1, reporterId); preparedStatement.setInt(2, resultType.getId()); ResultSet resultSet = preparedStatement.executeQuery(); @@ -537,7 +537,7 @@ public class ReportRepository future.exceptionally(throwable -> { - _logger.log(Level.SEVERE, "Error fetching result count for account: " + accountId + ", type: " + resultType + ".", throwable); + _logger.log(Level.SEVERE, "Error fetching result count for account: " + reporterId + ", type: " + resultType + ".", throwable); return 0; });