no message
This commit is contained in:
@@ -1,19 +1,24 @@
|
||||
package _VisualDVM.Passes.Server;
|
||||
import Common.Database.Database;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Database;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
||||
import _VisualDVM.Repository.RepositoryServer;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DeleteServerObjects <S extends RepositoryServer, D extends DBObject> extends RepositoryPass<S, Vector<Object>> {
|
||||
public class DeleteServerObjects<S extends RepositoryServer, D extends DBObject> extends RepositoryPass<S, Vector<Object>> {
|
||||
protected Class<D> d; //класс объектов.
|
||||
//---
|
||||
public DeleteServerObjects(S server_in, Class<D> d_in) {
|
||||
super(server_in);
|
||||
d = d_in;
|
||||
}
|
||||
//---
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
@@ -26,21 +31,17 @@ public class DeleteServerObjects <S extends RepositoryServer, D extends DBObject
|
||||
protected Database getDb() {
|
||||
return server.db;
|
||||
}
|
||||
protected String getEmail(){return null;}
|
||||
//---
|
||||
public DeleteServerObjects(S server_in, Class<D> d_in) {
|
||||
super(server_in);
|
||||
d = d_in;
|
||||
protected String getEmail() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
DBTable table =getDb().tables.get(d);
|
||||
if (table.getCheckedCount()>0) {
|
||||
DBTable table = getDb().tables.get(d);
|
||||
if (table.getCheckedCount() > 0) {
|
||||
target = table.getCheckedKeys();
|
||||
return UI_.Warning(table.getCheckedCount()+" объектов будет удален(о).");
|
||||
}
|
||||
else {
|
||||
if (Global.mainModule.Check(Log, table.CurrentName())){
|
||||
return UI_.Warning(table.getCheckedCount() + " объектов будет удален(о).");
|
||||
} else {
|
||||
if (Global.mainModule.Check(Log, table.CurrentName())) {
|
||||
target = new Vector<>();
|
||||
target.add(table.getCurrent().getPK());
|
||||
return getDb().tables.get(d).CheckCurrent(Log) && getDb().tables.get(d).ShowDeleteObjectDialog(table.getCurrent());
|
||||
@@ -65,13 +66,13 @@ public class DeleteServerObjects <S extends RepositoryServer, D extends DBObject
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DeleteObjectsByPK, getEmail(),new Pair<>(d, target)));
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DeleteObjectsByPK, getEmail(), new Pair<>(d, target)));
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
super.performFinish();
|
||||
Global.mainModule.getPass(getDb().getSynchronizePassCode()).Do();
|
||||
for (Object key: target){
|
||||
for (Object key : target) {
|
||||
VisualCaches.DeleteCache(d, key);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user