no message

This commit is contained in:
2024-10-22 13:36:57 +03:00
parent fc6282cd22
commit 54a52a1e6e
15 changed files with 170 additions and 174 deletions

17
.idea/workspace.xml generated
View File

@@ -7,9 +7,20 @@
</component>
<component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/src/Common/Visual/DataSetControlForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Visual/DataSetControlForm.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/RunTask/UI/RunTasksForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Tasks/RunTask/UI/RunTasksForm.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMPackage/UI/DVMPackagesForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMPackage/UI/DVMPackagesForm.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/AddBugReport.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/AddBugReport.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/AppendBugReportField.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/AppendBugReportField.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadBugReport.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadBugReport.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/OpenBugReportTestProject.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/OpenBugReportTestProject.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/PublishBugReport.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/PublishBugReport.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SaveBugReportRecipients.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SaveBugReportRecipients.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SendBugReport.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SendBugReport.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/UpdateBugReportField.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/UpdateBugReportField.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Repository/BugReport/BugReport.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Repository/BugReport/BugReport.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Repository/BugReport/UI/BugReportInterface.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Repository/BugReport/UI/BugReportsForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Repository/BugReport/UI/BugReportsForm.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Repository/Server/ComponentsServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Repository/Server/ComponentsServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/CallbackForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/CallbackForm.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -75,6 +75,6 @@ public class RunTasksForm extends DataSetControlForm<RunTask> {
MainModule_.instance.matchCurrentID(Current.RunConfiguration, object.run_configuration_id) &&
Global.mainModule.HasProject() &&
object.belongsToProject(Global.mainModule.getProject()) &&
MainModule_.instance.matchCurrentID(Current.CompilationTask, object.compilation_task_id);
MainModule_.instance.matchCurrentID(Current.CompilationTask, object.compilation_task_id);
}
}

View File

