Files
VisualSapfor/src/_VisualDVM/ComponentsServer/BugReport/BugReportsDBTable.java

44 lines
1.8 KiB
Java
Raw Normal View History

2025-02-18 16:21:20 +03:00
package _VisualDVM.ComponentsServer.BugReport;
2025-03-27 12:45:55 +03:00
import Common.Database.Objects.DBObject;
import Common.Database.Tables.DBTable;
2025-03-27 12:45:55 +03:00
import Common.Database.Tables.FKBehaviour;
import Common.Database.Tables.FKCurrentObjectBehaviuor;
import Common.Database.Tables.FKDataBehaviour;
import Common.Visual.DataSetControlForm;
2025-02-18 16:21:20 +03:00
import _VisualDVM.ComponentsServer.BugReport.UI.BugReportsForm;
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
2025-03-27 12:45:55 +03:00
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSetting;
2023-09-17 22:13:42 +03:00
import javax.swing.*;
2025-03-27 12:45:55 +03:00
import java.util.LinkedHashMap;
2023-09-17 22:13:42 +03:00
import java.util.Vector;
import java.util.stream.Collectors;
public class BugReportsDBTable extends DBTable<String, BugReport> {
public BugReportsDBTable() {
super(String.class, BugReport.class);
}
@Override
public String getSingleDescription() {
return "отчёт об ошибке";
}
@Override
public String getPluralDescription() {
return "отчёты об ошибках";
}
@Override
protected DataSetControlForm createUI(JPanel mountPanel) {
return new BugReportsForm(this, mountPanel);
2023-09-17 22:13:42 +03:00
}
public Vector<BugReport> getAllDrafts() throws Exception {
return Data.values().stream().filter(bugReport -> bugReport.state.equals(BugReportState.draft)).collect(Collectors.toCollection(Vector::new));
}
2025-03-27 12:45:55 +03:00
@Override
public LinkedHashMap<Class<? extends DBObject>, FKBehaviour> getFKDependencies() {
LinkedHashMap<Class<? extends DBObject>, FKBehaviour> res = new LinkedHashMap<>();
res.put(BugReportSetting.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
res.put(BugReportRecipient.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
2025-03-27 12:45:55 +03:00
return res;
}
//-
2023-09-17 22:13:42 +03:00
}