no message

This commit is contained in:
2024-10-11 00:00:30 +03:00
parent a11b7711f7
commit f317ab1aa1
341 changed files with 1866 additions and 1688 deletions

View File

@@ -1,6 +1,6 @@
package Common.Database;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import Common.Database.Tables.DBTable;
import Common.Database.Objects.DBObject;
import Common.Database.Tables.DataSet;
@@ -84,7 +84,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("Таблица " + CommonUtils.Brackets(table.Name) + " уже содержит объект с ключом " + CommonUtils.Brackets(object.getPK().toString()));
throw new RepositoryRefuseException("Таблица " + Utils_.Brackets(table.Name) + " уже содержит объект с ключом " + Utils_.Brackets(object.getPK().toString()));
insert(table, object);
table.Data.put(object.getPK(), object);
return object;
@@ -111,7 +111,7 @@ public abstract class Database {
table.Data.remove(o.getPK());
return o;
} else
throw new RepositoryRefuseException("Таблица " + CommonUtils.Brackets(table.Name) + " не содержит объект с ключом " + CommonUtils.Brackets(to_delete.getPK().toString()));
throw new RepositoryRefuseException("Таблица " + Utils_.Brackets(table.Name) + " не содержит объект с ключом " + Utils_.Brackets(to_delete.getPK().toString()));
}
public DBObject DeleteByPK(Class object_class, Object key) throws Exception {
DBTable table = tables.get(object_class);
@@ -121,7 +121,7 @@ public abstract class Database {
table.Data.remove(key);
return o;
} else
throw new RepositoryRefuseException("Таблица " + CommonUtils.Brackets(table.Name) + " не содержит объект с ключом " + CommonUtils.Brackets(key.toString()));
throw new RepositoryRefuseException("Таблица " + Utils_.Brackets(table.Name) + " не содержит объект с ключом " + Utils_.Brackets(key.toString()));
}
// не работает с автоинкрементом.
public DBObject getObjectCopyByPK(Class table_class, Object pk) throws Exception {
@@ -178,7 +178,7 @@ public abstract class Database {
if (fk_class.getField(owner.getFKName()).get(o).equals(owner.getPK())) res.add((DBObject) o);
}
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
return res;
}
@@ -207,7 +207,7 @@ public abstract class Database {
if (fk_class.getField(owner.getFKName()).get(f).equals(owner.getPK())) res.put((K) f.getPK(), f);
}
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
return res;
}
@@ -222,7 +222,7 @@ public abstract class Database {
if (fk_class.getField(owner.getFKName()).get(o).equals(owner.getPK())) res.add(o.toString());
}
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
return res;
}
@@ -243,7 +243,7 @@ public abstract class Database {
res.put((G) (fk_class.getField(group_field).get(f)), f);
}
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
return res;
}

View File

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

View File

