no message
This commit is contained in:
59
src/_VisualDVM/Passes/All/DownloadAllBugReportsArchives.java
Normal file
59
src/_VisualDVM/Passes/All/DownloadAllBugReportsArchives.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
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 {
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
|
||||
Global.mainModule.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");
|
||||
//-
|
||||
Global.mainModule.getPass(PassCode.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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user