@@ -8,7 +8,6 @@ import _VisualDVM.GlobalData.Account.AccountRole;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.BugReportState;
import _VisualDVM.Repository.BugReport.UI.BugReportInterface;
import _VisualDVM.Repository.Component.ComponentType;
import java.io.File;
@@ -79,12 +78,13 @@ public class AddBugReport extends AddObjectPass<BugReport> {
Files.copy(file.toPath(), Paths.get(attachementsDir.getAbsolutePath(), file.getName()), StandardCopyOption.REPLACE_EXISTING);
}
//запаковка рута
Global.mainModule.getPass(PassCode.ZipFolderPass).Do(Global.mainModule.getRoot().Home.getAbsolutePath(), BugReportInterface.getArchiveFile(target).getAbsolutePath());
Global.mainModule.getPass(PassCode.ZipFolderPass).Do(Global.mainModule.getRoot().Home.getAbsolutePath(),
target.getArchiveFile().getAbsolutePath());
}
}
@Override
protected boolean validate() {
double size = Utils_.getFileSizeMegaBytes(BugReportInterface.getArchiveFile(target));
double size = Utils_.getFileSizeMegaBytes(target.getArchiveFile());
if (size > 100) {
Log.Writeln_("Размер запакованного вложения " + size + " Мб превышает 100 Мб");
return false;

View File

@@ -5,7 +5,6 @@ import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.UI.BugReportInterface;
import _VisualDVM.Repository.EmailMessage;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
@@ -32,7 +31,7 @@ public class AppendBugReportField extends ComponentsRepositoryPass<BugReport> {
protected boolean canStart(Object... args) throws Exception {
if (Global.mainModule.Check(Log, Current.BugReport)) {
target = Global.mainModule.getBugReport();
if (!BugReportInterface.CheckNotDraft(target, Log))
if (!target.CheckNotDraft(Log))
return false;
fieldName = (String) args[0];
addition = (String) args[1];
@@ -67,7 +66,7 @@ public class AppendBugReportField extends ComponentsRepositoryPass<BugReport> {
}
@Override
protected void performDone() throws Exception {
String message_header = BugReportInterface.getMailTitlePrefix(target);
String message_header = target.getMailTitlePrefix();
String message_text = "";
switch (fieldName) {
default:
@@ -86,7 +85,7 @@ public class AppendBugReportField extends ComponentsRepositoryPass<BugReport> {
new EmailMessage(
message_header + " " + Utils_.Brackets(Global.mainModule.getAccount().name),
message_text,
BugReportInterface.getRecipients(target)
target.getRecipients()
)
);
}

View File

@@ -3,14 +3,13 @@ import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.UI.BugReportInterface;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
public class DownloadBugReport extends ComponentsRepositoryPass<BugReport> {
@Override
protected boolean canStart(Object... args) {
target = (BugReport) args[0];
return !BugReportInterface.getArchiveFile(target).exists();
return !target.getArchiveFile().exists();
}
@Override
protected void performPreparation() throws Exception {
@@ -19,10 +18,10 @@ public class DownloadBugReport extends ComponentsRepositoryPass<BugReport> {
@Override
protected void ServerAction() throws Exception {
Command(new ServerExchangeUnit_2021(ServerCode.ReceiveBugReport, target.id));
Utils_.bytesToFile((byte[]) response.object, BugReportInterface.getArchiveFile(target));
Utils_.bytesToFile((byte[]) response.object, target.getArchiveFile());
}
@Override
protected boolean validate() {
return BugReportInterface.getArchiveFile(target).exists();
return target.getArchiveFile().exists();
}
}

View File

@@ -5,7 +5,6 @@ import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.UI.BugReportInterface;
import java.io.File;
import java.nio.file.Paths;
@@ -23,7 +22,7 @@ public class OpenBugReportTestProject extends Pass<BugReport> {
@Override
protected boolean canStart(Object... args) throws Exception {
if (Global.mainModule.Check(Log, Current.BugReport) &&
(BugReportInterface.CheckNotDraft(target = Global.mainModule.getBugReport(), Log))) {
(target = Global.mainModule.getBugReport()).CheckNotDraft(Log)) {
if (!target.project_version.isEmpty()) {
root = Paths.get(Global.visualiser.getWorkspace().getAbsolutePath(),
target.id).toFile();
@@ -47,9 +46,9 @@ public class OpenBugReportTestProject extends Pass<BugReport> {
protected void body() throws Exception {
//попытка скачки. проверка существования архива уже там.
Global.mainModule.getPass(PassCode.DownloadBugReport).Do(target);
if (BugReportInterface.getArchiveFile(target).exists()) {
if (target.getArchiveFile().exists()) {
Global.mainModule.getPass(PassCode.UnzipFolderPass).Do(
BugReportInterface.getArchiveFile(target).getAbsolutePath(),
target.getArchiveFile().getAbsolutePath(),
root.getAbsolutePath()
);
}

View File

@@ -7,7 +7,6 @@ import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.BugReportState;
import _VisualDVM.Repository.BugReport.UI.BugReportInterface;
import _VisualDVM.Repository.EmailMessage;
import java.io.File;
@@ -34,7 +33,7 @@ public class PublishBugReport extends Pass<BugReport> {
if (!UI.Question("Для отчёта об ошибке не назначен исполнитель.\nВсе равно опубликовать его"))
return false;
}
if (!Global.mainModule.getAccount().CheckAccessRights(target.sender_address, Log) && (BugReportInterface.CheckDraft(target, Log))) {
if (!Global.mainModule.getAccount().CheckAccessRights(target.sender_address, Log) && (target.CheckDraft(Log))) {
return false;
}
return true;
@@ -43,7 +42,7 @@ public class PublishBugReport extends Pass<BugReport> {
}
@Override
protected void body() throws Exception {
target.targets = BugReportInterface.getPackedTargets();
target.targets = BugReport.getPackedTargets();
target.change_date = new Date().getTime();
Global.componentsServer.db.Update(target);
target.state = BugReportState.active;
@@ -55,10 +54,10 @@ public class PublishBugReport extends Pass<BugReport> {
Global.componentsServer.db.Update(target);
//3- рассылка
EmailMessage message = new EmailMessage("Обнаружена ошибка " + Utils_.Brackets(target.id),
BugReportInterface.getNewMailText(target),
BugReportInterface.getRecipients(target));
target.getNewMailText(),
target.getRecipients());
if (!target.project_version.isEmpty()) {
message.addAttachement(BugReportInterface.getArchiveFile(target));
message.addAttachement(target.getArchiveFile());
//со скринами будет небольшой трабл. потому что теретически возможна ситуация,
//что проект черновика бага уже закрыт.
if (Global.mainModule.HasProject()) {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Passes.All;
import _VisualDVM.Repository.BugReport.UI.BugReportInterface;
import _VisualDVM.Repository.BugReport.BugReport;
public class SaveBugReportRecipients extends UpdateBugReportField {
@Override
public String getIconPath() {
@@ -11,6 +11,6 @@ public class SaveBugReportRecipients extends UpdateBugReportField {
}
@Override
protected boolean canStart(Object... args) throws Exception {
return super.canStart("targets", BugReportInterface.getPackedTargets());
return super.canStart("targets", BugReport.getPackedTargets());
}
}

View File

@@ -3,7 +3,6 @@ import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
import _VisualDVM.Repository.BugReport.BugReportState;
import _VisualDVM.Repository.BugReport.UI.BugReportInterface;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
public class SendBugReport extends ComponentsRepositoryPass {
@@ -13,7 +12,7 @@ public class SendBugReport extends ComponentsRepositoryPass {
//отправить архив.
Command(new ServerExchangeUnit_2021(ServerCode.SendBugReport,
Global.mainModule.getBugReport().id,
Utils_.fileToBytes(BugReportInterface.getArchiveFile(Global.mainModule.getBugReport()))
Utils_.fileToBytes(Global.mainModule.getBugReport().getArchiveFile())
));
}
// синхрон бд

View File

@@ -6,7 +6,6 @@ import _VisualDVM.Passes.PassCode;
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.BugReportState;
import _VisualDVM.Repository.BugReport.UI.BugReportInterface;
import _VisualDVM.Repository.EmailMessage;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
@@ -89,7 +88,7 @@ public class UpdateBugReportField extends ComponentsRepositoryPass<BugReport> {
}
@Override
protected void performDone() throws Exception {
String message_header = BugReportInterface.getMailTitlePrefix(target);
String message_header = target.getMailTitlePrefix();
/*
String message_text = "DUMMY TEXT: ";
@@ -126,7 +125,7 @@ public class UpdateBugReportField extends ComponentsRepositoryPass<BugReport> {
Global.mainModule.getPass(PassCode.Email).Do(
new EmailMessage(message_header,
message_text,
BugReportInterface.getRecipients(target))
target.getRecipients())
);
}
}

View File

@@ -1,13 +1,20 @@
package _VisualDVM.Repository.BugReport;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.rDBObject;
import Common.Utils.TextLog;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Repository.Component.ComponentType;
import _VisualDVM.Repository.RepositoryServer;
import _VisualDVM.Repository.Subscribes.Subscriber;
import com.sun.org.glassfish.gmbal.Description;
import java.io.File;
import java.nio.file.Paths;
import java.util.Date;
import java.util.Vector;
public class BugReport extends rDBObject {
//todo все запакованные поля переделать в json.
public String project_version = "";
public long visualiser_version = -1;
public long sapfor_version = -1;
@@ -46,6 +53,12 @@ public class BugReport extends rDBObject {
state = BugReportState.draft;
owner = Global.mainModule.getProject().Home;
}
public static String getPackedTargets() {
Vector<String> selected = new Vector<>();
for (Subscriber subscriber : Global.componentsServer.db.subscribers.Data.values())
if (subscriber.isSelected()) selected.add(subscriber.address);
return String.join("\n", selected);
}
@Override
public void SynchronizeFields(DBObject src) {
super.SynchronizeFields(src);
@@ -68,4 +81,80 @@ public class BugReport extends rDBObject {
commentAdditionDraft = b.commentAdditionDraft;
owner = b.owner;
}
//--
public Vector<String> getRecipients() {
Vector<String> res = new Vector<>();
String[] data = targets.split("\n");
for (String a : data)
if (a.length() > 0)
res.add(a);
if (!res.contains(Global.mainModule.getAccount().email))
res.add(Global.mainModule.getAccount().email);
return res;
}
public File getArchiveFile() {
return Paths.get(System.getProperty("user.dir"), "Bugs", id + ".zip").toFile();
}
public String getDescriptionHeader() {
if (description != null) {
String[] data = description.split("\n");
return (data.length > 0) ? data[0] : "";
} else return "";
}
public void CheckSubscribers() {
for (Subscriber subscriber : Global.componentsServer.db.subscribers.Data.values())
subscriber.Select(targets.contains(subscriber.address));
}
public boolean CheckNotDraft(TextLog log) {
if (state.equals(BugReportState.draft)) {
log.Writeln_("Отчёт об ошибке является черновиком");
return false;
}
return true;
}
public String getMailTitlePrefix() {
return "Ошибка " + Utils_.Brackets(id) + ", автор " + Utils_.Brackets(sender_name) + " : ";
}
public File[] getAttachements() {
File[] project_attachements = Global.mainModule.getProject().getAttachmentsDirectory().listFiles();
File[] res = new File[project_attachements.length + 1];
res[0] = getArchiveFile();
for (int i = 0; i < project_attachements.length; ++i)
res[i + 1] = project_attachements[i];
return res;
}
public boolean CheckDraft(TextLog log) {
if (!state.equals(BugReportState.draft)) {
log.Writeln("Отчёт об ошибке не является черновиком. Он уже опубликован");
return false;
}
return true;
}
public String getNewMailText() {
String res = String.join("\n",
"Описание:", description, getPassport()
);
return res;
}
public String getSettingsSummary() {
return
(Global.mainModule.HasAccount() ? (Global.mainModule.getAccount().isAdmin() ? ("Адрес отправителя: " + sender_address + "\n") : "") : "") +
"Версия SAPFOR: " + sapfor_version + "\n" +
"Версия визуализатора: " + visualiser_version + "\n" +
"----------------------------------\n" +
sapfor_settings;
}
public String getPassport() {
return String.join("\n",
RepositoryServer.separator,
"Отправитель: " + sender_name,
"Исполнитель: " + executor,
"Проект: " + project_version,
RepositoryServer.separator,
getSettingsSummary(),
RepositoryServer.separator);
}
public boolean isNoneProject() {
return project_version.isEmpty();
}
}

View File

@@ -1,121 +0,0 @@
package _VisualDVM.Repository.BugReport.UI;
import Common.Utils.TextLog;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.BugReportState;
import _VisualDVM.Repository.RepositoryServer;
import _VisualDVM.Repository.Subscribes.Subscriber;
import java.io.File;
import java.nio.file.Paths;
import java.util.Vector;
//todo слить с формой.
public class BugReportInterface {
public static String filterKey = "";
public static String filterSenderName = "";
public static String filterDescription = "";
public static String filterComment = "";
public static String filterExecutor = "";
public static String filterVersion = "";
public static boolean filterOpenedOnly = false;
public static boolean filterMyOnly = false;
public static boolean isVisible(BugReport object) {
return
object.state.equals(BugReportState.draft) ||
object.id.toUpperCase().contains(filterKey.toUpperCase())
&& object.sender_name.toUpperCase().contains(filterSenderName.toUpperCase())
&& object.description.toUpperCase().contains(filterDescription.toUpperCase())
&& object.comment.toUpperCase().contains(filterComment.toUpperCase())
&& object.executor.toUpperCase().contains(filterExecutor.toUpperCase())
&& object.project_version.toUpperCase().contains(filterVersion.toUpperCase())
&& (!filterOpenedOnly || object.state.equals(BugReportState.active))
&& (!filterMyOnly ||
(object.sender_address.equalsIgnoreCase(Global.mainModule.getAccount().email) ||
object.executor_address.equalsIgnoreCase(Global.mainModule.getAccount().email)
)
);
}
public static String getPackedTargets() {
Vector<String> selected = new Vector<>();
for (Subscriber subscriber : Global.componentsServer.db.subscribers.Data.values())
if (subscriber.isSelected()) selected.add(subscriber.address);
return String.join("\n", selected);
}
public static File getArchiveFile(BugReport object) {
return Paths.get(System.getProperty("user.dir"), "Bugs", object.id + ".zip").toFile();
}
public static String getDescriptionHeader(BugReport object) {
if (object.description != null) {
String[] data = object.description.split("\n");
return (data.length > 0) ? data[0] : "";
} else return "";
}
public static void CheckSubscribers(BugReport object) {
for (Subscriber subscriber : Global.componentsServer.db.subscribers.Data.values())
subscriber.Select(object.targets.contains(subscriber.address));
}
public static boolean CheckNotDraft(BugReport object, TextLog log) {
if (object.state.equals(BugReportState.draft)) {
log.Writeln_("Отчёт об ошибке является черновиком");
return false;
}
return true;
}
public static String getMailTitlePrefix(BugReport object) {
return "Ошибка " + Utils_.Brackets(object.id) + ", автор " + Utils_.Brackets(object.sender_name) + " : ";
}
public static Vector<String> getRecipients(BugReport object) {
Vector<String> res = new Vector<>();
String[] data = object.targets.split("\n");
for (String a : data)
if (a.length() > 0)
res.add(a);
if (!res.contains(Global.mainModule.getAccount().email))
res.add(Global.mainModule.getAccount().email);
return res;
}
public static File[] getAttachements(BugReport object) {
File[] project_attachements = Global.mainModule.getProject().getAttachmentsDirectory().listFiles();
File[] res = new File[project_attachements.length + 1];
res[0] = getArchiveFile(object);
for (int i = 0; i < project_attachements.length; ++i)
res[i + 1] = project_attachements[i];
return res;
}
public static boolean CheckDraft(BugReport object, TextLog log) {
if (!object.state.equals(BugReportState.draft)) {
log.Writeln("Отчёт об ошибке не является черновиком. Он уже опубликован");
return false;
}
return true;
}
public static String getNewMailText(BugReport object) {
String res = String.join("\n",
"Описание:", object.description,
getPassport(object)
);
return res;
}
public static String getSettingsSummary(BugReport object) {
return
(Global.mainModule.HasAccount() ? (Global.mainModule.getAccount().isAdmin() ? ("Адрес отправителя: " + object.sender_address + "\n") : "") : "") +
"Версия SAPFOR: " + object.sapfor_version + "\n" +
"Версия визуализатора: " + object.visualiser_version + "\n" +
"----------------------------------\n" +
object.sapfor_settings;
}
public static String getPassport(BugReport object) {
return String.join("\n",
RepositoryServer.separator,
"Отправитель: " + object.sender_name,
"Исполнитель: " + object.executor,
"Проект: " + object.project_version,
RepositoryServer.separator,
getSettingsSummary(object),
RepositoryServer.separator);
}
public static boolean isNoneProject(BugReport object) {
return object.project_version.isEmpty();
}
}

View File

@@ -8,12 +8,23 @@ import Common.Visual.Tables.RendererStatusEnum;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.BugReportState;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.Comparator;
public class BugReportsForm extends DataSetControlForm<BugReport> {
//todo упразднить и раскидать по стандартным фильтрам. галки и столбцы
public static String filterKey = "";
public static String filterSenderName = "";
public static String filterDescription = "";
public static String filterComment = "";
public static String filterExecutor = "";
public static String filterVersion = "";
public static boolean filterOpenedOnly = false;
public static boolean filterMyOnly = false;
//--
public BugReportsForm(DataSet<?, BugReport> dataSource_in, JPanel mountPanel_in) {
super(dataSource_in, mountPanel_in);
}
@@ -84,14 +95,27 @@ public class BugReportsForm extends DataSetControlForm<BugReport> {
}
@Override
public boolean isObjectVisible(BugReport object) {
return super.isObjectVisible(object) && BugReportInterface.isVisible(object);
return super.isObjectVisible(object) && (
object.state.equals(BugReportState.draft) ||
object.id.toUpperCase().contains(filterKey.toUpperCase())
&& object.sender_name.toUpperCase().contains(filterSenderName.toUpperCase())
&& object.description.toUpperCase().contains(filterDescription.toUpperCase())
&& object.comment.toUpperCase().contains(filterComment.toUpperCase())
&& object.executor.toUpperCase().contains(filterExecutor.toUpperCase())
&& object.project_version.toUpperCase().contains(filterVersion.toUpperCase())
&& (!filterOpenedOnly || object.state.equals(BugReportState.active))
&& (!filterMyOnly ||
(object.sender_address.equalsIgnoreCase(Global.mainModule.getAccount().email) ||
object.executor_address.equalsIgnoreCase(Global.mainModule.getAccount().email)
)
)
);
}
@Override
public Object getFieldAt(BugReport object, int columnIndex) {
switch (columnIndex) {
case 1:
//todo выкинуть этот интерфейс. бессмысленный
return BugReportInterface.getDescriptionHeader(object);
return object.getDescriptionHeader();
case 2:
return object.sender_name;
case 3:

View File

@@ -13,7 +13,6 @@ import _VisualDVM.Passes.All.UnzipFolderPass;
import _VisualDVM.Passes.All.ZipFolderPass;
import _VisualDVM.ProjectData.LanguageName;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.UI.BugReportInterface;
import _VisualDVM.Repository.BugReportsDatabase;
import _VisualDVM.Repository.Component.ComponentType;
import _VisualDVM.Repository.EmailMessage;
@@ -125,7 +124,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
if (object instanceof BugReport) {
BugReport bugReport = (BugReport) object;
if (!bugReport.project_version.isEmpty())
Utils_.forceDeleteWithCheck(BugReportInterface.getArchiveFile(bugReport));
Utils_.forceDeleteWithCheck(bugReport.getArchiveFile());
}
}
@Override

View File

@@ -9,7 +9,7 @@ import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.BugReportState;
import _VisualDVM.Repository.BugReport.UI.BugReportInterface;
import _VisualDVM.Repository.BugReport.UI.BugReportsForm;
import _VisualDVM.Visual.Editor.BaseEditor;
import _VisualDVM.Visual.Editor.Viewer;
import _VisualDVM.Visual.Interface.CallbackWindow;
@@ -166,12 +166,12 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
BugReportsKeyFilter.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
BugReportInterface.filterKey = BugReportsKeyFilter.getText();
BugReportsForm.filterKey = BugReportsKeyFilter.getText();
ShowBugReports();
}
@Override
public void removeUpdate(DocumentEvent e) {
BugReportInterface.filterKey = BugReportsKeyFilter.getText();
BugReportsForm.filterKey = BugReportsKeyFilter.getText();
ShowBugReports();
}
@Override
@@ -181,12 +181,12 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
BugReportsSenderNameFilter.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
BugReportInterface.filterSenderName = BugReportsSenderNameFilter.getText();
BugReportsForm.filterSenderName = BugReportsSenderNameFilter.getText();
ShowBugReports();
}
@Override
public void removeUpdate(DocumentEvent e) {
BugReportInterface.filterSenderName = BugReportsSenderNameFilter.getText();
BugReportsForm.filterSenderName = BugReportsSenderNameFilter.getText();
ShowBugReports();
}
@Override
@@ -196,12 +196,12 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
BugReportsDescriptionFilter.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
BugReportInterface.filterDescription = BugReportsDescriptionFilter.getText();
BugReportsForm.filterDescription = BugReportsDescriptionFilter.getText();
ShowBugReports();
}
@Override
public void removeUpdate(DocumentEvent e) {
BugReportInterface.filterDescription = BugReportsDescriptionFilter.getText();
BugReportsForm.filterDescription = BugReportsDescriptionFilter.getText();
ShowBugReports();
}
@Override
@@ -212,12 +212,12 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
BugReportsCommentFilter.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
BugReportInterface.filterComment = BugReportsCommentFilter.getText();
BugReportsForm.filterComment = BugReportsCommentFilter.getText();
ShowBugReports();
}
@Override
public void removeUpdate(DocumentEvent e) {
BugReportInterface.filterComment = BugReportsCommentFilter.getText();
BugReportsForm.filterComment = BugReportsCommentFilter.getText();
ShowBugReports();
}
@Override
@@ -227,12 +227,12 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
BugReportsExecutorFilter.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
BugReportInterface.filterExecutor = BugReportsExecutorFilter.getText();
BugReportsForm.filterExecutor = BugReportsExecutorFilter.getText();
ShowBugReports();
}
@Override
public void removeUpdate(DocumentEvent e) {
BugReportInterface.filterExecutor = BugReportsExecutorFilter.getText();
BugReportsForm.filterExecutor = BugReportsExecutorFilter.getText();
ShowBugReports();
}
@Override
@@ -242,12 +242,12 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
BugReportsVersionFilter.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
BugReportInterface.filterVersion = BugReportsVersionFilter.getText();
BugReportsForm.filterVersion = BugReportsVersionFilter.getText();
ShowBugReports();
}
@Override
public void removeUpdate(DocumentEvent e) {
BugReportInterface.filterVersion = BugReportsVersionFilter.getText();
BugReportsForm.filterVersion = BugReportsVersionFilter.getText();
ShowBugReports();
}
@Override
@@ -256,11 +256,11 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
});
//--------
BugReportsMyOnlyFilter.addActionListener(e -> {
BugReportInterface.filterMyOnly = BugReportsMyOnlyFilter.isSelected();
BugReportsForm.filterMyOnly = BugReportsMyOnlyFilter.isSelected();
ShowBugReports();
});
BugReportsOpenedOnly.addActionListener(e -> {
BugReportInterface.filterOpenedOnly = BugReportsOpenedOnly.isSelected();
BugReportsForm.filterOpenedOnly = BugReportsOpenedOnly.isSelected();
ShowBugReports();
});
//-
@@ -508,7 +508,7 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
SwitchListeners(false);
// currentBugReportTabs.setSelectedIndex(0);
BugReport target = Global.mainModule.getBugReport();
BugReportInterface.CheckSubscribers(target);
target.CheckSubscribers();
Global.componentsServer.db.subscribers.ShowUI();
//-
BugReportDescription.setText(target.description);