смена ключей багов на численнные.
This commit is contained in:
2025-12-16 02:32:20 +03:00
parent f104335bfe
commit 6da9698285
19 changed files with 81 additions and 47 deletions

17
.idea/workspace.xml generated
View File

@@ -8,7 +8,24 @@
<component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReport/BugReport.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReport/BugReport.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReport/Json/BugReportAdditionJson.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReport/Json/BugReportAdditionJson.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReport/UI/BugReportsForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReport/UI/BugReportsForm.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReportRecipient/BugReportRecipient.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReportRecipient/BugReportRecipient.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReportRecipient/BugReportRecipientsDBTable.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReportRecipient/BugReportRecipientsDBTable.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReportSetting/BugReportSetting.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReportSetting/BugReportSetting.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReportsDatabase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/BugReportsDatabase.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/ComponentsServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/ComponentsServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Global.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Global.java" 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/DeleteBugReport.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteBugReport.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadAllBugReportsArchives.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadAllBugReportsArchives.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/UpdateBugReportField.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/UpdateBugReportField.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -4,7 +4,7 @@
"ServerUserPassword": "mprit_2011",
"OfferRegistrationOnStart": true,
"Workspace": "E:\\Tests",
"ProjectsSearchDirectory": "E:\\Tests\\Downloads\\bugreport_1765484296",
"ProjectsSearchDirectory": "E:\\Tests\\Downloads\\1413\\BT_inserted\\v1",
"DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system",
"VisualiserPath": "C:\\Users\\misha\\Downloads",
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",

View File

