mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-14 12:11:23 +01:00
Rename things for better understanding
fetchQueryPreviewPlayersOnline -> fetchViewPreviewGraphData FilterQuery -> SpecifiedFilterInformation ExtensionQueryPlayerDataTableQuery -> ExtensionQueryResultTableDataQuery ExtensionServerPlayerDataTableQuery -> ExtensionServerTableDataQuery
This commit is contained in:
parent
c55f44a3e5
commit
7480aa9d63
@ -24,7 +24,7 @@ import com.djrapitops.plan.delivery.formatting.Formatter;
|
|||||||
import com.djrapitops.plan.delivery.formatting.Formatters;
|
import com.djrapitops.plan.delivery.formatting.Formatters;
|
||||||
import com.djrapitops.plan.delivery.rendering.json.graphs.Graphs;
|
import com.djrapitops.plan.delivery.rendering.json.graphs.Graphs;
|
||||||
import com.djrapitops.plan.extension.implementation.results.ExtensionTabData;
|
import com.djrapitops.plan.extension.implementation.results.ExtensionTabData;
|
||||||
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionServerPlayerDataTableQuery;
|
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionServerTableDataQuery;
|
||||||
import com.djrapitops.plan.gathering.cache.SessionCache;
|
import com.djrapitops.plan.gathering.cache.SessionCache;
|
||||||
import com.djrapitops.plan.gathering.domain.Ping;
|
import com.djrapitops.plan.gathering.domain.Ping;
|
||||||
import com.djrapitops.plan.gathering.domain.PlayerKill;
|
import com.djrapitops.plan.gathering.domain.PlayerKill;
|
||||||
@ -91,7 +91,7 @@ public class JSONFactory {
|
|||||||
|
|
||||||
return new PlayersTableJSONCreator(
|
return new PlayersTableJSONCreator(
|
||||||
database.query(new ServerTablePlayersQuery(serverUUID, System.currentTimeMillis(), playtimeThreshold, xMostRecentPlayers)),
|
database.query(new ServerTablePlayersQuery(serverUUID, System.currentTimeMillis(), playtimeThreshold, xMostRecentPlayers)),
|
||||||
database.query(new ExtensionServerPlayerDataTableQuery(serverUUID, xMostRecentPlayers)),
|
database.query(new ExtensionServerTableDataQuery(serverUUID, xMostRecentPlayers)),
|
||||||
openPlayerLinksInNewTab,
|
openPlayerLinksInNewTab,
|
||||||
formatters, locale
|
formatters, locale
|
||||||
).toJSONMap();
|
).toJSONMap();
|
||||||
@ -105,7 +105,7 @@ public class JSONFactory {
|
|||||||
Database database = dbSystem.getDatabase();
|
Database database = dbSystem.getDatabase();
|
||||||
|
|
||||||
UUID mainServerUUID = database.query(ServerQueries.fetchProxyServerInformation()).map(Server::getUuid).orElse(serverInfo.getServerUUID());
|
UUID mainServerUUID = database.query(ServerQueries.fetchProxyServerInformation()).map(Server::getUuid).orElse(serverInfo.getServerUUID());
|
||||||
Map<UUID, ExtensionTabData> pluginData = database.query(new ExtensionServerPlayerDataTableQuery(mainServerUUID, xMostRecentPlayers));
|
Map<UUID, ExtensionTabData> pluginData = database.query(new ExtensionServerTableDataQuery(mainServerUUID, xMostRecentPlayers));
|
||||||
|
|
||||||
return new PlayersTableJSONCreator(
|
return new PlayersTableJSONCreator(
|
||||||
database.query(new NetworkTablePlayersQuery(System.currentTimeMillis(), playtimeThreshold, xMostRecentPlayers)),
|
database.query(new NetworkTablePlayersQuery(System.currentTimeMillis(), playtimeThreshold, xMostRecentPlayers)),
|
||||||
|
@ -80,7 +80,7 @@ public class FiltersJSONResolver implements Resolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Response getResponse() {
|
private Response getResponse() {
|
||||||
List<DateObj<Integer>> data = dbSystem.getDatabase().query(TPSQueries.fetchQueryPreviewPlayersOnline(serverInfo.getServerUUID()));
|
List<DateObj<Integer>> data = dbSystem.getDatabase().query(TPSQueries.fetchViewPreviewGraphData(serverInfo.getServerUUID()));
|
||||||
Long earliestStart = dbSystem.getDatabase().query(SessionQueries.earliestSessionStart());
|
Long earliestStart = dbSystem.getDatabase().query(SessionQueries.earliestSessionStart());
|
||||||
data.add(0, new DateObj<>(earliestStart, 1));
|
data.add(0, new DateObj<>(earliestStart, 1));
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ import com.djrapitops.plan.delivery.web.resolver.Response;
|
|||||||
import com.djrapitops.plan.delivery.web.resolver.exception.BadRequestException;
|
import com.djrapitops.plan.delivery.web.resolver.exception.BadRequestException;
|
||||||
import com.djrapitops.plan.delivery.web.resolver.request.Request;
|
import com.djrapitops.plan.delivery.web.resolver.request.Request;
|
||||||
import com.djrapitops.plan.delivery.web.resolver.request.WebUser;
|
import com.djrapitops.plan.delivery.web.resolver.request.WebUser;
|
||||||
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionQueryPlayerDataTableQuery;
|
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionQueryResultTableDataQuery;
|
||||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||||
import com.djrapitops.plan.settings.config.paths.DisplaySettings;
|
import com.djrapitops.plan.settings.config.paths.DisplaySettings;
|
||||||
import com.djrapitops.plan.settings.config.paths.TimeSettings;
|
import com.djrapitops.plan.settings.config.paths.TimeSettings;
|
||||||
@ -36,8 +36,8 @@ import com.djrapitops.plan.storage.database.DBSystem;
|
|||||||
import com.djrapitops.plan.storage.database.Database;
|
import com.djrapitops.plan.storage.database.Database;
|
||||||
import com.djrapitops.plan.storage.database.queries.analysis.NetworkActivityIndexQueries;
|
import com.djrapitops.plan.storage.database.queries.analysis.NetworkActivityIndexQueries;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.Filter;
|
import com.djrapitops.plan.storage.database.queries.filter.Filter;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.FilterQuery;
|
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.QueryFilters;
|
import com.djrapitops.plan.storage.database.queries.filter.QueryFilters;
|
||||||
|
import com.djrapitops.plan.storage.database.queries.filter.SpecifiedFilterInformation;
|
||||||
import com.djrapitops.plan.storage.database.queries.objects.GeoInfoQueries;
|
import com.djrapitops.plan.storage.database.queries.objects.GeoInfoQueries;
|
||||||
import com.djrapitops.plan.storage.database.queries.objects.SessionQueries;
|
import com.djrapitops.plan.storage.database.queries.objects.SessionQueries;
|
||||||
import com.djrapitops.plan.storage.database.queries.objects.playertable.QueryTablePlayersQuery;
|
import com.djrapitops.plan.storage.database.queries.objects.playertable.QueryTablePlayersQuery;
|
||||||
@ -118,7 +118,7 @@ public class QueryJSONResolver implements Resolver {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
q = URLDecoder.decode(q, "UTF-8");
|
q = URLDecoder.decode(q, "UTF-8");
|
||||||
List<FilterQuery> queries = FilterQuery.parse(q);
|
List<SpecifiedFilterInformation> queries = SpecifiedFilterInformation.parse(q);
|
||||||
Filter.Result result = filters.apply(queries);
|
Filter.Result result = filters.apply(queries);
|
||||||
List<Filter.ResultPath> resultPath = result.getInverseResultPath();
|
List<Filter.ResultPath> resultPath = result.getInverseResultPath();
|
||||||
Collections.reverse(resultPath);
|
Collections.reverse(resultPath);
|
||||||
@ -198,7 +198,7 @@ public class QueryJSONResolver implements Resolver {
|
|||||||
Database database = dbSystem.getDatabase();
|
Database database = dbSystem.getDatabase();
|
||||||
return new PlayersTableJSONCreator(
|
return new PlayersTableJSONCreator(
|
||||||
database.query(new QueryTablePlayersQuery(playerUUIDs, after, before, config.get(TimeSettings.ACTIVE_PLAY_THRESHOLD))),
|
database.query(new QueryTablePlayersQuery(playerUUIDs, after, before, config.get(TimeSettings.ACTIVE_PLAY_THRESHOLD))),
|
||||||
database.query(new ExtensionQueryPlayerDataTableQuery(playerUUIDs)),
|
database.query(new ExtensionQueryResultTableDataQuery(playerUUIDs)),
|
||||||
config.get(DisplaySettings.OPEN_PLAYER_LINKS_IN_NEW_TAB),
|
config.get(DisplaySettings.OPEN_PLAYER_LINKS_IN_NEW_TAB),
|
||||||
formatters, locale
|
formatters, locale
|
||||||
).toJSONMap();
|
).toJSONMap();
|
||||||
|
@ -46,11 +46,11 @@ import static com.djrapitops.plan.storage.database.sql.building.Sql.*;
|
|||||||
*
|
*
|
||||||
* @author Rsl1122
|
* @author Rsl1122
|
||||||
*/
|
*/
|
||||||
public class ExtensionQueryPlayerDataTableQuery implements Query<Map<UUID, ExtensionTabData>> {
|
public class ExtensionQueryResultTableDataQuery implements Query<Map<UUID, ExtensionTabData>> {
|
||||||
|
|
||||||
private final Collection<UUID> playerUUIDs;
|
private final Collection<UUID> playerUUIDs;
|
||||||
|
|
||||||
public ExtensionQueryPlayerDataTableQuery(Collection<UUID> playerUUIDs) {
|
public ExtensionQueryResultTableDataQuery(Collection<UUID> playerUUIDs) {
|
||||||
this.playerUUIDs = playerUUIDs;
|
this.playerUUIDs = playerUUIDs;
|
||||||
}
|
}
|
||||||
|
|
@ -43,12 +43,12 @@ import static com.djrapitops.plan.storage.database.sql.building.Sql.*;
|
|||||||
*
|
*
|
||||||
* @author Rsl1122
|
* @author Rsl1122
|
||||||
*/
|
*/
|
||||||
public class ExtensionServerPlayerDataTableQuery implements Query<Map<UUID, ExtensionTabData>> {
|
public class ExtensionServerTableDataQuery implements Query<Map<UUID, ExtensionTabData>> {
|
||||||
|
|
||||||
private final UUID serverUUID;
|
private final UUID serverUUID;
|
||||||
private final int xMostRecentPlayers;
|
private final int xMostRecentPlayers;
|
||||||
|
|
||||||
public ExtensionServerPlayerDataTableQuery(UUID serverUUID, int xMostRecentPlayers) {
|
public ExtensionServerTableDataQuery(UUID serverUUID, int xMostRecentPlayers) {
|
||||||
this.serverUUID = serverUUID;
|
this.serverUUID = serverUUID;
|
||||||
this.xMostRecentPlayers = xMostRecentPlayers;
|
this.xMostRecentPlayers = xMostRecentPlayers;
|
||||||
}
|
}
|
@ -41,9 +41,9 @@ public interface Filter {
|
|||||||
* @throws IllegalArgumentException If the arguments are not valid.
|
* @throws IllegalArgumentException If the arguments are not valid.
|
||||||
* @throws CompleteSetException If the arguments produce a complete set.
|
* @throws CompleteSetException If the arguments produce a complete set.
|
||||||
*/
|
*/
|
||||||
Set<UUID> getMatchingUUIDs(FilterQuery query);
|
Set<UUID> getMatchingUUIDs(SpecifiedFilterInformation query);
|
||||||
|
|
||||||
default Result apply(FilterQuery query) {
|
default Result apply(SpecifiedFilterInformation query) {
|
||||||
return new Result(null, getKind(), getMatchingUUIDs(query));
|
return new Result(null, getKind(), getMatchingUUIDs(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public interface Filter {
|
|||||||
this.currentUUIDs = currentUUIDs;
|
this.currentUUIDs = currentUUIDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result apply(Filter filter, FilterQuery query) {
|
public Result apply(Filter filter, SpecifiedFilterInformation query) {
|
||||||
Set<UUID> got = filter.getMatchingUUIDs(query);
|
Set<UUID> got = filter.getMatchingUUIDs(query);
|
||||||
currentUUIDs.retainAll(got);
|
currentUUIDs.retainAll(got);
|
||||||
return new Result(this, filter.getKind(), currentUUIDs);
|
return new Result(this, filter.getKind(), currentUUIDs);
|
||||||
|
@ -78,26 +78,26 @@ public class QueryFilters {
|
|||||||
* @return the result object or null if none of the filterQueries could be applied.
|
* @return the result object or null if none of the filterQueries could be applied.
|
||||||
* @throws BadRequestException If the request kind is not supported or if filter was given bad options.
|
* @throws BadRequestException If the request kind is not supported or if filter was given bad options.
|
||||||
*/
|
*/
|
||||||
public Filter.Result apply(List<FilterQuery> filterQueries) {
|
public Filter.Result apply(List<SpecifiedFilterInformation> filterQueries) {
|
||||||
prepareFilters();
|
prepareFilters();
|
||||||
Filter.Result current = null;
|
Filter.Result current = null;
|
||||||
if (filterQueries.isEmpty()) return allPlayersFilter.apply(null);
|
if (filterQueries.isEmpty()) return allPlayersFilter.apply(null);
|
||||||
for (FilterQuery filterQuery : filterQueries) {
|
for (SpecifiedFilterInformation specifiedFilterInformation : filterQueries) {
|
||||||
current = apply(current, filterQuery);
|
current = apply(current, specifiedFilterInformation);
|
||||||
if (current != null && current.isEmpty()) break;
|
if (current != null && current.isEmpty()) break;
|
||||||
}
|
}
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Filter.Result apply(Filter.Result current, FilterQuery filterQuery) {
|
private Filter.Result apply(Filter.Result current, SpecifiedFilterInformation specifiedFilterInformation) {
|
||||||
String kind = filterQuery.getKind();
|
String kind = specifiedFilterInformation.getKind();
|
||||||
Filter filter = getFilter(kind).orElseThrow(() -> new BadRequestException("Filter kind not supported: '" + kind + "'"));
|
Filter filter = getFilter(kind).orElseThrow(() -> new BadRequestException("Filter kind not supported: '" + kind + "'"));
|
||||||
|
|
||||||
current = getResult(current, filter, filterQuery);
|
current = getResult(current, filter, specifiedFilterInformation);
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Filter.Result getResult(Filter.Result current, Filter filter, FilterQuery query) {
|
private Filter.Result getResult(Filter.Result current, Filter filter, SpecifiedFilterInformation query) {
|
||||||
try {
|
try {
|
||||||
return current == null ? filter.apply(query) : current.apply(filter, query);
|
return current == null ? filter.apply(query) : current.apply(filter, query);
|
||||||
} catch (IllegalArgumentException badOptions) {
|
} catch (IllegalArgumentException badOptions) {
|
||||||
|
@ -27,18 +27,18 @@ import java.util.*;
|
|||||||
*
|
*
|
||||||
* @author Rsl1122
|
* @author Rsl1122
|
||||||
*/
|
*/
|
||||||
public class FilterQuery {
|
public class SpecifiedFilterInformation {
|
||||||
|
|
||||||
private final String kind;
|
private final String kind;
|
||||||
private final Map<String, String> parameters;
|
private final Map<String, String> parameters;
|
||||||
|
|
||||||
public FilterQuery(String kind, Map<String, String> parameters) {
|
public SpecifiedFilterInformation(String kind, Map<String, String> parameters) {
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.parameters = parameters;
|
this.parameters = parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<FilterQuery> parse(String json) throws IOException {
|
public static List<SpecifiedFilterInformation> parse(String json) throws IOException {
|
||||||
return new Gson().getAdapter(new TypeToken<List<FilterQuery>>() {}).fromJson(json);
|
return new Gson().getAdapter(new TypeToken<List<SpecifiedFilterInformation>>() {}).fromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKind() {
|
public String getKind() {
|
@ -23,7 +23,7 @@ import com.djrapitops.plan.settings.locale.Locale;
|
|||||||
import com.djrapitops.plan.storage.database.DBSystem;
|
import com.djrapitops.plan.storage.database.DBSystem;
|
||||||
import com.djrapitops.plan.storage.database.queries.analysis.NetworkActivityIndexQueries;
|
import com.djrapitops.plan.storage.database.queries.analysis.NetworkActivityIndexQueries;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.CompleteSetException;
|
import com.djrapitops.plan.storage.database.queries.filter.CompleteSetException;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.FilterQuery;
|
import com.djrapitops.plan.storage.database.queries.filter.SpecifiedFilterInformation;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@ -63,7 +63,7 @@ public class ActivityIndexFilter extends MultiOptionFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> getMatchingUUIDs(FilterQuery query) {
|
public Set<UUID> getMatchingUUIDs(SpecifiedFilterInformation query) {
|
||||||
List<String> selected = getSelected(query);
|
List<String> selected = getSelected(query);
|
||||||
String[] options = getOptionsArray();
|
String[] options = getOptionsArray();
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package com.djrapitops.plan.storage.database.queries.filter.filters;
|
|||||||
|
|
||||||
import com.djrapitops.plan.storage.database.DBSystem;
|
import com.djrapitops.plan.storage.database.DBSystem;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.Filter;
|
import com.djrapitops.plan.storage.database.queries.filter.Filter;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.FilterQuery;
|
import com.djrapitops.plan.storage.database.queries.filter.SpecifiedFilterInformation;
|
||||||
import com.djrapitops.plan.storage.database.queries.objects.UserIdentifierQueries;
|
import com.djrapitops.plan.storage.database.queries.objects.UserIdentifierQueries;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -52,7 +52,7 @@ public class AllPlayersFilter implements Filter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> getMatchingUUIDs(FilterQuery query) {
|
public Set<UUID> getMatchingUUIDs(SpecifiedFilterInformation query) {
|
||||||
return dbSystem.getDatabase().query(UserIdentifierQueries.fetchAllPlayerUUIDs());
|
return dbSystem.getDatabase().query(UserIdentifierQueries.fetchAllPlayerUUIDs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import com.djrapitops.plan.settings.locale.Locale;
|
|||||||
import com.djrapitops.plan.settings.locale.lang.FilterLang;
|
import com.djrapitops.plan.settings.locale.lang.FilterLang;
|
||||||
import com.djrapitops.plan.storage.database.DBSystem;
|
import com.djrapitops.plan.storage.database.DBSystem;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.CompleteSetException;
|
import com.djrapitops.plan.storage.database.queries.filter.CompleteSetException;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.FilterQuery;
|
import com.djrapitops.plan.storage.database.queries.filter.SpecifiedFilterInformation;
|
||||||
import com.djrapitops.plan.storage.database.queries.objects.UserInfoQueries;
|
import com.djrapitops.plan.storage.database.queries.objects.UserInfoQueries;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -57,7 +57,7 @@ public class BannedFilter extends MultiOptionFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> getMatchingUUIDs(FilterQuery query) {
|
public Set<UUID> getMatchingUUIDs(SpecifiedFilterInformation query) {
|
||||||
List<String> selected = getSelected(query);
|
List<String> selected = getSelected(query);
|
||||||
Set<UUID> uuids = new HashSet<>();
|
Set<UUID> uuids = new HashSet<>();
|
||||||
String[] options = getOptionsArray();
|
String[] options = getOptionsArray();
|
||||||
|
@ -18,7 +18,7 @@ package com.djrapitops.plan.storage.database.queries.filter.filters;
|
|||||||
|
|
||||||
import com.djrapitops.plan.storage.database.DBSystem;
|
import com.djrapitops.plan.storage.database.DBSystem;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.Filter;
|
import com.djrapitops.plan.storage.database.queries.filter.Filter;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.FilterQuery;
|
import com.djrapitops.plan.storage.database.queries.filter.SpecifiedFilterInformation;
|
||||||
import com.djrapitops.plan.storage.database.queries.objects.BaseUserQueries;
|
import com.djrapitops.plan.storage.database.queries.objects.BaseUserQueries;
|
||||||
import com.djrapitops.plan.utilities.java.Maps;
|
import com.djrapitops.plan.utilities.java.Maps;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -60,15 +60,15 @@ public abstract class DateRangeFilter implements Filter {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getAfter(FilterQuery query) {
|
protected long getAfter(SpecifiedFilterInformation query) {
|
||||||
return getTime(query, "afterDate", "afterTime");
|
return getTime(query, "afterDate", "afterTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getBefore(FilterQuery query) {
|
protected long getBefore(SpecifiedFilterInformation query) {
|
||||||
return getTime(query, "beforeDate", "beforeTime");
|
return getTime(query, "beforeDate", "beforeTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getTime(FilterQuery query, String dateKey, String timeKey) {
|
private long getTime(SpecifiedFilterInformation query, String dateKey, String timeKey) {
|
||||||
String date = query.get(dateKey).orElseThrow(IllegalArgumentException::new);
|
String date = query.get(dateKey).orElseThrow(IllegalArgumentException::new);
|
||||||
String time = query.get(timeKey).orElseThrow(IllegalArgumentException::new);
|
String time = query.get(timeKey).orElseThrow(IllegalArgumentException::new);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package com.djrapitops.plan.storage.database.queries.filter.filters;
|
|||||||
|
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.CompleteSetException;
|
import com.djrapitops.plan.storage.database.queries.filter.CompleteSetException;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.Filter;
|
import com.djrapitops.plan.storage.database.queries.filter.Filter;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.FilterQuery;
|
import com.djrapitops.plan.storage.database.queries.filter.SpecifiedFilterInformation;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public abstract class MultiOptionFilter implements Filter {
|
|||||||
return new String[]{"selected"};
|
return new String[]{"selected"};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<String> getSelected(FilterQuery query) {
|
protected List<String> getSelected(SpecifiedFilterInformation query) {
|
||||||
String selectedJSON = query.get("selected").orElseThrow(IllegalArgumentException::new);
|
String selectedJSON = query.get("selected").orElseThrow(IllegalArgumentException::new);
|
||||||
List<String> selected = new Gson().fromJson(selectedJSON, new TypeToken<List<String>>() {}.getType());
|
List<String> selected = new Gson().fromJson(selectedJSON, new TypeToken<List<String>>() {}.getType());
|
||||||
if (selected.isEmpty()) throw new CompleteSetException();
|
if (selected.isEmpty()) throw new CompleteSetException();
|
||||||
|
@ -20,7 +20,7 @@ import com.djrapitops.plan.settings.locale.Locale;
|
|||||||
import com.djrapitops.plan.settings.locale.lang.FilterLang;
|
import com.djrapitops.plan.settings.locale.lang.FilterLang;
|
||||||
import com.djrapitops.plan.storage.database.DBSystem;
|
import com.djrapitops.plan.storage.database.DBSystem;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.CompleteSetException;
|
import com.djrapitops.plan.storage.database.queries.filter.CompleteSetException;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.FilterQuery;
|
import com.djrapitops.plan.storage.database.queries.filter.SpecifiedFilterInformation;
|
||||||
import com.djrapitops.plan.storage.database.queries.objects.UserInfoQueries;
|
import com.djrapitops.plan.storage.database.queries.objects.UserInfoQueries;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -57,7 +57,7 @@ public class OperatorsFilter extends MultiOptionFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> getMatchingUUIDs(FilterQuery query) {
|
public Set<UUID> getMatchingUUIDs(SpecifiedFilterInformation query) {
|
||||||
List<String> selected = getSelected(query);
|
List<String> selected = getSelected(query);
|
||||||
Set<UUID> uuids = new HashSet<>();
|
Set<UUID> uuids = new HashSet<>();
|
||||||
String[] options = getOptionsArray();
|
String[] options = getOptionsArray();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package com.djrapitops.plan.storage.database.queries.filter.filters;
|
package com.djrapitops.plan.storage.database.queries.filter.filters;
|
||||||
|
|
||||||
import com.djrapitops.plan.storage.database.DBSystem;
|
import com.djrapitops.plan.storage.database.DBSystem;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.FilterQuery;
|
import com.djrapitops.plan.storage.database.queries.filter.SpecifiedFilterInformation;
|
||||||
import com.djrapitops.plan.storage.database.queries.objects.SessionQueries;
|
import com.djrapitops.plan.storage.database.queries.objects.SessionQueries;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -28,7 +28,7 @@ import java.util.UUID;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class PlayedBetweenDateRangeFilter extends DateRangeFilter {
|
public class PlayedBetweenDateRangeFilter extends DateRangeFilter {
|
||||||
|
|
||||||
private DBSystem dbSystem;
|
private final DBSystem dbSystem;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public PlayedBetweenDateRangeFilter(DBSystem dbSystem) {
|
public PlayedBetweenDateRangeFilter(DBSystem dbSystem) {
|
||||||
@ -42,7 +42,7 @@ public class PlayedBetweenDateRangeFilter extends DateRangeFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> getMatchingUUIDs(FilterQuery query) {
|
public Set<UUID> getMatchingUUIDs(SpecifiedFilterInformation query) {
|
||||||
long after = getAfter(query);
|
long after = getAfter(query);
|
||||||
long before = getBefore(query);
|
long before = getBefore(query);
|
||||||
return dbSystem.getDatabase().query(SessionQueries.uuidsOfPlayedBetween(after, before));
|
return dbSystem.getDatabase().query(SessionQueries.uuidsOfPlayedBetween(after, before));
|
||||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.storage.database.queries.filter.filters;
|
|||||||
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionUUIDsInGroupQuery;
|
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionUUIDsInGroupQuery;
|
||||||
import com.djrapitops.plan.storage.database.DBSystem;
|
import com.djrapitops.plan.storage.database.DBSystem;
|
||||||
import com.djrapitops.plan.storage.database.queries.QueryAllStatement;
|
import com.djrapitops.plan.storage.database.queries.QueryAllStatement;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.FilterQuery;
|
import com.djrapitops.plan.storage.database.queries.filter.SpecifiedFilterInformation;
|
||||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionGroupsTable;
|
import com.djrapitops.plan.storage.database.sql.tables.ExtensionGroupsTable;
|
||||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionPluginTable;
|
import com.djrapitops.plan.storage.database.sql.tables.ExtensionPluginTable;
|
||||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||||
@ -66,7 +66,7 @@ public class PluginGroupsFilter extends MultiOptionFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> getMatchingUUIDs(FilterQuery query) {
|
public Set<UUID> getMatchingUUIDs(SpecifiedFilterInformation query) {
|
||||||
return dbSystem.getDatabase().query(
|
return dbSystem.getDatabase().query(
|
||||||
new ExtensionUUIDsInGroupQuery(pluginName, groupProvider, getSelected(query))
|
new ExtensionUUIDsInGroupQuery(pluginName, groupProvider, getSelected(query))
|
||||||
);
|
);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package com.djrapitops.plan.storage.database.queries.filter.filters;
|
package com.djrapitops.plan.storage.database.queries.filter.filters;
|
||||||
|
|
||||||
import com.djrapitops.plan.storage.database.DBSystem;
|
import com.djrapitops.plan.storage.database.DBSystem;
|
||||||
import com.djrapitops.plan.storage.database.queries.filter.FilterQuery;
|
import com.djrapitops.plan.storage.database.queries.filter.SpecifiedFilterInformation;
|
||||||
import com.djrapitops.plan.storage.database.queries.objects.BaseUserQueries;
|
import com.djrapitops.plan.storage.database.queries.objects.BaseUserQueries;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -28,7 +28,7 @@ import java.util.UUID;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class RegisteredBetweenDateRangeFilter extends DateRangeFilter {
|
public class RegisteredBetweenDateRangeFilter extends DateRangeFilter {
|
||||||
|
|
||||||
private DBSystem dbSystem;
|
private final DBSystem dbSystem;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RegisteredBetweenDateRangeFilter(DBSystem dbSystem) {
|
public RegisteredBetweenDateRangeFilter(DBSystem dbSystem) {
|
||||||
@ -42,7 +42,7 @@ public class RegisteredBetweenDateRangeFilter extends DateRangeFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> getMatchingUUIDs(FilterQuery query) {
|
public Set<UUID> getMatchingUUIDs(SpecifiedFilterInformation query) {
|
||||||
long after = getAfter(query);
|
long after = getAfter(query);
|
||||||
long before = getBefore(query);
|
long before = getBefore(query);
|
||||||
return dbSystem.getDatabase().query(BaseUserQueries.uuidsOfRegisteredBetween(after, before));
|
return dbSystem.getDatabase().query(BaseUserQueries.uuidsOfRegisteredBetween(after, before));
|
||||||
|
@ -154,7 +154,7 @@ public class TPSQueries {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Query<List<DateObj<Integer>>> fetchQueryPreviewPlayersOnline(UUID serverUUID) {
|
public static Query<List<DateObj<Integer>>> fetchViewPreviewGraphData(UUID serverUUID) {
|
||||||
String sql = SELECT + min(DATE) + " as " + DATE + ',' +
|
String sql = SELECT + min(DATE) + " as " + DATE + ',' +
|
||||||
max(PLAYERS_ONLINE) + " as " + PLAYERS_ONLINE +
|
max(PLAYERS_ONLINE) + " as " + PLAYERS_ONLINE +
|
||||||
FROM + TABLE_NAME +
|
FROM + TABLE_NAME +
|
||||||
|
@ -27,7 +27,7 @@ import com.djrapitops.plan.extension.icon.Icon;
|
|||||||
import com.djrapitops.plan.extension.implementation.results.*;
|
import com.djrapitops.plan.extension.implementation.results.*;
|
||||||
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionPlayerDataQuery;
|
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionPlayerDataQuery;
|
||||||
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionServerDataQuery;
|
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionServerDataQuery;
|
||||||
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionServerPlayerDataTableQuery;
|
import com.djrapitops.plan.extension.implementation.storage.queries.ExtensionServerTableDataQuery;
|
||||||
import com.djrapitops.plan.extension.implementation.storage.transactions.results.RemoveUnsatisfiedConditionalPlayerResultsTransaction;
|
import com.djrapitops.plan.extension.implementation.storage.transactions.results.RemoveUnsatisfiedConditionalPlayerResultsTransaction;
|
||||||
import com.djrapitops.plan.extension.implementation.storage.transactions.results.RemoveUnsatisfiedConditionalServerResultsTransaction;
|
import com.djrapitops.plan.extension.implementation.storage.transactions.results.RemoveUnsatisfiedConditionalServerResultsTransaction;
|
||||||
import com.djrapitops.plan.extension.table.Table;
|
import com.djrapitops.plan.extension.table.Table;
|
||||||
@ -116,7 +116,7 @@ public interface ExtensionsDatabaseTest extends DatabaseTestPreparer {
|
|||||||
|
|
||||||
execute(DataStoreQueries.storeSession(session));
|
execute(DataStoreQueries.storeSession(session));
|
||||||
|
|
||||||
Map<UUID, ExtensionTabData> result = db().query(new ExtensionServerPlayerDataTableQuery(serverUUID(), 50));
|
Map<UUID, ExtensionTabData> result = db().query(new ExtensionServerTableDataQuery(serverUUID(), 50));
|
||||||
assertEquals(1, result.size());
|
assertEquals(1, result.size());
|
||||||
ExtensionTabData playerData = result.get(playerUUID);
|
ExtensionTabData playerData = result.get(playerUUID);
|
||||||
assertNotNull(playerData);
|
assertNotNull(playerData);
|
||||||
|
Loading…
Reference in New Issue
Block a user