From 5c4a768a65e243fba0d512e5a674b93ba1d34061 Mon Sep 17 00:00:00 2001 From: Presti Date: Tue, 9 Aug 2022 13:15:54 +0200 Subject: [PATCH] * Code refactoring and documentation fix. --- .../java/de/presti/ree6/events/LoggingEvents.java | 2 +- .../java/de/presti/ree6/events/OtherEvents.java | 2 +- src/main/java/de/presti/ree6/sql/SQLConnector.java | 13 +++++-------- src/main/java/de/presti/ree6/sql/SQLWorker.java | 8 ++++---- .../ree6/sql/base/{data => entitis}/SQLEntity.java | 2 +- .../sql/base/{data => entitis}/SQLParameter.java | 2 +- .../sql/base/{data => entitis}/SQLResponse.java | 2 +- .../sql/base/{data => entitis}/StoredResultSet.java | 2 +- .../sql/base/{data => utils}/MigrationUtil.java | 2 +- .../ree6/sql/base/{data => utils}/SQLUtil.java | 4 +++- .../de/presti/ree6/sql/entities/BirthdayWish.java | 2 +- .../java/de/presti/ree6/sql/entities/Blacklist.java | 2 +- .../java/de/presti/ree6/sql/entities/Invite.java | 2 +- .../java/de/presti/ree6/sql/entities/Recording.java | 2 +- .../java/de/presti/ree6/sql/entities/Setting.java | 2 +- .../ree6/sql/entities/TemporalVoicechannel.java | 2 +- .../presti/ree6/sql/entities/level/UserLevel.java | 2 +- .../de/presti/ree6/sql/entities/roles/Role.java | 2 +- .../de/presti/ree6/sql/entities/stats/Stats.java | 2 +- .../presti/ree6/sql/entities/webhook/Webhook.java | 2 +- .../de/presti/ree6/sql/mapper/EntityMapper.java | 8 ++++---- .../ree6/sql/migrations/MigrationBuilder.java | 6 +++++- src/main/java/de/presti/ree6/utils/data/Data.java | 9 ++++++--- .../ree6/utils/data/ImageCreationUtility.java | 4 +++- 24 files changed, 47 insertions(+), 39 deletions(-) rename src/main/java/de/presti/ree6/sql/base/{data => entitis}/SQLEntity.java (66%) rename src/main/java/de/presti/ree6/sql/base/{data => entitis}/SQLParameter.java (96%) rename src/main/java/de/presti/ree6/sql/base/{data => entitis}/SQLResponse.java (97%) rename src/main/java/de/presti/ree6/sql/base/{data => entitis}/StoredResultSet.java (99%) rename src/main/java/de/presti/ree6/sql/base/{data => utils}/MigrationUtil.java (99%) rename src/main/java/de/presti/ree6/sql/base/{data => utils}/SQLUtil.java (98%) diff --git a/src/main/java/de/presti/ree6/events/LoggingEvents.java b/src/main/java/de/presti/ree6/events/LoggingEvents.java index 8c43befad..8241f6c7a 100644 --- a/src/main/java/de/presti/ree6/events/LoggingEvents.java +++ b/src/main/java/de/presti/ree6/events/LoggingEvents.java @@ -12,7 +12,7 @@ import de.presti.ree6.logger.invite.InviteContainer; import de.presti.ree6.logger.invite.InviteContainerManager; import de.presti.ree6.main.Main; -import de.presti.ree6.sql.base.data.SQLResponse; +import de.presti.ree6.sql.base.entitis.SQLResponse; import de.presti.ree6.sql.entities.Invite; import de.presti.ree6.sql.entities.webhook.Webhook; import de.presti.ree6.utils.data.ArrayUtil; diff --git a/src/main/java/de/presti/ree6/events/OtherEvents.java b/src/main/java/de/presti/ree6/events/OtherEvents.java index 027e7b7ad..9444cb423 100644 --- a/src/main/java/de/presti/ree6/events/OtherEvents.java +++ b/src/main/java/de/presti/ree6/events/OtherEvents.java @@ -5,7 +5,7 @@ import de.presti.ree6.bot.util.WebhookUtil; import de.presti.ree6.bot.version.BotState; import de.presti.ree6.main.Main; -import de.presti.ree6.sql.base.data.SQLResponse; +import de.presti.ree6.sql.base.entitis.SQLResponse; import de.presti.ree6.sql.entities.TemporalVoicechannel; import de.presti.ree6.sql.entities.level.ChatUserLevel; import de.presti.ree6.sql.entities.level.VoiceUserLevel; diff --git a/src/main/java/de/presti/ree6/sql/SQLConnector.java b/src/main/java/de/presti/ree6/sql/SQLConnector.java index dd65c507c..14cd8976d 100644 --- a/src/main/java/de/presti/ree6/sql/SQLConnector.java +++ b/src/main/java/de/presti/ree6/sql/SQLConnector.java @@ -2,20 +2,17 @@ import com.google.gson.JsonElement; import de.presti.ree6.main.Main; -import de.presti.ree6.sql.base.data.MigrationUtil; -import de.presti.ree6.sql.base.data.SQLEntity; -import de.presti.ree6.sql.base.data.SQLUtil; -import de.presti.ree6.sql.base.data.StoredResultSet; +import de.presti.ree6.sql.base.entitis.SQLEntity; +import de.presti.ree6.sql.base.entitis.StoredResultSet; +import de.presti.ree6.sql.base.utils.MigrationUtil; +import de.presti.ree6.sql.base.utils.SQLUtil; import de.presti.ree6.sql.mapper.EntityMapper; import de.presti.ree6.sql.seed.SeedManager; import org.reflections.Reflections; import java.sql.*; -import java.util.Base64; import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * A "Connector" Class which connect with the used Database Server. diff --git a/src/main/java/de/presti/ree6/sql/SQLWorker.java b/src/main/java/de/presti/ree6/sql/SQLWorker.java index d68a74a1a..5436de6c5 100644 --- a/src/main/java/de/presti/ree6/sql/SQLWorker.java +++ b/src/main/java/de/presti/ree6/sql/SQLWorker.java @@ -7,10 +7,10 @@ import de.presti.ree6.logger.invite.InviteContainer; import de.presti.ree6.main.Main; import de.presti.ree6.sql.base.annotations.Table; -import de.presti.ree6.sql.base.data.SQLEntity; -import de.presti.ree6.sql.base.data.SQLParameter; -import de.presti.ree6.sql.base.data.SQLResponse; -import de.presti.ree6.sql.base.data.SQLUtil; +import de.presti.ree6.sql.base.entitis.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLParameter; +import de.presti.ree6.sql.base.entitis.SQLResponse; +import de.presti.ree6.sql.base.utils.SQLUtil; import de.presti.ree6.sql.entities.BirthdayWish; import de.presti.ree6.sql.entities.Blacklist; import de.presti.ree6.sql.entities.Invite; diff --git a/src/main/java/de/presti/ree6/sql/base/data/SQLEntity.java b/src/main/java/de/presti/ree6/sql/base/entitis/SQLEntity.java similarity index 66% rename from src/main/java/de/presti/ree6/sql/base/data/SQLEntity.java rename to src/main/java/de/presti/ree6/sql/base/entitis/SQLEntity.java index 7c97df0fd..8f9cdc0f7 100644 --- a/src/main/java/de/presti/ree6/sql/base/data/SQLEntity.java +++ b/src/main/java/de/presti/ree6/sql/base/entitis/SQLEntity.java @@ -1,4 +1,4 @@ -package de.presti.ree6.sql.base.data; +package de.presti.ree6.sql.base.entitis; /** * Class to keep track of the SQL Entities. diff --git a/src/main/java/de/presti/ree6/sql/base/data/SQLParameter.java b/src/main/java/de/presti/ree6/sql/base/entitis/SQLParameter.java similarity index 96% rename from src/main/java/de/presti/ree6/sql/base/data/SQLParameter.java rename to src/main/java/de/presti/ree6/sql/base/entitis/SQLParameter.java index c56b7bdb5..53316d0eb 100644 --- a/src/main/java/de/presti/ree6/sql/base/data/SQLParameter.java +++ b/src/main/java/de/presti/ree6/sql/base/entitis/SQLParameter.java @@ -1,4 +1,4 @@ -package de.presti.ree6.sql.base.data; +package de.presti.ree6.sql.base.entitis; /** * This class is used to represent a SQL Parameter. diff --git a/src/main/java/de/presti/ree6/sql/base/data/SQLResponse.java b/src/main/java/de/presti/ree6/sql/base/entitis/SQLResponse.java similarity index 97% rename from src/main/java/de/presti/ree6/sql/base/data/SQLResponse.java rename to src/main/java/de/presti/ree6/sql/base/entitis/SQLResponse.java index 9822b5e30..a4fda5e60 100644 --- a/src/main/java/de/presti/ree6/sql/base/data/SQLResponse.java +++ b/src/main/java/de/presti/ree6/sql/base/entitis/SQLResponse.java @@ -1,4 +1,4 @@ -package de.presti.ree6.sql.base.data; +package de.presti.ree6.sql.base.entitis; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/de/presti/ree6/sql/base/data/StoredResultSet.java b/src/main/java/de/presti/ree6/sql/base/entitis/StoredResultSet.java similarity index 99% rename from src/main/java/de/presti/ree6/sql/base/data/StoredResultSet.java rename to src/main/java/de/presti/ree6/sql/base/entitis/StoredResultSet.java index 310383fc4..180ce9ab4 100644 --- a/src/main/java/de/presti/ree6/sql/base/data/StoredResultSet.java +++ b/src/main/java/de/presti/ree6/sql/base/entitis/StoredResultSet.java @@ -1,4 +1,4 @@ -package de.presti.ree6.sql.base.data; +package de.presti.ree6.sql.base.entitis; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/main/java/de/presti/ree6/sql/base/data/MigrationUtil.java b/src/main/java/de/presti/ree6/sql/base/utils/MigrationUtil.java similarity index 99% rename from src/main/java/de/presti/ree6/sql/base/data/MigrationUtil.java rename to src/main/java/de/presti/ree6/sql/base/utils/MigrationUtil.java index 68fced9d7..37a2d9655 100644 --- a/src/main/java/de/presti/ree6/sql/base/data/MigrationUtil.java +++ b/src/main/java/de/presti/ree6/sql/base/utils/MigrationUtil.java @@ -1,4 +1,4 @@ -package de.presti.ree6.sql.base.data; +package de.presti.ree6.sql.base.utils; import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLConnector; diff --git a/src/main/java/de/presti/ree6/sql/base/data/SQLUtil.java b/src/main/java/de/presti/ree6/sql/base/utils/SQLUtil.java similarity index 98% rename from src/main/java/de/presti/ree6/sql/base/data/SQLUtil.java rename to src/main/java/de/presti/ree6/sql/base/utils/SQLUtil.java index baea63fd2..c1ac1945e 100644 --- a/src/main/java/de/presti/ree6/sql/base/data/SQLUtil.java +++ b/src/main/java/de/presti/ree6/sql/base/utils/SQLUtil.java @@ -1,9 +1,11 @@ -package de.presti.ree6.sql.base.data; +package de.presti.ree6.sql.base.utils; import com.google.gson.*; import de.presti.ree6.main.Main; import de.presti.ree6.sql.base.annotations.Property; import de.presti.ree6.sql.base.annotations.Table; +import de.presti.ree6.sql.base.entitis.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLParameter; import javax.sql.rowset.serial.SerialBlob; import java.io.BufferedReader; diff --git a/src/main/java/de/presti/ree6/sql/entities/BirthdayWish.java b/src/main/java/de/presti/ree6/sql/entities/BirthdayWish.java index 25e9a1b53..aeeb0ddfd 100644 --- a/src/main/java/de/presti/ree6/sql/entities/BirthdayWish.java +++ b/src/main/java/de/presti/ree6/sql/entities/BirthdayWish.java @@ -2,7 +2,7 @@ import de.presti.ree6.sql.base.annotations.Property; import de.presti.ree6.sql.base.annotations.Table; -import de.presti.ree6.sql.base.data.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLEntity; import java.util.Date; diff --git a/src/main/java/de/presti/ree6/sql/entities/Blacklist.java b/src/main/java/de/presti/ree6/sql/entities/Blacklist.java index 43e243b02..3dd0cf76d 100644 --- a/src/main/java/de/presti/ree6/sql/entities/Blacklist.java +++ b/src/main/java/de/presti/ree6/sql/entities/Blacklist.java @@ -2,7 +2,7 @@ import de.presti.ree6.sql.base.annotations.Property; import de.presti.ree6.sql.base.annotations.Table; -import de.presti.ree6.sql.base.data.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLEntity; /** * SQL Entity for the Blacklist. diff --git a/src/main/java/de/presti/ree6/sql/entities/Invite.java b/src/main/java/de/presti/ree6/sql/entities/Invite.java index 3c5c2ab48..2a040201a 100644 --- a/src/main/java/de/presti/ree6/sql/entities/Invite.java +++ b/src/main/java/de/presti/ree6/sql/entities/Invite.java @@ -2,7 +2,7 @@ import de.presti.ree6.sql.base.annotations.Property; import de.presti.ree6.sql.base.annotations.Table; -import de.presti.ree6.sql.base.data.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLEntity; /** * Invite class to store information about an Invite. diff --git a/src/main/java/de/presti/ree6/sql/entities/Recording.java b/src/main/java/de/presti/ree6/sql/entities/Recording.java index ea7d74c21..b28a0fa00 100644 --- a/src/main/java/de/presti/ree6/sql/entities/Recording.java +++ b/src/main/java/de/presti/ree6/sql/entities/Recording.java @@ -3,7 +3,7 @@ import com.google.gson.JsonArray; import de.presti.ree6.sql.base.annotations.Property; import de.presti.ree6.sql.base.annotations.Table; -import de.presti.ree6.sql.base.data.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLEntity; import de.presti.ree6.utils.others.RandomUtils; /** diff --git a/src/main/java/de/presti/ree6/sql/entities/Setting.java b/src/main/java/de/presti/ree6/sql/entities/Setting.java index 72d766227..edd9bedc2 100644 --- a/src/main/java/de/presti/ree6/sql/entities/Setting.java +++ b/src/main/java/de/presti/ree6/sql/entities/Setting.java @@ -2,7 +2,7 @@ import de.presti.ree6.sql.base.annotations.Property; import de.presti.ree6.sql.base.annotations.Table; -import de.presti.ree6.sql.base.data.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLEntity; /** * File to store Settings information. diff --git a/src/main/java/de/presti/ree6/sql/entities/TemporalVoicechannel.java b/src/main/java/de/presti/ree6/sql/entities/TemporalVoicechannel.java index de62edeee..120438a7f 100644 --- a/src/main/java/de/presti/ree6/sql/entities/TemporalVoicechannel.java +++ b/src/main/java/de/presti/ree6/sql/entities/TemporalVoicechannel.java @@ -2,7 +2,7 @@ import de.presti.ree6.sql.base.annotations.Property; import de.presti.ree6.sql.base.annotations.Table; -import de.presti.ree6.sql.base.data.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLEntity; /** * Class used to store information about the temporal Voice-Channel. diff --git a/src/main/java/de/presti/ree6/sql/entities/level/UserLevel.java b/src/main/java/de/presti/ree6/sql/entities/level/UserLevel.java index d74c7df96..ba37b88ce 100644 --- a/src/main/java/de/presti/ree6/sql/entities/level/UserLevel.java +++ b/src/main/java/de/presti/ree6/sql/entities/level/UserLevel.java @@ -1,7 +1,7 @@ package de.presti.ree6.sql.entities.level; import de.presti.ree6.sql.base.annotations.Property; -import de.presti.ree6.sql.base.data.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLEntity; import de.presti.ree6.utils.data.LevelUtil; import net.dv8tion.jda.api.entities.User; diff --git a/src/main/java/de/presti/ree6/sql/entities/roles/Role.java b/src/main/java/de/presti/ree6/sql/entities/roles/Role.java index f9833732e..395d7f10a 100644 --- a/src/main/java/de/presti/ree6/sql/entities/roles/Role.java +++ b/src/main/java/de/presti/ree6/sql/entities/roles/Role.java @@ -1,7 +1,7 @@ package de.presti.ree6.sql.entities.roles; import de.presti.ree6.sql.base.annotations.Property; -import de.presti.ree6.sql.base.data.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLEntity; /** * Role class to store data about roles. diff --git a/src/main/java/de/presti/ree6/sql/entities/stats/Stats.java b/src/main/java/de/presti/ree6/sql/entities/stats/Stats.java index c319bd6be..d9360c3eb 100644 --- a/src/main/java/de/presti/ree6/sql/entities/stats/Stats.java +++ b/src/main/java/de/presti/ree6/sql/entities/stats/Stats.java @@ -2,7 +2,7 @@ import de.presti.ree6.sql.base.annotations.Property; import de.presti.ree6.sql.base.annotations.Table; -import de.presti.ree6.sql.base.data.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLEntity; /** * SQL Entity for the Stats. diff --git a/src/main/java/de/presti/ree6/sql/entities/webhook/Webhook.java b/src/main/java/de/presti/ree6/sql/entities/webhook/Webhook.java index b183002c4..408fbd31e 100644 --- a/src/main/java/de/presti/ree6/sql/entities/webhook/Webhook.java +++ b/src/main/java/de/presti/ree6/sql/entities/webhook/Webhook.java @@ -1,7 +1,7 @@ package de.presti.ree6.sql.entities.webhook; import de.presti.ree6.sql.base.annotations.Property; -import de.presti.ree6.sql.base.data.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLEntity; /** * SQL Entity for the Webhooks. diff --git a/src/main/java/de/presti/ree6/sql/mapper/EntityMapper.java b/src/main/java/de/presti/ree6/sql/mapper/EntityMapper.java index 68ef88cbe..25207d52b 100644 --- a/src/main/java/de/presti/ree6/sql/mapper/EntityMapper.java +++ b/src/main/java/de/presti/ree6/sql/mapper/EntityMapper.java @@ -2,10 +2,10 @@ import de.presti.ree6.main.Main; import de.presti.ree6.sql.base.annotations.Property; -import de.presti.ree6.sql.base.data.SQLEntity; -import de.presti.ree6.sql.base.data.SQLResponse; -import de.presti.ree6.sql.base.data.SQLUtil; -import de.presti.ree6.sql.base.data.StoredResultSet; +import de.presti.ree6.sql.base.entitis.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLResponse; +import de.presti.ree6.sql.base.entitis.StoredResultSet; +import de.presti.ree6.sql.base.utils.SQLUtil; import java.lang.reflect.Field; import java.util.ArrayList; diff --git a/src/main/java/de/presti/ree6/sql/migrations/MigrationBuilder.java b/src/main/java/de/presti/ree6/sql/migrations/MigrationBuilder.java index e966054b4..601cd7af5 100644 --- a/src/main/java/de/presti/ree6/sql/migrations/MigrationBuilder.java +++ b/src/main/java/de/presti/ree6/sql/migrations/MigrationBuilder.java @@ -4,7 +4,11 @@ import de.presti.ree6.sql.SQLConnector; import de.presti.ree6.sql.base.annotations.Property; import de.presti.ree6.sql.base.annotations.Table; -import de.presti.ree6.sql.base.data.*; +import de.presti.ree6.sql.base.entitis.SQLEntity; +import de.presti.ree6.sql.base.entitis.SQLParameter; +import de.presti.ree6.sql.base.entitis.StoredResultSet; +import de.presti.ree6.sql.base.utils.MigrationUtil; +import de.presti.ree6.sql.base.utils.SQLUtil; import org.reflections.Reflections; import java.lang.reflect.Field; diff --git a/src/main/java/de/presti/ree6/utils/data/Data.java b/src/main/java/de/presti/ree6/utils/data/Data.java index 6bad543b8..1a51b44a7 100644 --- a/src/main/java/de/presti/ree6/utils/data/Data.java +++ b/src/main/java/de/presti/ree6/utils/data/Data.java @@ -5,7 +5,6 @@ */ public class Data { - // Completely remove this, and migrate it into the main class. /** * Constructor for the Data Utility class. @@ -14,10 +13,14 @@ private Data() { throw new IllegalStateException("Utility class"); } - // Current Domain of the Website. + /** + * Current Domain of the Website. + */ public static final String WEBSITE = "https://ree6.de"; - // Advertisement, because of Sponsors. + /** + * Advertisement, because of Sponsors. + */ public static final String ADVERTISEMENT = "powered by Tube-Hosting"; } diff --git a/src/main/java/de/presti/ree6/utils/data/ImageCreationUtility.java b/src/main/java/de/presti/ree6/utils/data/ImageCreationUtility.java index c58cb21b6..bb85c31c3 100644 --- a/src/main/java/de/presti/ree6/utils/data/ImageCreationUtility.java +++ b/src/main/java/de/presti/ree6/utils/data/ImageCreationUtility.java @@ -23,7 +23,9 @@ private ImageCreationUtility() { throw new IllegalStateException("Utility class"); } - // Cached Background Image, for performance. + /** + * Cached Background Image, for performance. + */ private static BufferedImage rankBackgroundBase; /**