рефакторинг отправления бага. была избыточная команда
This commit is contained in:
@@ -115,6 +115,16 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
return Global.properties.ComponentsServerPort;
|
||||
}
|
||||
@Override
|
||||
protected void beforePublishAction(DBObject object) throws Exception {
|
||||
if (object instanceof BugReport){
|
||||
BugReport bugReport = (BugReport) object;
|
||||
if (bugReport.packed_archive!=null) {
|
||||
File bugArchive = Utils_.getFile(Utils_.getHomePath(), "Bugs", bugReport.id);
|
||||
Utils_.bytesToFile(bugReport.packed_archive, bugArchive);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void afterDeleteAction(DBObject object) throws Exception {
|
||||
if (object instanceof BugReport) {
|
||||
BugReport bugReport = (BugReport) object;
|
||||
@@ -208,13 +218,13 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
break;
|
||||
case ReceiveBugReport:
|
||||
Print("Скачать баг репорт по ключу " + request.arg);
|
||||
File bugArchive = Paths.get(Utils_.getHomePath(), "Bugs", request.arg).toFile();
|
||||
File bugArchive = Utils_.getFile(Utils_.getHomePath(), "Bugs", request.arg);
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = Utils_.fileToBytes(bugArchive);
|
||||
break;
|
||||
case SendBugReport:
|
||||
case SendBugReport: //todo устарело
|
||||
Print("Отправить баг репорт " + request.arg);
|
||||
File bugArchive1 = Paths.get(Utils_.getHomePath(), "Bugs", request.arg).toFile();
|
||||
File bugArchive1 = Utils_.getFile(Utils_.getHomePath(), "Bugs", request.arg);
|
||||
Utils_.bytesToFile((byte[]) request.object, bugArchive1);
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user