Refactor some parameter names to make method function more obvious
This commit is contained in:
parent
3dc441d61d
commit
696a99b872
@ -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<List<Long>> getUnhandledReports(int accountId, ReportCategory category, Region region, boolean devMode)
|
||||
public CompletableFuture<List<Long>> getUnhandledReports(int handlerId, ReportCategory category, Region region, boolean devMode)
|
||||
{
|
||||
CompletableFuture<List<Long>> 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<List<Long>> getReportsHandling(int accountId)
|
||||
public CompletableFuture<List<Long>> getReportsHandling(int handlerId)
|
||||
{
|
||||
CompletableFuture<List<Long>> 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<List<Report>> getOngoingReports(int accountId)
|
||||
public CompletableFuture<List<Report>> getOngoingReports(int suspectId)
|
||||
{
|
||||
CompletableFuture<List<Report>> future = CompletableFuture.supplyAsync(() ->
|
||||
{
|
||||
@ -405,7 +405,7 @@ public class ReportRepository
|
||||
{
|
||||
List<Report> 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<List<Long>> getOngoingReports(int accountId, ReportCategory category)
|
||||
public CompletableFuture<List<Long>> getOngoingReports(int suspectId, ReportCategory category)
|
||||
{
|
||||
CompletableFuture<List<Long>> 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<Integer> getResultCount(int accountId, ReportResultType resultType)
|
||||
public CompletableFuture<Integer> getResultCount(int reporterId, ReportResultType resultType)
|
||||
{
|
||||
CompletableFuture<Integer> 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;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user