смена ключей багов на численнные.
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

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 {