рефакторинг массовых удалений объектов
This commit is contained in:
@@ -22,7 +22,7 @@ public class CompareDVMRunTasks extends Pass<Vector<DVMRunTask>> {
|
||||
master = null;
|
||||
slave = null;
|
||||
//--
|
||||
target = Global.testingServer.db.dvmRunTasks.getCheckedItems();
|
||||
target = Global.testingServer.db.dvmRunTasks.getSelectedItems();
|
||||
if (target.size() == 2) {
|
||||
if (UI.Question("Назначить задачу " + Utils_.Brackets(target.get(0).getPK()) + " эталоном" +
|
||||
"\n(в случае отказа, будет назначена задача " + Utils_.Brackets(target.get(1).getPK()) + ")")) {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class CompareSapforPackages extends Pass<Vector<SapforPackage>> {
|
||||
master = null;
|
||||
slave = null;
|
||||
//--
|
||||
target = Global.testingServer.db.sapforPackages.getCheckedItems();
|
||||
target = Global.testingServer.db.sapforPackages.getSelectedItems();
|
||||
if (target.size() == 2) {
|
||||
if (UI.Question("Назначить пакет " + Utils_.Brackets(target.get(0).getPK()) + " эталоном" +
|
||||
"\n(в случае отказа, будет назначен пакет " + Utils_.Brackets(target.get(1).getPK()) + ")")) {
|
||||
|
||||
@@ -13,18 +13,18 @@ public class DeleteSelectedFiles extends Pass {
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Global.mainModule.getProject().db.files.getCheckedCount() == 0) {
|
||||
if (Global.mainModule.getProject().db.files.getSelectedCount() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одного файла.");
|
||||
return false;
|
||||
}
|
||||
return UI.Warning("Удалить " + Global.mainModule.getProject().db.files.getCheckedCount() + " файлов.");
|
||||
return UI.Warning("Удалить " + Global.mainModule.getProject().db.files.getSelectedCount() + " файлов.");
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
boolean hasCurrent = false;
|
||||
boolean hasSelected = false;
|
||||
if (Global.mainModule.HasFile()) {
|
||||
for (DBProjectFile file : Global.mainModule.getProject().db.files.getCheckedItems()) {
|
||||
for (DBProjectFile file : Global.mainModule.getProject().db.files.getSelectedItems()) {
|
||||
if (Global.mainModule.getFile().file.equals(file.file))
|
||||
hasCurrent = true;
|
||||
if (Global.mainModule.getSelectedFile().file.equals(file.file))
|
||||
@@ -44,7 +44,7 @@ public class DeleteSelectedFiles extends Pass {
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (DBProjectFile file : Global.mainModule.getProject().db.files.getCheckedItems()) {
|
||||
for (DBProjectFile file : Global.mainModule.getProject().db.files.getSelectedItems()) {
|
||||
ShowMessage1(file.name);
|
||||
Global.mainModule.getUI().getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RemoveNode(file.node);
|
||||
Global.mainModule.getProject().db.Delete(file);
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ExcludeSelectedFiles extends Pass<Vector<DBProjectFile>> {
|
||||
Log.Writeln_("Нажмите правую клавишу мыши, и перейдите в режим выбора файлов.");
|
||||
return false;
|
||||
}
|
||||
target = Global.mainModule.getProject().db.files.getCheckedItems();
|
||||
target = Global.mainModule.getProject().db.files.getSelectedItems();
|
||||
if (target.isEmpty()) {
|
||||
Log.Writeln_("Не отмечено ни одного файла.");
|
||||
return false;
|
||||
|
||||
@@ -58,8 +58,8 @@ public class ExportDVMPackageToExcel extends Pass<Vector<DVMPackage>> {
|
||||
styles = null;
|
||||
target = null;
|
||||
//--
|
||||
if (Global.testingServer.db.dvmPackages.getCheckedCount() > 0) {
|
||||
target = Global.testingServer.db.dvmPackages.getCheckedItems();
|
||||
if (Global.testingServer.db.dvmPackages.getSelectedCount() > 0) {
|
||||
target = Global.testingServer.db.dvmPackages.getSelectedItems();
|
||||
} else {
|
||||
if (Global.mainModule.Check(Log, Current.DVMPackage)) {
|
||||
target = new Vector<>();
|
||||
|
||||
@@ -16,7 +16,7 @@ public class IncludeSelectedFiles extends Pass<Vector<DBProjectFile>> {
|
||||
Log.Writeln_("Нажмите правую клавишу мыши, и перейдите в режим выбора файлов.");
|
||||
return false;
|
||||
}
|
||||
target = Global.mainModule.getProject().db.files.getCheckedItems();
|
||||
target = Global.mainModule.getProject().db.files.getSelectedItems();
|
||||
if (target.isEmpty()) {
|
||||
Log.Writeln_("Не отмечено ни одного файла.");
|
||||
return false;
|
||||
|
||||
@@ -43,11 +43,10 @@ public class StartSelectedDVMConfigurations extends PublishServerObject<TestingS
|
||||
if (!Global.mainModule.getCompiler().versionLoaded)
|
||||
Global.mainModule.getPass(PassCode.ShowCompilerVersion).Do(Global.mainModule.getCompiler(), false);
|
||||
//-----
|
||||
Vector<DVMConfiguration> configurations = Global.testingServer.db.dvm_configurations.getCheckedOrCurrent();
|
||||
if (configurations.isEmpty()) {
|
||||
Log.Writeln_("Не отмечено ни одной конфигурации, или отсутствует текущая конфигурация.");
|
||||
if (!Global.testingServer.db.dvm_configurations.CheckSelectedOrCurrent(Log)){
|
||||
return false;
|
||||
}
|
||||
Vector<DVMConfiguration> configurations = Global.testingServer.db.dvm_configurations.getSelectedOrCurrent();
|
||||
//---
|
||||
target = new DVMPackage(
|
||||
Global.mainModule.getAccount(),
|
||||
|
||||
@@ -35,11 +35,10 @@ public class StartSelectedSAPFORConfigurations extends PublishServerObject<Testi
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
configurations = Global.testingServer.db.sapforConfigurations.getCheckedOrCurrent();
|
||||
if (configurations.isEmpty()) {
|
||||
Log.Writeln_("Не отмечено ни одной конфигурации, или отсутствует текущая конфигурация.");
|
||||
if (!Global.testingServer.db.sapforConfigurations.CheckSelectedOrCurrent(Log)){
|
||||
return false;
|
||||
}
|
||||
configurations = Global.testingServer.db.sapforConfigurations.getSelectedOrCurrent();
|
||||
target = new SapforPackage(Global.mainModule.getAccount(),
|
||||
Global.mainModule.getServerSapfor(),
|
||||
configurations,
|
||||
|
||||
@@ -22,18 +22,18 @@ public class UpdateSelectedComponents extends Pass<Vector<Component>> {
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = new Vector<>();
|
||||
//------------------------
|
||||
if (Global.Components.getCheckedCount() == 0) {
|
||||
if (Global.Components.getSelectedCount() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одного компонента!");
|
||||
return false;
|
||||
}
|
||||
target = Global.Components.getCheckedItems();
|
||||
target = Global.Components.getSelectedItems();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String getStartDescription() {
|
||||
Vector<String> question = new Vector<>();
|
||||
question.add("Обновить компоненты");
|
||||
for (Component component : Global.Components.getCheckedItems()) {
|
||||
for (Component component : Global.Components.getSelectedItems()) {
|
||||
question.add(component.getComponentType().getDescription());
|
||||
}
|
||||
return String.join("\n", question);
|
||||
|
||||
@@ -5,7 +5,7 @@ import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
public abstract class FilesMassPass<T> extends Pass<T> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Global.mainModule.getProject().db.files.getCheckedCount() == 0) {
|
||||
if (Global.mainModule.getProject().db.files.getSelectedCount() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одного файла.");
|
||||
return false;
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public abstract class FilesMassPass<T> extends Pass<T> {
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Global.mainModule.getProject().db.BeginTransaction();
|
||||
for (DBProjectFile file : Global.mainModule.getProject().db.files.getCheckedItems()) {
|
||||
for (DBProjectFile file : Global.mainModule.getProject().db.files.getSelectedItems()) {
|
||||
ShowMessage1(file.name);
|
||||
operation(file);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public abstract class VariantsMassPass extends CurrentProjectPass {
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
count = 0;
|
||||
if (super.canStart(args)) {
|
||||
count = target.parallelVariants.getCheckedCount();
|
||||
count = target.parallelVariants.getSelectedCount();
|
||||
if (count == 0) {
|
||||
Log.Writeln_("Не выбрано ни одного параллельного варианта");
|
||||
return false;
|
||||
|
||||
@@ -2,7 +2,6 @@ package _VisualDVM.Passes.Server;
|
||||
import Common.Database.Database;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.RepositoryServer;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
@@ -37,17 +36,10 @@ public class DeleteServerObjects<S extends RepositoryServer, D extends DBObject>
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
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())) {
|
||||
target = new Vector<>();
|
||||
target.add(table.getCurrent().getPK());
|
||||
return getDb().tables.get(d).CheckCurrent(Log) && getDb().tables.get(d).ShowDeleteObjectDialog(table.getCurrent());
|
||||
}
|
||||
if (!table.CheckSelectedOrCurrent(Log))
|
||||
return false;
|
||||
}
|
||||
target = table.getSelectedOrCurrentKeys();
|
||||
return table.ShowDeleteObjectsDialog(target.size());
|
||||
}
|
||||
//Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта.
|
||||
@Override
|
||||
@@ -63,7 +55,7 @@ public class DeleteServerObjects<S extends RepositoryServer, D extends DBObject>
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}//DeleteTestingPackages
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DeleteObjectsByPK, getEmail(), new Pair<>(d, target)));
|
||||
|
||||
@@ -14,9 +14,9 @@ public abstract class DeleteTestingPackages<P extends TestingPackage> extends De
|
||||
super(Global.testingServer, p);
|
||||
}
|
||||
public boolean checkActivity() {
|
||||
/*
|
||||
/* //todo
|
||||
for (Object key : target) {
|
||||
DVMPackage tasksPackage = server.db.dvmPackages.get(key);
|
||||
TestingPackage tasksPackage = server.db.dvmPackages.get(key);
|
||||
if (!tasksPackage.state.equals(TasksPackageState.Done) &&
|
||||
!tasksPackage.state.equals(TasksPackageState.Aborted)
|
||||
) {
|
||||
@@ -24,7 +24,7 @@ public abstract class DeleteTestingPackages<P extends TestingPackage> extends De
|
||||
return false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
protected abstract File getPackagesHome();
|
||||
|
||||
@@ -33,12 +33,12 @@ public abstract class SaveCurrentConfiguration<C extends Configuration, S extend
|
||||
tests = new Vector<>();
|
||||
settings = new Vector<>();
|
||||
//---
|
||||
for (Group group : Global.testingServer.db.groups.getCheckedItems()) {
|
||||
for (Group group : Global.testingServer.db.groups.getSelectedItems()) {
|
||||
groups.add(group);
|
||||
Vector<Test> groupTests = Global.testingServer.db.tests.getSelectedGroupTests(group);
|
||||
tests.addAll(groupTests);
|
||||
}
|
||||
for (Object setting : Global.testingServer.db.tables.get(s).getCheckedItems()) {
|
||||
for (Object setting : Global.testingServer.db.tables.get(s).getSelectedItems()) {
|
||||
settings.add((Settings) setting);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -61,12 +61,12 @@ public class ComponentsSet extends DataSet<ComponentType, Component> {
|
||||
return Current.Component;
|
||||
}
|
||||
@Override
|
||||
public Vector<Component> getCheckedItems() {
|
||||
public Vector<Component> getSelectedItems() {
|
||||
Vector<Component> target = new Vector<>();
|
||||
Component visualiser = null;
|
||||
Component server = null;
|
||||
//------------------------
|
||||
for (Component component : super.getCheckedItems()) {
|
||||
for (Component component : super.getSelectedItems()) {
|
||||
switch (component.getComponentType()) {
|
||||
case Visualizer_2:
|
||||
server = component;
|
||||
|
||||
@@ -70,4 +70,8 @@ public class Configuration extends riDBObject {
|
||||
public boolean validate(TextLog log) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String getDialogName() {
|
||||
return description;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class MainForm extends Form implements MainWindow {
|
||||
@Override
|
||||
public void ShowCheckedTestsCount() {
|
||||
int res = 0;
|
||||
for (Group group : Global.testingServer.db.groups.getCheckedItems()) {
|
||||
for (Group group : Global.testingServer.db.groups.getSelectedItems()) {
|
||||
Vector<Test> selected_tests = new Vector<>();
|
||||
Vector<Test> group_tests = new Vector<>();
|
||||
for (Test test : Global.testingServer.db.tests.Data.values()) {
|
||||
|
||||
Reference in New Issue
Block a user