2025-02-18 16:21:20 +03:00
|
|
|
package _VisualDVM.ComponentsServer;
|
2023-09-17 22:13:42 +03:00
|
|
|
import Common.Database.SQLITE.SQLiteDatabase;
|
2025-02-18 16:21:20 +03:00
|
|
|
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
|
|
|
|
import _VisualDVM.ComponentsServer.BugReport.BugReportsDBTable;
|
2025-03-27 15:12:09 +03:00
|
|
|
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
|
|
|
|
|
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipientsDBTable;
|
2025-03-27 12:45:55 +03:00
|
|
|
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSettingsDBTable;
|
2025-02-19 22:47:56 +03:00
|
|
|
import _VisualDVM.ComponentsServer.Recipient.RecipientsDataSet;
|
2024-10-14 15:19:13 +03:00
|
|
|
import _VisualDVM.Passes.PassCode;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
|
import java.util.Vector;
|
|
|
|
|
public class BugReportsDatabase extends SQLiteDatabase {
|
|
|
|
|
public BugReportsDBTable bugReports;
|
2025-03-27 12:45:55 +03:00
|
|
|
public BugReportSettingsDBTable bugReportSettings;
|
2025-03-27 15:12:09 +03:00
|
|
|
public BugReportRecipientsDBTable bugReportRecipients;
|
2025-02-19 22:47:56 +03:00
|
|
|
public RecipientsDataSet recipients = new RecipientsDataSet();
|
2023-09-17 22:13:42 +03:00
|
|
|
public BugReportsDatabase() {
|
2025-01-18 01:36:02 +03:00
|
|
|
super(Paths.get(System.getProperty("user.dir"), "Data", "bug_reports.sqlite").toFile());
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void initAllTables() throws Exception {
|
|
|
|
|
addTable(bugReports = new BugReportsDBTable());
|
2025-03-27 12:45:55 +03:00
|
|
|
addTable(bugReportSettings = new BugReportSettingsDBTable());
|
2025-03-27 15:12:09 +03:00
|
|
|
addTable(bugReportRecipients = new BugReportRecipientsDBTable());
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void Init() throws Exception {
|
|
|
|
|
DeleteDrafts();
|
|
|
|
|
}
|
2023-11-16 16:20:20 +03:00
|
|
|
@Override
|
2024-10-09 23:37:58 +03:00
|
|
|
public PassCode getSynchronizePassCode() {
|
|
|
|
|
return PassCode.SynchronizeBugReports;
|
2023-11-16 16:20:20 +03:00
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
public void DeleteDrafts() throws Exception {
|
|
|
|
|
Vector<BugReport> drafts = bugReports.getAllDrafts();
|
|
|
|
|
for (BugReport draft : drafts)
|
|
|
|
|
Delete(draft);
|
|
|
|
|
}
|
2025-02-18 23:45:24 +03:00
|
|
|
@Override
|
2025-02-04 16:22:42 +03:00
|
|
|
public void DropUI() {
|
2025-02-18 23:45:24 +03:00
|
|
|
super.DropUI();
|
2025-02-04 16:22:42 +03:00
|
|
|
bugReports.ClearUI();
|
2025-02-19 22:47:56 +03:00
|
|
|
recipients.ClearUI();
|
2025-02-04 16:22:42 +03:00
|
|
|
}
|
2025-02-18 23:45:24 +03:00
|
|
|
@Override
|
2025-02-04 16:22:42 +03:00
|
|
|
public void ResetUI() {
|
|
|
|
|
bugReports.ShowUI();
|
2025-02-19 22:47:56 +03:00
|
|
|
recipients.ShowUI(); //todo временно.
|
2025-02-18 23:45:24 +03:00
|
|
|
super.ResetUI();
|
2025-02-04 16:22:42 +03:00
|
|
|
}
|
2025-03-27 15:12:09 +03:00
|
|
|
public void saveBugreportRecipients(BugReport bugReport) throws Exception {
|
|
|
|
|
if (bugReport.recipients != null) {
|
|
|
|
|
for (BugReportRecipient recipient : bugReport.recipients) {
|
|
|
|
|
recipient.bugreport_id = bugReport.id;
|
|
|
|
|
Insert(recipient);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-27 12:45:55 +03:00
|
|
|
public void Patch() throws Exception {
|
|
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|