рефакторинг. вынес в обобщенную часть бд, но еще не все
This commit is contained in:
@@ -3,11 +3,11 @@ import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common_old.Current;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common_old.UI.Windows.Dialog.DBObjectDialog;
|
||||
import Common_old.Utils.Utils;
|
||||
import GlobalData.DVMParameter.UI.DVMParameterFields;
|
||||
import GlobalData.GlobalDatabase;
|
||||
public class DVMParameterDBTable extends iDBTable<DVMParameter> {
|
||||
public DVMParameterDBTable() {
|
||||
super(DVMParameter.class);
|
||||
@@ -76,7 +76,7 @@ public class DVMParameterDBTable extends iDBTable<DVMParameter> {
|
||||
Log.Writeln("Значение переменной окружения не может содержать двойные кавычки");
|
||||
}
|
||||
*/
|
||||
for (DVMParameter par : Global.db.dvmParameters.Data.values()) {
|
||||
for (DVMParameter par : ((GlobalDatabase)CommonUtils.db).dvmParameters.Data.values()) {
|
||||
if (par.isVisible() && (Result.id != par.id) && (par.name.equals(name))) {
|
||||
Log.Writeln("В конфигурации запуска уже задан параметр DVM системы с именем " + CommonUtils.Brackets(name));
|
||||
break;
|
||||
|
||||
@@ -3,11 +3,11 @@ import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common_old.Current;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common_old.UI.Windows.Dialog.DBObjectDialog;
|
||||
import Common_old.Utils.Utils;
|
||||
import GlobalData.EnvironmentValue.UI.EnvironmentValueFields;
|
||||
import GlobalData.GlobalDatabase;
|
||||
public class EnvironmentValuesDBTable extends iDBTable<EnvironmentValue> {
|
||||
public EnvironmentValuesDBTable() {
|
||||
super(EnvironmentValue.class);
|
||||
@@ -43,7 +43,7 @@ public class EnvironmentValuesDBTable extends iDBTable<EnvironmentValue> {
|
||||
if (value.contains("\"")) {
|
||||
Log.Writeln("Значение переменной окружения не может содержать двойные кавычки");
|
||||
}
|
||||
for (EnvironmentValue env : Global.db.environmentValues.Data.values()) {
|
||||
for (EnvironmentValue env : ((GlobalDatabase)CommonUtils.db).environmentValues.Data.values()) {
|
||||
if (env.isVisible() && (Result.id != env.id) && (env.name.equals(name))) {
|
||||
Log.Writeln("В конфигурации запуска уже задана переменная окружения с именем " + CommonUtils.Brackets(name));
|
||||
break;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package GlobalData;
|
||||
import Common.CurrentAnchestor;
|
||||
import Common.Database.VisualiserDatabase;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.SQLITE.SQLiteDatabase;
|
||||
import _VisualDVM.Global;
|
||||
import GlobalData.Account.Account;
|
||||
import GlobalData.Account.AccountsDBTable;
|
||||
@@ -15,7 +15,6 @@ import GlobalData.DVMParameter.DVMParameterDBTable;
|
||||
import GlobalData.EnvironmentValue.EnvironmentValuesDBTable;
|
||||
import GlobalData.FormsParams.FormsDBTable;
|
||||
import GlobalData.FormsParams.MainFormParamsDBTable;
|
||||
import GlobalData.Grid.GridsDBTable;
|
||||
import GlobalData.Machine.MachinesDBTable;
|
||||
import GlobalData.Makefile.MakefilesDBTable;
|
||||
import GlobalData.Module.ModulesDBTable;
|
||||
@@ -27,7 +26,6 @@ import GlobalData.SapforProfileSetting.SapforProfileSettingsDBTable;
|
||||
import GlobalData.Settings.DBSetting;
|
||||
import GlobalData.Settings.SettingName;
|
||||
import GlobalData.Settings.SettingsDBTable;
|
||||
import GlobalData.Splitter.SplittersDBTable;
|
||||
import GlobalData.Tasks.CompilationTask.CompilationTasksDBTable;
|
||||
import GlobalData.Tasks.RunTask.RunTasksDBTable;
|
||||
import GlobalData.User.UsersDBTable;
|
||||
@@ -38,7 +36,7 @@ import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
public class GlobalDatabase extends SQLiteDatabase {
|
||||
public class GlobalDatabase extends VisualiserDatabase {
|
||||
//---------СЕАНС----------------------------------------------
|
||||
public MachinesDBTable machines;
|
||||
public UsersDBTable users;
|
||||
@@ -58,8 +56,6 @@ public class GlobalDatabase extends SQLiteDatabase {
|
||||
public LastProjectsDBTable lastProjects;
|
||||
public AccountsDBTable accounts;
|
||||
public PassStatsDBTable passStats;
|
||||
public SplittersDBTable splitters;
|
||||
public GridsDBTable tablesVisualData;
|
||||
//-
|
||||
public SapforProfilesDBTable sapforProfiles = null;
|
||||
//---------
|
||||
@@ -70,6 +66,7 @@ public class GlobalDatabase extends SQLiteDatabase {
|
||||
}
|
||||
@Override
|
||||
protected void initAllTables() throws Exception {
|
||||
super.initAllTables();
|
||||
addTable(machines = new MachinesDBTable());
|
||||
addTable(users = new UsersDBTable());
|
||||
addTable(compilers = new CompilersDBTable());
|
||||
@@ -86,9 +83,7 @@ public class GlobalDatabase extends SQLiteDatabase {
|
||||
addTable(lastProjects = new LastProjectsDBTable());
|
||||
addTable(accounts = new AccountsDBTable());
|
||||
addTable(passStats = new PassStatsDBTable());
|
||||
addTable(splitters = new SplittersDBTable());
|
||||
addTable(dvmParameters = new DVMParameterDBTable());
|
||||
addTable(tablesVisualData = new GridsDBTable());
|
||||
addTable(sapforProfiles = new SapforProfilesDBTable());
|
||||
addTable(sapforProfilesSettings = new SapforProfileSettingsDBTable());
|
||||
}
|
||||
@@ -131,7 +126,7 @@ public class GlobalDatabase extends SQLiteDatabase {
|
||||
}
|
||||
public void UpdateCredentials() {
|
||||
try {
|
||||
Global.db.Update((DBObject) CurrentAnchestor.get(Current.Credentials));
|
||||
Update((DBObject) CurrentAnchestor.get(Current.Credentials));
|
||||
} catch (Exception ex) {
|
||||
CommonUtils.MainLog.PrintException(ex);
|
||||
}
|
||||
@@ -139,7 +134,7 @@ public class GlobalDatabase extends SQLiteDatabase {
|
||||
//--
|
||||
public LinkedHashMap<SettingName, String> getSapforSettingsForProfile() {
|
||||
LinkedHashMap<SettingName, String> res = new LinkedHashMap<>();
|
||||
for (DBSetting setting : Global.db.settings.getSettingsByOwner(ComponentType.SapforOptions))
|
||||
for (DBSetting setting : settings.getSettingsByOwner(ComponentType.SapforOptions))
|
||||
if (setting.Visible)
|
||||
res.put(setting.Name, setting.Value);
|
||||
return res;
|
||||
@@ -170,18 +165,18 @@ public class GlobalDatabase extends SQLiteDatabase {
|
||||
}
|
||||
}
|
||||
public void saveCurrentProfile(String name_in) throws Exception {
|
||||
if (Global.db.checkProfileForCurrentSettings() == null) {
|
||||
if (checkProfileForCurrentSettings() == null) {
|
||||
SapforProfile profile = new SapforProfile();
|
||||
profile.description = name_in;
|
||||
profile.creationDate = new Date().getTime();
|
||||
Global.db.Insert(profile);
|
||||
Global.db.insertProfileSettings(profile);
|
||||
Insert(profile);
|
||||
insertProfileSettings(profile);
|
||||
}
|
||||
}
|
||||
public void rewriteProfileByDescription(String description_in) throws Exception {
|
||||
SapforProfile old = null;
|
||||
//ищем профиль с именем бага
|
||||
for (SapforProfile p : Global.db.sapforProfiles.Data.values())
|
||||
for (SapforProfile p : sapforProfiles.Data.values())
|
||||
if (p.description.equalsIgnoreCase(description_in)) {
|
||||
old = p;
|
||||
break;
|
||||
@@ -189,14 +184,14 @@ public class GlobalDatabase extends SQLiteDatabase {
|
||||
if (old != null) {
|
||||
//удалить профиль с именем бага,если есть, чтобы не множить кроликов.
|
||||
//при условии что не видно окна профилей!!
|
||||
Global.db.Delete(old);
|
||||
Global.db.DeleteByFK(old, SapforProfileSetting.class);
|
||||
Delete(old);
|
||||
DeleteByFK(old, SapforProfileSetting.class);
|
||||
}
|
||||
//---
|
||||
SapforProfile profile = new SapforProfile();
|
||||
profile.description = description_in;
|
||||
profile.creationDate = new Date().getTime();
|
||||
Global.db.Insert(profile);
|
||||
Global.db.insertProfileSettings(profile);
|
||||
Insert(profile);
|
||||
insertProfileSettings(profile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package GlobalData.Grid;
|
||||
import Common.Database.Tables.DBTable;
|
||||
public class GridsDBTable extends DBTable<String, TableVisualData> {
|
||||
public GridsDBTable() {
|
||||
public class TablesVisualDatasDBTable extends DBTable<String, TableVisualData> {
|
||||
public TablesVisualDatasDBTable() {
|
||||
super(String.class, TableVisualData.class);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package GlobalData.Machine;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import Common.Utils.CommonUtils;
|
||||
import _VisualDVM.Global;
|
||||
import GlobalData.Compiler.Compiler;
|
||||
import GlobalData.User.User;
|
||||
|
||||
@@ -27,10 +26,10 @@ public class Machine extends iDBObject {
|
||||
"Машина по адресу " + CommonUtils.Brackets(getURL());
|
||||
}
|
||||
public LinkedHashMap<Integer, Compiler> getCompilers() {
|
||||
return Global.db.getMapByFKi(this, Compiler.class);
|
||||
return CommonUtils.db.getMapByFKi(this, Compiler.class);
|
||||
}
|
||||
public LinkedHashMap<Integer, User> getUsers() {
|
||||
return Global.db.getMapByFKi(this, User.class);
|
||||
return CommonUtils.db.getMapByFKi(this, User.class);
|
||||
}
|
||||
@Override
|
||||
public String getDialogName() {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package GlobalData.Makefile;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Utils.TextLog;
|
||||
import Common_old.Utils.Utils;
|
||||
import GlobalData.Compiler.Compiler;
|
||||
@@ -26,10 +25,10 @@ public class Makefile extends ModuleAnchestor {
|
||||
return Current.HasMachine() && (machine_id == Current.getMachine().id);
|
||||
}
|
||||
public LinkedHashMap<LanguageName, Module> getActiveModules() {
|
||||
return Global.db.getByFKAndGroupBy(this, Module.class, "language", LanguageName.class).values().stream().filter(Module::isSelected).collect(Collectors.toMap(module -> module.language, module -> module, (a, b) -> b, LinkedHashMap::new));
|
||||
return CommonUtils.db.getByFKAndGroupBy(this, Module.class, "language", LanguageName.class).values().stream().filter(Module::isSelected).collect(Collectors.toMap(module -> module.language, module -> module, (a, b) -> b, LinkedHashMap::new));
|
||||
}
|
||||
public LinkedHashMap<LanguageName, Module> getModules() {
|
||||
return Global.db.getByFKAndGroupBy(this, Module.class, "language", LanguageName.class);
|
||||
return CommonUtils.db.getByFKAndGroupBy(this, Module.class, "language", LanguageName.class);
|
||||
}
|
||||
public String Generate(db_project_info project, boolean useFilesOrder, LinkedHashMap<LanguageName, Module> modules) throws Exception {
|
||||
Compiler linker = getCompiler();
|
||||
@@ -160,7 +159,7 @@ public class Makefile extends ModuleAnchestor {
|
||||
//todo возможно улучшить
|
||||
//https://habr.com/ru/post/211751/
|
||||
public Machine getMachine() {
|
||||
return Global.db.getById(Machine.class, machine_id);
|
||||
return CommonUtils.db.getById(Machine.class, machine_id);
|
||||
}
|
||||
public boolean DependsToCompiler(Compiler compiler) {
|
||||
if (compiler_id == compiler.id) return true;
|
||||
|
||||
@@ -2,7 +2,6 @@ package GlobalData.Module;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Global;
|
||||
import GlobalData.Makefile.Makefile;
|
||||
import ProjectData.LanguageName;
|
||||
public class Module extends ModuleAnchestor {
|
||||
@@ -30,7 +29,7 @@ public class Module extends ModuleAnchestor {
|
||||
public void Select(boolean flag) {
|
||||
on = flag ? 1 : 0;
|
||||
try {
|
||||
Global.db.Update(this);
|
||||
CommonUtils.db.Update(this);
|
||||
} catch (Exception e) {
|
||||
CommonUtils.MainLog.PrintException(e);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package GlobalData.Module;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.Global;
|
||||
import GlobalData.Compiler.Compiler;
|
||||
public class ModuleAnchestor extends iDBObject {
|
||||
//--------------------------------------------------------------------------------------
|
||||
@@ -17,7 +16,7 @@ public class ModuleAnchestor extends iDBObject {
|
||||
return ((compiler = getCompiler()) == null) ? "" : compiler.getDescription();
|
||||
}
|
||||
public Compiler getCompiler() {
|
||||
return Global.db.getById(Compiler.class, compiler_id);
|
||||
return CommonUtils.db.getById(Compiler.class, compiler_id);
|
||||
}
|
||||
public String getDescription() {
|
||||
String res = "";
|
||||
|
||||
@@ -3,7 +3,6 @@ import Common.CommonConstants;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Utils.TextLog;
|
||||
import GlobalData.Compiler.Compiler;
|
||||
import GlobalData.DVMParameter.DVMParameter;
|
||||
@@ -118,7 +117,7 @@ public class RunConfiguration extends iDBObject {
|
||||
}
|
||||
//---------------------------------------->
|
||||
public Compiler getCompiler() {
|
||||
return Global.db.getById(Compiler.class, compiler_id);
|
||||
return CommonUtils.db.getById(Compiler.class, compiler_id);
|
||||
}
|
||||
public boolean isCube() {
|
||||
return cube != 0;
|
||||
@@ -190,13 +189,13 @@ public class RunConfiguration extends iDBObject {
|
||||
return "run_configuration_id";
|
||||
}
|
||||
public Vector<String> getEnvList() {
|
||||
return Global.db.getVectorStringByFK(this, EnvironmentValue.class);
|
||||
return CommonUtils.db.getVectorStringByFK(this, EnvironmentValue.class);
|
||||
}
|
||||
public Vector<String> getParList() {
|
||||
return Global.db.getVectorStringByFK(this, DVMParameter.class);
|
||||
return CommonUtils.db.getVectorStringByFK(this, DVMParameter.class);
|
||||
}
|
||||
public LinkedHashMap<String, String> getEnvMap() {
|
||||
LinkedHashMap<Integer, EnvironmentValue> envs = Global.db.getMapByFKi(this, EnvironmentValue.class);
|
||||
LinkedHashMap<Integer, EnvironmentValue> envs = CommonUtils.db.getMapByFKi(this, EnvironmentValue.class);
|
||||
LinkedHashMap<String, String> res = new LinkedHashMap<>();
|
||||
for (EnvironmentValue e : envs.values()) {
|
||||
if (!res.containsKey(e.name))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package GlobalData.RunConfiguration;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common_old.UI.Windows.Dialog.DBObjectDialog;
|
||||
import Common.Database.Objects.DBObject;
|
||||
@@ -14,6 +14,7 @@ import GlobalData.Compiler.Compiler;
|
||||
import GlobalData.Compiler.CompilerType;
|
||||
import GlobalData.DVMParameter.DVMParameter;
|
||||
import GlobalData.EnvironmentValue.EnvironmentValue;
|
||||
import GlobalData.GlobalDatabase;
|
||||
import GlobalData.RunConfiguration.UI.MatrixBar;
|
||||
import GlobalData.RunConfiguration.UI.RunConfigurationFields;
|
||||
import GlobalData.Tasks.RunTask.RunTask;
|
||||
@@ -39,7 +40,7 @@ public class RunConfigurationsDBTable extends iDBTable<RunConfiguration> {
|
||||
return new DBObjectDialog<RunConfiguration, RunConfigurationFields>(RunConfigurationFields.class) {
|
||||
@Override
|
||||
public void fillFields() {
|
||||
for (Compiler compiler : Global.db.compilers.Data.values()) {
|
||||
for (Compiler compiler : ((GlobalDatabase)CommonUtils.db).compilers.Data.values()) {
|
||||
if (compiler.isVisible() && compiler.type.equals(CompilerType.dvm))
|
||||
fields.cbLauncherCall.addItem(compiler);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package GlobalData.Tasks.CompilationTask;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import GlobalData.GlobalDatabase;
|
||||
import _VisualDVM.Global;
|
||||
import GlobalData.Makefile.Makefile;
|
||||
import GlobalData.Module.Module;
|
||||
@@ -62,7 +63,7 @@ public class CompilationTask extends Task {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Global.db.Update(this);
|
||||
CommonUtils.db.Update(this);
|
||||
}
|
||||
//---------------------------------------------------
|
||||
@Override
|
||||
@@ -78,7 +79,7 @@ public class CompilationTask extends Task {
|
||||
belongsToProject(Current.getProject());
|
||||
}
|
||||
public Makefile getMakefile() {
|
||||
return Global.db.getById(Makefile.class, makefile_id);
|
||||
return CommonUtils.db.getById(Makefile.class, makefile_id);
|
||||
}
|
||||
@Override
|
||||
public String getFullCommand() {
|
||||
@@ -88,7 +89,7 @@ public class CompilationTask extends Task {
|
||||
LinkedHashMap<Integer, RunTask> res = new LinkedHashMap<>();
|
||||
//так не получится. не правильно назвал ключевое поле. F...
|
||||
// return Global.db.getMapByFKi(this, RunTask.class);
|
||||
for (RunTask runTask : Global.db.runTasks.Data.values()) {
|
||||
for (RunTask runTask : ((GlobalDatabase)CommonUtils.db).runTasks.Data.values()) {
|
||||
if (runTask.compilation_task_id == id)
|
||||
res.put(runTask.id, runTask);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package GlobalData.Tasks.RunTask;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import GlobalData.GlobalDatabase;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Utils.StringTemplate;
|
||||
import Common_old.Utils.Utils;
|
||||
@@ -37,7 +38,7 @@ public class RunTask extends Task {
|
||||
super.DropResults();
|
||||
Utils.forceDeleteWithCheck(getLocalStsFile());
|
||||
CleanTime = 0;
|
||||
Global.db.Update(this);
|
||||
CommonUtils.db.Update(this);
|
||||
}
|
||||
@Override
|
||||
public File getHome() {
|
||||
@@ -60,16 +61,16 @@ public class RunTask extends Task {
|
||||
compilation_task_id == Current.getCompilationTask().id;
|
||||
}
|
||||
public RunConfiguration getRunConfiguration() {
|
||||
return Global.db.runConfigurations.Data.get(run_configuration_id);
|
||||
return ((GlobalDatabase)CommonUtils.db).runConfigurations.Data.get(run_configuration_id);
|
||||
}
|
||||
public CompilationTask getCompilationTask() {
|
||||
return Global.db.compilationTasks.Data.get(compilation_task_id);
|
||||
return ((GlobalDatabase)CommonUtils.db).compilationTasks.Data.get(compilation_task_id);
|
||||
}
|
||||
public void UpdateLastStsName(String file_name) {
|
||||
if (!last_sts_name.equals(file_name)) {
|
||||
last_sts_name = file_name;
|
||||
try {
|
||||
Global.db.Update(this);
|
||||
CommonUtils.db.Update(this);
|
||||
} catch (Exception ex) {
|
||||
CommonUtils.MainLog.PrintException(ex);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package GlobalData.Tasks.Supervisor.Local.Windows;
|
||||
import Common.Utils.CommonUtils;
|
||||
import _VisualDVM.Global;
|
||||
import Common_old.Utils.Utils;
|
||||
import GlobalData.GlobalDatabase;
|
||||
import GlobalData.Makefile.Makefile;
|
||||
import GlobalData.Settings.SettingName;
|
||||
import GlobalData.Tasks.CompilationTask.CompilationTask;
|
||||
@@ -19,7 +19,7 @@ public class WindowsLocalCompilationSupervisor extends WindowsLocalTaskSuperviso
|
||||
}
|
||||
@Override
|
||||
protected String getScriptText() {
|
||||
return CommonUtils.DQuotes(Global.db.settings.get(SettingName.LocalMakePathWindows).Value) + " 1>out.txt 2>err.txt";
|
||||
return CommonUtils.DQuotes(((GlobalDatabase)CommonUtils.db).settings.get(SettingName.LocalMakePathWindows).Value) + " 1>out.txt 2>err.txt";
|
||||
}
|
||||
//скорее всего как то выделить подготовку к компиляции как метод предка.
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package GlobalData.Tasks.Supervisor;
|
||||
import Common.Utils.CommonUtils;
|
||||
import _VisualDVM.Global;
|
||||
import Common_old.Utils.Utils;
|
||||
import GlobalData.Tasks.Task;
|
||||
import GlobalData.Tasks.TaskState;
|
||||
@@ -17,7 +16,7 @@ public abstract class TaskSupervisor<T extends Task, P extends Pass_2021> {
|
||||
public void ShowTaskState(){
|
||||
|
||||
|
||||
Global.db.tables.get(task.getClass()).ShowUI(task.getPK());
|
||||
CommonUtils.db.tables.get(task.getClass()).ShowUI(task.getPK());
|
||||
}
|
||||
public void Init(T task_in, P pass_in, db_project_info project_in) {
|
||||
task = task_in;
|
||||
@@ -133,6 +132,6 @@ public abstract class TaskSupervisor<T extends Task, P extends Pass_2021> {
|
||||
}
|
||||
}
|
||||
public void UpdateTask() throws Exception {
|
||||
Global.db.Update(task);
|
||||
CommonUtils.db.Update(task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import Common.CommonConstants;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Constants;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.Global;
|
||||
import Common_old.Utils.Utils;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.User.User;
|
||||
@@ -45,7 +44,7 @@ public abstract class Task extends iDBObject {
|
||||
EndDate = 0;
|
||||
Time = 0;
|
||||
state = TaskState.Inactive;
|
||||
Global.db.Update(this);
|
||||
CommonUtils.db.Update(this);
|
||||
}
|
||||
//</editor-fold>
|
||||
//<editor-fold desc="локальные файлы">
|
||||
@@ -67,10 +66,10 @@ public abstract class Task extends iDBObject {
|
||||
return new Date(EndDate);
|
||||
}
|
||||
public Machine getMachine() {
|
||||
return Global.db.getById(Machine.class, machine_id);
|
||||
return CommonUtils.db.getById(Machine.class, machine_id);
|
||||
}
|
||||
public User getUser() {
|
||||
return Global.db.getById(User.class, user_id);
|
||||
return CommonUtils.db.getById(User.class, user_id);
|
||||
}
|
||||
protected String getTextResult(File file) {
|
||||
return (file.exists()) ? Utils.ReadAllText(file) : "файл не найден. Задача еще не выполнялась или была завершена некорректно";
|
||||
@@ -93,7 +92,7 @@ public abstract class Task extends iDBObject {
|
||||
if (state != state_in) {
|
||||
state = state_in;
|
||||
try {
|
||||
Global.db.Update(this);
|
||||
CommonUtils.db.Update(this);
|
||||
} catch (Exception ex) {
|
||||
CommonUtils.MainLog.PrintException(ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user