35 lines
1.0 KiB
Java
35 lines
1.0 KiB
Java
package _VisualDVM.Passes.All;
|
|
import _VisualDVM.Passes.Server.ComponentsServerPass;
|
|
import _VisualDVM.Repository.EmailMessage;
|
|
import _VisualDVM.Repository.Server.ServerCode;
|
|
|
|
import java.util.Vector;
|
|
public class Email extends ComponentsServerPass<EmailMessage> {
|
|
Vector<String> recipients;
|
|
@Override
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
recipients = null;
|
|
if (args.length<=1) {
|
|
return false;
|
|
}
|
|
target = (EmailMessage) args[0];
|
|
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 void body() throws Exception {
|
|
SendRequest(ServerCode.EmailBroadcast, String.join("\n",recipients), target);
|
|
}
|
|
}
|
|
|