масс удаление конфигураций сапфора. был баг - не прописано было удаление команд с сервера.
This commit is contained in:
@@ -26,6 +26,8 @@ import TestingSystem.DVM.Tasks.TestRunTask;
|
||||
import TestingSystem.DVM.Tasks.TestTask;
|
||||
import TestingSystem.DVM.TasksPackage.TasksPackage;
|
||||
import TestingSystem.DVM.UserConnection;
|
||||
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||
import TestingSystem.SAPFOR.SapforTask.SapforTask;
|
||||
import TestingSystem.SAPFOR.SapforTasksPackage.SapforPackageData;
|
||||
import TestingSystem.SAPFOR.SapforTasksPackage.SapforTasksPackage;
|
||||
@@ -73,49 +75,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void afterDeleteAction(DBObject object) throws Exception {
|
||||
if (object instanceof Test) {
|
||||
Test test = (Test) object;
|
||||
Utils.forceDeleteWithCheck(test.getArchive());
|
||||
Utils.forceDeleteWithCheck(test.getServerPath());
|
||||
} else if (object instanceof Group) {
|
||||
Group group = (Group) object;
|
||||
Vector<Test> tests = new Vector<>();
|
||||
for (Test group_test : db.tests.Data.values()) {
|
||||
if (group_test.group_id == group.id) // todo group_name -> group_id
|
||||
tests.add(group_test);
|
||||
}
|
||||
for (Test group_test : tests) {
|
||||
db.Delete(group_test);
|
||||
Utils.forceDeleteWithCheck(group_test.getArchive());
|
||||
Utils.forceDeleteWithCheck(group_test.getServerPath());
|
||||
}
|
||||
} else if (object instanceof ServerSapfor) {
|
||||
Utils.forceDeleteWithCheck(
|
||||
new File(
|
||||
((ServerSapfor) object).home_path
|
||||
)
|
||||
);
|
||||
} else if (object instanceof SapforTasksPackage) {
|
||||
SapforTasksPackage sapforTasksPackage = (SapforTasksPackage) object;
|
||||
File workspace = new File(
|
||||
sapforTasksPackage.workspace
|
||||
);
|
||||
System.out.println(Utils.Brackets(workspace.getAbsolutePath()));
|
||||
Utils.forceDeleteWithCheck(workspace);
|
||||
Utils.forceDeleteWithCheck(sapforTasksPackage.getArchive());
|
||||
//внешние ключи не работают
|
||||
Vector<SapforTask> tasks = new Vector<>();
|
||||
for (SapforTask task : account_db.sapforTasks.Data.values()) {
|
||||
if (task.sapfortaskspackage_id == sapforTasksPackage.id) // todo group_name -> group_id
|
||||
tasks.add(task);
|
||||
}
|
||||
for (SapforTask task : tasks) {
|
||||
account_db.Delete(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean canDelete(DBObject object) throws Exception {
|
||||
if (object instanceof TestTask) {
|
||||
return !((TestTask) object).state.equals(TaskState.Running);
|
||||
@@ -614,4 +573,57 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void afterDeleteAction(DBObject object) throws Exception {
|
||||
if (object instanceof Test) {
|
||||
Test test = (Test) object;
|
||||
Utils.forceDeleteWithCheck(test.getArchive());
|
||||
Utils.forceDeleteWithCheck(test.getServerPath());
|
||||
} else if (object instanceof Group) {
|
||||
Group group = (Group) object;
|
||||
Vector<Test> tests = new Vector<>();
|
||||
for (Test group_test : db.tests.Data.values()) {
|
||||
if (group_test.group_id == group.id)
|
||||
tests.add(group_test);
|
||||
}
|
||||
for (Test group_test : tests) {
|
||||
db.Delete(group_test);
|
||||
Utils.forceDeleteWithCheck(group_test.getArchive());
|
||||
Utils.forceDeleteWithCheck(group_test.getServerPath());
|
||||
}
|
||||
} else if (object instanceof ServerSapfor) {
|
||||
Utils.forceDeleteWithCheck(
|
||||
new File(
|
||||
((ServerSapfor) object).home_path
|
||||
)
|
||||
);
|
||||
} else if (object instanceof SapforTasksPackage) {
|
||||
SapforTasksPackage sapforTasksPackage = (SapforTasksPackage) object;
|
||||
File workspace = new File(
|
||||
sapforTasksPackage.workspace
|
||||
);
|
||||
System.out.println(Utils.Brackets(workspace.getAbsolutePath()));
|
||||
Utils.forceDeleteWithCheck(workspace);
|
||||
Utils.forceDeleteWithCheck(sapforTasksPackage.getArchive());
|
||||
//внешние ключи не работают
|
||||
Vector<SapforTask> tasks = new Vector<>();
|
||||
for (SapforTask task : account_db.sapforTasks.Data.values()) {
|
||||
if (task.sapfortaskspackage_id == sapforTasksPackage.id) // todo group_name -> group_id
|
||||
tasks.add(task);
|
||||
}
|
||||
for (SapforTask task : tasks) {
|
||||
account_db.Delete(task);
|
||||
}
|
||||
} else if (object instanceof SapforConfiguration){
|
||||
SapforConfiguration sapforConfiguration = (SapforConfiguration) object;
|
||||
Vector<SapforConfigurationCommand> commands = new Vector<>();
|
||||
for (SapforConfigurationCommand command : db.sapforConfigurationCommands.Data.values()) {
|
||||
if (command.sapforconfiguration_id == sapforConfiguration.id)
|
||||
commands.add(command);
|
||||
}
|
||||
for (SapforConfigurationCommand command : commands) {
|
||||
db.Delete(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user