рефакторинг публикации компонентов

This commit is contained in:
2025-02-03 23:04:40 +03:00
parent 458e250b5c
commit 26434b21ab
11 changed files with 192 additions and 85 deletions

View File

@@ -15,6 +15,7 @@ public class AppendBugReportField extends ClientPass<ComponentsServer, BugReport
String oldValue;
String addition;
String newValue;
BugReport actual;
@Override
public String getIconPath() {
return "/icons/Append.png";
@@ -23,15 +24,13 @@ public class AppendBugReportField extends ClientPass<ComponentsServer, BugReport
public String getButtonText() {
return "";
}
protected boolean canUpdate() {
return target.canModify(Global.mainModule.getAccount(), Log);
}
@Override
protected ComponentsServer getServer() {
return Global.componentsServer;
}
@Override
protected boolean canStart(Object... args) throws Exception {
actual = null;
if (getServer().db.getTable(BugReport.class).getUI().CheckCurrent(Log)) {
target = getServer().db.getTable(BugReport.class).getUI().getCurrent();
if (!target.CheckNotDraft(Log))
@@ -45,13 +44,18 @@ public class AppendBugReportField extends ClientPass<ComponentsServer, BugReport
addition = Utils_.Brackets(Utils_.print_date(
new Date())) + " " + Global.mainModule.getAccount().name
+ " : " + addition;
return canUpdate();
if (canUpdate() && (SendRequest(ServerCode.AppendBugReportTextField, "", new BugReportAdditionJson(target, fieldName, addition)))) {
actual = (BugReport) request.target;
return true;
}
}
return false;
}
protected boolean canUpdate() {
return target.canModify(Global.mainModule.getAccount(), Log);
}
@Override
protected void body() throws Exception {
BugReport actual = (BugReport) getServer().ClientRequest(ServerCode.AppendBugReportTextField, "", new BugReportAdditionJson(target, fieldName, addition));
target.SynchronizeFields(actual);
Global.componentsServer.db.Update(target);
}