промежуточный. переходный момент в рефакторинге багов. нужен для патча.

This commit is contained in:
2025-12-15 20:45:31 +03:00
parent c0bdad60ef
commit 42b179a0cc
7 changed files with 61 additions and 3 deletions

View File

@@ -4,11 +4,13 @@ import _VisualDVM.ComponentsServer.BugReport.BugReport;
import _VisualDVM.ComponentsServer.BugReport.BugReportsDBTable;
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipientsDBTable;
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSetting;
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSettingsDBTable;
import _VisualDVM.ComponentsServer.Recipient.RecipientsDataSet;
import _VisualDVM.Passes.PassCode;
import java.nio.file.Paths;
import java.util.Comparator;
import java.util.Vector;
public class BugReportsDatabase extends SQLiteDatabase {
public BugReportsDBTable bugReports;
@@ -27,6 +29,8 @@ public class BugReportsDatabase extends SQLiteDatabase {
@Override
public void Init() throws Exception {
DeleteDrafts();
//--
Patch();
}
@Override
public PassCode getSynchronizePassCode() {
@@ -58,5 +62,33 @@ public class BugReportsDatabase extends SQLiteDatabase {
}
}
public void Patch() throws Exception {
int i = 0;
Vector<BugReport> sortedBugs = new Vector<>(bugReports.Data.values());
sortedBugs.sort(new Comparator<BugReport>() {
@Override
public int compare(BugReport o1, BugReport o2) {
return Long.compare(o1.date,o2.date);
}
});
//--
for (BugReport bugReport: sortedBugs){
bugReport.id_ = i;
++i;
Update(bugReport);
}
//--
for (BugReport bugReport: sortedBugs){
Vector<BugReportSetting> bugSettings = getVectorByFK(bugReport, BugReportSetting.class);
Vector<BugReportRecipient> bugReportRecipients = getVectorByFK(bugReport, BugReportRecipient.class);
for (BugReportSetting setting: bugSettings){
setting.bugreport_id_ = bugReport.id_;
Update(setting);
}
for (BugReportRecipient recipient: bugReportRecipients){
recipient.bugreport_id_ = bugReport.id_;
Update(recipient);
}
}
//--
}
}