no message

This commit is contained in:
2024-10-07 14:22:52 +03:00
parent 6b1576461d
commit 61fc37b574
173 changed files with 960 additions and 1526 deletions

View File

@@ -1,8 +1,8 @@
package Common.Database;
import Common_old.Constants;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Database.Tables.DBTable;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import Common.Database.Objects.DBObject;
import Common.Database.Tables.DataSet;
import Common.Database.Objects.iDBObject;
@@ -85,7 +85,7 @@ public abstract class Database {
public DBObject InsertS(DBObject object) throws Exception {
DBTable table = tables.get(object.getClass());
if (!(object instanceof iDBObject) && table.Data.containsKey(object.getPK()))
throw new RepositoryRefuseException("Таблица " + Utils.Brackets(table.Name) + " уже содержит объект с ключом " + Utils.Brackets(object.getPK().toString()));
throw new RepositoryRefuseException("Таблица " + CommonUtils.Brackets(table.Name) + " уже содержит объект с ключом " + CommonUtils.Brackets(object.getPK().toString()));
insert(table, object);
table.Data.put(object.getPK(), object);
return object;
@@ -112,7 +112,7 @@ public abstract class Database {
table.Data.remove(o.getPK());
return o;
} else
throw new RepositoryRefuseException("Таблица " + Utils.Brackets(table.Name) + " не содержит объект с ключом " + Utils.Brackets(to_delete.getPK().toString()));
throw new RepositoryRefuseException("Таблица " + CommonUtils.Brackets(table.Name) + " не содержит объект с ключом " + CommonUtils.Brackets(to_delete.getPK().toString()));
}
public DBObject DeleteByPK(Class object_class, Object key) throws Exception {
DBTable table = tables.get(object_class);
@@ -122,7 +122,7 @@ public abstract class Database {
table.Data.remove(key);
return o;
} else
throw new RepositoryRefuseException("Таблица " + Utils.Brackets(table.Name) + " не содержит объект с ключом " + Utils.Brackets(key.toString()));
throw new RepositoryRefuseException("Таблица " + CommonUtils.Brackets(table.Name) + " не содержит объект с ключом " + CommonUtils.Brackets(key.toString()));
}
// не работает с автоинкрементом.
public DBObject getObjectCopyByPK(Class table_class, Object pk) throws Exception {
@@ -233,7 +233,7 @@ public abstract class Database {
(O) (tables.get(class_in).Data.get(pk)) : null;
}
public <O extends iDBObject> O getById(Class<O> class_in, int pk) {
return getByPK(class_in, pk, Constants.Nan);
return getByPK(class_in, pk, CommonConstants.Nan);
}
public <G, O extends DBObject, F extends DBObject> LinkedHashMap<G, F> getByFKAndGroupBy(O owner, Class<F> fk_class, String group_field, Class<G> group_class) {
LinkedHashMap<G, F> res = new LinkedHashMap<>();

View File

@@ -1,7 +1,7 @@
package Common.Database.Objects;
import Common.Utils.CommonUtils;
import Common_old.UI.Selectable;
import Common.Utils.Index;
import Common_old.Utils.Utils;
import com.sun.org.glassfish.gmbal.Description;
import java.io.Serializable;
@@ -34,7 +34,7 @@ public abstract class DBObject implements Selectable, Serializable {
}
public abstract Object getPK();
public String getBDialogName() {
return Utils.Brackets(getDialogName());
return CommonUtils.Brackets(getDialogName());
}
public String getDialogName() {
return getPK().toString();

View File

@@ -1,5 +1,5 @@
package Common.Database.Objects;
import Common_old.Constants;
import Common.CommonConstants;
import com.google.gson.annotations.Expose;
import com.sun.org.glassfish.gmbal.Description;
//автоинкрементальный ключ
@@ -13,7 +13,7 @@ public class iDBObject extends DBObject {
}
@Override
public Object getEmptyFK() {
return Constants.Nan;
return CommonConstants.Nan;
}
//---
@Override

View File

@@ -3,6 +3,7 @@ import Common.Database.Objects.DBObject;
import Common.Database.Tables.DBTable;
import Common.Database.Tables.DBTableColumn;
import Common.Database.Database;
import Common.Utils.CommonUtils;
import Common_old.UI.UI;
import Common_old.Utils.Utils;
import Visual_DVM_2021.Passes.PassException;
@@ -116,7 +117,7 @@ public abstract class SQLiteDatabase extends Database {
Vector<String> columns_names = new Vector<>();
for (DBTableColumn column : table.columns.values())
columns_names.add(column.toString());
cmd += Utils.RBrackets(String.join(",", columns_names));
cmd += CommonUtils.RBrackets(String.join(",", columns_names));
statement.execute(cmd);
}
}
@@ -135,8 +136,8 @@ public abstract class SQLiteDatabase extends Database {
}
insertStatements.put(table.d, conn.prepareStatement(
"INSERT OR REPLACE INTO " + table.QName() + " " +
Utils.RBrackets(String.join(",", column_names)) + " " + "VALUES " +
Utils.RBrackets(String.join(",", column_values))));
CommonUtils.RBrackets(String.join(",", column_names)) + " " + "VALUES " +
CommonUtils.RBrackets(String.join(",", column_values))));
//------------------------------------------------------------------------------->>
Vector<String> new_values = new Vector();
for (DBTableColumn column : table.columns.values()) {
@@ -194,7 +195,7 @@ public abstract class SQLiteDatabase extends Database {
if (field_value != null) {
table.d.getField(column.Name).set(o, field_value);
} else
throw new PassException("Ошибка при загрузке поля " + Utils.Brackets(column.Name) + " класса " + Utils.Brackets(table.d.getSimpleName()));
throw new PassException("Ошибка при загрузке поля " + CommonUtils.Brackets(column.Name) + " класса " + CommonUtils.Brackets(table.d.getSimpleName()));
}
return new Pair<>((K) o.getPK(), o);
}