продолжение рефакторинга рассылки и исправление анимации
v++
This commit is contained in:
@@ -84,8 +84,9 @@ public class AppendBugReportField extends ComponentsRepositoryPass<BugReport> {
|
||||
message_header + " " + Utils_.Brackets(Global.mainModule.getAccount().name),
|
||||
message_text
|
||||
);
|
||||
for (String address: target.getRecipients()) {
|
||||
Global.mainModule.getPass(PassCode.CheckedEmail).Do(message, address);
|
||||
}
|
||||
Global.mainModule.getPass(PassCode.Email).Do(
|
||||
message,
|
||||
server.db.subscribers.checkRecipients(target.getRecipients())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Repository.Subscribes.Subscriber;
|
||||
//http://java-online.ru/javax-mail.xhtml
|
||||
//https://javarush.ru/groups/posts/1226-kak-otpravitjh-pisjhmo-iz-java-prilozhenija-s-primerom
|
||||
public class CheckedEmail extends Email {
|
||||
//отправляет с учетом включения рассылки у подписчика.
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (super.canStart(args)) {
|
||||
if (server.db.subscribers.containsKey(address)) {
|
||||
Subscriber subscriber = server.db.subscribers.get(address);
|
||||
if (subscriber.mailOn != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,29 @@ import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
||||
import _VisualDVM.Repository.EmailMessage;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
|
||||
import java.util.Vector;
|
||||
public class Email extends ComponentsRepositoryPass<EmailMessage> {
|
||||
protected String address;
|
||||
Vector<String> recipients;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
recipients = null;
|
||||
if (args.length<=1) {
|
||||
return false;
|
||||
}
|
||||
target = (EmailMessage) args[0];
|
||||
address = (String) args[1];
|
||||
return true;
|
||||
if (args[1]instanceof Vector) {
|
||||
recipients = (Vector<String>) args[1];
|
||||
return true;
|
||||
}
|
||||
else if (args[1] instanceof String){
|
||||
recipients= new Vector<>();
|
||||
for (int i=1; i< args.length; ++i){
|
||||
recipients.add((String) args[i]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected int getTimeout() {
|
||||
@@ -17,6 +33,12 @@ public class Email extends ComponentsRepositoryPass<EmailMessage> {
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.Email, address, target));
|
||||
int i = 0;
|
||||
for (String address : recipients) {
|
||||
ShowProgress(recipients.size(), i, true);
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.Email, address, target));
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,9 +65,10 @@ public class PublishBugReport extends Pass<BugReport> {
|
||||
message.addAttachement(screen);
|
||||
}
|
||||
}
|
||||
for (String address: target.getRecipients()) {
|
||||
Global.mainModule.getPass(PassCode.CheckedEmail).Do(message, address);
|
||||
}
|
||||
Global.mainModule.getPass(PassCode.Email).Do(
|
||||
message,
|
||||
Global.componentsServer.db.subscribers.checkRecipients(target.getRecipients())
|
||||
);
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
@@ -12,10 +11,8 @@ import _VisualDVM.Repository.EmailMessage;
|
||||
import _VisualDVM.Repository.RepositoryServer;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Repository.Subscribes.Subscriber;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class PublishComponent extends ComponentsRepositoryPass<Component> {
|
||||
String version_mail_header = "";
|
||||
String version_text = "";
|
||||
@@ -111,20 +108,7 @@ public class PublishComponent extends ComponentsRepositoryPass<Component> {
|
||||
if (f.fields.cbForceMail.isSelected())
|
||||
message.addAttachement(target.getFile());
|
||||
//--
|
||||
Vector<String> mails = new Vector<>();
|
||||
//--
|
||||
for (Subscriber subscriber : Global.componentsServer.db.subscribers.Data.values()) {
|
||||
if ((subscriber.mailOn != 0) && !mails.contains(subscriber.address))
|
||||
mails.add(subscriber.address);
|
||||
}
|
||||
for (String admin_mail : Constants.admins_mails) {
|
||||
if (!mails.contains(admin_mail))
|
||||
mails.add(admin_mail);
|
||||
}
|
||||
//--
|
||||
for (String mail : mails) {
|
||||
Global.mainModule.getPass(PassCode.Email).Do(message, mail);
|
||||
}
|
||||
Global.mainModule.getPass(PassCode.Email).Do(message, Global.componentsServer.db.subscribers.getActiveSubscribers());
|
||||
//---
|
||||
if (target.getComponentType().equals(ComponentType.Sapfor_F) && f.fields.cbAssemblyOnServer.isSelected()) {
|
||||
Global.mainModule.getUI().getMainWindow().FocusTesting();
|
||||
|
||||
@@ -125,9 +125,10 @@ public class UpdateBugReportField extends ComponentsRepositoryPass<BugReport> {
|
||||
message_header + " " + Utils_.Brackets(Global.mainModule.getAccount().name),
|
||||
message_text
|
||||
);
|
||||
for (String address : target.getRecipients()) {
|
||||
Global.mainModule.getPass(PassCode.CheckedEmail).Do(message, address);
|
||||
}
|
||||
Global.mainModule.getPass(PassCode.Email).Do(
|
||||
message,
|
||||
server.db.subscribers.checkRecipients(target.getRecipients())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user