масс удаление конфигураций сапфора. был баг - не прописано было удаление команд с сервера.
This commit is contained in:
4
.idea/workspace.xml
generated
4
.idea/workspace.xml
generated
@@ -7,8 +7,8 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteTasksPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteTasksPackage.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteSapforConfiguration.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteSapforConfiguration.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import TestingSystem.Common.TestingServer;
|
||||
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
import Visual_DVM_2021.Passes.Server.DeleteServerObject;
|
||||
public class DeleteSapforConfiguration extends DeleteServerObject<TestingServer, SapforConfiguration> {
|
||||
import Visual_DVM_2021.Passes.DeleteServerObjects;
|
||||
public class DeleteSapforConfiguration extends DeleteServerObjects<TestingServer, SapforConfiguration> {
|
||||
public DeleteSapforConfiguration() {
|
||||
super(Global.testingServer, SapforConfiguration.class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user