2024-10-14 12:14:01 +03:00
|
|
|
|
package _VisualDVM.Passes.All;
|
2024-10-09 22:01:19 +03:00
|
|
|
|
import _VisualDVM.Current;
|
2024-10-07 00:58:29 +03:00
|
|
|
|
import _VisualDVM.Global;
|
2024-10-14 15:19:13 +03:00
|
|
|
|
import _VisualDVM.Passes.PassCode;
|
|
|
|
|
|
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.Repository.Server.ServerCode;
|
|
|
|
|
|
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
2024-10-14 15:19:13 +03:00
|
|
|
|
import _VisualDVM.Utils;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
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 {
|
2024-10-13 23:55:03 +03:00
|
|
|
|
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
|
2024-10-13 22:08:13 +03:00
|
|
|
|
Global.mainModule.set(Current.Root, null); //чтобы гарантированно не существовало корня.
|
2023-09-17 22:13:42 +03:00
|
|
|
|
Utils.CleanDirectory(Global.BugReportsDirectory);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected int getTimeout() {
|
|
|
|
|
|
return 60000;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void ServerAction() throws Exception {
|
|
|
|
|
|
Command(new ServerExchangeUnit_2021(ServerCode.ReceiveAllArchives));
|
2025-02-03 15:19:53 +03:00
|
|
|
|
server_response.Unpack(target = Utils.getTempFileName("bugs"));
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean validate() {
|
|
|
|
|
|
return target.exists();
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void performDone() throws Exception {
|
|
|
|
|
|
File tempFolder = Utils.getTempFileName("bugsBuffer");
|
|
|
|
|
|
//-
|
2024-10-13 23:55:03 +03:00
|
|
|
|
Global.mainModule.getPass(PassCode.UnzipFolderPass).Do(
|
2023-09-17 22:13:42 +03:00
|
|
|
|
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());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|