no message

This commit is contained in:
2023-11-23 22:38:21 +03:00
parent b3401bfe1c
commit 509c858b1a
10 changed files with 89 additions and 173 deletions

View File

@@ -1,86 +1,15 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants;
import Common.Current;
import Common.Global;
import Common.UI.UI;
import Common.Utils.Utils;
import ProjectData.Project.db_project_info;
import TestingSystem.Common.Test.Test;
import TestingSystem.Common.TestingServer;
import Visual_DVM_2021.Passes.Server.PublishServerObject;
import java.util.Vector;
public class PublishTest extends PublishServerObject<TestingServer, Test> {
boolean from_current_project;
protected int group_id;
protected db_project_info project = null;
public PublishTest() {
super(Global.testingServer, Test.class);
}
@Override
public boolean fillObjectFields() throws Exception {
target.description = project.getLocalName();
if (!project.description.isEmpty()) {
target.description += " " + project.description;
target.description = Utils.ReplaceForbiddenSymbols(target.description);
}
target.group_id = group_id;
//подпапок нет. имена совпадают с относительными.
Vector<String> filesNames = new Vector<>(project.db.files.Data.keySet());
target.files = String.join(";", filesNames);
//--
if (from_current_project) {
// target.max_dim = project.testMaxDim;
return super.fillObjectFields();
} else {
switch (project.languageName) {
case fortran:
target.max_dim = Current.getSapfor().getTextMaxDim(null, project);
break;
case c:
target.max_dim = Utils.getCProjectMaxDim(project);
break;
}
return true;
}
}
@Override
protected void performPreparation() throws Exception {
target.packProject(project);
}
@Override
protected boolean canStart(Object... args) throws Exception {
group_id = Constants.Nan;
project = null;
if (args.length == 0) {
from_current_project = true;
if (Current.Check(Log, Current.Group, Current.Project) && UI.Question("Добавить текущий проект в глобальную базу тестов")) {
project = Current.getProject();
group_id = Current.getGroup().id;
}
} else {
from_current_project = false;
project = (db_project_info) args[0];
group_id = (int) args[1];
}
//--
if (project == null)
return false;
//--
if (!project.checkSubdirectories(Log))
return false;
//-
return super.canStart(args);
}
@Override
protected void performFinish() throws Exception {
if (from_current_project)
super.performFinish();
else disconnect();
}
@Override
protected void showDone() throws Exception {
if (from_current_project)
super.showDone();
target = (Test) args[0];
return true;
}
}