Do all database operations asynchronously.
This commit is contained in:
parent
9030b4f264
commit
6054bfaac4
|
@ -1,6 +1,7 @@
|
|||
package mineplex.core.report;
|
||||
|
||||
import mineplex.core.database.DBPool;
|
||||
import mineplex.core.database.DatabaseRunnable;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.column.ColumnByte;
|
||||
import mineplex.core.database.column.ColumnInt;
|
||||
|
@ -51,22 +52,42 @@ This will be used to determine if staff are handling
|
|||
|
||||
}
|
||||
|
||||
public void logReportHandling(int reportId, int handlerId)
|
||||
public void logReportHandling(final int reportId, final int handlerId)
|
||||
{
|
||||
executeUpdate(INSERT_HANDLER, new ColumnInt("reportId", reportId), new ColumnInt("handlerId", handlerId));
|
||||
handleDatabaseCall(new DatabaseRunnable(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
executeUpdate(INSERT_HANDLER, new ColumnInt("reportId", reportId), new ColumnInt("handlerId", handlerId));
|
||||
}
|
||||
}), "Error logging report " + reportId + " as being handled by user " + handlerId + ".");
|
||||
}
|
||||
|
||||
public void logReportSending(int reportId, int reporterId, Category category, String reason)
|
||||
public void logReportSending(final int reportId, final int reporterId, final Category category, final String reason)
|
||||
{
|
||||
executeUpdate(INSERT_SENDER, new ColumnInt("reportId", reportId), new ColumnInt("reporterId", reporterId),
|
||||
new ColumnByte("type", (byte) category.getId()), new ColumnVarChar("reason", 100, reason));
|
||||
handleDatabaseCall(new DatabaseRunnable(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
executeUpdate(INSERT_SENDER, new ColumnInt("reportId", reportId), new ColumnInt("reporterId", reporterId),
|
||||
new ColumnByte("type", (byte) category.getId()), new ColumnVarChar("reason", 100, reason));
|
||||
}
|
||||
}), "Error logging report " + reportId + " by user " + reporterId + ".");
|
||||
}
|
||||
|
||||
public void logReport(int reportId, int playerId, String server, int closerId, ReportResult result, String reason)
|
||||
public void logReport(final int reportId, final int playerId, final String server, final int closerId, final ReportResult result, final String reason)
|
||||
{
|
||||
executeUpdate(INSERT_TICKET, new ColumnInt("reportId", reportId), new ColumnInt("playerId", playerId),
|
||||
new ColumnVarChar("server", 50, server), new ColumnInt("closerId", closerId),
|
||||
new ColumnVarChar("result", 25, result.toString()), new ColumnVarChar("reason", 100, reason));
|
||||
handleDatabaseCall(new DatabaseRunnable(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
executeUpdate(INSERT_TICKET, new ColumnInt("reportId", reportId), new ColumnInt("playerId", playerId),
|
||||
new ColumnVarChar("server", 50, server), new ColumnInt("closerId", closerId),
|
||||
new ColumnVarChar("result", 25, result.toString()), new ColumnVarChar("reason", 100, reason));
|
||||
}
|
||||
}), "Error logging result for report " + reportId + ".");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue