++
убирание джсон запакованных полей у баг репортов
This commit is contained in:
@@ -4,7 +4,6 @@ import Common.Database.Objects.rDBObject;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Utils.Vector_;
|
||||
import _VisualDVM.ComponentsServer.BugReport.Json.VisualiserSettingsJson;
|
||||
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
|
||||
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSetting;
|
||||
import _VisualDVM.ComponentsServer.Component.ComponentType;
|
||||
@@ -23,10 +22,6 @@ public class BugReport extends rDBObject {
|
||||
public long visualiser_version = -1;
|
||||
public long sapfor_version = -1;
|
||||
public String comment = "";
|
||||
@Description("IGNORE")
|
||||
public String packedRecipientsJson = "";
|
||||
@Description("IGNORE")
|
||||
public String packedSettingsJson = ""; //todo вывести.
|
||||
public Vector<BugReportSetting> settings = null;
|
||||
public Vector<BugReportRecipient> recipients = null;
|
||||
public String executor = "";
|
||||
@@ -156,19 +151,13 @@ public class BugReport extends rDBObject {
|
||||
Global.componentsServer.db.recipients.getUI().SelectAll(false);
|
||||
Vector<BugReportRecipient> recipients_ = state.equals(BugReportState.draft) ?
|
||||
recipients : Global.componentsServer.db.getVectorByFK(this, BugReportRecipient.class);
|
||||
if (recipients_!=null) {
|
||||
if (recipients_ != null) {
|
||||
for (BugReportRecipient bugReportRecipient : recipients_) {
|
||||
if (Global.componentsServer.db.recipients.containsKey(bugReportRecipient.email))
|
||||
Global.componentsServer.db.recipients.get(bugReportRecipient.email).Select(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
public VisualiserSettingsJson getSettingsJson() {
|
||||
return packedSettingsJson.isEmpty() ? new VisualiserSettingsJson() : Utils_.gson.fromJson(packedSettingsJson, VisualiserSettingsJson.class);
|
||||
}
|
||||
public SapforProperties getPropertiesJson() {
|
||||
return packedSettingsJson.isEmpty() ? new SapforProperties() : Utils_.gson.fromJson(packedSettingsJson, SapforProperties.class);
|
||||
}
|
||||
public boolean canAppend(UserAccount account, TextLog log) {
|
||||
if (account.CheckRegistered(log)) {
|
||||
if (account.email.equals(sender_address) || account.email.equals(executor_address)) {
|
||||
|
||||
@@ -8,15 +8,6 @@ import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.ComponentsServer.BugReport.UI.BugReportsForm;
|
||||
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
|
||||
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSetting;
|
||||
import _VisualDVM.GlobalData.Compiler.Compiler;
|
||||
import _VisualDVM.GlobalData.DVMParameter.DVMParameter;
|
||||
import _VisualDVM.GlobalData.EnvironmentValue.EnvironmentValue;
|
||||
import _VisualDVM.GlobalData.Makefile.Makefile;
|
||||
import _VisualDVM.GlobalData.Module.Module;
|
||||
import _VisualDVM.GlobalData.RunConfiguration.RunConfiguration;
|
||||
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;
|
||||
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
|
||||
import _VisualDVM.GlobalData.User.User;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package _VisualDVM.ComponentsServer.BugReport.Json;
|
||||
import com.google.gson.annotations.Expose;
|
||||
public class RecipientJson {
|
||||
@Expose
|
||||
public String address;
|
||||
public RecipientJson(String addres_in) {
|
||||
address = addres_in;
|
||||
}
|
||||
public RecipientJson() {
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package _VisualDVM.ComponentsServer.BugReport.Json;
|
||||
import _VisualDVM.ComponentsServer.Recipient.Recipient;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class RecipientsJson {
|
||||
@Expose
|
||||
public List<RecipientJson> array = new Vector<>();
|
||||
public RecipientsJson() {
|
||||
}
|
||||
public RecipientsJson(Vector<? extends Recipient> recipients) {
|
||||
array = new Vector<>();
|
||||
for (Recipient recipient : recipients)
|
||||
array.add(new RecipientJson(recipient.email));
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package _VisualDVM.ComponentsServer.BugReport.Json;
|
||||
import com.google.gson.annotations.Expose;
|
||||
public class VisualiserSettingJson {
|
||||
@Expose
|
||||
public String name;
|
||||
@Expose
|
||||
public String value;
|
||||
public VisualiserSettingJson() {
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package _VisualDVM.ComponentsServer.BugReport.Json;
|
||||
import _VisualDVM.ProjectData.SapforData.SapforProperties;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class VisualiserSettingsJson {
|
||||
@Expose
|
||||
public List<VisualiserSettingJson> array = new Vector<>();
|
||||
public String getSummary() {
|
||||
SapforProperties properties = new SapforProperties(); //только для извлечения описаний.
|
||||
Vector<String> res = new Vector<>();
|
||||
for (VisualiserSettingJson setting : array) {
|
||||
try {
|
||||
res.add(properties.getFieldDescription(setting.name) + "=" + setting.value);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return String.join("\n", res);
|
||||
}
|
||||
}
|
||||
@@ -4,22 +4,21 @@ import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
public class BugReportRecipient extends iDBObject {
|
||||
public String bugreport_id = "";
|
||||
public String email ="";
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
BugReportRecipient src_= (BugReportRecipient) src;
|
||||
bugreport_id = src_.bugreport_id;
|
||||
email = src_.email;
|
||||
public String email = "";
|
||||
public BugReportRecipient() {
|
||||
}
|
||||
public BugReportRecipient(){
|
||||
|
||||
}
|
||||
public BugReportRecipient(BugReport bugReport, String email_in){
|
||||
public BugReportRecipient(BugReport bugReport, String email_in) {
|
||||
bugreport_id = bugReport.id;
|
||||
email = email_in;
|
||||
}
|
||||
public BugReportRecipient(String email_in){
|
||||
public BugReportRecipient(String email_in) {
|
||||
email = email_in;
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
BugReportRecipient src_ = (BugReportRecipient) src;
|
||||
bugreport_id = src_.bugreport_id;
|
||||
email = src_.email;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,16 @@ public class BugReportSetting extends iDBObject {
|
||||
public String bugreport_id = "";
|
||||
public String name = "";
|
||||
public String value = "";
|
||||
public BugReportSetting() {
|
||||
}
|
||||
public BugReportSetting(BugReport bugReport, String name_in, Object value_in) {
|
||||
this(name_in, value_in);
|
||||
bugreport_id = bugReport.id;
|
||||
}
|
||||
public BugReportSetting(String name_in, Object value_in) {
|
||||
name = name_in;
|
||||
value = (value_in instanceof Boolean) ? ((boolean) value_in ? "1" : "0") : value_in.toString();
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
@@ -14,14 +24,4 @@ public class BugReportSetting extends iDBObject {
|
||||
name = src_.name;
|
||||
value = src_.value;
|
||||
}
|
||||
public BugReportSetting() {
|
||||
}
|
||||
public BugReportSetting(BugReport bugReport, String name_in, Object value_in) {
|
||||
this(name_in, value_in);
|
||||
bugreport_id = bugReport.id;
|
||||
}
|
||||
public BugReportSetting(String name_in, Object value_in){
|
||||
name = name_in;
|
||||
value = (value_in instanceof Boolean) ? ((boolean) value_in ? "1" : "0"): value_in.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,4 @@ public class BugReportSettingsDBTable extends iDBTable<BugReportSetting> {
|
||||
public BugReportSettingsDBTable() {
|
||||
super(BugReportSetting.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,52 +58,5 @@ public class BugReportsDatabase extends SQLiteDatabase {
|
||||
}
|
||||
}
|
||||
public void Patch() throws Exception {
|
||||
/*
|
||||
Vector<BugReportSetting> settings = new Vector<>();
|
||||
//--
|
||||
for (BugReport bugReport : bugReports.Data.values()) {
|
||||
//--
|
||||
if (!bugReport.project_version.isEmpty()) {
|
||||
if (bugReport.visualiser_version < 1134) {
|
||||
VisualiserSettingsJson visualiserSettingsJson = bugReport.getSettingsJson();
|
||||
for (VisualiserSettingJson visualiserSettingJson : visualiserSettingsJson.array) {
|
||||
BugReportSetting bugReportSetting = new BugReportSetting();
|
||||
bugReportSetting.bugreport_id = bugReport.id;
|
||||
bugReportSetting.name = visualiserSettingJson.name;
|
||||
bugReportSetting.value = visualiserSettingJson.value;
|
||||
settings.add(bugReportSetting);
|
||||
}
|
||||
} else {
|
||||
SapforProperties sapforProperties = bugReport.getPropertiesJson();
|
||||
Vector<BugReportSetting> settings_= sapforProperties.toBugReportSettings();
|
||||
for (BugReportSetting bugReportSetting: settings_)
|
||||
bugReportSetting.bugreport_id = bugReport.id;
|
||||
settings.addAll(settings_);
|
||||
}
|
||||
}
|
||||
//--
|
||||
}
|
||||
BeginTransaction();
|
||||
for (BugReportSetting bugReportSetting : settings)
|
||||
Insert(bugReportSetting);
|
||||
Commit();
|
||||
*/
|
||||
//---
|
||||
/*
|
||||
Vector<BugReportRecipient> recipients = new Vector<>();
|
||||
for (BugReport bugReport: bugReports.Data.values()){
|
||||
RecipientsJson recipientsJson = Utils_.gson.fromJson(bugReport.packedRecipientsJson, RecipientsJson.class);
|
||||
for (RecipientJson recipientJson: recipientsJson.array){
|
||||
recipients.add(new BugReportRecipient(bugReport, recipientJson.address));
|
||||
}
|
||||
}
|
||||
|
||||
//-
|
||||
BeginTransaction();
|
||||
for (BugReportRecipient recipient: recipients){
|
||||
Insert(recipient);
|
||||
}
|
||||
Commit();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ import Common.CommonConstants;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSetting;
|
||||
import _VisualDVM.ComponentsServer.Component.OSDComponent;
|
||||
import _VisualDVM.ComponentsServer.Component.Visualizer_2;
|
||||
import _VisualDVM.Constants;
|
||||
@@ -14,14 +12,12 @@ import _VisualDVM.Passes.Sapfor.SapforAnalysis;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.Files.UI.Editor.SPFEditor;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import _VisualDVM.ProjectData.SapforData.SapforProperties;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import _VisualDVM.Utils;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -645,5 +641,4 @@ public abstract class Sapfor extends OSDComponent {
|
||||
Global.mainModule.getUI().getVersionsWindow().BlockVariants();
|
||||
}
|
||||
//--
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import _VisualDVM.Passes.All.ZipFolderPass;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.Repository.EmailMessage;
|
||||
import _VisualDVM.Repository.Server.RepositoryServer;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMConfigurationTest.DVMConfigurationTest;
|
||||
import _VisualDVM.Utils;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@@ -67,24 +66,24 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
}
|
||||
@Override
|
||||
protected void afterPublishAction(DBObject object) throws Exception {
|
||||
if (object instanceof BugReport){
|
||||
if (object instanceof BugReport) {
|
||||
BugReport bugReport = (BugReport) object;
|
||||
if (bugReport.settings!=null){
|
||||
for (BugReportSetting setting: bugReport.settings){
|
||||
setting.bugreport_id=bugReport.id;
|
||||
if (bugReport.settings != null) {
|
||||
for (BugReportSetting setting : bugReport.settings) {
|
||||
setting.bugreport_id = bugReport.id;
|
||||
db.Insert(setting);
|
||||
}
|
||||
}
|
||||
if (bugReport.recipients!=null){
|
||||
if (bugReport.recipients != null) {
|
||||
db.saveBugreportRecipients(bugReport);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void afterEditAction(DBObject object) throws Exception {
|
||||
if (object instanceof BugReport){
|
||||
if (object instanceof BugReport) {
|
||||
BugReport bugReport = (BugReport) object;
|
||||
if (bugReport.recipients!=null){
|
||||
if (bugReport.recipients != null) {
|
||||
db.bugReportRecipients.ActualizeData(
|
||||
db.getVectorByFK(bugReport, BugReportRecipient.class),
|
||||
bugReport.recipients);
|
||||
@@ -379,9 +378,4 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void StartAction() throws Exception {
|
||||
super.StartAction();
|
||||
db.Patch();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user