no message

This commit is contained in:
2023-11-16 21:03:25 +03:00
parent 4545cf2d26
commit 27f275e1d8
6 changed files with 51 additions and 160 deletions

View File

@@ -1550,4 +1550,11 @@ public class db_project_info extends DBObject {
getSubdirectoriesR(Home);
return !subdirectories.isEmpty();
}
public boolean checkSubdirectories(TextLog Log){
if (hasSubdirectories()) {
Log.Writeln_("Проект содержит вложенные папки!");
return false;
}
return true;
}
}

View File

@@ -15,12 +15,12 @@ import javax.swing.*;
import java.util.LinkedHashMap;
import java.util.Vector;
//-
public class GroupsDBTable extends DBTable<String, Group> {
public class GroupsDBTable extends iDBTable<Group> {
public Vector<TableFilter<Group>> typeFilters;
public Vector<TableFilter<Group>> languageFilters;
//------------------------------------------------>>>
public GroupsDBTable() {
super(String.class, Group.class);
super(Group.class);
if (Current.hasUI()) {
//--
typeFilters = new Vector<>();

View File

@@ -94,38 +94,30 @@ public class CreateTestsGroupFromSelectedVersions extends Pass_2021<Vector<db_pr
vizTestProject.Close();
ShowMessage1("Публикация теста " + vizTestProject.getTitle());
PublishTest pass = new PublishTest() {
@Override
protected boolean setProject() {
project = vizTestProject;
switch (project.languageName) {
case fortran:
project.testMaxDim = Current.getSapfor().getTextMaxDim(null, project);
break;
default:
project.testMaxDim = 0;
break;
}
return true;
}
@Override
protected boolean needsAnimation() {
return false;
}
@Override
protected boolean fillObjectFields() throws Exception {
return true;
public boolean fillObjectFields() throws Exception {
project = vizTestProject;
if (project.checkSubdirectories(Log)) {
switch (project.languageName) {
case fortran:
project.testMaxDim = Current.getSapfor().getTextMaxDim(null, project);
break;
default:
project.testMaxDim = 0;
break;
}
return true;
}
return false;
}
@Override
public String getDescription() {
return "Добавление версии " + vizTestProject.name;
}
@Override
protected void performFinish() throws Exception {
disconnect();
}
@Override
protected void showDone() throws Exception {
}
};
if (pass.Do())
test = pass.target;

View File

@@ -1,70 +1,53 @@
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.Test.Test;
import TestingSystem.TestingServer;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
import Visual_DVM_2021.Passes.Server.PublishServerObject;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.nio.file.Paths;
public class PublishTest extends TestingSystemPass<Test> {
@Override
public String getIconPath() {
return "/icons/RedAdd.png";
}
@Override
public String getButtonText() {
return "";
public class PublishTest extends PublishServerObject<TestingServer, Test> {
public PublishTest() {
super(Global.testingServer, Test.class);
}
protected db_project_info project = null;
protected boolean setProject() {
if (Current.Check(Log, Current.Group, Current.Project) &&
checkSubdirectories()
if (Current.Check(Log, Current.Group, Current.Project)
&& UI.Question("Добавить текущий проект в глобальную базу тестов")) {
project = Current.getProject();
switch (project.languageName) {
case fortran:
return passes.get(PassCode_2021.SPF_GetMaxMinBlockDistribution).Do();
case c:
project.testMaxDim = Utils.getCProjectMaxDim(project);
return true;
default:
return false;
if (project.checkSubdirectories(Log)) {
switch (project.languageName) {
case fortran:
return passes.get(PassCode_2021.SPF_GetMaxMinBlockDistribution).Do();
case c:
project.testMaxDim = Utils.getCProjectMaxDim(project);
return true;
default:
return false;
}
}
}
return false;
}
protected boolean checkSubdirectories() {
if (Current.getProject().hasSubdirectories()) {
Log.Writeln_("Запрещено добавлять тестовые проекты, содержащие подпапки!");
return false;
}
return true;
}
@Override
protected boolean canStart(Object... args) throws Exception {
project = null;
if (Current.getAccount().CheckRegistered(Log) && setProject()) {
target = new Test();
public boolean fillObjectFields() throws Exception {
if (setProject()) {
target.description = project.getLocalName() + " " + project.description;
target.dim = project.testMaxDim;
target.sender_name = Current.getAccount().name;
target.sender_address = Current.getAccount().email;
target.group_id = Current.getGroup().id;
if (fillObjectFields()) {
File src = Paths.get(System.getProperty("user.dir"), "Temp", String.valueOf(target.id)).toFile();
Utils.forceDeleteWithCheck(src);
FileUtils.forceMkdir(src);
if (project.db.files.Data.isEmpty()) {
UI.Info("Клонируемый проект не синхронизирован!!! Внутренняя ошибка.");
}
if (super.fillObjectFields()) {
File src = Utils.getTempFileName("test");
Utils.CheckAndCleanDirectory(src);
project.Clone(src, false);
FileUtils.copyFile(project.db.getFile(), Paths.get(src.getAbsolutePath(),
Constants.data, project.db.getFile().getName()).toFile());
FileUtils.copyFile(project.db.getFile(),
Paths.get(src.getAbsolutePath(),Constants.data, project.db.getFile().getName()).toFile());
//архивация.
File archive = Utils.getTempFileName("test_archive");
if (passes.get(PassCode_2021.ZipFolderPass).Do(src.getAbsolutePath(), archive.getAbsolutePath())) {
@@ -75,22 +58,5 @@ public class PublishTest extends TestingSystemPass<Test> {
}
return false;
}
//тест с именем
protected boolean fillObjectFields() throws Exception {
return server.db.tests.ShowAddObjectDialog(target);
}
@Override
protected void ServerAction() throws Exception {
PublishObject(target);
}
@Override
protected void performFinish() throws Exception {
super.performFinish();
passes.get(PassCode_2021.SynchronizeTests).Do();
}
@Override
protected void showDone() throws Exception {
super.showDone();
server.db.tests.ui_.Show(target.getPK());
}
//--
}

View File

@@ -304,6 +304,7 @@ public enum PassCode_2021 {
ShowSapforTaskPackage, //временный проход на демонстрацию дерева файлов и версий пакета.
OpenSapforEtalonVersion,
OpenSapforVersion,
//->
TestPass;
public String getDescription() {