Перенос.
This commit is contained in:
32
src/Visual_DVM_2021/Passes/AddObjectPass.java
Normal file
32
src/Visual_DVM_2021/Passes/AddObjectPass.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package Visual_DVM_2021.Passes;
|
||||
import Common.Database.DBObject;
|
||||
public abstract class AddObjectPass<D extends DBObject> extends ObjectPass<D> {
|
||||
public AddObjectPass(Class<D> d_in) {
|
||||
super(d_in);
|
||||
}
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = d.newInstance();
|
||||
return
|
||||
((getOwner() == null) || (getDb().tables.get(getOwner()).CheckCurrent(Log))) &&
|
||||
fillObjectFields();
|
||||
}
|
||||
protected boolean fillObjectFields() throws Exception {
|
||||
return getTable().ShowAddObjectDialog(target);
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/RedAdd.png";
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
getDb().Insert(target);
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
getTable().ShowUI(target.getPK());
|
||||
}
|
||||
}
|
||||
45
src/Visual_DVM_2021/Passes/All/AbortSelectedPackages.java
Normal file
45
src/Visual_DVM_2021/Passes/All/AbortSelectedPackages.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.TasksPackage.TasksPackage;
|
||||
import TestingSystem.TasksPackageToKill.TasksPackageToKill;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
|
||||
import java.util.Vector;
|
||||
public class AbortSelectedPackages extends TestingSystemPass<Vector<TasksPackage>> {
|
||||
Vector<TasksPackageToKill> packagesToKill;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Ban.PNG";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = server.account_db.packages.getCheckedItems();
|
||||
packagesToKill = new Vector<>();
|
||||
for (TasksPackage tasksPackage : target) {
|
||||
switch (tasksPackage.state) {
|
||||
case Done:
|
||||
case Aborted:
|
||||
break;
|
||||
default:
|
||||
TasksPackageToKill tasksPackageToKill = new TasksPackageToKill();
|
||||
tasksPackageToKill.packageName = tasksPackage.id;
|
||||
packagesToKill.add(tasksPackageToKill);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (packagesToKill.isEmpty()) {
|
||||
Log.Writeln_("Не отмечено ни одного активного пакета для удаления");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.PublishAccountObjects, Current.getAccount().email, packagesToKill));
|
||||
}
|
||||
}
|
||||
70
src/Visual_DVM_2021/Passes/All/ActualizePackages.java
Normal file
70
src/Visual_DVM_2021/Passes/All/ActualizePackages.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.TasksPackage.TasksPackage;
|
||||
import TestingSystem.TasksPackage.TasksPackageState;
|
||||
import TestingSystem.TestingServer;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.util.Vector;
|
||||
public class ActualizePackages extends TestingSystemPass<Vector<TasksPackage>> {
|
||||
boolean needsSynchronize;
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Vector<TasksPackage> actual_packages = new Vector<>();
|
||||
for (TasksPackage p : target) {
|
||||
TasksPackageState oldState = p.state;
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.GetAccountObjectCopyByPK, Current.getAccount().email, new Pair<>(TasksPackage.class, p.id)));
|
||||
TasksPackage actual_package = (TasksPackage) response.object;
|
||||
actual_packages.add(actual_package);
|
||||
//-
|
||||
p.SynchronizeFields(actual_package);
|
||||
if (!oldState.equals(p.state) && p.state.equals(TasksPackageState.Done))
|
||||
needsSynchronize=true; //состояние изменилось, и на Done значит нужно скачивать задачи.
|
||||
server.account_db.Update(p);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
needsSynchronize=false;
|
||||
target = server.account_db.getActivePackages();
|
||||
return !target.isEmpty();
|
||||
}
|
||||
@Override
|
||||
protected void performCanNotStart() throws Exception {
|
||||
TestingServer.TimerOff();
|
||||
}
|
||||
@Override
|
||||
protected void showCanNotStart() throws Exception {
|
||||
UI.getMainWindow().getTestingWindow().ShowAutoActualizeTestsState();
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
server.account_db.SaveLastSelections();
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
server.account_db.packages.ClearUI();
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
server.account_db.packages.ShowUI();
|
||||
if (!TestingServer.checkTasks) UI.getMainWindow().getTestingWindow().ShowAutoActualizeTestsState();
|
||||
server.account_db.RestoreLastSelections();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
if (needsSynchronize) {
|
||||
passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
|
||||
}
|
||||
}
|
||||
}
|
||||
95
src/Visual_DVM_2021/Passes/All/AddBugReport.java
Normal file
95
src/Visual_DVM_2021/Passes/All/AddBugReport.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Account.AccountRole;
|
||||
import Repository.BugReport.BugReport;
|
||||
import Repository.BugReport.BugReportInterface;
|
||||
import Repository.BugReport.BugReportState;
|
||||
import Repository.Component.ComponentType;
|
||||
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class AddBugReport extends AddObjectPass<BugReport> {
|
||||
public AddBugReport() {
|
||||
super(BugReport.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.componentsServer.db;
|
||||
}
|
||||
@Override
|
||||
public boolean canStart(Object... args) throws Exception {
|
||||
if (Current.getAccount().role.equals(AccountRole.Undefined)) {
|
||||
Log.Writeln_("Для создания отчёта требуется регистрация");
|
||||
return false;
|
||||
}
|
||||
if (Current.HasProject()) {
|
||||
String version = Current.getProject().Home.getAbsolutePath().substring(Current.getRoot().Home.getParent().length());
|
||||
if (version.toCharArray()[0] == '\\') version = version.substring(1);
|
||||
target = new BugReport(Current.getAccount().name, Current.getAccount().email,
|
||||
"Черновик отчёта об ошибке.\nЗаполните описание ошибочной ситуации, и нажмите 'Опубликовать'", version);
|
||||
return true;
|
||||
} else {
|
||||
if (UI.Warning("Создать отчёт об ошибке без прикрепления проекта.")) {
|
||||
target = new BugReport();
|
||||
target.genName();
|
||||
target.sender_name = Current.getAccount().name;
|
||||
target.sender_address = Current.getAccount().email;
|
||||
target.project_version = "";
|
||||
target.visualiser_version = Global.visualiser.version;
|
||||
target.sapfor_version = Global.Components.get(ComponentType.Sapfor_F).version;
|
||||
target.sapfor_settings = Global.db.settings.getSapforSettingsText();
|
||||
target.percentage = 0;
|
||||
target.description = "Черновик отчёта об ошибке.\nЗаполните описание ошибочной ситуации, и нажмите 'Опубликовать'";
|
||||
target.date = new Date().getTime();
|
||||
target.change_date = new Date().getTime();
|
||||
target.state = BugReportState.draft;
|
||||
target.owner = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
Current.getSapfor().ResetAllAnalyses();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
super.body();
|
||||
if (!target.project_version.isEmpty()) {
|
||||
Current.getRoot().cleanDepAndGCOVR(); //удаление депов и гкова
|
||||
//логи во вложения.
|
||||
File attachementsDir = Current.getProject().getAttachmentsDirectory();
|
||||
Vector<File> logs = new Vector<>();
|
||||
logs.add(Global.Log.getLogFile());
|
||||
logs.add(Paths.get(Global.ComponentsDirectory.getAbsolutePath(), "Sapfor_log.txt").toFile());
|
||||
logs.add(Paths.get(Global.ComponentsDirectory.getAbsolutePath(), "Server_log.txt").toFile());
|
||||
logs.add(Global.Components.get(ComponentType.Visualizer_2).getLogFile());
|
||||
for (File file : logs) {
|
||||
if (file.exists())
|
||||
Files.copy(file.toPath(), Paths.get(attachementsDir.getAbsolutePath(), file.getName()), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
//запаковка рута
|
||||
passes.get(PassCode_2021.ZipFolderPass).Do(Current.getRoot().Home.getAbsolutePath(), BugReportInterface.getArchiveFile(target).getAbsolutePath());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
double size = Utils.getFileSizeMegaBytes(BugReportInterface.getArchiveFile(target));
|
||||
if (size > 100) {
|
||||
Log.Writeln_("Размер запакованного вложения " + size + " Мб превышает 100 Мб");
|
||||
return false;
|
||||
}
|
||||
return super.validate();
|
||||
}
|
||||
}
|
||||
20
src/Visual_DVM_2021/Passes/All/AddCompiler.java
Normal file
20
src/Visual_DVM_2021/Passes/All/AddCompiler.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Compiler.Compiler;
|
||||
import GlobalData.Machine.Machine;
|
||||
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||
public class AddCompiler extends AddObjectPass<Compiler> {
|
||||
public AddCompiler() {
|
||||
super(Compiler.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return Machine.class;
|
||||
}
|
||||
}
|
||||
20
src/Visual_DVM_2021/Passes/All/AddDVMParameter.java
Normal file
20
src/Visual_DVM_2021/Passes/All/AddDVMParameter.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.DVMParameter.DVMParameter;
|
||||
import GlobalData.RunConfiguration.RunConfiguration;
|
||||
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||
public class AddDVMParameter extends AddObjectPass<DVMParameter> {
|
||||
public AddDVMParameter() {
|
||||
super(DVMParameter.class);
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return RunConfiguration.class;
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.UI.Windows.Dialog.DBObjectDialog;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.DVMParameter.DVMParameter;
|
||||
import GlobalData.DVMParameter.UI.DVMParameterFields;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
public class AddDVMParameterForTesting extends Pass_2021<String> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
DBObjectDialog<DVMParameter, DVMParameterFields> dialog =
|
||||
new DBObjectDialog<DVMParameter, DVMParameterFields>(DVMParameterFields.class) {
|
||||
@Override
|
||||
public void fillFields() {
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
String name = (String) fields.cbName.getSelectedItem();
|
||||
String value = fields.tfValue.getText();
|
||||
if (name.isEmpty())
|
||||
Log.Writeln("Имя параметра DVM системы не может быть пустым.");
|
||||
if (Utils.isLinuxSystemCommand(name))
|
||||
Log.Writeln(Utils.DQuotes(name) + " является системной командой Linux");
|
||||
if (Utils.isLinuxSystemCommand(value))
|
||||
Log.Writeln(Utils.DQuotes(value) + " является системной командой Linux");
|
||||
}
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
target = fields.cbName.getSelectedItem() +"="+fields.tfValue.getText();
|
||||
}
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 200;
|
||||
}
|
||||
};
|
||||
return dialog.ShowDialog("Добавление параметра DVM системы", new DVMParameter());
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/AddEnvironmentValue.java
Normal file
14
src/Visual_DVM_2021/Passes/All/AddEnvironmentValue.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.EnvironmentValue.EnvironmentValue;
|
||||
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||
public class AddEnvironmentValue extends AddObjectPass<EnvironmentValue> {
|
||||
public AddEnvironmentValue() {
|
||||
super(EnvironmentValue.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
73
src/Visual_DVM_2021/Passes/All/AddFile.java
Normal file
73
src/Visual_DVM_2021/Passes/All/AddFile.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Common.UI.Windows.Dialog.Text.FileNameForm;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import ProjectData.Files.FileType;
|
||||
import Visual_DVM_2021.Passes.ChangeFilePass;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class AddFile extends ChangeFilePass<DBProjectFile> {
|
||||
Mode mode;
|
||||
File src;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
resetArgs();
|
||||
mode = Mode.Dialog;
|
||||
src = null;
|
||||
if (args.length > 0) {
|
||||
src = (File) args[0];
|
||||
mode = Mode.Import;
|
||||
fileName = src.getName();
|
||||
if (Utils.ContainsCyrillic(fileName)) {
|
||||
Log.Writeln_("Имя файла " + Utils.Brackets(fileName) + " содержит кириллицу.");
|
||||
return false;
|
||||
}
|
||||
if (Utils.ContainsForbiddenName(fileName)) {
|
||||
Log.Writeln_("Имя файла " + Utils.Brackets(fileName)
|
||||
+ " содержит запрещенные символы." +
|
||||
"\n" + Utils.all_forbidden_characters_string);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
(ff = new FileNameForm()).ShowDialog("Введите имя создаваемого файла");
|
||||
fileName = ff.Result;
|
||||
//тут имена фильтруются уже на этапе формы.
|
||||
}
|
||||
if (fileName != null) {
|
||||
//->
|
||||
parent_node = Current.getProjectCurrentParentNode();
|
||||
target_dir = (File) parent_node.getUserObject();
|
||||
//->
|
||||
dst = Paths.get(target_dir.getAbsolutePath(), fileName).toFile();
|
||||
if (dst.exists()) {
|
||||
Log.Writeln_("Файл с именем " + Utils.Brackets(fileName) + " уже существует");
|
||||
return false;
|
||||
}
|
||||
target = new DBProjectFile(dst, project);
|
||||
if (target.fileType.equals(FileType.forbidden)) {
|
||||
Log.Writeln_("Расширение " + Utils.Brackets(Utils.getExtension(dst)) + " недопустимо");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
if (mode == Mode.Dialog) Utils.WriteToFile(target.file, "");
|
||||
else FileUtils.copyFile(src, dst);
|
||||
project.db.Insert(target);
|
||||
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().AddNode(parent_node,
|
||||
dst_node = target.node = new DefaultMutableTreeNode(target)
|
||||
);
|
||||
}
|
||||
enum Mode {
|
||||
Dialog,
|
||||
Import
|
||||
}
|
||||
}
|
||||
59
src/Visual_DVM_2021/Passes/All/AddMachine.java
Normal file
59
src/Visual_DVM_2021/Passes/All/AddMachine.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Compiler.Compiler;
|
||||
import GlobalData.Compiler.CompilerType;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.Machine.MachineType;
|
||||
import GlobalData.User.User;
|
||||
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||
public class AddMachine extends AddObjectPass<Machine> {
|
||||
public AddMachine() {
|
||||
super(Machine.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (super.canStart(args)) {
|
||||
if (target.type.equals(MachineType.Local) && Global.db.machines.LocalMachineExists()) {
|
||||
Log.Writeln_("Локальная машина уже добавлена.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
getDb().Insert(new Compiler(
|
||||
target,
|
||||
"gfortran",
|
||||
CompilerType.gnu,
|
||||
"gfortran",
|
||||
"--version",
|
||||
"--help"
|
||||
));
|
||||
getDb().Insert(new Compiler(
|
||||
target,
|
||||
"gcc",
|
||||
CompilerType.gnu,
|
||||
"gcc",
|
||||
"--version",
|
||||
"--help"
|
||||
));
|
||||
getDb().Insert(new Compiler(
|
||||
target,
|
||||
"g++",
|
||||
CompilerType.gnu,
|
||||
"g++",
|
||||
"--version",
|
||||
"--help"
|
||||
));
|
||||
if (target.type.equals(MachineType.Local))
|
||||
getDb().Insert(new User(target, "этот пользователь", ""));
|
||||
}
|
||||
}
|
||||
30
src/Visual_DVM_2021/Passes/All/AddMakefile.java
Normal file
30
src/Visual_DVM_2021/Passes/All/AddMakefile.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.Makefile.Makefile;
|
||||
import GlobalData.Module.Module;
|
||||
import ProjectData.LanguageName;
|
||||
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||
public class AddMakefile extends AddObjectPass<Makefile> {
|
||||
public AddMakefile() {
|
||||
super(Makefile.class);
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return Machine.class;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
super.body();
|
||||
//создать модули для языков.
|
||||
getDb().Insert(new Module(LanguageName.fortran, target));
|
||||
getDb().Insert(new Module(LanguageName.c, target));
|
||||
getDb().Insert(new Module(LanguageName.cpp, target));
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
20
src/Visual_DVM_2021/Passes/All/AddRunConfiguration.java
Normal file
20
src/Visual_DVM_2021/Passes/All/AddRunConfiguration.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.RunConfiguration.RunConfiguration;
|
||||
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||
public class AddRunConfiguration extends AddObjectPass<RunConfiguration> {
|
||||
public AddRunConfiguration() {
|
||||
super(RunConfiguration.class);
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return Machine.class;
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
24
src/Visual_DVM_2021/Passes/All/AddSapfor.java
Normal file
24
src/Visual_DVM_2021/Passes/All/AddSapfor.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Machine.MachineType;
|
||||
import GlobalData.RemoteSapfor.RemoteSapfor;
|
||||
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||
public class AddSapfor extends AddObjectPass<RemoteSapfor> {
|
||||
public AddSapfor() { super(RemoteSapfor.class); }
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.Machine)){
|
||||
if (Current.getMachine().type.equals(MachineType.Server)){
|
||||
target = d.newInstance();
|
||||
return fillObjectFields();
|
||||
}else Log.Writeln_("Тестирование SAPFOR поддерживается только на удаленном одиночном сервере.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
38
src/Visual_DVM_2021/Passes/All/AddSubscriber.java
Normal file
38
src/Visual_DVM_2021/Passes/All/AddSubscriber.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Repository.Subscribes.Subscriber;
|
||||
import Visual_DVM_2021.Passes.ComponentsRepositoryPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class AddSubscriber extends ComponentsRepositoryPass<Subscriber> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/RedAdd.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = new Subscriber();
|
||||
return fillObjectFields();
|
||||
}
|
||||
protected boolean fillObjectFields() throws Exception {
|
||||
return server.db.subscribers.ShowAddObjectDialog(target);
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.PublishObject, "", target));
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
super.performFinish();
|
||||
passes.get(PassCode_2021.SynchronizeBugReports).Do();
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
super.showDone();
|
||||
server.db.subscribers.ui_.Show(target.getPK());
|
||||
}
|
||||
}
|
||||
34
src/Visual_DVM_2021/Passes/All/AddUser.java
Normal file
34
src/Visual_DVM_2021/Passes/All/AddUser.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.Machine.MachineType;
|
||||
import GlobalData.User.User;
|
||||
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||
public class AddUser extends AddObjectPass<User> {
|
||||
public AddUser() {
|
||||
super(User.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return Machine.class;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (super.canStart(args)) {
|
||||
Machine machine = Current.getMachine();
|
||||
if (machine.type.equals(MachineType.Local) && (machine.getUsers().size() > 0)) {
|
||||
Log.Writeln_("У локальной машины может быть только один пользователь");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import TestingSystem.Sapfor.SapforTask.SapforTask_2023;
|
||||
import TestingSystem.Sapfor.ScenarioResults_json;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
public class AnalyseSapforPackageResults extends Pass_2021<ScenarioResults_json> {
|
||||
File packageWorkspace;
|
||||
File scenarioFile;
|
||||
//--
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
//--
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
//--
|
||||
packageWorkspace = new File((String) args[0]);
|
||||
scenarioFile = new File(packageWorkspace, "results.txt");
|
||||
//--
|
||||
String packed = FileUtils.readFileToString(scenarioFile, Charset.defaultCharset());
|
||||
target = Utils.gson.fromJson(packed, ScenarioResults_json.class);
|
||||
//---
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (SapforTask_2023 task: target.tasks) {
|
||||
task.id=Global.db.IncSapforMaxTaskId();
|
||||
Global.db.Insert(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
src/Visual_DVM_2021/Passes/All/AppendBugReportComment.java
Normal file
19
src/Visual_DVM_2021/Passes/All/AppendBugReportComment.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
public class AppendBugReportComment extends AppendBugReportField {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart("comment",
|
||||
UI.getMainWindow().getCallbackWindow().getBugReportCommentAdditionText());
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
UI.getMainWindow().getCallbackWindow().ClearBugReportCommentAdditionText();
|
||||
}
|
||||
@Override
|
||||
protected boolean canUpdate() {
|
||||
return Current.getAccount().ExtendedCheckAccessRights(target, Log);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.UI.UI;
|
||||
public class AppendBugReportDescription extends AppendBugReportField {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart("description",
|
||||
UI.getMainWindow().getCallbackWindow().getBugReportDescriptionAdditionText());
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
UI.getMainWindow().getCallbackWindow().ClearBugReportDescriptionAdditionText();
|
||||
}
|
||||
}
|
||||
93
src/Visual_DVM_2021/Passes/All/AppendBugReportField.java
Normal file
93
src/Visual_DVM_2021/Passes/All/AppendBugReportField.java
Normal file
@@ -0,0 +1,93 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.BugReport.BugReport;
|
||||
import Repository.BugReport.BugReportInterface;
|
||||
import Repository.EmailMessage;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Visual_DVM_2021.Passes.ComponentsRepositoryPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.util.Date;
|
||||
public class AppendBugReportField extends ComponentsRepositoryPass<BugReport> {
|
||||
String fieldName;
|
||||
String oldValue;
|
||||
String addition;
|
||||
String newValue;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Append.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
protected boolean canUpdate() {
|
||||
return Current.getAccount().CheckAccessRights(target.sender_address, Log);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.BugReport)) {
|
||||
target = Current.getBugReport();
|
||||
if (!BugReportInterface.CheckNotDraft(target,Log))
|
||||
return false;
|
||||
fieldName = (String) args[0];
|
||||
addition = (String) args[1];
|
||||
if (addition.isEmpty()) {
|
||||
Log.Writeln_("Дополнение не может быть пустым.");
|
||||
return false;
|
||||
}
|
||||
return canUpdate();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.GetObjectCopyByPK, "", new Pair<>(BugReport.class, target.id)));
|
||||
target.SynchronizeFields((BugReport) response.object);
|
||||
oldValue = (String) BugReport.class.getField(fieldName).get(target);
|
||||
newValue = oldValue + "\n" + Utils.Brackets(Utils.print_date(
|
||||
new Date())) + " " + Current.getAccount().name
|
||||
+ " : " + addition;
|
||||
//2. дописываем нужное поле.
|
||||
BugReport.class.getField(fieldName).set(target, newValue);
|
||||
//обновляем дату.
|
||||
target.change_date = new Date().getTime();
|
||||
server.db.Update(target);
|
||||
//3. отправляем на сервер
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.UpdateBugReportField, fieldName, target));
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
server.db.bugReports.RefreshUI();
|
||||
UI.getMainWindow().getCallbackWindow().ShowCurrentBugReport();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
String message_header = BugReportInterface.getMailTitlePrefix(target);
|
||||
String message_text = "";
|
||||
switch (fieldName) {
|
||||
default:
|
||||
return;
|
||||
case "description":
|
||||
message_header += "описание дополнено";
|
||||
message_text = target.description
|
||||
;
|
||||
break;
|
||||
case "comment":
|
||||
message_header += "комментарий дополнен";
|
||||
message_text = target.comment;
|
||||
break;
|
||||
}
|
||||
passes.get(PassCode_2021.Email).Do(
|
||||
new EmailMessage(
|
||||
message_header + " " + Utils.Brackets(Current.getAccount().name),
|
||||
message_text,
|
||||
BugReportInterface.getRecipients(target,true)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
57
src/Visual_DVM_2021/Passes/All/ApplyBugReportSettings.java
Normal file
57
src/Visual_DVM_2021/Passes/All/ApplyBugReportSettings.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import GlobalData.Settings.SettingName;
|
||||
import Repository.BugReport.BugReport;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
public class ApplyBugReportSettings extends Pass_2021<BugReport> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Apply.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public boolean needsConfirmations() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
if (Current.Check(Log, Current.BugReport)) {
|
||||
target = Current.getBugReport();
|
||||
long vv = target.visualiser_version;
|
||||
if (vv < 500) {
|
||||
Log.Writeln_("Автоматическое применение настроек поддерживается только в отчётах об ошибках,\n" +
|
||||
"отправленных с версии визуализатора 500 и выше");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
String[] lines = target.sapfor_settings.split("\n");
|
||||
LinkedHashMap<SettingName, String> to_apply = new LinkedHashMap<>();
|
||||
for (int i = 1; i < lines.length; ++i) {
|
||||
SettingName settingName = SettingName.getByDescription(lines[i].substring(4, lines[i].indexOf('=')));
|
||||
String settingValue = lines[i].substring(lines[i].indexOf('=') + 1);
|
||||
if (!settingName.equals(SettingName.Undefined))
|
||||
to_apply.put(settingName, settingValue);
|
||||
}
|
||||
//сохранить текущие настройки как профиль
|
||||
// Global.db.rewriteProfileByDescription("Saved Profile");
|
||||
//--
|
||||
//само применение.
|
||||
for (SettingName settingName : to_apply.keySet())
|
||||
Pass_2021.passes.get(PassCode_2021.UpdateSetting).Do(
|
||||
settingName,
|
||||
to_apply.get(settingName));
|
||||
//сохранить настройки бага как профиль
|
||||
// Global.db.rewriteProfileByDescription(target.id);
|
||||
}
|
||||
}
|
||||
47
src/Visual_DVM_2021/Passes/All/ApplyCurrentFunction.java
Normal file
47
src/Visual_DVM_2021/Passes/All/ApplyCurrentFunction.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Common.UI.Windows.Dialog.Text.ComboTextDialog;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.SapforData.Functions.FuncInfo;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Vector;
|
||||
public class ApplyCurrentFunction extends Pass_2021 {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Apply.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (passes.get(PassCode_2021.SPF_GetGraphFunctions).isDone()) {
|
||||
ComboTextDialog ff = new ComboTextDialog();
|
||||
Vector<String> names = new Vector<>(Current.getProject().allFunctions.keySet());
|
||||
names.sort(Comparator.naturalOrder());
|
||||
if (ff.ShowDialog("Выберите имя текущей процедуры", names)) {
|
||||
String func_name = ff.Result;
|
||||
if (Current.getProject().allFunctions.containsKey(func_name)) {
|
||||
FuncInfo fi = Current.getProject().allFunctions.get(func_name);
|
||||
Current.set(Current.Function, fi);
|
||||
return true;
|
||||
} else {
|
||||
Log.Writeln_("Проект не содержит процедуры с именем " + Utils.Brackets(func_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
UI.getMainWindow().getProjectWindow().getFunctionsWindow().ShowCurrentFunction();
|
||||
if (SPF_GetGraphFunctionPositions.showByCurrentFunction) {
|
||||
Pass_2021.passes.get(PassCode_2021.SPF_GetGraphFunctionPositions).Do();
|
||||
}
|
||||
}
|
||||
}
|
||||
43
src/Visual_DVM_2021/Passes/All/ApplyProfile.java
Normal file
43
src/Visual_DVM_2021/Passes/All/ApplyProfile.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import GlobalData.SapforProfile.SapforProfile;
|
||||
import GlobalData.SapforProfileSetting.SapforProfileSetting;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.util.Vector;
|
||||
public class ApplyProfile extends Pass_2021<SapforProfile> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Apply.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public boolean needsConfirmations() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.SapforProfile)) {
|
||||
target = (SapforProfile) Current.get(Current.SapforProfile);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Vector<SapforProfileSetting> settings = new Vector<>();
|
||||
for (SapforProfileSetting sapforProfileSetting : Global.db.sapforProfilesSettings.Data.values())
|
||||
if (sapforProfileSetting.sapforprofile_id == target.id)
|
||||
settings.add(sapforProfileSetting);
|
||||
//--
|
||||
for (SapforProfileSetting setting : settings)
|
||||
if (Global.db.settings.containsKey(setting.name))
|
||||
passes.get(PassCode_2021.UpdateSetting).Do(setting.name, setting.value);
|
||||
//--
|
||||
}
|
||||
}
|
||||
51
src/Visual_DVM_2021/Passes/All/ArchivesBackupPass.java
Normal file
51
src/Visual_DVM_2021/Passes/All/ArchivesBackupPass.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.RemoteFile.RemoteFile;
|
||||
import GlobalData.User.User;
|
||||
import Visual_DVM_2021.Passes.SSH.ConnectionPass;
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Vector;
|
||||
public class ArchivesBackupPass extends ConnectionPass<File> {
|
||||
File src;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
machine = (Machine) args[0];
|
||||
user = (User) args[1];
|
||||
src = (File) args[2];
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean needsInitialize() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
String workspace_path = Utils.toU(Paths.get(sftpChannel.getHome(),Global.properties.BackupWorkspace).toString());
|
||||
RemoteFile workspace = new RemoteFile(workspace_path, true);
|
||||
tryMKDir(workspace);
|
||||
RemoteFile dst = new RemoteFile(workspace.full_name, src.getName());
|
||||
putSingleFile(src, dst);
|
||||
//-теперь, удалить старые файлы.
|
||||
Vector<ChannelSftp.LsEntry> raw_files = sftpChannel.ls(workspace.full_name);
|
||||
Vector<RemoteFile> files = new Vector<>();
|
||||
for (ChannelSftp.LsEntry file : raw_files) {
|
||||
if (!file.getAttrs().isDir()) {
|
||||
RemoteFile rfile = new RemoteFile(workspace.full_name, file.getFilename(), false);
|
||||
rfile.updateTime = RemoteFile.convertUpdateTime(file.getAttrs().getMTime());
|
||||
files.add(rfile);
|
||||
}
|
||||
}
|
||||
//сортируем по времени обновления. по убыванию.
|
||||
files.sort((o1, o2) -> (int) (o2.updateTime - o1.updateTime));
|
||||
for (int i = 2; i < files.size(); ++i) {
|
||||
System.out.println(files.get(i).full_name + ":" + files.get(i).updateTime);
|
||||
sftpChannel.rm(files.get(i).full_name);
|
||||
}
|
||||
//--------------
|
||||
}
|
||||
}
|
||||
40
src/Visual_DVM_2021/Passes/All/BuildComponent.java
Normal file
40
src/Visual_DVM_2021/Passes/All/BuildComponent.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.Component.Component;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.ProcessPass;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
public class BuildComponent extends ProcessPass<Component> {
|
||||
@Override
|
||||
protected PassCode_2021 necessary() {
|
||||
return PassCode_2021.DownloadRepository;
|
||||
}
|
||||
@Override
|
||||
protected boolean resetsNecessary() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = Current.getComponent();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
Utils.forceDeleteWithCheck(target.getAssemblyFile());
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
ShowMessage1("Сборка " + target.getComponentType().getDescription());
|
||||
PerformScript(target.getAssemblyCommand());
|
||||
if (!target.getAssemblyFile().exists())
|
||||
throw new PassException("Сборка не найдена");
|
||||
Files.copy(target.getAssemblyFile().toPath(),
|
||||
target.getNewFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
if (!target.getNewFile().exists())
|
||||
throw new PassException("Не удалось скопировать сборку для установки");
|
||||
}
|
||||
}
|
||||
33
src/Visual_DVM_2021/Passes/All/CheckAccount.java
Normal file
33
src/Visual_DVM_2021/Passes/All/CheckAccount.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
public class CheckAccount extends Pass_2021 {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Registry.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
if (Current.getAccount().email.equals("?")) {
|
||||
if (Pass_2021.passes.get(PassCode_2021.EditAccount).Do())
|
||||
Pass_2021.passes.get(PassCode_2021.CheckRegistrationOnServer).Do();
|
||||
} else
|
||||
Pass_2021.passes.get(PassCode_2021.CheckRegistrationOnServer).Do();
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
if (UI.getMainWindow() != null) {
|
||||
UI.getMainWindow().getCallbackWindow().ShowAccount();
|
||||
if (Current.HasBugReport())
|
||||
UI.getMainWindow().getCallbackWindow().ShowCurrentBugReport();
|
||||
}
|
||||
if (Current.getAccount().isAdmin())
|
||||
Pass_2021.passes.get(PassCode_2021.PublishComponent).setControlsVisible(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Repository.Subscribes.Subscriber;
|
||||
import Visual_DVM_2021.Passes.ComponentsRepositoryPass;
|
||||
public class CheckRegistrationOnServer extends ComponentsRepositoryPass<Subscriber> {
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.CheckSubscriberRole, "", Current.getAccount()));
|
||||
target = (Subscriber) response.object;
|
||||
Current.getAccount().role = target.role;
|
||||
}
|
||||
}
|
||||
22
src/Visual_DVM_2021/Passes/All/CheckRemoteWorkspace.java
Normal file
22
src/Visual_DVM_2021/Passes/All/CheckRemoteWorkspace.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Repository.SubscriberWorkspace.SubscriberWorkspace;
|
||||
import Visual_DVM_2021.Passes.ComponentsRepositoryPass;
|
||||
public class CheckRemoteWorkspace extends ComponentsRepositoryPass<SubscriberWorkspace> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target=null;
|
||||
return Current.getAccount().CheckRegistered(Log);
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
String email = Current.getAccount().email;
|
||||
String machineURL = Current.getMachine().getURL();
|
||||
String login = Current.getUser().login;
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.CheckURLRegistered,
|
||||
email+"\n"+machineURL+"\n"+login));
|
||||
target = (SubscriberWorkspace) response.object;
|
||||
}
|
||||
}
|
||||
29
src/Visual_DVM_2021/Passes/All/CleanAnalyses.java
Normal file
29
src/Visual_DVM_2021/Passes/All/CleanAnalyses.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Visual_DVM_2021.Passes.CurrentProjectPass;
|
||||
public class CleanAnalyses extends CurrentProjectPass {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart(args) && (Current.getSapfor() != null);
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Current.getSapfor().ResetAllAnalyses();
|
||||
target.CleanAnalyses();
|
||||
target.CreateParserOptionsDirs();
|
||||
target.ClearGCOV();
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
super.showDone();
|
||||
UI.getMainWindow().getProjectWindow().RefreshProjectFiles();
|
||||
UI.getMainWindow().getProjectWindow().ShowNoAnalyses();
|
||||
UI.getMainWindow().getProjectWindow().ShowProjectSapforLog();
|
||||
if (Current.HasFile()) {
|
||||
Current.getFile().form.ShowNoMessages();
|
||||
Current.getFile().form.ShowNoAnalyses();
|
||||
Current.getFile().form.ShowNoGCOVLog();
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/Visual_DVM_2021/Passes/All/CloseBugReport.java
Normal file
16
src/Visual_DVM_2021/Passes/All/CloseBugReport.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Repository.BugReport.BugReportState;
|
||||
public class CloseBugReport extends UpdateBugReportField {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/CloseBugReport.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart("state", BugReportState.closed, "percentage", 100);
|
||||
}
|
||||
}
|
||||
51
src/Visual_DVM_2021/Passes/All/CloseCurrentFile.java
Normal file
51
src/Visual_DVM_2021/Passes/All/CloseCurrentFile.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import javax.swing.*;
|
||||
public class CloseCurrentFile extends Pass_2021<DBProjectFile> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Close.png";
|
||||
}
|
||||
@Override
|
||||
public Icon getTabIcon() {
|
||||
return Utils.getIcon("/icons/Close_18.png");
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return (target = Current.getFile()) != null;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
//действия по закрытию. сохранение и т д.
|
||||
target.form.SaveSplitters();
|
||||
target.UpdateLastLine(target.form.getEditor().getCurrentLine());
|
||||
passes.get(PassCode_2021.Save).Do();
|
||||
UI.getSearchReplaceForm().ClearMarkers();
|
||||
target.form = null;
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Current.set(Current.File, null);
|
||||
Current.set(Current.FileGraphElement, null);
|
||||
//-
|
||||
Current.set(Current.Notes, null);
|
||||
Current.set(Current.Warnings, null);
|
||||
Current.set(Current.Errors, null);
|
||||
//-
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
//отобразить отсутствие файла.
|
||||
UI.getMainWindow().getProjectWindow().ShowNoFile();
|
||||
}
|
||||
}
|
||||
66
src/Visual_DVM_2021/Passes/All/CloseCurrentProject.java
Normal file
66
src/Visual_DVM_2021/Passes/All/CloseCurrentProject.java
Normal file
@@ -0,0 +1,66 @@
|
||||
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 Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
public class CloseCurrentProject extends Pass_2021<db_project_info> {
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Close.png";
|
||||
}
|
||||
@Override
|
||||
public Icon getTabIcon() {
|
||||
return Utils.getIcon("/icons/Close_18.png");
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return (target = Current.getProject()) != null;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
passes.get(PassCode_2021.CloseCurrentFile).Do();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
target.Close();
|
||||
UI.HideSearchForm();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Global.files_multiselection = false;
|
||||
//--
|
||||
Current.getSapfor().ResetAllAnalyses();
|
||||
Current.getSapfor().cd(new File(Global.Home));
|
||||
Current.set(Current.Project, null);
|
||||
Current.set(Current.File, null);
|
||||
Current.set(Current.Function, null);
|
||||
Current.set(Current.SelectedFunction,null);
|
||||
Current.set(Current.ProjectNode, null);
|
||||
Current.set(Current.SelectedFile, null);
|
||||
Current.set(Current.SelectedDirectory, null);
|
||||
//-мб перестраховка. мб и нет.
|
||||
Current.set(Current.ParallelVariant, null);
|
||||
Current.set(Current.Dimensions, null);
|
||||
Current.set(Current.Array, null);
|
||||
Current.set(Current.DBArray, null);
|
||||
//-
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
if (UI.HasNewMainWindow()) {
|
||||
UI.getMainWindow().ShowNoProject();
|
||||
UI.getVersionsWindow().ShowNoProjectVariants();
|
||||
UI.getVersionsWindow().BlockVariants();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/Visual_DVM_2021/Passes/All/CloseProject.java
Normal file
24
src/Visual_DVM_2021/Passes/All/CloseProject.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.io.File;
|
||||
public class CloseProject extends Pass_2021<db_project_info> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return (target = Current.getProject()) != null;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
target.Close();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Current.getSapfor().ResetAllAnalyses();
|
||||
Current.getSapfor().cd(new File(Global.Home));
|
||||
Current.set(Current.Project, null);
|
||||
//-
|
||||
}
|
||||
}
|
||||
101
src/Visual_DVM_2021/Passes/All/CombineFiles.java
Normal file
101
src/Visual_DVM_2021/Passes/All/CombineFiles.java
Normal file
@@ -0,0 +1,101 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.UI.Windows.Dialog.Text.ComboTextDialog;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import Repository.Component.Sapfor.TransformationPermission;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Transformation;
|
||||
import Visual_DVM_2021.UI.Main.CombineFilesDialog;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class CombineFiles extends Transformation {
|
||||
ComboTextDialog fd = null;
|
||||
protected File result = null;
|
||||
@Override
|
||||
protected PassCode_2021 necessary() {
|
||||
return PassCode_2021.SPF_GetIncludeDependencies;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
switch (Global.transformationPermission) {
|
||||
case All:
|
||||
return super.canStart(args) && target.CheckSameStyle(Log) &&
|
||||
(fd = new CombineFilesDialog()).ShowDialog("Выберите имя итогового файла", target.files_order);
|
||||
case VariantsOnly:
|
||||
if (getPermission().equals(TransformationPermission.VariantsOnly)) {
|
||||
return super.canStart(args) && target.CheckSameStyle(Log) && (
|
||||
(fd = new CombineFilesDialog()).ShowDialog("Выберите имя итогового файла", target.files_order)
|
||||
);
|
||||
} else {
|
||||
Log.Writeln_("Разрешено только построение параллельных вариантов!");
|
||||
return false;
|
||||
}
|
||||
case None:
|
||||
Log.Writeln_("Нет разрешения на выполнение преобразований");
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//правила инклудов https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vna1/index.html
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
result = Paths.get(target.last_version.Home.getAbsolutePath(),
|
||||
Global.isWindows ? fd.Result : Utils.toU(fd.Result)).toFile();
|
||||
//-----------------------
|
||||
//получить список хедеров.
|
||||
//-----------------------
|
||||
Vector<String> result_lines = new Vector<>();
|
||||
Vector<String> all_includes = new Vector<>();
|
||||
//-----------------------------
|
||||
result_lines.add("!-Found " + target.allIncludes.size() + " headers");
|
||||
for (String name : target.allIncludes.keySet()) {
|
||||
all_includes.add(" include " + Utils.Quotes(Utils.toU(name)));
|
||||
result_lines.add("! include " + Utils.Quotes(Utils.toU(name)));
|
||||
}
|
||||
result_lines.add("!-Collapse-" + target.files_order.size() + " files");
|
||||
int i = 1;
|
||||
for (String name : target.files_order) {
|
||||
result_lines.add("! -- " + i + ". " + Utils.Brackets(name));
|
||||
++i;
|
||||
}
|
||||
result_lines.add("!--------------------");
|
||||
for (String name : target.files_order) {
|
||||
//если есть инклуды начинаем мучиться.
|
||||
if (target.addictedFiles.containsKey(name)) {
|
||||
DBProjectFile file = target.db.files.Data.get(name);
|
||||
//---------------------------------------------------->>>
|
||||
List<String> file_lines = FileUtils.readLines(file.file);
|
||||
for (String line : file_lines) {
|
||||
String header = Utils.extractHeaderName(line);
|
||||
if (header != null) {
|
||||
if (file.relativeHeaders.containsKey(header))
|
||||
result_lines.add(" include " + Utils.Quotes(
|
||||
Utils.toU(
|
||||
file.relativeHeaders.get(header).name)));
|
||||
} else
|
||||
result_lines.add(line);
|
||||
}
|
||||
} else {
|
||||
//инклудов нет. добавляем все подряд.
|
||||
result_lines.addAll(FileUtils.readLines(target.db.files.Data.get(name).file));
|
||||
}
|
||||
}
|
||||
FileUtils.writeLines(result, result_lines, false);
|
||||
//-------------------------------
|
||||
//теперь скопировать остальные файлы
|
||||
for (String name : target.db.files.Data.keySet()) {
|
||||
if (!target.files_order.contains(name)) {
|
||||
Files.copy(
|
||||
target.db.files.Data.get(name).file.toPath(),
|
||||
Paths.get(target.last_version.Home.getAbsolutePath(), name)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/CompareSapforPackages.java
Normal file
14
src/Visual_DVM_2021/Passes/All/CompareSapforPackages.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.DataSet;
|
||||
import TestingSystem.Sapfor.SapforTask.SapforTaskResult;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
public class CompareSapforPackages extends Pass_2021 {
|
||||
DataSet<String, SapforTaskResult> masterTasks;
|
||||
DataSet<String, SapforTaskResult> slaveTasks;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
masterTasks = (DataSet<String, SapforTaskResult>) args[0];
|
||||
slaveTasks = (DataSet<String, SapforTaskResult>) args[1];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
95
src/Visual_DVM_2021/Passes/All/Compile.java
Normal file
95
src/Visual_DVM_2021/Passes/All/Compile.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Tasks.CompilationTask.CompilationTask;
|
||||
import GlobalData.Tasks.TaskState;
|
||||
import GlobalData.User.UserState;
|
||||
import ProjectData.LanguageName;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
public class Compile extends Pass_2021<db_project_info> {
|
||||
Pass_2021 subpass = null;
|
||||
CompilationTask compilationTask = null;
|
||||
@Override
|
||||
protected PassCode_2021 necessary() {
|
||||
return Current.getProject().languageName.equals(LanguageName.fortran) ? PassCode_2021.SPF_ParseFilesWithOrder : null;
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Start.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
if (Current.Check(Log, Current.Project, Current.Machine, Current.User, Current.Makefile)) {
|
||||
target = Current.getProject();
|
||||
subpass = null;
|
||||
compilationTask = null;
|
||||
if (Current.getUser().state != UserState.ready_to_work)
|
||||
Log.Writeln_("Пользователь " + Utils.Brackets(Current.getUser().login) +
|
||||
" не проинициализирован\nПерейдите на вкладку 'Настройки компиляции и запуска',\n" +
|
||||
" и выполните команду 'Инициализация пользователя'\n");
|
||||
Current.getMakefile().Validate(Log);
|
||||
return Log.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
compilationTask = new CompilationTask();
|
||||
compilationTask.machine_id = Current.getMachine().id;
|
||||
compilationTask.user_id = Current.getUser().id;
|
||||
compilationTask.makefile_id = Current.getMakefile().id;
|
||||
compilationTask.project_path = target.Home.getAbsolutePath();
|
||||
compilationTask.project_description = target.description;
|
||||
//------------------------------------------
|
||||
compilationTask.CompleteSummary(target.compilation_maxtime);
|
||||
compilationTask.state = TaskState.Inactive;
|
||||
Global.db.Insert(compilationTask);
|
||||
Utils.forceDeleteWithCheck(compilationTask.getLocalWorkspace());
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
Global.db.compilationTasks.ShowUI(compilationTask.getPK());
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
|
||||
switch (Current.getMachine().type) {
|
||||
case Local:
|
||||
if (Global.isWindows) {
|
||||
subpass = passes.get(PassCode_2021.WindowsLocalCompilation);
|
||||
} else
|
||||
subpass = passes.get(PassCode_2021.LinuxLocalCompilation);
|
||||
break;
|
||||
case Undefined:
|
||||
throw new PassException("Компиляция не реализована для типа машины " + Utils.DQuotes(Current.getMachine().type));
|
||||
default:
|
||||
subpass = passes.get(PassCode_2021.RemoteCompilation);
|
||||
break;
|
||||
}
|
||||
subpass.Do(Current.getCompilationTask(), Current.getProject());
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return (subpass != null) && subpass.isDone();
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
Global.db.compilationTasks.ShowUI(compilationTask.getPK());
|
||||
UI.getMainWindow().getTestingWindow().ShowLastCompilationTask();
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
protected void showCanNotStart() throws Exception {
|
||||
UI.getNewMainWindow().getTestingWindow().FocusCredentials();
|
||||
}
|
||||
*/
|
||||
}
|
||||
133
src/Visual_DVM_2021/Passes/All/ConvertCorrectnessTests.java
Normal file
133
src/Visual_DVM_2021/Passes/All/ConvertCorrectnessTests.java
Normal file
@@ -0,0 +1,133 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.Group.Group;
|
||||
import TestingSystem.Test.ProjectFiles_json;
|
||||
import TestingSystem.Test.Test;
|
||||
import TestingSystem.TestingServer;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class ConvertCorrectnessTests extends TestingSystemPass<File> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/DownloadAll.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (!Current.getAccount().isAdmin())
|
||||
Log.Writeln_("Вы не являетесь администратором");
|
||||
else return UI.Warning("Загрузить полный пакет DVM тестов на корректность и производительность.");
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
passes.get(PassCode_2021.CloseCurrentProject);
|
||||
Current.set(Current.Root, null);
|
||||
Current.set(Current.Version, null);
|
||||
if (TestingServer.checkTasks)
|
||||
TestingServer.TimerOff();
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
UI.getMainWindow().getTestingWindow().ShowAutoActualizeTestsState();
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.RefreshDVMTests));
|
||||
Vector<Group> groups = (Vector<Group>) response.object;
|
||||
System.out.println("найдено " + groups.size() + " групп");
|
||||
Test test = null;
|
||||
Vector<Test> tests = null;
|
||||
for (Group group : groups) {
|
||||
ShowMessage1("Создание группы " + group.description);
|
||||
tests = new Vector<>();
|
||||
group.genName();
|
||||
group.sender_name = Current.getAccount().name;
|
||||
group.sender_address = Current.getAccount().email;
|
||||
//->>
|
||||
//->>
|
||||
for (String testFileName : group.testsFiles.keySet()) {
|
||||
ShowMessage2("Создание теста " + testFileName);
|
||||
test = new Test();
|
||||
test.genName();
|
||||
test.description = Utils.getNameWithoutExtension(testFileName) + "_" + group.language.getDVMCompile();
|
||||
test.date = new Date().getTime();
|
||||
test.sender_name = Current.getAccount().name;
|
||||
test.sender_address = Current.getAccount().email;
|
||||
test.group_id = group.id;
|
||||
//->>
|
||||
File testProject = Paths.get(Global.TempDirectory.getAbsolutePath(), test.id).toFile();
|
||||
Utils.forceDeleteWithCheck(testProject);
|
||||
FileUtils.forceMkdir(testProject);
|
||||
File testFile = Paths.get(testProject.getAbsolutePath(), testFileName).toFile();
|
||||
Utils.unpackFile(group.testsFiles.get(testFileName), testFile);
|
||||
//----
|
||||
ProjectFiles_json projectFiles_json = new ProjectFiles_json();
|
||||
//----
|
||||
DBProjectFile testDBProjectFile = new DBProjectFile();
|
||||
testDBProjectFile.name = testFile.getName();
|
||||
testDBProjectFile.file = testFile;
|
||||
testDBProjectFile.AutoDetectProperties();
|
||||
//---
|
||||
projectFiles_json.files.add(testDBProjectFile);
|
||||
//---
|
||||
test.files_json = Utils.jsonToPrettyFormat(Utils.gson.toJson(projectFiles_json));
|
||||
//->
|
||||
//без создания бд!!
|
||||
db_project_info vizTestProject = new db_project_info(testProject, "", false);
|
||||
switch (group.language) {
|
||||
case fortran:
|
||||
test.dim = Current.getSapfor().getTextMaxDim(testFile, vizTestProject);
|
||||
break;
|
||||
case c:
|
||||
test.dim = Utils.getCTestMaxDim(testFile);
|
||||
break;
|
||||
}
|
||||
//-
|
||||
//архивация.
|
||||
File archive = Utils.getTempFileName("test_archive");
|
||||
if (passes.get(PassCode_2021.ZipFolderPass).Do(vizTestProject.Home.getAbsolutePath(), archive.getAbsolutePath())) {
|
||||
test.project_archive_bytes = Utils.packFile(archive);
|
||||
if (test.dim >= 0)
|
||||
tests.add(test);
|
||||
else UI.Info("для теста " + testFileName + " не удалось определить размерность");
|
||||
} else throw new PassException("Не удалось заархивировать тест");
|
||||
}
|
||||
//->>
|
||||
if (!tests.isEmpty()) {
|
||||
ShowMessage1("Публикация группы " + group.description);
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.PublishObject, "", group));
|
||||
for (Test test1 : tests) {
|
||||
ShowMessage2("Публикация теста " + test1.description);
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.PublishObject, "", test1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
super.performFinish();
|
||||
passes.get(PassCode_2021.SynchronizeTests).Do();
|
||||
}
|
||||
}
|
||||
7
src/Visual_DVM_2021/Passes/All/CopyConfigurations.java
Normal file
7
src/Visual_DVM_2021/Passes/All/CopyConfigurations.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import TestingSystem.Configuration.Configuration;
|
||||
public class CopyConfigurations extends CopyServerObjects{
|
||||
public CopyConfigurations() {
|
||||
super(Configuration.class);
|
||||
}
|
||||
}
|
||||
7
src/Visual_DVM_2021/Passes/All/CopyGroups.java
Normal file
7
src/Visual_DVM_2021/Passes/All/CopyGroups.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import TestingSystem.Group.Group;
|
||||
public class CopyGroups extends CopyServerObjects{
|
||||
public CopyGroups() {
|
||||
super(Group.class);
|
||||
}
|
||||
}
|
||||
69
src/Visual_DVM_2021/Passes/All/CopyProject.java
Normal file
69
src/Visual_DVM_2021/Passes/All/CopyProject.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.UI.Windows.Dialog.Dialog;
|
||||
import Common.Utils.Utils;
|
||||
import Visual_DVM_2021.Passes.CurrentProjectPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.UI.CopyProjectFields;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class CopyProject extends CurrentProjectPass {
|
||||
protected File dstFile = null;
|
||||
protected boolean migrateData = false;
|
||||
@Override
|
||||
protected boolean hasStats() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (super.canStart(args)) {
|
||||
Dialog<Object, CopyProjectFields> dialog = new Dialog<Object, CopyProjectFields>(CopyProjectFields.class) {
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 230;
|
||||
}
|
||||
@Override
|
||||
public void Init(Object... params) {
|
||||
fields.tfParent.setText(Global.visualiser.getWorkspace().getAbsolutePath());
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
Utils.validateFileShortNewName(fields.tfName.getText(), Log);
|
||||
if (!fields.tfParent.getText().isEmpty()) {
|
||||
if (Utils.ContainsCyrillic(fields.tfParent.getText()))
|
||||
Log.Writeln_("Путь к целевой папке не может содержать кириллицу!");
|
||||
} else Log.Writeln_("Путь к целевой папке не может быть пустым!");
|
||||
if (Log.isEmpty()) {
|
||||
dstFile = Paths.get(fields.tfParent.getText(), fields.tfName.getText()).toFile();
|
||||
if (dstFile.exists())
|
||||
Log.Writeln_("Файл " + dstFile.getAbsolutePath() + " уже существует!");
|
||||
}
|
||||
}
|
||||
};
|
||||
if (dialog.ShowDialog(getDescription())) {
|
||||
migrateData = dialog.fields.MigrateData.isSelected();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Transformations/CopyProject.png";
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
FileUtils.forceMkdir(dstFile);
|
||||
target.Clone(dstFile, migrateData);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
if (UI.Question("копия текущего проекта успешно создана по адресу\n" + dstFile.getAbsolutePath() + "\nОткрыть её")) {
|
||||
passes.get(PassCode_2021.CloseCurrentProject).Do();
|
||||
passes.get(PassCode_2021.OpenCurrentProject).Do(dstFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
59
src/Visual_DVM_2021/Passes/All/CopyServerObjects.java
Normal file
59
src/Visual_DVM_2021/Passes/All/CopyServerObjects.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Database.DataSet;
|
||||
import Common.Database.rDBObject;
|
||||
import Common.UI.UI;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
|
||||
import java.util.Vector;
|
||||
public class CopyServerObjects extends TestingSystemPass<Vector<DBObject>> {
|
||||
@Override
|
||||
protected int getTimeout() {
|
||||
return 400000;
|
||||
}
|
||||
Class objects_class;
|
||||
Vector<String> names;
|
||||
public CopyServerObjects(Class class_in) {
|
||||
objects_class = class_in;
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Editor/Copy.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.getAccount().CheckRegistered(Log)) {
|
||||
DataSet table = server.db.tables.get(objects_class);
|
||||
if (table.getCheckedCount() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одного объекта.");
|
||||
return false;
|
||||
}
|
||||
Vector checkedItems = table.getCheckedItems();
|
||||
target = new Vector<>();
|
||||
names = new Vector<>();
|
||||
for (Object o : checkedItems) {
|
||||
rDBObject r = (rDBObject) o;
|
||||
names.add(r.description);
|
||||
target.add(r);
|
||||
}
|
||||
return UI.Warning(getDescription() + "\n" + String.join("\n", names));
|
||||
} else return false;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.CopyObjects, Current.getAccount().name + "\n" + Current.getAccount().email, target));
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
super.performFinish();
|
||||
passes.get(PassCode_2021.SynchronizeTests).Do();
|
||||
}
|
||||
}
|
||||
13
src/Visual_DVM_2021/Passes/All/CreateComponentBackUp.java
Normal file
13
src/Visual_DVM_2021/Passes/All/CreateComponentBackUp.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Visual_DVM_2021.Passes.CurrentComponentPass;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
public class CreateComponentBackUp extends CurrentComponentPass {
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
//form.ShowMessage2("копирование предыдущей версии...");
|
||||
if (target.getFile().exists())
|
||||
Files.copy(target.getFile().toPath(), target.getBackUpFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
}
|
||||
41
src/Visual_DVM_2021/Passes/All/CreateEmptyDirectory.java
Normal file
41
src/Visual_DVM_2021/Passes/All/CreateEmptyDirectory.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Common.UI.Windows.Dialog.Text.FileNameForm;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Visual_DVM_2021.Passes.ChangeFilePass;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class CreateEmptyDirectory extends ChangeFilePass {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
resetArgs();
|
||||
if ((ff = new FileNameForm()).ShowDialog("Введите имя создаваемой папки")) {
|
||||
fileName = ff.Result;
|
||||
//->
|
||||
parent_node = Current.getProjectCurrentParentNode();
|
||||
target_dir = (File) parent_node.getUserObject();
|
||||
//->
|
||||
dst = Paths.get(target_dir.getAbsolutePath(), fileName).toFile();
|
||||
if (dst.exists()) {
|
||||
Log.Writeln("Файл с именем " + Utils.Brackets(fileName) + " уже существует");
|
||||
return false;
|
||||
}
|
||||
if (fileName.equalsIgnoreCase(db_project_info.data)) {
|
||||
Log.Writeln(Utils.Brackets(db_project_info.data) + " является зарезервированным именем!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
if (!dst.mkdir()) throw new PassException("Не удалось создать папку.");
|
||||
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().AddNode(parent_node, dst_node = new DefaultMutableTreeNode(dst));
|
||||
}
|
||||
}
|
||||
46
src/Visual_DVM_2021/Passes/All/CreateEmptyProject.java
Normal file
46
src/Visual_DVM_2021/Passes/All/CreateEmptyProject.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.UI.Windows.Dialog.Text.FileNameForm;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class CreateEmptyProject extends Pass_2021<File> {
|
||||
String project_name;
|
||||
FileNameForm ff = new FileNameForm();
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/CreateProject.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
project_name = "";
|
||||
target = null;
|
||||
if (ff.ShowDialog("Укажите имя создаваемого проекта", "NewProject")) {
|
||||
project_name = ff.Result;
|
||||
target = Paths.get(Global.visualiser.getWorkspace().getAbsolutePath(), project_name).toFile();
|
||||
if (target.exists())
|
||||
Log.Writeln("Файл\n" + Utils.Brackets(target.getAbsolutePath()) + "\nуже существует");
|
||||
return Log.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
File data = new File(target, db_project_info.data);
|
||||
if (!(target.mkdir()&&data.mkdir()))
|
||||
throw new PassException("Не удалось создать проект.");
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
passes.get(PassCode_2021.OpenCurrentProject).Do(target);
|
||||
}
|
||||
}
|
||||
28
src/Visual_DVM_2021/Passes/All/CreateParallelVariants.java
Normal file
28
src/Visual_DVM_2021/Passes/All/CreateParallelVariants.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.UI.UI;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.VariantsMassPass;
|
||||
public class CreateParallelVariants extends VariantsMassPass {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Create.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public PassCode_2021 getSubPassCode() {
|
||||
return PassCode_2021.SPF_CreateParallelVariant;
|
||||
}
|
||||
@Override
|
||||
protected void FocusResult() {
|
||||
UI.getMainWindow().getProjectWindow().FocusVersions();
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
db_project_info.ResetNewVersions();
|
||||
super.performPreparation();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import ProjectData.SapforData.Variants.ParallelVariant;
|
||||
import Repository.Component.Sapfor.Sapfor;
|
||||
import Visual_DVM_2021.Passes.CurrentProjectPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class CreateParallelVariantsCoverageForScenario extends CurrentProjectPass {
|
||||
@Override
|
||||
public void Interrupt() throws Exception {
|
||||
Current.getSapfor().Interrupt();
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
}
|
||||
@Override
|
||||
protected PassCode_2021 necessary() {
|
||||
return PassCode_2021.SPF_GetArrayDistribution;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (super.canStart(args)) {
|
||||
target.gen_variants_coverage();
|
||||
if (target.parallelVariants.size() == 0) {
|
||||
Log.Writeln_("Покрытие вариантов пусто");
|
||||
return false;
|
||||
} else if (!passes.get(PassCode_2021.SPF_GetArrayDistribution).isDone()) {
|
||||
Log.Writeln_("Варианты неактуальны. Сначала перестройте распределение данных.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
protected void body() throws Exception {
|
||||
for (ParallelVariant p : target.parallelVariants.Data.values())
|
||||
if (!passes.get(PassCode_2021.SPF_CreateParallelVariant).Do(p)) break;
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
//распаковку соо делаем только 1 раз. после всей массы вариантов.
|
||||
Sapfor sapfor = Current.getSapfor();
|
||||
target.unpackMessagesAndLog(sapfor.getOutputMessage(), sapfor.getOutput());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
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.Group.Group;
|
||||
import TestingSystem.Test.Test;
|
||||
import TestingSystem.Test.TestType;
|
||||
import TestingSystem.TestingServer;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.util.Vector;
|
||||
public class CreateTestsGroupFromSelectedVersions extends Pass_2021<Vector<db_project_info>> {
|
||||
Group group;
|
||||
Test test;
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/DownloadAll.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (!Current.getAccount().CheckRegistered(Log))
|
||||
return false;
|
||||
if (!Global.versions_multiselection) {
|
||||
Log.Writeln_("Нажмите правую клавишу мыши, и перейдите в режим выбора версий.");
|
||||
return false;
|
||||
}
|
||||
target = new Vector<>();
|
||||
group = null;
|
||||
test = null;
|
||||
Current.getRoot().getSelectedVersions(target);
|
||||
if (target.size() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одной версии.");
|
||||
return false;
|
||||
}
|
||||
if (Current.getProject().hasSubdirectories()) {
|
||||
Log.Writeln_("Запрещено добавлять тестовые проекты, содержащие подпапки!");
|
||||
return false;
|
||||
}
|
||||
String cp_info = "";
|
||||
if (Current.HasProject()) {
|
||||
for (db_project_info version : target) {
|
||||
if (version.Home.getAbsolutePath().equals(Current.getProject().Home.getAbsolutePath())) {
|
||||
cp_info = "Текущий проект будет закрыт.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return UI.Question("Будет сформирована группа из " + target.size() + " тестов.\n" + cp_info +
|
||||
"\nПродолжить");
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (TestingServer.checkTasks)
|
||||
TestingServer.TimerOff();
|
||||
passes.get(PassCode_2021.CloseCurrentProject).Do();
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
UI.getMainWindow().getTestingWindow().ShowAutoActualizeTestsState();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
PublishGroup publishGroup = new PublishGroup() {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Добавление группы";
|
||||
}
|
||||
@Override
|
||||
protected boolean fillObjectFields() throws Exception {
|
||||
//тут имя надо генерить, потому что может совпасть.
|
||||
target.description = Utils.getDateName(Current.getRoot().name);
|
||||
target.type = TestType.Default;
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
ShowMessage1("Публикация группы ");
|
||||
if (publishGroup.Do()) {
|
||||
group = publishGroup.target;
|
||||
for (db_project_info vizTestProject : target) {
|
||||
//на случай если версия в текущем сеансе еще не открывалась.
|
||||
vizTestProject.Open();
|
||||
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;
|
||||
}
|
||||
@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;
|
||||
}
|
||||
if (passes.get(PassCode_2021.SynchronizeTests).Do()) {
|
||||
if (group != null) Global.testingServer.db.groups.ui_.Show(group.getPK());
|
||||
if (test != null) Global.testingServer.db.tests.ui_.Show(test.getPK());
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void FocusResult() {
|
||||
UI.getMainWindow().FocusTesting();
|
||||
UI.getMainWindow().getTestingWindow().FocusTestingSystem();
|
||||
}
|
||||
}
|
||||
154
src/Visual_DVM_2021/Passes/All/DVMConvertProject.java
Normal file
154
src/Visual_DVM_2021/Passes/All/DVMConvertProject.java
Normal file
@@ -0,0 +1,154 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.Menus_2023.PassMenuItem;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Settings.SettingName;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Visual_DVM_2021.Passes.ComponentsRepositoryPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class DVMConvertProject extends ComponentsRepositoryPass<db_project_info> {
|
||||
File workspace = null;
|
||||
File archive = null;
|
||||
Vector<DBProjectFile> programsToConvert = null;
|
||||
Vector<String> programsNames = null;
|
||||
String output = null;
|
||||
File versionArchive = null;
|
||||
File version = null;
|
||||
String badFiles = "";
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
programsToConvert = null;
|
||||
programsNames = null;
|
||||
output = "";
|
||||
workspace = null;
|
||||
archive = null;
|
||||
versionArchive = null;
|
||||
version = null;
|
||||
badFiles = "";
|
||||
//--
|
||||
if (Current.Check(Log, Current.Project)) {
|
||||
target = Current.getProject();
|
||||
programsToConvert = target.getPrograms().get(target.languageName);
|
||||
programsNames = new Vector<>();
|
||||
if (programsToConvert.size() > 100) {
|
||||
Log.Writeln_("Количество активных файлов кода на языке " + target.languageName + " в проекте превышает 100.");
|
||||
return false;
|
||||
}
|
||||
for (DBProjectFile program : programsToConvert) {
|
||||
if (Utils.getFileSizeMegaBytes(program.file) > 1) {
|
||||
Log.Writeln_("Размер файла кода " + Utils.Brackets(program.name) + " превышает 1 Мб.");
|
||||
return false;
|
||||
} else programsNames.add(Utils.toU(program.name));
|
||||
}
|
||||
workspace = Utils.getTempFileName("convertation");
|
||||
FileUtils.forceMkdir(workspace);
|
||||
File cleanCopy = Paths.get(workspace.getAbsolutePath(), target.name).toFile();
|
||||
FileUtils.forceMkdir(cleanCopy);
|
||||
archive = Paths.get(workspace.getAbsolutePath(), target.name + ".zip").toFile();
|
||||
target.Clone(cleanCopy, false);
|
||||
if (!passes.get(PassCode_2021.ZipFolderPass).Do(cleanCopy.getAbsolutePath(), archive.getAbsolutePath())) {
|
||||
Log.Writeln_("Не удалось создать архив проекта!");
|
||||
return false;
|
||||
}
|
||||
;
|
||||
if (Utils.getFileSizeMegaBytes(archive) > 500) {
|
||||
Log.Writeln_("Размер архива проекта превышает 500 МБ");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
super.performPreparation();
|
||||
db_project_info.ResetNewVersions();
|
||||
}
|
||||
//-
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Transformations/" + code().toString() + ".png";
|
||||
}
|
||||
@Override
|
||||
protected boolean hasStats() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected int getTimeout() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
ServerExchangeUnit_2021 unit = new ServerExchangeUnit_2021(ServerCode.DVMConvertProject);
|
||||
unit.object = Utils.packFile(archive);
|
||||
Vector<String> unit_args = new Vector<>();
|
||||
unit_args.add(target.name);
|
||||
unit_args.add(target.languageName.toString());
|
||||
unit_args.add(Global.db.settings.get(SettingName.DVMConvertationOptions).toString());
|
||||
unit_args.addAll(programsNames);
|
||||
unit.arg = String.join("\n", unit_args);
|
||||
Command(unit);
|
||||
output = response.arg;
|
||||
versionArchive = new File(workspace, target.name + "_result.zip");
|
||||
response.Unpack(versionArchive);
|
||||
File result = new File(workspace, "result");
|
||||
if (passes.get(PassCode_2021.UnzipFolderPass).Do(versionArchive.getAbsolutePath(), result.getAbsolutePath())) {
|
||||
if (target.last_modification == null) {
|
||||
target.last_modification = new db_project_info(target,
|
||||
"m",
|
||||
"копия от " + new Date(),
|
||||
"");
|
||||
target.last_modification.CloneParent();
|
||||
}
|
||||
File resultProject = new File(result, target.name);
|
||||
String versionName = target.GenerateVersionName("v");
|
||||
version = new File(target.Home, versionName);
|
||||
FileUtils.moveDirectory(resultProject, version);
|
||||
if (!version.exists()) Log.Writeln_("Не удалось перенести результат");
|
||||
} else Log.Writeln_("Не удалось распаковать результат");
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
super.performFinish();
|
||||
String[] data = output.split("\\|");
|
||||
if (data.length > 1) {
|
||||
badFiles = "Не удалось сконвертировать " + data[0].split("\n").length + " файлов:\n" + data[0];
|
||||
target.updateCompilationOut(data[1]);
|
||||
} else
|
||||
target.updateCompilationOut(output);
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
UI.getMainWindow().getProjectWindow().RefreshProjectTreeAndMessages();
|
||||
if (Current.HasFile()) {
|
||||
Current.getFile().form.ShowCompilationOutput();
|
||||
if (!output.isEmpty())
|
||||
Current.getFile().form.FocusCompilationOut();
|
||||
}
|
||||
if (!badFiles.isEmpty())
|
||||
UI.Error(badFiles);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
target.joinExistingVersion(version, getDescription());
|
||||
target.migrateFilesSettings(target.last_version, false, false, false);
|
||||
}
|
||||
@Override
|
||||
public JMenuItem createMenuItem() {
|
||||
if (menuItem == null)
|
||||
menuItem = new PassMenuItem(this);
|
||||
return menuItem;
|
||||
}
|
||||
}
|
||||
25
src/Visual_DVM_2021/Passes/All/DeleteBugReport.java
Normal file
25
src/Visual_DVM_2021/Passes/All/DeleteBugReport.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import Repository.BugReport.BugReport;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class DeleteBugReport extends DeleteObjectPass<BugReport> {
|
||||
public DeleteBugReport() {
|
||||
super(BugReport.class);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart(args) && Current.getAccount().CheckAccessRights(target.sender_address, Log);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
passes.get(PassCode_2021.DeleteBugReportFromServer).Do(target);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.componentsServer.db;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Repository.BugReport.BugReport;
|
||||
import Repository.BugReport.BugReportState;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Visual_DVM_2021.Passes.ComponentsRepositoryPass;
|
||||
public class DeleteBugReportFromServer extends ComponentsRepositoryPass<BugReport> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
target = (BugReport) args[0];
|
||||
return !target.state.equals(BugReportState.draft);
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DeleteObject,"", target));
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/DeleteCompiler.java
Normal file
14
src/Visual_DVM_2021/Passes/All/DeleteCompiler.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Compiler.Compiler;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
public class DeleteCompiler extends DeleteObjectPass<Compiler> {
|
||||
public DeleteCompiler() {
|
||||
super(Compiler.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/DeleteDVMParameter.java
Normal file
14
src/Visual_DVM_2021/Passes/All/DeleteDVMParameter.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.DVMParameter.DVMParameter;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
public class DeleteDVMParameter extends DeleteObjectPass<DVMParameter> {
|
||||
public DeleteDVMParameter() {
|
||||
super(DVMParameter.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
29
src/Visual_DVM_2021/Passes/All/DeleteDebugResults.java
Normal file
29
src/Visual_DVM_2021/Passes/All/DeleteDebugResults.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Tasks.Task;
|
||||
import Visual_DVM_2021.Passes.CurrentProjectPass;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
public class DeleteDebugResults extends CurrentProjectPass {
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
Global.db.compilationTasks.ClearUI();
|
||||
Global.db.runTasks.ClearUI();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Vector<Task> toDelete = Global.db.compilationTasks.Data.values().stream().filter(task -> task.belongsToProject(target)).collect(Collectors.toCollection(Vector::new));
|
||||
Global.db.runTasks.Data.values().stream().filter(task -> task.belongsToProject(target)).forEach(toDelete::add);
|
||||
for (Task task : toDelete) {
|
||||
Utils.forceDeleteWithCheck(task.getLocalWorkspace());
|
||||
Global.db.Delete(task);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
Global.db.compilationTasks.ShowUI();
|
||||
Global.db.runTasks.ShowUI();
|
||||
}
|
||||
}
|
||||
59
src/Visual_DVM_2021/Passes/All/DeleteDirectory.java
Normal file
59
src/Visual_DVM_2021/Passes/All/DeleteDirectory.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import Visual_DVM_2021.Passes.ChangeFilePass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public class DeleteDirectory extends ChangeFilePass {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
resetArgs();
|
||||
dst_node = Current.getProjectNode();
|
||||
if ((dst_node != null) && (dst_node.getUserObject() instanceof File)) {
|
||||
target_dir = Current.getSelectedDirectory();
|
||||
if (target_dir.equals(project.Home)) {
|
||||
Log.Writeln("Нельзя удалять домашнюю папку проекта.");
|
||||
return false;
|
||||
}
|
||||
return (UI.Warning("Удалить папку\n" + Utils.Brackets(target_dir.getAbsolutePath())
|
||||
+ "\n и всё её содержимое."));
|
||||
} else Log.Writeln_("Папка не выделена.");
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (Current.HasFile() && (Utils.isAnchestor(Current.getFile().file, target_dir)))
|
||||
passes.get(PassCode_2021.CloseCurrentFile).Do();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
FileUtils.deleteDirectory(target_dir);
|
||||
if (target_dir.exists()) throw new PassException("Не удалось удалить папку");
|
||||
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RemoveNode(dst_node);
|
||||
Vector<DBProjectFile> to_delete = new Vector<>();
|
||||
for (DBProjectFile file : project.db.files.Data.values()) {
|
||||
if (Utils.isAnchestor(file.file, target_dir))
|
||||
to_delete.add(file);
|
||||
}
|
||||
//так как имя первичный ключ приходится удалять их из бд проекта.
|
||||
for (DBProjectFile file : to_delete) {
|
||||
file.CleanAll();
|
||||
file.father.db.Delete(file);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Current.set(Current.SelectedDirectory, null);
|
||||
Current.set(Current.ProjectNode, null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Settings.SettingName;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
public class DeleteDownloadedBugReports extends Pass_2021<Vector<File>> {
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean needsConfirmations() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = null;
|
||||
File workspace = new File(Global.db.settings.get(SettingName.Workspace).toString());
|
||||
File[] files = workspace.listFiles(pathname -> pathname.isDirectory() && pathname.getName().toLowerCase().startsWith("bugreport_"));
|
||||
if (files != null) {
|
||||
target = new Vector<>(Arrays.asList(files));
|
||||
return UI.Warning("Будет удалено " + target.size() + " скачанных отчётов об ошибках." +
|
||||
(Current.HasProject() ? "(Текущий проект будет закрыт)" : "")
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (Current.HasProject())
|
||||
passes.get(PassCode_2021.CloseCurrentProject).Do();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (File file : target) {
|
||||
ShowMessage1(file.getAbsolutePath());
|
||||
Utils.forceDeleteWithCheck(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/DeleteEnvironmentValue.java
Normal file
14
src/Visual_DVM_2021/Passes/All/DeleteEnvironmentValue.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.EnvironmentValue.EnvironmentValue;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
public class DeleteEnvironmentValue extends DeleteObjectPass<EnvironmentValue> {
|
||||
public DeleteEnvironmentValue() {
|
||||
super(EnvironmentValue.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
36
src/Visual_DVM_2021/Passes/All/DeleteFile.java
Normal file
36
src/Visual_DVM_2021/Passes/All/DeleteFile.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import Visual_DVM_2021.Passes.ChangeFilePass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class DeleteFile extends ChangeFilePass<DBProjectFile> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
resetArgs();
|
||||
return (Current.Check(Log, Current.SelectedFile)) &&
|
||||
UI.Warning("Удалить файл "
|
||||
+ Utils.Brackets((target = Current.getSelectedFile()).name));
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (Current.HasFile() && (Current.getFile().file.equals(target.file)))
|
||||
passes.get(PassCode_2021.CloseCurrentFile).Do();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RemoveNode(target.node);
|
||||
project.db.Delete(target);
|
||||
Utils.forceDeleteWithCheck(target.file);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Current.set(Current.SelectedFile, null);
|
||||
Current.set(Current.ProjectNode, null);
|
||||
}
|
||||
}
|
||||
25
src/Visual_DVM_2021/Passes/All/DeleteLonelyM.java
Normal file
25
src/Visual_DVM_2021/Passes/All/DeleteLonelyM.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DeleteLonelyM extends Pass_2021<db_project_info> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.Root)) {
|
||||
target = Current.getRoot();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Vector<db_project_info> targets = target.getLonelyM();
|
||||
System.out.println(targets.size());
|
||||
for (db_project_info m : targets) {
|
||||
passes.get(PassCode_2021.DeleteVersion).Do(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/DeleteMachine.java
Normal file
14
src/Visual_DVM_2021/Passes/All/DeleteMachine.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Machine.Machine;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
public class DeleteMachine extends DeleteObjectPass<Machine> {
|
||||
public DeleteMachine() {
|
||||
super(Machine.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/DeleteMakefile.java
Normal file
14
src/Visual_DVM_2021/Passes/All/DeleteMakefile.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Makefile.Makefile;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
public class DeleteMakefile extends DeleteObjectPass<Makefile> {
|
||||
public DeleteMakefile() {
|
||||
super(Makefile.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/DeleteProfile.java
Normal file
14
src/Visual_DVM_2021/Passes/All/DeleteProfile.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.SapforProfile.SapforProfile;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
public class DeleteProfile extends DeleteObjectPass<SapforProfile> {
|
||||
public DeleteProfile() {
|
||||
super(SapforProfile.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/DeleteRunConfiguration.java
Normal file
14
src/Visual_DVM_2021/Passes/All/DeleteRunConfiguration.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.RunConfiguration.RunConfiguration;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
public class DeleteRunConfiguration extends DeleteObjectPass<RunConfiguration> {
|
||||
public DeleteRunConfiguration() {
|
||||
super(RunConfiguration.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/DeleteSapfor.java
Normal file
14
src/Visual_DVM_2021/Passes/All/DeleteSapfor.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.RemoteSapfor.RemoteSapfor;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
public class DeleteSapfor extends DeleteObjectPass<RemoteSapfor>{
|
||||
public DeleteSapfor() {
|
||||
super(RemoteSapfor.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import TestingSystem.Sapfor.SapforConfiguration.SapforConfiguration;
|
||||
import Visual_DVM_2021.Passes.DeleteSelectedServerObjects;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DeleteSapforConfiguration extends DeleteSelectedServerObjects {
|
||||
public DeleteSapforConfiguration() {
|
||||
super(SapforConfiguration.class);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.SapforConfiguration)){
|
||||
target= new Vector<>();
|
||||
target.add(Current.getSapforConfiguration());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import TestingSystem.Sapfor.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||
import Visual_DVM_2021.Passes.DeleteSelectedServerObjects;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DeleteSapforConfigurationCommand extends DeleteSelectedServerObjects {
|
||||
public DeleteSapforConfigurationCommand() {
|
||||
super(SapforConfigurationCommand.class);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.SapforConfigurationCommand)){
|
||||
target= new Vector<>();
|
||||
target.add(Current.getSapforConfigurationCommand());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
30
src/Visual_DVM_2021/Passes/All/DeleteSapforTasksPackage.java
Normal file
30
src/Visual_DVM_2021/Passes/All/DeleteSapforTasksPackage.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import TestingSystem.Sapfor.SapforTasksPackage.SapforTasksPackage_2023;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
|
||||
import java.io.File;
|
||||
public class DeleteSapforTasksPackage extends DeleteObjectPass<SapforTasksPackage_2023> {
|
||||
public DeleteSapforTasksPackage() {
|
||||
super(SapforTasksPackage_2023.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (Current.hasUI()) {
|
||||
UI.getMainWindow().getTestingWindow().RemoveSapforPackageFromComparison(target);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
super.body();
|
||||
Utils.delete_with_check(new File(target.workspace));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Tasks.CompilationTask.CompilationTask;
|
||||
import GlobalData.Tasks.RunTask.RunTask;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DeleteSelectedCompilationTasks extends Pass_2021<Vector<CompilationTask>> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = new Vector<>();
|
||||
Global.db.compilationTasks.Data.values().stream().filter(task -> task.isVisible() && task.isSelected() && task.isPassive()).forEach(task -> target.add(task));
|
||||
if (target.isEmpty()) {
|
||||
Log.Writeln_("Не отмечено ни одной задачи для удаления.");
|
||||
return false;
|
||||
} else return true;
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
Global.db.compilationTasks.ClearUI();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (CompilationTask task : target) {
|
||||
for (RunTask runTask : task.getRunTasks().values()) {
|
||||
Global.db.Delete(runTask);
|
||||
Utils.forceDeleteWithCheck(runTask.getLocalWorkspace());
|
||||
}
|
||||
Global.db.Delete(task);
|
||||
Utils.forceDeleteWithCheck(task.getLocalWorkspace());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
Global.db.compilationTasks.ShowUI();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import TestingSystem.Configuration.Configuration;
|
||||
import Visual_DVM_2021.Passes.DeleteSelectedServerObjects;
|
||||
public class DeleteSelectedConfigurations extends DeleteSelectedServerObjects {
|
||||
public DeleteSelectedConfigurations() {
|
||||
super(Configuration.class);
|
||||
}
|
||||
}
|
||||
53
src/Visual_DVM_2021/Passes/All/DeleteSelectedFiles.java
Normal file
53
src/Visual_DVM_2021/Passes/All/DeleteSelectedFiles.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
public class DeleteSelectedFiles extends Pass_2021 {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.getProject().db.files.getCheckedCount() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одного файла.");
|
||||
return false;
|
||||
}
|
||||
return UI.Warning("Удалить " + Current.getProject().db.files.getCheckedCount() + " файлов.");
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
boolean hasCurrent = false;
|
||||
boolean hasSelected = false;
|
||||
if (Current.HasFile()) {
|
||||
for (DBProjectFile file : Current.getProject().db.files.getCheckedItems()) {
|
||||
if (Current.getFile().file.equals(file.file))
|
||||
hasCurrent = true;
|
||||
if (Current.getSelectedFile().file.equals(file.file))
|
||||
hasSelected = true;
|
||||
}
|
||||
}
|
||||
if (hasCurrent)
|
||||
passes.get(PassCode_2021.CloseCurrentFile).Do();
|
||||
if (hasSelected) {
|
||||
Current.set(Current.SelectedFile, null);
|
||||
Current.set(Current.ProjectNode, null);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (DBProjectFile file : Current.getProject().db.files.getCheckedItems()) {
|
||||
ShowMessage1(file.name);
|
||||
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RemoveNode(file.node);
|
||||
Current.getProject().db.Delete(file);
|
||||
Utils.forceDeleteWithCheck(file.file);
|
||||
}
|
||||
}
|
||||
}
|
||||
8
src/Visual_DVM_2021/Passes/All/DeleteSelectedGroups.java
Normal file
8
src/Visual_DVM_2021/Passes/All/DeleteSelectedGroups.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import TestingSystem.Group.Group;
|
||||
import Visual_DVM_2021.Passes.DeleteSelectedServerObjects;
|
||||
public class DeleteSelectedGroups extends DeleteSelectedServerObjects {
|
||||
public DeleteSelectedGroups() {
|
||||
super(Group.class);
|
||||
}
|
||||
}
|
||||
41
src/Visual_DVM_2021/Passes/All/DeleteSelectedRunTasks.java
Normal file
41
src/Visual_DVM_2021/Passes/All/DeleteSelectedRunTasks.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Tasks.RunTask.RunTask;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DeleteSelectedRunTasks extends Pass_2021<Vector<RunTask>> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = new Vector<>();
|
||||
Global.db.runTasks.Data.values().stream().filter(task -> task.isVisible() && task.isSelected() && task.isPassive()).forEach(task -> target.add(task));
|
||||
if (target.isEmpty()) {
|
||||
Log.Writeln_("Не отмечено ни одной задачи для удаления.");
|
||||
return false;
|
||||
} else return true;
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
Global.db.runTasks.ClearUI();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (RunTask task : target) {
|
||||
Global.db.Delete(task);
|
||||
Utils.forceDeleteWithCheck(task.getLocalWorkspace());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
Global.db.runTasks.ShowUI();
|
||||
}
|
||||
}
|
||||
8
src/Visual_DVM_2021/Passes/All/DeleteSelectedTests.java
Normal file
8
src/Visual_DVM_2021/Passes/All/DeleteSelectedTests.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import TestingSystem.Test.Test;
|
||||
import Visual_DVM_2021.Passes.DeleteSelectedServerObjects;
|
||||
public class DeleteSelectedTests extends DeleteSelectedServerObjects {
|
||||
public DeleteSelectedTests() {
|
||||
super(Test.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.Tasks.TestRunTask;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DeleteSelectedTestsRunTasks extends TestingSystemPass<Vector<TestRunTask>> {
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = new Vector<>();
|
||||
//------------------------
|
||||
if (Current.getAccount().CheckRegistered(Log)) {
|
||||
for (TestRunTask task : Global.testingServer.account_db.testRunTasks.getCheckedItems()) {
|
||||
if (!task.state.isActive())
|
||||
target.add(task);
|
||||
}
|
||||
if (target.isEmpty()) {
|
||||
Log.Writeln_("не отмечено неактивных задач.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DeleteAccountObjects, Current.getAccount().email, target));
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
|
||||
}
|
||||
}
|
||||
54
src/Visual_DVM_2021/Passes/All/DeleteSelectedVersions.java
Normal file
54
src/Visual_DVM_2021/Passes/All/DeleteSelectedVersions.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DeleteSelectedVersions extends Pass_2021<Vector<db_project_info>> {
|
||||
boolean has_current_project;
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
has_current_project = false;
|
||||
target = new Vector<>();
|
||||
//------------------------
|
||||
if (!Global.versions_multiselection) {
|
||||
Log.Writeln_("Нажмите правую клавишу мыши, и перейдите в режим выбора версий.");
|
||||
return false;
|
||||
}
|
||||
if (!Current.Check(Log, Current.Root)) {
|
||||
return false;
|
||||
}
|
||||
Vector<db_project_info> allVersions = new Vector<>();
|
||||
Current.getRoot().getSelectedVersions(allVersions);
|
||||
if (allVersions.size() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одной версии.");
|
||||
return false;
|
||||
}
|
||||
int q = Current.getRoot().getSelectedVersionsForDeletion(target);
|
||||
if (Current.HasProject()) {
|
||||
for (db_project_info version : target) {
|
||||
if (Current.getProject().Home.getAbsolutePath().startsWith(version.Home.getAbsolutePath())) {
|
||||
has_current_project = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return UI.Warning("Удалить " + q + " версий.");
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (db_project_info version : target)
|
||||
passes.get(PassCode_2021.DeleteVersion).Do(version);
|
||||
}
|
||||
}
|
||||
20
src/Visual_DVM_2021/Passes/All/DeleteSubscriber.java
Normal file
20
src/Visual_DVM_2021/Passes/All/DeleteSubscriber.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import Repository.Subscribes.Subscriber;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class DeleteSubscriber extends DeleteObjectPass<Subscriber> {
|
||||
public DeleteSubscriber() {
|
||||
super(Subscriber.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.componentsServer.db;
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
passes.get(PassCode_2021.DeleteSubscriberOnServer).Do(target);
|
||||
}
|
||||
}
|
||||
22
src/Visual_DVM_2021/Passes/All/DeleteSubscriberOnServer.java
Normal file
22
src/Visual_DVM_2021/Passes/All/DeleteSubscriberOnServer.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Repository.Subscribes.Subscriber;
|
||||
import Visual_DVM_2021.Passes.ComponentsRepositoryPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class DeleteSubscriberOnServer extends ComponentsRepositoryPass<Subscriber> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (Subscriber) args[0];
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DeleteObject, "", target));
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
super.performFinish();
|
||||
passes.get(PassCode_2021.SynchronizeBugReports).Do();
|
||||
}
|
||||
}
|
||||
19
src/Visual_DVM_2021/Passes/All/DeleteSubversions.java
Normal file
19
src/Visual_DVM_2021/Passes/All/DeleteSubversions.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Visual_DVM_2021.Passes.CurrentProjectPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DeleteSubversions extends CurrentProjectPass {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Vector<db_project_info> targets = new Vector<>(target.versions.values());
|
||||
for (db_project_info m : targets) {
|
||||
passes.get(PassCode_2021.DeleteVersion).Do(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/DeleteUser.java
Normal file
14
src/Visual_DVM_2021/Passes/All/DeleteUser.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.User.User;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
public class DeleteUser extends DeleteObjectPass<User> {
|
||||
public DeleteUser() {
|
||||
super(User.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
59
src/Visual_DVM_2021/Passes/All/DeleteVersion.java
Normal file
59
src/Visual_DVM_2021/Passes/All/DeleteVersion.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
public class DeleteVersion extends Pass_2021<db_project_info> {
|
||||
db_project_info parent;
|
||||
boolean current;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
if (args.length > 0) {
|
||||
target = (db_project_info) args[0];
|
||||
current = (Current.getVersion() != null) && Current.getVersion().Home.equals(target.Home);
|
||||
return true;
|
||||
} else {
|
||||
if (((target = Current.getVersion()) != null) && (!Current.hasUI() ||
|
||||
UI.Warning("Удалить " +
|
||||
((Current.HasProject() && target.Home.equals(Current.getProject().Home)) ? "текущий проект" : "версию ")
|
||||
+ Utils.Brackets(target.name)))) {
|
||||
current = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (target.parent != null)
|
||||
target.parent.checkLastModification(target);
|
||||
if (Current.HasProject()) {
|
||||
if ((Current.getProject().Home.getAbsolutePath().startsWith(target.Home.getAbsolutePath())))
|
||||
passes.get(PassCode_2021.CloseCurrentProject).Do();
|
||||
}
|
||||
if (Current.hasUI()) {
|
||||
UI.getVersionsWindow().RemoveVersionFromComparison(target);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Utils.forceDeleteWithCheck(target.Home);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
parent = target.parent;
|
||||
if (current)
|
||||
Current.set(Current.Version, null);
|
||||
if (parent != null) {
|
||||
UI.getVersionsWindow().getVersionsForm().getTree().RemoveNode(target.node);
|
||||
parent.versions.remove(target.name);
|
||||
} else
|
||||
Current.set(Current.Root, null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Visual_DVM_2021.Passes.ComponentsRepositoryPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class DownloadAllBugReportsArchives extends ComponentsRepositoryPass<File> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/DownloadAll.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
passes.get(PassCode_2021.CloseCurrentProject).Do();
|
||||
Current.set(Current.Root, null); //чтобы гарантированно не существовало корня.
|
||||
Utils.CleanDirectory(Global.BugReportsDirectory);
|
||||
}
|
||||
@Override
|
||||
protected int getTimeout() {
|
||||
return 60000;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.ReceiveAllArchives));
|
||||
response.Unpack(target = Utils.getTempFileName("bugs"));
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return target.exists();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
File tempFolder = Utils.getTempFileName("bugsBuffer");
|
||||
//-
|
||||
passes.get(PassCode_2021.UnzipFolderPass).Do(
|
||||
target.getAbsolutePath(),
|
||||
tempFolder.getAbsolutePath()
|
||||
);
|
||||
//-
|
||||
//теперь скопировать это в папку Bugs, с нормальными именами через zip
|
||||
File t2 = Paths.get(tempFolder.getAbsolutePath(), "Bugs").toFile();
|
||||
File[] archives = t2.listFiles();
|
||||
if (archives != null) {
|
||||
for (File file : archives) {
|
||||
FileUtils.moveFile(file, Paths.get(Global.BugReportsDirectory.getAbsolutePath(), file.getName() + ".zip").toFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
30
src/Visual_DVM_2021/Passes/All/DownloadBugReport.java
Normal file
30
src/Visual_DVM_2021/Passes/All/DownloadBugReport.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.BugReport.BugReport;
|
||||
import Repository.BugReport.BugReportInterface;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Visual_DVM_2021.Passes.ComponentsRepositoryPass;
|
||||
public class DownloadBugReport extends ComponentsRepositoryPass<BugReport> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
target = (BugReport) args[0];
|
||||
|
||||
|
||||
return !BugReportInterface.getArchiveFile(target).exists();
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
Utils.CheckDirectory(Global.BugReportsDirectory);
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.ReceiveBugReport, target.id));
|
||||
Utils.unpackFile((byte[]) response.object, BugReportInterface.getArchiveFile(target));
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return BugReportInterface.getArchiveFile(target).exists();
|
||||
}
|
||||
}
|
||||
16
src/Visual_DVM_2021/Passes/All/DownloadComponent.java
Normal file
16
src/Visual_DVM_2021/Passes/All/DownloadComponent.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.Component.Component;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Visual_DVM_2021.Passes.ComponentsRepositoryPass;
|
||||
public class DownloadComponent extends ComponentsRepositoryPass<Component> {
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
target = Current.getComponent();
|
||||
String packed = target.getComponentType()+"\n"+target.getFileName();
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.ReceiveComponent, packed));
|
||||
Utils.unpackFile((byte[]) response.object, target.getNewFile());
|
||||
}
|
||||
}
|
||||
67
src/Visual_DVM_2021/Passes/All/DownloadGroup.java
Normal file
67
src/Visual_DVM_2021/Passes/All/DownloadGroup.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.Group.Group;
|
||||
import TestingSystem.Group.GroupInterface;
|
||||
import TestingSystem.Test.Test;
|
||||
import TestingSystem.Test.TestInterface;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public class DownloadGroup extends TestingSystemPass<Group> {
|
||||
File workspace = null;
|
||||
Vector<Test> tests = null;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/DownloadBugReport.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
workspace = null;
|
||||
tests = null;
|
||||
if (args.length > 0) {
|
||||
target = (Group) args[0];
|
||||
workspace = GroupInterface.getLocalWorkspaceD(target);
|
||||
return true;
|
||||
} else if (Current.Check(Log, Current.Group)) {
|
||||
target = Current.getGroup();
|
||||
workspace = GroupInterface.getLocalWorkspaceD(target);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
//на случай если был открыт какой то из тестов.
|
||||
passes.get(PassCode_2021.CloseCurrentProject).Do();
|
||||
Utils.CheckAndCleanDirectory(workspace);
|
||||
tests = new Vector<>();
|
||||
server.db.tests.Data.values().stream().filter(test -> test.group_id.equals(target.id)).forEach(test -> tests.add(test));
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
for (Test test : tests) {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DownloadTest, test.id));
|
||||
response.Unpack(TestInterface.getArchive(test));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
for (Test test : tests) {
|
||||
if (TestInterface.getArchive(test).exists())
|
||||
passes.get(PassCode_2021.UnzipFolderPass).Do(
|
||||
TestInterface.getArchive(test).getAbsolutePath(),
|
||||
workspace.getAbsolutePath(), false
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
60
src/Visual_DVM_2021/Passes/All/DownloadProject.java
Normal file
60
src/Visual_DVM_2021/Passes/All/DownloadProject.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.RemoteFile.RemoteFile;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.SSH.CurrentConnectionPass;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class DownloadProject extends CurrentConnectionPass {
|
||||
private static final int maxSize = 10240;
|
||||
boolean dialogOK = false;
|
||||
RemoteFile src;
|
||||
RemoteFile remote_archive;
|
||||
File local_archive;
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
dialogOK = (UI.getRemoteFileChooser().ShowDialog(getDescription(), this, true));
|
||||
if (dialogOK) {
|
||||
src = Current.getRemoteFile();
|
||||
System.out.println(Current.getRemoteFile());
|
||||
remote_archive = new RemoteFile(src.full_name, src.name + ".zip", false);
|
||||
local_archive = Utils.getTempFileName(remote_archive.name);
|
||||
if ((getFileKBSize(src.full_name)) <= maxSize) {
|
||||
ShowMessage2("Запаковка папки проекта..");
|
||||
Command(
|
||||
"cd " + Utils.DQuotes(src.full_name),
|
||||
"zip -r " + Utils.DQuotes(remote_archive.full_name) + " ./"
|
||||
);
|
||||
// try {
|
||||
ShowMessage2("Загрузка проекта..");
|
||||
getSingleFile(remote_archive.full_name, local_archive.getAbsolutePath());
|
||||
// } catch (Exception ex) {
|
||||
// throw new PassException("Ошибка загрузки");
|
||||
// }
|
||||
sftpChannel.rm(remote_archive.full_name);
|
||||
} else throw new PassException("Размер проекта превышает " + maxSize + " KB.\n");
|
||||
} else {
|
||||
//диалога не вышло, сбрасываем файл.
|
||||
Current.set(Current.RemoteFile, null);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
Current.Check(Log, Current.RemoteFile);
|
||||
return (Log.isEmpty());
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
File project = Paths.get(Global.visualiser.getWorkspace().getAbsolutePath(),
|
||||
Utils.getDateName(src.name)).toFile();
|
||||
if (passes.get(PassCode_2021.UnzipFolderPass).Do(local_archive.getAbsolutePath(), project.getAbsolutePath())) {
|
||||
if (UI.Question("Проект " + Utils.Brackets(src.name) + " успешно загружен. Открыть его"))
|
||||
passes.get(PassCode_2021.OpenCurrentProject).Do(project);
|
||||
}
|
||||
}
|
||||
}
|
||||
42
src/Visual_DVM_2021/Passes/All/DownloadRepository.java
Normal file
42
src/Visual_DVM_2021/Passes/All/DownloadRepository.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.SVN.SVN;
|
||||
import Visual_DVM_2021.Passes.ProcessPass;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class DownloadRepository extends ProcessPass {
|
||||
|
||||
File dvmHome;
|
||||
File sapforHome;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
dvmHome = Paths.get(Global.RepoDirectory.getAbsolutePath(),
|
||||
"dvm").toFile();
|
||||
sapforHome = Paths.get(Global.RepoDirectory.getAbsolutePath(),
|
||||
"sapfor").toFile();
|
||||
return true;
|
||||
}
|
||||
private void synchronize(String src, File dst) throws Exception {
|
||||
File loadedFile = Paths.get(dst.getAbsolutePath(), SVN.LOADED).toFile();
|
||||
if (loadedFile.exists()) {
|
||||
PerformScript("cd " +
|
||||
dst.getAbsolutePath() +
|
||||
"\nsvn update " + SVN.REPOSITORY_AUTHENTICATION + "\n");
|
||||
} else {
|
||||
Utils.CleanDirectory(dst);
|
||||
PerformScript("cd Repo\nsvn checkout " + SVN.REPOSITORY_AUTHENTICATION + " " + src + "\n"); //export
|
||||
FileUtils.write(loadedFile, "+");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
ShowProgress(2, 0, true);
|
||||
synchronize(SVN.DVM_REPOSITORY, dvmHome);
|
||||
ShowProgress(2, 1, true);
|
||||
synchronize(SVN.SAPFOR_REPOSITORY, sapforHome);
|
||||
ShowProgress(2, 2, true);
|
||||
}
|
||||
}
|
||||
18
src/Visual_DVM_2021/Passes/All/DownloadTaskTest.java
Normal file
18
src/Visual_DVM_2021/Passes/All/DownloadTaskTest.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import TestingSystem.Tasks.TestRunTask;
|
||||
import TestingSystem.Test.Test;
|
||||
public class DownloadTaskTest extends DownloadTest {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = null;
|
||||
if (Current.getAccount().CheckRegistered(Log) && Current.Check(Log, Current.TestRunTask)) {
|
||||
TestRunTask task = Current.getTestRunTask();
|
||||
//-- квазиобъект, нам от него нужно только имя.
|
||||
target = new Test();
|
||||
target.id = task.test_id;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
59
src/Visual_DVM_2021/Passes/All/DownloadTest.java
Normal file
59
src/Visual_DVM_2021/Passes/All/DownloadTest.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.Test.Test;
|
||||
import TestingSystem.Test.TestInterface;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
public class DownloadTest extends TestingSystemPass<Test> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/DownloadBugReport.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.getAccount().CheckRegistered(Log) && Current.Check(Log, Current.Test)) {
|
||||
target = Current.getTest();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
passes.get(PassCode_2021.CloseCurrentProject).Do();
|
||||
Current.set(Current.Root, null); //чтобы гарантированно не существовало корня.
|
||||
Utils.forceDeleteWithCheck(TestInterface.getArchive(target));
|
||||
Utils.forceDeleteWithCheck(TestInterface.getHomePath(target));
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DownloadTest, target.id));
|
||||
response.Unpack(TestInterface.getArchive(target));
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return TestInterface.getArchive(target).exists();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
if (passes.get(PassCode_2021.UnzipFolderPass).Do(
|
||||
TestInterface.getArchive(target).getAbsolutePath(),
|
||||
Global.visualiser.getWorkspace().getAbsolutePath(), false
|
||||
))
|
||||
if (UI.Question("Тестовый проект успешно загружен под именем\n" +
|
||||
Utils.Brackets(TestInterface.getHomePath(target).getName()) +
|
||||
"\nОткрыть его"))
|
||||
passes.get(PassCode_2021.OpenCurrentProject).Do(TestInterface.getHomePath(target));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
14
src/Visual_DVM_2021/Passes/All/DropAnalyses.java
Normal file
14
src/Visual_DVM_2021/Passes/All/DropAnalyses.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Visual_DVM_2021.Passes.CurrentProjectPass;
|
||||
public class DropAnalyses extends CurrentProjectPass {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart(args) && (Current.getSapfor() != null);
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Current.getSapfor().ResetAllAnalyses();
|
||||
}
|
||||
}
|
||||
21
src/Visual_DVM_2021/Passes/All/DropFastAccess.java
Normal file
21
src/Visual_DVM_2021/Passes/All/DropFastAccess.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
public class DropFastAccess extends Pass_2021 {
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (Pass_2021 pass : Pass_2021.FAPasses) {
|
||||
pass.stats.Drop();
|
||||
Global.db.Update(pass.stats);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
UI.fastAccessMenuBar.Drop();
|
||||
}
|
||||
}
|
||||
10
src/Visual_DVM_2021/Passes/All/DropLastProjects.java
Normal file
10
src/Visual_DVM_2021/Passes/All/DropLastProjects.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import GlobalData.DBLastProject.DBLastProject;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
public class DropLastProjects extends Pass_2021 {
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Global.db.DeleteAll(DBLastProject.class);
|
||||
}
|
||||
}
|
||||
17
src/Visual_DVM_2021/Passes/All/DropSavedArrays.java
Normal file
17
src/Visual_DVM_2021/Passes/All/DropSavedArrays.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import ProjectData.DBArray.DBArray;
|
||||
import Visual_DVM_2021.Passes.CurrentProjectPass;
|
||||
public class DropSavedArrays extends CurrentProjectPass {
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
target.db.DeleteAll(DBArray.class);
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
target.db.savedArrays.ShowUI();
|
||||
}
|
||||
}
|
||||
70
src/Visual_DVM_2021/Passes/All/EditAccount.java
Normal file
70
src/Visual_DVM_2021/Passes/All/EditAccount.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.EmailMessage;
|
||||
import Repository.Subscribes.Subscriber;
|
||||
import Repository.Subscribes.UI.SubscriberForm;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Vector;
|
||||
public class EditAccount extends Email {
|
||||
public String name;
|
||||
public String email;
|
||||
String password;
|
||||
SubscriberForm f = new SubscriberForm(){
|
||||
{
|
||||
fields.cbRole.setEnabled(false);
|
||||
}
|
||||
};
|
||||
public static int getRandomIntegerBetweenRange(int min, int max) {
|
||||
return (int) ((Math.random() * ((max - min) + 1)) + min);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
Subscriber res = new Subscriber(); // объект для заполнения полей.не более.
|
||||
if (f.ShowDialog("Регистрация", res)) {
|
||||
if (!Utils.validateEmail(res.address, Log)) {
|
||||
return false;
|
||||
}
|
||||
name = res.name;
|
||||
email = res.address;
|
||||
Vector<String> rec = new Vector<>();
|
||||
rec.add(email);
|
||||
password = String.valueOf(getRandomIntegerBetweenRange(1111, 9999));
|
||||
return super.canStart(new EmailMessage("Код подтверждения визуализатора для: " + Utils.Brackets(name), password, rec));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
String attempt = null;
|
||||
do {
|
||||
attempt = JOptionPane.showInputDialog(null,
|
||||
new String[]{"Введите код активации, полученный по почте"},
|
||||
"Подтверждение адреса почты",
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
if (attempt != null) {
|
||||
System.out.println("Введенный код: " + Utils.Brackets(attempt));
|
||||
if (attempt.equals(password)) {
|
||||
UI.Info("Почта успешно подтверждена!");
|
||||
return true;
|
||||
} else {
|
||||
UI.Error("Неверный код активации.\nПовторите попытку.");
|
||||
}
|
||||
} else {
|
||||
UI.Info("Подтверждение почты отменено");
|
||||
return false;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
Current.getAccount().name = name;
|
||||
Current.getAccount().email = email;
|
||||
Global.db.Update(Current.getAccount());
|
||||
//это не регистрация. только заполнение почты в своей бд и ее подтверждение на реальность.
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/EditCompiler.java
Normal file
14
src/Visual_DVM_2021/Passes/All/EditCompiler.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Compiler.Compiler;
|
||||
import Visual_DVM_2021.Passes.EditObjectPass;
|
||||
public class EditCompiler extends EditObjectPass<Compiler> {
|
||||
public EditCompiler() {
|
||||
super(Compiler.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
29
src/Visual_DVM_2021/Passes/All/EditConfiguration.java
Normal file
29
src/Visual_DVM_2021/Passes/All/EditConfiguration.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import TestingSystem.Configuration.Configuration;
|
||||
import Visual_DVM_2021.Passes.EditObjectPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class EditConfiguration extends EditObjectPass<Configuration> {
|
||||
public EditConfiguration() {
|
||||
super(Configuration.class);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.Configuration)) {
|
||||
return getTable().ShowEditObjectDialog(target= Current.getConfiguration());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.testingServer.db;
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
//отправка.
|
||||
passes.get(PassCode_2021.EditConfigurationOnServer).Do(target);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.Configuration.Configuration;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
public class EditConfigurationOnServer extends TestingSystemPass<Configuration> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (Configuration) args[0];
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.EditObject, "", target));
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/EditDVMParameter.java
Normal file
14
src/Visual_DVM_2021/Passes/All/EditDVMParameter.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.DVMParameter.DVMParameter;
|
||||
import Visual_DVM_2021.Passes.EditObjectPass;
|
||||
public class EditDVMParameter extends EditObjectPass<DVMParameter> {
|
||||
public EditDVMParameter() {
|
||||
super(DVMParameter.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/EditEnvironmentValue.java
Normal file
14
src/Visual_DVM_2021/Passes/All/EditEnvironmentValue.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.EnvironmentValue.EnvironmentValue;
|
||||
import Visual_DVM_2021.Passes.EditObjectPass;
|
||||
public class EditEnvironmentValue extends EditObjectPass<EnvironmentValue> {
|
||||
public EditEnvironmentValue() {
|
||||
super(EnvironmentValue.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
33
src/Visual_DVM_2021/Passes/All/EditGroup.java
Normal file
33
src/Visual_DVM_2021/Passes/All/EditGroup.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import TestingSystem.Group.Group;
|
||||
import Visual_DVM_2021.Passes.EditObjectPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class EditGroup extends EditObjectPass<Group> {
|
||||
public EditGroup() {
|
||||
super(Group.class);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.Group)){
|
||||
target = Current.getGroup();
|
||||
if (!Current.getAccount().CheckAccessRights(target.sender_address, Log)){
|
||||
return false;
|
||||
}
|
||||
return getTable().ShowEditObjectDialog(target);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.testingServer.db;
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
//отправка.
|
||||
passes.get(PassCode_2021.EditGroupOnServer).Do(target);
|
||||
}
|
||||
}
|
||||
16
src/Visual_DVM_2021/Passes/All/EditGroupOnServer.java
Normal file
16
src/Visual_DVM_2021/Passes/All/EditGroupOnServer.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.Group.Group;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
public class EditGroupOnServer extends TestingSystemPass<Group> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (Group) args[0];
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.EditObject, "", target));
|
||||
}
|
||||
}
|
||||
14
src/Visual_DVM_2021/Passes/All/EditMachine.java
Normal file
14
src/Visual_DVM_2021/Passes/All/EditMachine.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Machine.Machine;
|
||||
import Visual_DVM_2021.Passes.EditObjectPass;
|
||||
public class EditMachine extends EditObjectPass<Machine> {
|
||||
public EditMachine() {
|
||||
super(Machine.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
50
src/Visual_DVM_2021/Passes/All/EditMachineKernels.java
Normal file
50
src/Visual_DVM_2021/Passes/All/EditMachineKernels.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.UI.Windows.Dialog.SliderNumberForm;
|
||||
import GlobalData.Machine.Machine;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.MachineMaxKernels.MachineMaxKernels;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
public class EditMachineKernels extends TestingSystemPass<MachineMaxKernels> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Machine.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.Machine)) {
|
||||
Machine machine = Current.getMachine();
|
||||
String url = machine.getURL();
|
||||
if (server.db.machinesMaxKernels.containsKey(url)) target = server.db.machinesMaxKernels.get(url);
|
||||
else {
|
||||
target = new MachineMaxKernels(url);
|
||||
server.db.Insert(target);
|
||||
}
|
||||
SliderNumberForm fff = new SliderNumberForm();
|
||||
if (fff.ShowDialog(url, target.limit, 1, 16)) {
|
||||
target.limit = fff.Result;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.EditObject, "", target));
|
||||
Global.testingServer.db.Update(target);
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
if (Current.HasMachine())
|
||||
UI.getMainWindow().getTestingWindow().ShowCurrentMachine();
|
||||
else
|
||||
UI.getMainWindow().getTestingWindow().ShowNoCurrentMachine();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user