рефакторинг адресатов баг репортов
This commit is contained in:
@@ -1,19 +1,41 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import _VisualDVM.ComponentsServer.BugReport.Json.RecipientsJson;
|
||||
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
|
||||
import _VisualDVM.ComponentsServer.ComponentsServer;
|
||||
import _VisualDVM.ComponentsServer.Recipient.Recipient;
|
||||
import _VisualDVM.Global;
|
||||
public class SaveBugReportRecipients extends UpdateBugReportField {
|
||||
import _VisualDVM.Passes.Server.EditServerObject;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class SaveBugReportRecipients extends EditServerObject<ComponentsServer, BugReport> {
|
||||
public SaveBugReportRecipients() {
|
||||
super(Global.componentsServer, BugReport.class);
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/Common/icons/Save.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart("packedRecipientsJson",
|
||||
Utils_.gson.toJson(new RecipientsJson(Global.componentsServer.db.recipients.getUI().getSelectedItems())));
|
||||
if (server.db.bugReports.getUI().CheckCurrent(Log)){
|
||||
target = server.db.bugReports.getUI().getCurrent();
|
||||
target.recipients = new Vector<>();
|
||||
for (Recipient recipient: server.db.recipients.getUI().getSelectedItems()){
|
||||
target.recipients.add(new BugReportRecipient(recipient.email));
|
||||
}
|
||||
switch (target.state){
|
||||
case draft:
|
||||
break;
|
||||
default:
|
||||
for (BugReportRecipient recipient: target.recipients)
|
||||
recipient.bugreport_id = target.id;
|
||||
target.change_date = new Date().getTime();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user