@@ -1,7 +1,7 @@
package _VisualDVM.ComponentsServer.BugReport;
import Common.CommonConstants;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.rDBObject;
import Common.Database.Objects.riDBObject;
import Common.Utils.TextLog;
import Common.Utils.Utils_;
import Common.Utils.Vector_;
@@ -18,10 +18,7 @@ import java.io.File;
import java.nio.file.Paths;
import java.util.Date;
import java.util.Vector;
public class BugReport extends rDBObject {
//---
@Description("DEFAULT '-1'")
public int id_ = CommonConstants.Nan;
public class BugReport extends riDBObject {
//---
public String project_version = "";
public long visualiser_version = -1;
@@ -43,13 +40,17 @@ public class BugReport extends rDBObject {
public File owner = null;
@Description("IGNORE")
public byte[] packed_archive = null;
//--
public long date = 0;
public long change_date;
//--
public BugReport() {
}
public BugReport(BugReport src) {
this.SynchronizeFields(src);
}
public BugReport(String sender_name_in, String sender_address_in, String description_in, String version_in) {
genName();
id = CommonConstants.Nan;
sender_name = sender_name_in;
sender_address = sender_address_in;
project_version = version_in;
@@ -67,7 +68,6 @@ public class BugReport extends rDBObject {
public void SynchronizeFields(DBObject src) {
super.SynchronizeFields(src);
BugReport b = (BugReport) src;
id_ = b.id_;
change_date = b.change_date;
description = b.description;
comment = b.comment;
@@ -82,11 +82,16 @@ public class BugReport extends rDBObject {
descriptionAdditionDraft = b.descriptionAdditionDraft;
commentAdditionDraft = b.commentAdditionDraft;
owner = b.owner;
change_date = b.change_date;
}
//--
public File getArchiveFile() {
return Paths.get(System.getProperty("user.dir"), "Bugs", id + ".zip").toFile();
public File getHome() {
return Utils_.getFile(System.getProperty("user.dir"), "BugReports", String.valueOf(id));
}
public File getArchiveFile() {
return new File(getHome(),id + ".zip");
}
//--
public String getDescriptionHeader() {
if (description != null) {
String[] data = description.split("\n");

View File

@@ -1,11 +1,12 @@
package _VisualDVM.ComponentsServer.BugReport.Json;
import Common.CommonConstants;
import _VisualDVM.ComponentsServer.BugReport.BugReport;
import com.google.gson.annotations.Expose;
import java.io.Serializable;
public class BugReportAdditionJson implements Serializable {
@Expose
public String id = "";
public int id = CommonConstants.Nan;
@Expose
public String fieldName = "";
@Expose

View File

@@ -100,13 +100,15 @@ public class BugReportsForm extends DataSetControlForm<BugReport> {
public Class getRendererClass() {
return RendererStatusEnum.class;
}
},
}
/*,
new ColumnInfo<BugReport>("id_") {
@Override
public Object getFieldAt(BugReport object) {
return object.id_;
}
}
*/
);
}
@Override
@@ -149,7 +151,7 @@ public class BugReportsForm extends DataSetControlForm<BugReport> {
public DataMenuBar createMenuBar() {
return new DataMenuBar(dataSource.getPluralDescription(),
PassCode.SynchronizeBugReports,
PassCode.DownloadAllBugReportsArchives,
// PassCode.DownloadAllBugReportsArchives,
PassCode.AddBugReport,
PassCode.PublishBugReport,
PassCode.OpenBugReportTestProject,
@@ -160,13 +162,14 @@ public class BugReportsForm extends DataSetControlForm<BugReport> {
}
@Override
protected Comparator<BugReport> getDefaultComparator() {
return (o1, o2) -> -(o1.getDate().compareTo(o2.getDate()));
return (o1, o2) -> -Long.compare(o1.date, o2.date);
}
@Override
public boolean isObjectVisible(BugReport object) {
return super.isObjectVisible(object) && (
object.state.equals(BugReportState.draft) ||
object.id.toUpperCase().contains(filterKey.toUpperCase())
(String.valueOf(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())

View File

@@ -5,10 +5,9 @@ import Common.Database.Objects.iDBObject;
import _VisualDVM.ComponentsServer.BugReport.BugReport;
import com.sun.org.glassfish.gmbal.Description;
public class BugReportRecipient extends iDBObject {
public String bugreport_id = "";
public String email = "";
@Description("DEFAULT '-1'")
public int bugreport_id_ = CommonConstants.Nan;
public int bugreport_id = CommonConstants.Nan;
public BugReportRecipient() {
}
public BugReportRecipient(BugReport bugReport, String email_in) {
@@ -24,6 +23,5 @@ public class BugReportRecipient extends iDBObject {
BugReportRecipient src_ = (BugReportRecipient) src;
bugreport_id = src_.bugreport_id;
email = src_.email;
bugreport_id_ = src_.bugreport_id_;
}
}

View File

@@ -6,6 +6,6 @@ public class BugReportRecipientsDBTable extends iDBTable<BugReportRecipient> {
}
@Override
public boolean isEqual(BugReportRecipient o1, BugReportRecipient o2) {
return o1.bugreport_id.equals(o2.bugreport_id) && o1.email.equals(o2.email);
return o1.bugreport_id==o2.bugreport_id && o1.email.equals(o2.email);
}
}

View File

@@ -5,11 +5,10 @@ import Common.Database.Objects.iDBObject;
import _VisualDVM.ComponentsServer.BugReport.BugReport;
import com.sun.org.glassfish.gmbal.Description;
public class BugReportSetting extends iDBObject {
public String bugreport_id = "";
public String name = "";
public String value = "";
@Description("DEFAULT '-1'")
public int bugreport_id_ = CommonConstants.Nan;
public int bugreport_id = CommonConstants.Nan;
public BugReportSetting() {
}
public BugReportSetting(BugReport bugReport, String name_in, Object value_in) {
@@ -27,6 +26,5 @@ public class BugReportSetting extends iDBObject {
bugreport_id = src_.bugreport_id;
name = src_.name;
value = src_.value;
bugreport_id_ = src_.bugreport_id_;
}
}

View File

@@ -67,6 +67,7 @@ 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>() {
@@ -132,5 +133,6 @@ public class BugReportsDatabase extends SQLiteDatabase {
}
}
*/
}
}

View File

@@ -55,18 +55,9 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
return super.getDb();
}
@Override
protected void beforePublishAction(DBObject object) throws Exception {
if (object instanceof BugReport) {
BugReport bugReport = (BugReport) object;
if (bugReport.packed_archive != null) {
File bugArchive = Utils_.getFile(Utils_.getHomePath(), "Bugs", bugReport.id);
Utils_.bytesToFile(bugReport.packed_archive, bugArchive);
}
}
}
@Override
protected void afterPublishAction(DBObject object) throws Exception {
if (object instanceof BugReport) {
//---
BugReport bugReport = (BugReport) object;
if (bugReport.settings != null) {
for (BugReportSetting setting : bugReport.settings) {
@@ -77,6 +68,14 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
if (bugReport.recipients != null) {
db.saveBugreportRecipients(bugReport);
}
//-->
Utils_.CheckAndCleanDirectory(bugReport.getHome());
//-->
if (bugReport.packed_archive != null) {
File bugArchive = bugReport.getArchiveFile();
Utils_.bytesToFile(bugReport.packed_archive, bugArchive);
bugReport.packed_archive = null;
}
}
}
@Override
@@ -94,7 +93,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
protected void afterDeleteAction(DBObject object) throws Exception {
if (object instanceof BugReport) {
BugReport bugReport = (BugReport) object;
if (!bugReport.project_version.isEmpty()) Utils_.forceDeleteWithCheck(bugReport.getArchiveFile());
Utils_.forceDeleteWithCheck(bugReport.getHome());
} else if (object instanceof UserAccount) {
UserAccount account = (UserAccount) object;
Utils_.forceDeleteWithCheck(account.getServerKeyFile());
@@ -170,7 +169,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
void ReceiveAllArchives() throws Exception {
ZipFolderPass zip = new ZipFolderPass();
File archives = new File(Utils_.getDateName("Bugs"));
if (zip.Do("Bugs", archives.getAbsolutePath())) {
if (zip.Do("BugReports", archives.getAbsolutePath())) {
response.object = Utils_.fileToBytes(archives);
} else throw new RepositoryRefuseException("Не удалось запаковать архивы");
}
@@ -179,7 +178,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
response.arg = credentials_db.userAccounts.getPackedActiveRecipients();
}
void ReceiveBugReport() throws Exception {
File bugArchive = Utils_.getFile(Utils_.getHomePath(), "Bugs", request.arg);
File bugArchive = Utils_.getFile(Utils_.getHomePath(), "BugReports", request.arg, request.arg + ".zip");
response.object = Utils_.fileToBytes(bugArchive);
}
void UpdateBugReport() throws Exception {

View File

@@ -3,7 +3,7 @@ import Common.Utils.Vector_;
import java.util.Vector;
public class Constants {
public static final int version = 1262;
public static final int version = 1263;
public static final int planner_version = 24;
public static final int testingMaxKernels = 64;
//--
@@ -47,7 +47,7 @@ public class Constants {
public static final int MailSocketPort = 465;
//
//7998 отладочный порт. теперь.
public static final int ComponentsServerPort = 7998; //7795
public static final int ComponentsServerPort = 7995; //7795
public static final int TestingServerPort = 7996; //7996
public static final int SocketTimeout = 0;
//-

View File

@@ -37,7 +37,6 @@ public class Global {
public static File ComponentsDirectory;
public static File KeysDirectory;
public static File DataDirectory;
public static File BugReportsDirectory_OLD;
public static File BugReportsDirectory;
public static File BackUpsDirectory; //бекапы компонентов на локальной машине.
public static File TempDirectory;
@@ -66,7 +65,6 @@ public class Global {
Utils_.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
//-
Utils_.CheckDirectory(RepoDirectory = new File(Utils_.getHomeDirectory(), Constants.RepoDirectoryName));
Utils_.CheckDirectory(BugReportsDirectory_OLD = new File(Utils_.getHomeDirectory(), Constants.BugsDirectoryName));
Utils_.CheckDirectory(BugReportsDirectory = new File(Utils_.getHomeDirectory(), "BugReports"));
Utils_.CheckDirectory(BackUpsDirectory = new File(Utils_.getHomeDirectory(), Constants.BackUpsDirectoryName));
Utils_.CheckDirectory(ProjectsDirectory = new File(Utils_.getHomeDirectory(), Constants.ProjectsDirectoryName));
@@ -90,7 +88,6 @@ public class Global {
Utils_.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
Utils_.CheckDirectory(DataBackUpsDirectory = new File(Utils_.getHomeDirectory(), Constants.DataBackUpsDirectoryName));
//--
Utils_.CheckDirectory(BugReportsDirectory_OLD = new File(Utils_.getHomeDirectory(), Constants.BugsDirectoryName));
Utils_.CheckDirectory(BugReportsDirectory = new File(Utils_.getHomeDirectory(), "BugReports"));
Utils_.CheckDirectory(KeysDirectory = new File(Utils_.getHomeDirectory(), Constants.KeyDirectoryName));
}

View File

@@ -1,4 +1,5 @@
package _VisualDVM.Passes.All;
import Common.CommonConstants;
import Common.Database.Database;
import Common.Passes.AddObjectPass;
import Common.Utils.Utils_;
@@ -30,6 +31,10 @@ public class AddBugReport extends AddObjectPass<BugReport> {
Log.Writeln_("Для создания отчёта требуется регистрация");
return false;
}
if (getDb().getTable(BugReport.class).containsKey(CommonConstants.Nan)){
Log.Writeln_("Может существовать не более одного черновика одновременно!");
return false;
}
if (Global.mainModule.HasProject()) {
String version = Global.mainModule.getProject().Home.getAbsolutePath().substring(Global.mainModule.getRoot().Home.getParent().length());
if (version.toCharArray()[0] == '\\') version = version.substring(1);
@@ -39,7 +44,7 @@ public class AddBugReport extends AddObjectPass<BugReport> {
} else {
if (UI.Warning("Создать отчёт об ошибке без прикрепления проекта.")) {
target = new BugReport();
target.genName();
target.id = CommonConstants.Nan;
target.sender_name = Global.mainModule.getAccount().name;
target.sender_address = Global.mainModule.getAccount().email;
target.project_version = "";
@@ -62,10 +67,12 @@ public class AddBugReport extends AddObjectPass<BugReport> {
}
@Override
protected void body() throws Exception {
super.body();
//--
Utils_.CheckAndCleanDirectory(target.getHome());
//--
if (!target.project_version.isEmpty()) {
Global.mainModule.getRoot().cleanDepAndGCOVR(); //удаление депов и гкова
//логи во вложения.
//логи во вложения. todo переделать в полноценные вложения.
File attachementsDir = Global.mainModule.getProject().getAttachmentsDirectory();
Vector<File> logs = new Vector<>();
logs.add(Utils_.MainLog.getLogFile());
@@ -80,6 +87,7 @@ public class AddBugReport extends AddObjectPass<BugReport> {
Global.mainModule.getPass(PassCode.ZipFolderPass).Do(Global.mainModule.getRoot().Home.getAbsolutePath(),
target.getArchiveFile().getAbsolutePath());
}
getDb().getTable(BugReport.class).put(target.id, target);
}
@Override
protected boolean validate() {

View File

@@ -76,6 +76,7 @@ public class AppendBugReportField extends ComponentsServerPass<BugReport> {
message_header + " " + Utils_.Brackets(Global.mainModule.getAccount().name),
message_text
);
Global.mainModule.getPass(PassCode.Email).Do(
message,
Global.componentsServer.db.recipients.getSelectedMails());

View File

@@ -1,6 +1,7 @@
package _VisualDVM.Passes.All;
import Common.Database.Database;
import Common.Passes.DeleteObjectPass;
import Common.Utils.Utils_;
import _VisualDVM.ComponentsServer.BugReport.BugReport;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
@@ -15,6 +16,7 @@ public class DeleteBugReport extends DeleteObjectPass<BugReport> {
@Override
protected void performDone() throws Exception {
super.performDone();
Utils_.forceDeleteWithCheck(target.getHome());
Global.mainModule.getPass(PassCode.DeleteBugReportFromServer).Do(target);
}
@Override

View File

@@ -11,6 +11,7 @@ import org.apache.commons.io.FileUtils;
import java.io.File;
import java.nio.file.Paths;
public class DownloadAllBugReportsArchives extends ComponentsServerPass<File> {
//упраздненный временно проход.
@Override
public String getIconPath() {
return "/icons/DownloadAll.png";
@@ -19,7 +20,6 @@ public class DownloadAllBugReportsArchives extends ComponentsServerPass<File> {
protected void performPreparation() throws Exception {
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
Global.mainModule.set(Current.Root, null); //чтобы гарантированно не существовало корня.
Utils.CleanDirectory(Global.BugReportsDirectory_OLD);
Utils.CleanDirectory(Global.BugReportsDirectory);
}
@Override
@@ -46,10 +46,12 @@ public class DownloadAllBugReportsArchives extends ComponentsServerPass<File> {
//теперь скопировать это в папку Bugs, с нормальными именами через zip
File t2 = Paths.get(tempFolder.getAbsolutePath(), "Bugs").toFile();
File[] archives = t2.listFiles();
/*
if (archives != null) {
for (File file : archives) {
FileUtils.moveFile(file, Paths.get(Global.BugReportsDirectory_OLD.getAbsolutePath(), file.getName() + ".zip").toFile());
}
}
*/
}
}

View File

@@ -8,15 +8,15 @@ public class DownloadBugReport extends ComponentsServerPass<BugReport> {
@Override
protected boolean canStart(Object... args) {
target = (BugReport) args[0];
return !target.getArchiveFile().exists() && SendRequest(ServerCode.ReceiveBugReport, target.id);
return !target.getArchiveFile().exists() && SendRequest(ServerCode.ReceiveBugReport, String.valueOf(target.id));
}
@Override
protected void performPreparation() throws Exception {
Utils_.CheckDirectory(Global.BugReportsDirectory_OLD);
Utils_.CheckDirectory(Global.BugReportsDirectory);
}
@Override
protected void body() throws Exception {
Utils_.CheckAndCleanDirectory(target.getHome());
Utils_.bytesToFile((byte[]) request.server_response.object, target.getArchiveFile());
}
@Override

View File

@@ -23,7 +23,7 @@ public class OpenBugReportTestProject extends Pass<BugReport> {
if (Global.componentsServer.db.CheckCurrent(Log, BugReport.class) &&
(target = Global.componentsServer.db.bugReports.getUI().getCurrent()).CheckNotDraft(Log)) {
if (!target.project_version.isEmpty()) {
root = new File(Global.visualiser.getDownloadsDirectory(), target.id);
root = new File(Global.visualiser.getDownloadsDirectory(), String.valueOf(target.id));
project = new File(root,
Utils_.isWindows() ? Utils_.toW(target.project_version) : Utils_.toU(target.project_version)
);

View File

@@ -124,6 +124,7 @@ public class UpdateBugReportField extends ComponentsServerPass<BugReport> {
message_header + " " + Utils_.Brackets(Global.mainModule.getAccount().name),
message_text
);
Global.mainModule.getPass(PassCode.Email).Do(
message,
Global.componentsServer.db.recipients.getSelectedMails());