mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-24 16:14:26 +08:00
Removed ServerTable#getServerUUID
This commit is contained in:
parent
5776215c1e
commit
eadc45d7ed
@ -181,29 +181,6 @@ public class ServerTable extends Table {
|
||||
});
|
||||
}
|
||||
|
||||
public Optional<UUID> getServerUUID(String serverName) {
|
||||
String sql = Select.from(tableName,
|
||||
SERVER_UUID)
|
||||
.where(NAME + "=?")
|
||||
.toString();
|
||||
|
||||
return query(new QueryStatement<Optional<UUID>>(sql) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
statement.setString(1, serverName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UUID> processResults(ResultSet set) throws SQLException {
|
||||
if (set.next()) {
|
||||
return Optional.of(UUID.fromString(set.getString(SERVER_UUID)));
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Optional<Server> getServerInfo(UUID serverUUID) {
|
||||
String sql = Select.from(tableName, "*")
|
||||
.where(SERVER_UUID + "=?")
|
||||
|
@ -80,7 +80,8 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
||||
|
||||
@Override
|
||||
public Optional<UUID> getServerUUID(String serverName) {
|
||||
return serverTable.getServerUUID(serverName);
|
||||
return db.query(OptionalFetchQueries.fetchMatchingServerIdentifier(serverName))
|
||||
.map(Server::getUuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,10 @@ import com.djrapitops.plan.api.exceptions.WebUserAuthException;
|
||||
import com.djrapitops.plan.api.exceptions.connection.ConnectionFailException;
|
||||
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||
import com.djrapitops.plan.db.access.queries.OptionalFetchQueries;
|
||||
import com.djrapitops.plan.system.database.DBSystem;
|
||||
import com.djrapitops.plan.system.info.InfoSystem;
|
||||
import com.djrapitops.plan.system.info.server.Server;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.processing.Processing;
|
||||
import com.djrapitops.plan.system.webserver.Request;
|
||||
@ -109,7 +111,9 @@ public class ServerPageHandler implements PageHandler {
|
||||
if (!target.isEmpty()) {
|
||||
try {
|
||||
String serverName = target.get(0);
|
||||
Optional<UUID> serverUUIDOptional = dbSystem.getDatabase().fetch().getServerUUID(serverName);
|
||||
Optional<UUID> serverUUIDOptional = dbSystem.getDatabase()
|
||||
.query(OptionalFetchQueries.fetchMatchingServerIdentifier(serverName))
|
||||
.map(Server::getUuid);
|
||||
if (serverUUIDOptional.isPresent()) {
|
||||
serverUUID = serverUUIDOptional.get();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user