@@ -1,5 +1,5 @@
package Common.Database.Objects;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import com.sun.org.glassfish.gmbal.Description;
public abstract class nDBObject extends DBObject {
@Description("PRIMARY KEY, UNIQUE")
@@ -13,7 +13,7 @@ public abstract class nDBObject extends DBObject {
return "";
}
public void genName() {
id = CommonUtils.getDateName(getClass().getSimpleName().toLowerCase());
id = Utils_.getDateName(getClass().getSimpleName().toLowerCase());
}
//-
@Override

View File

@@ -3,8 +3,8 @@ 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.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import Common.Passes.PassException;
import javafx.util.Pair;
@@ -13,7 +13,7 @@ import java.sql.*;
import java.util.LinkedHashMap;
import java.util.Vector;
import static Common.Utils.CommonUtils.requireNonNullElse;
import static Common.Utils.Utils_.requireNonNullElse;
public abstract class SQLiteDatabase extends Database {
protected Connection conn = null;
protected Statement statement = null;
@@ -36,7 +36,7 @@ public abstract class SQLiteDatabase extends Database {
ex.printStackTrace();
conn = null;
System.gc();
CommonUtils.sleep(2000);
Utils_.sleep(2000);
}
}
if (conn == null)
@@ -116,7 +116,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 += CommonUtils.RBrackets(String.join(",", columns_names));
cmd += Utils_.RBrackets(String.join(",", columns_names));
statement.execute(cmd);
}
}
@@ -135,8 +135,8 @@ public abstract class SQLiteDatabase extends Database {
}
insertStatements.put(table.d, conn.prepareStatement(
"INSERT OR REPLACE INTO " + table.QName() + " " +
CommonUtils.RBrackets(String.join(",", column_names)) + " " + "VALUES " +
CommonUtils.RBrackets(String.join(",", column_values))));
Utils_.RBrackets(String.join(",", column_names)) + " " + "VALUES " +
Utils_.RBrackets(String.join(",", column_values))));
//------------------------------------------------------------------------------->>
Vector<String> new_values = new Vector();
for (DBTableColumn column : table.columns.values()) {
@@ -194,7 +194,7 @@ public abstract class SQLiteDatabase extends Database {
if (field_value != null) {
table.d.getField(column.Name).set(o, field_value);
} else
throw new PassException("Ошибка при загрузке поля " + CommonUtils.Brackets(column.Name) + " класса " + CommonUtils.Brackets(table.d.getSimpleName()));
throw new PassException("Ошибка при загрузке поля " + Utils_.Brackets(column.Name) + " класса " + Utils_.Brackets(table.d.getSimpleName()));
}
return new Pair<>((K) o.getPK(), o);
}
@@ -210,7 +210,7 @@ public abstract class SQLiteDatabase extends Database {
protected void insert(DBTable table, DBObject o) throws Exception {
PreparedStatement ps = insertStatements.get(table.d);
if (ps == null)
CommonUI.Info("INSERT NULL");
UI_.Info("INSERT NULL");
int i = 1;
for (DBTableColumn column : table.columns.values()) {
if (!column.AutoIncrement) {
@@ -234,7 +234,7 @@ public abstract class SQLiteDatabase extends Database {
protected void update(DBTable table, DBObject o) throws Exception {
PreparedStatement ps = updateStatements.get(table.d);
if (ps == null)
CommonUI.Info("UPDATE NULL");
UI_.Info("UPDATE NULL");
int i = 1;
for (DBTableColumn column : table.columns.values()) {
if (!column.AutoIncrement) {

View File

@@ -8,7 +8,7 @@ import Common.Visual.Windows.Dialog.DBObjectDialog;
import Common.Visual.Windows.Dialog.DialogFields;
import Common.Utils.TextLog;
import Common.Database.Objects.DBObject;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.FilterInterface;
import javax.swing.*;
@@ -41,15 +41,15 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
Name = d.getSimpleName();
}
public void mountUI(JPanel content_in) {
CommonUI.Clear(content_in);
UI_.Clear(content_in);
//-->
ui_ = createUI();
ui_.setContent(content_in);
//-->
if ( CommonUI.menuBars.containsKey(getClass())) {
DataMenuBar bar = CommonUI.menuBars.get(getClass());
if ( UI_.menuBars.containsKey(getClass())) {
DataMenuBar bar = UI_.menuBars.get(getClass());
content_in.add(bar, BorderLayout.NORTH);
setFilterUI(count -> CommonUI.menuBars.get(getClass()).countLabel.setText(String.valueOf(count)));
setFilterUI(count -> UI_.menuBars.get(getClass()).countLabel.setText(String.valueOf(count)));
if (ui_.hasCheckBox())
bar.createSelectionButtons(this);
}
@@ -57,7 +57,7 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
//----
createFilters();
if (!filters.isEmpty()) {
DataMenuBar menuBar = CommonUI.menuBars.get(getClass());
DataMenuBar menuBar = UI_.menuBars.get(getClass());
for (DataSetFilter<D> filter : filters)
menuBar.addMenus(filter.menu);
}
@@ -133,7 +133,7 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
return false;
}
public boolean ShowDeleteObjectDialog(DBObject object) {
return CommonUI.Warning(getSingleDescription() + " " + object.getBDialogName() + " будет удален(а)");
return UI_.Warning(getSingleDescription() + " " + object.getBDialogName() + " будет удален(а)");
}
public String QName() {
return "\"" + Name + "\"";