промежуточный. Рефакторинг публикации теста из текущего проекта.

This commit is contained in:
2023-11-23 01:00:08 +03:00
parent 14b13eae97
commit e852443100
12 changed files with 222 additions and 329 deletions

View File

@@ -77,23 +77,14 @@ public abstract class Database {
table.Data.put(o.getPK(), o);
return o;
}
public DBObject InsertWithCheck(DBObject o) throws Exception {
DBTable table = tables.get(o.getClass());
if (!table.Data.containsKey(o.getPK())) {
insert(table, o);
table.Data.put(o.getPK(), o);
} else
throw new RepositoryRefuseException("Таблица " + Utils.Brackets(table.Name) + " уже содержит объект с ключом " + Utils.Brackets(o.getPK().toString()));
return o;
}
public DBObject InsertWithCheck_(DBObject o) throws Exception {
DBTable table = tables.get(o.getClass());
if (!table.Data.containsKey(o.getPK())) {
insert(table, o);
table.Data.put(o.getPK(), o);
return o;
}
return null;
//метод для вставки в серверную базу.
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()));
insert(table, object);
table.Data.put(object.getPK(), object);
return object;
}
// не работает с автоинкрементом.
public DBObject UpdateWithCheck(DBObject to_update) throws Exception {