рефакторинг. вынес в обобщенную часть бд, но еще не все
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
package _VisualDVM;
|
||||
import Common.CurrentAnchestor;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Loggable;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common_old.Constants;
|
||||
import Common_old.Current;
|
||||
import Common_old.GlobalProperties;
|
||||
import Common_old.UI.UI;
|
||||
import Common_old.Utils.Utils;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.CommonUI;
|
||||
import GlobalData.Account.Account;
|
||||
import GlobalData.Account.AccountRole;
|
||||
import GlobalData.GlobalDatabase;
|
||||
@@ -26,7 +27,6 @@ import TestingSystem.DVM.RemoteDVMTestingPlanner;
|
||||
import TestingSystem.SAPFOR.PackageModeSupervisor;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import Common.Utils.Loggable;
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory;
|
||||
|
||||
@@ -47,8 +47,6 @@ public class Global {
|
||||
//??
|
||||
public static DataSet<ComponentType, Component> Components = null;
|
||||
public static MessagesServer messagesServer = null;
|
||||
//--------------------------------------------------
|
||||
public static GlobalDatabase db = null;
|
||||
public static File ComponentsDirectory;
|
||||
public static File DataDirectory;
|
||||
public static File BugReportsDirectory;
|
||||
@@ -156,7 +154,7 @@ public class Global {
|
||||
//-
|
||||
public static void FinishApplication() {
|
||||
try {
|
||||
if (db != null) db.Disconnect();
|
||||
if (CommonUtils.db != null) CommonUtils.db.Disconnect();
|
||||
if (componentsServer.db != null)
|
||||
componentsServer.db.Disconnect();
|
||||
if (testingServer.db != null)
|
||||
@@ -177,11 +175,11 @@ public class Global {
|
||||
System.exit(0);
|
||||
}
|
||||
public static void ActivateDB() throws Exception {
|
||||
db = new GlobalDatabase();
|
||||
db.Connect();
|
||||
db.CreateAllTables();
|
||||
db.prepareTablesStatements();
|
||||
db.Synchronize();
|
||||
CommonUtils.db = new GlobalDatabase();
|
||||
CommonUtils.db.Connect();
|
||||
CommonUtils.db.CreateAllTables();
|
||||
CommonUtils.db.prepareTablesStatements();
|
||||
CommonUtils.db.Synchronize();
|
||||
}
|
||||
public static void RefreshUpdatesStatus() {
|
||||
Components.RefreshUI();
|
||||
@@ -220,7 +218,7 @@ public class Global {
|
||||
public static DBSetting getSetting(SettingName settingName) throws Exception {
|
||||
switch (Current.mode) {
|
||||
case Normal:
|
||||
return db.settings.get(settingName);
|
||||
return ((GlobalDatabase)CommonUtils.db).settings.get(settingName);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -235,7 +233,7 @@ public class Global {
|
||||
forbidden.add(SettingName.Precompilation);
|
||||
forbidden.add(SettingName.DVMConvertationOptions);
|
||||
forbidden.add(SettingName.SaveModifications);
|
||||
for (DBSetting setting : db.settings.getSettingsByOwner(ComponentType.SapforOptions)) {
|
||||
for (DBSetting setting : ((GlobalDatabase)CommonUtils.db).settings.getSettingsByOwner(ComponentType.SapforOptions)) {
|
||||
if (!forbidden.contains(setting.Name))
|
||||
res_.add(setting.Value);
|
||||
}
|
||||
@@ -330,11 +328,12 @@ public class Global {
|
||||
//---------------
|
||||
componentsServer.ActivateDB();
|
||||
testingServer.ActivateDB();
|
||||
//в проперти их!
|
||||
//-- чисто чтобы создать таблицы. соединения на стороне клиента не предвидится.
|
||||
if (db.settings.get(SettingName.AutoBugReportsLoad).toBoolean())
|
||||
if (((GlobalDatabase)CommonUtils.db).settings.get(SettingName.AutoBugReportsLoad).toBoolean())
|
||||
Pass_2021.passes.get(PassCode_2021.SynchronizeBugReports).Do();
|
||||
//--
|
||||
if (db.settings.get(SettingName.AutoTestsLoad).toBoolean())
|
||||
if (((GlobalDatabase)CommonUtils.db).settings.get(SettingName.AutoTestsLoad).toBoolean())
|
||||
Pass_2021.passes.get(PassCode_2021.SynchronizeTests).Do();
|
||||
Pass_2021.CheckAllStats();
|
||||
Current.getSapfor().refreshPid(); //без сапфора сюда это все равно не дойдет.
|
||||
|
||||
Reference in New Issue
Block a user