no message
This commit is contained in:
@@ -2,10 +2,12 @@ package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Server.ClientPass;
|
||||
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import _VisualDVM.Repository.BugReport.BugReportState;
|
||||
import _VisualDVM.Repository.EmailMessage;
|
||||
import _VisualDVM.Repository.Server.ComponentsServer;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Utils;
|
||||
@@ -14,16 +16,22 @@ import javafx.util.Pair;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class UpdateBugReportField extends ComponentsRepositoryPass<BugReport> {
|
||||
public class UpdateBugReportField extends ClientPass<ComponentsServer,BugReport> {
|
||||
Vector<String> fieldNames = new Vector<>();
|
||||
Vector<Serializable> fieldValues = new Vector<>();
|
||||
String old_description = "";
|
||||
String old_comment = "";
|
||||
BugReport actual;
|
||||
@Override
|
||||
protected ComponentsServer getServer() {
|
||||
return Global.componentsServer;
|
||||
}
|
||||
protected boolean canUpdate() {
|
||||
return target.canModify(Global.mainModule.getAccount(),Log);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
actual = null;
|
||||
if (!Global.componentsServer.db.bugReports.getUI().CheckCurrent(Log))
|
||||
return false;
|
||||
old_description = "";
|
||||
@@ -49,36 +57,34 @@ public class UpdateBugReportField extends ComponentsRepositoryPass<BugReport> {
|
||||
for (int i = 0; i < fieldNames.size(); ++i)
|
||||
BugReport.class.getField(fieldNames.get(i)).set(target, fieldValues.get(i));
|
||||
target.change_date = new Date().getTime();
|
||||
server.db.Update(target);
|
||||
server.db.bugReports.getUI().RedrawControl();
|
||||
getServer().db.Update(target);
|
||||
getServer().db.bugReports.getUI().RedrawControl();
|
||||
Global.mainModule.getUI().getMainWindow().getCallbackWindow().ShowCurrentBugReport();
|
||||
} else
|
||||
return canUpdate();
|
||||
} else {
|
||||
if (canUpdate()&& SendRequest(ServerCode.GetObjectCopyByPK, "", new Pair<>(BugReport.class, target.id))){
|
||||
actual = (BugReport) request.target;
|
||||
target.SynchronizeFields(actual);
|
||||
for (int i = 0; i < fieldNames.size(); ++i) {
|
||||
String fieldName = fieldNames.get(i);
|
||||
switch (fieldName) {
|
||||
case "comment":
|
||||
old_comment = (String) BugReport.class.getField(fieldName).get(target);
|
||||
break;
|
||||
case "description":
|
||||
old_description = (String) BugReport.class.getField(fieldName).get(target);
|
||||
break;
|
||||
}
|
||||
BugReport.class.getField(fieldNames.get(i)).set(target, fieldValues.get(i));
|
||||
}
|
||||
target.change_date = new Date().getTime();
|
||||
return SendRequest(ServerCode.UpdateBugReport, "", target);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
//1. прежде чем дополнять поле(комментарий или описание) следует скачать с сервера
|
||||
//последнюю версию этого баг репорта.
|
||||
//все это должно быть в рамках одной транзакции с сервером!
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.GetObjectCopyByPK, "", new Pair<>(BugReport.class, target.id)));
|
||||
target.SynchronizeFields((BugReport) server_response.object);
|
||||
for (int i = 0; i < fieldNames.size(); ++i) {
|
||||
String fieldName = fieldNames.get(i);
|
||||
switch (fieldName) {
|
||||
case "comment":
|
||||
old_comment = (String) BugReport.class.getField(fieldName).get(target);
|
||||
break;
|
||||
case "description":
|
||||
old_description = (String) BugReport.class.getField(fieldName).get(target);
|
||||
break;
|
||||
}
|
||||
BugReport.class.getField(fieldNames.get(i)).set(target, fieldValues.get(i));
|
||||
}
|
||||
target.change_date = new Date().getTime();
|
||||
//3. отправляем на сервер
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.UpdateBugReport, "", target));
|
||||
server.db.Update(target);
|
||||
protected void body() throws Exception {
|
||||
getServer().db.Update(target);
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
@@ -127,7 +133,7 @@ public class UpdateBugReportField extends ComponentsRepositoryPass<BugReport> {
|
||||
);
|
||||
Global.mainModule.getPass(PassCode.Email).Do(
|
||||
message,
|
||||
server.db.subscribers.checkRecipients(target.getRecipients())
|
||||
getServer().db.subscribers.checkRecipients(target.getRecipients())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user