продолжение рефакторинга. создал предка для класса current

This commit is contained in:
2024-10-08 00:39:13 +03:00
parent 3516b58127
commit d0c08a2c7e
157 changed files with 648 additions and 421 deletions

View File

@@ -1,4 +1,5 @@
package GlobalData;
import Common.CurrentAnchestor;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common.Database.Objects.DBObject;
@@ -58,7 +59,7 @@ public class GlobalDatabase extends SQLiteDatabase {
public AccountsDBTable accounts;
public PassStatsDBTable passStats;
public SplittersDBTable splitters;
public GridsDBTable grids;
public GridsDBTable tablesVisualData;
//-
public SapforProfilesDBTable sapforProfiles = null;
//---------
@@ -87,18 +88,18 @@ public class GlobalDatabase extends SQLiteDatabase {
addTable(passStats = new PassStatsDBTable());
addTable(splitters = new SplittersDBTable());
addTable(dvmParameters = new DVMParameterDBTable());
addTable(grids = new GridsDBTable());
addTable(tablesVisualData = new GridsDBTable());
addTable(sapforProfiles = new SapforProfilesDBTable());
addTable(sapforProfilesSettings = new SapforProfileSettingsDBTable());
}
//---------------------------------------------------------------------------------
@Override
public void Init() throws Exception {
Current.set(Current.Account,
CurrentAnchestor.set(Current.Account,
accounts.Data.isEmpty() ? Insert(new Account()) :
accounts.getFirstRecord()
);
Current.set(Current.Credentials,
CurrentAnchestor.set(Current.Credentials,
credentials.Data.isEmpty() ? Insert(new Credentials()) :
credentials.getFirstRecord());
//настройки компонент
@@ -111,7 +112,7 @@ public class GlobalDatabase extends SQLiteDatabase {
}
public void SaveCredentials(){
try {
Credentials credentials = (Credentials) Current.get(Current.Credentials);
Credentials credentials = (Credentials) CurrentAnchestor.get(Current.Credentials);
if (Current.HasMachine())
credentials.machine_id = Current.getMachine().id;
if (Current.HasUser())
@@ -130,7 +131,7 @@ public class GlobalDatabase extends SQLiteDatabase {
}
public void UpdateCredentials() {
try {
Global.db.Update((DBObject) Current.get(Current.Credentials));
Global.db.Update((DBObject) CurrentAnchestor.get(Current.Credentials));
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
}