This commit is contained in:
2023-11-20 18:01:31 +03:00
parent daf58423c7
commit 0dd1bbc8f6
3 changed files with 45 additions and 66 deletions

View File

@@ -2,32 +2,62 @@ package Visual_DVM_2021.Passes.All;
import Common.Current;
import Common.Global;
import Common.UI.UI;
import Common.Utils.Utils;
import ProjectData.Project.db_project_info;
import TestingSystem.Common.Group.Group;
import TestingSystem.Common.Test.Test;
import TestingSystem.Common.TestingServer;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Server.PublishServerObject;
public class PublishTest extends PublishServerObject<TestingServer, Test> {
boolean from_current_project;
protected Group group = null;
protected db_project_info project = null;
public PublishTest() {
super(Global.testingServer, Test.class);
}
db_project_info project = null;
protected boolean setProject() {
if (Current.Check(Log, Current.Group, Current.Project) && UI.Question("Добавить текущий проект в глобальную базу тестов")) {
project = Current.getProject();
return true;
}
return false;
}
@Override
public boolean fillObjectFields() throws Exception {
if (setProject()&&project.checkSubdirectories(Log)) {
target.description = project.getLocalName() + " " + project.description;
target.description = project.getLocalName() + " " + project.description;
target.group_id = group.id;
if (from_current_project) {
target.dim = project.testMaxDim;
target.group_id = Current.getGroup().id;
return super.fillObjectFields();
} else {
switch (project.languageName) {
case fortran:
target.dim = Current.getSapfor().getTextMaxDim(null, project);
break;
case c:
target.dim = Utils.getCProjectMaxDim(project);
break;
}
return true;
}
return false;
}
@Override
protected boolean canStart(Object... args) throws Exception {
group = null;
project = null;
if (args.length == 0) {
from_current_project = true;
if (Current.Check(Log, Current.Group, Current.Project) && UI.Question("Добавить текущий проект в глобальную базу тестов")) {
project = Current.getProject();
group= Current.getGroup();
}
} else {
from_current_project = false;
project = (db_project_info) args[0];
group = (Group) args[1];
}
//--
if (project == null)
return false;
//--
if (!project.checkSubdirectories(Log))
return false;
//-
return super.canStart(args);
}
@Override
protected void performDone() throws Exception {