Skip to content
Snippets Groups Projects
Commit a263ab9f authored by buczekp's avatar buczekp
Browse files

[LMS-2301] improvements for sending emails

SVN: 21930
parent 3896fa99
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,10 @@ public class EmailSender implements IEmailSender
public IEmailSender withAttachedFile(String filePath, String attachmentName)
{
if (attachmentName == null)
{
throw new IllegalArgumentException("Unspecified attachment name.");
}
if (attachmentTextOrNull != null)
{
throw new IllegalStateException("Attachment text was already set.");
......@@ -75,6 +79,10 @@ public class EmailSender implements IEmailSender
public IEmailSender withAttachedText(String text, String attachmentName)
{
if (attachmentName == null)
{
throw new IllegalArgumentException("Unspecified attachment name.");
}
if (attachmentFilePathOrNull != null)
{
throw new IllegalStateException("Attachment file path was already set.");
......@@ -84,6 +92,14 @@ public class EmailSender implements IEmailSender
return this;
}
@Override
public String toString()
{
return "EmailSender [subject=" + subject + ", bodyText=" + bodyText
+ ", attachmentNameOrNull=" + attachmentNameOrNull + ", attachmentFilePathOrNull="
+ attachmentFilePathOrNull + ", attachmentTextOrNull=" + attachmentTextOrNull + "]";
}
// sender
public void send()
......
......@@ -138,7 +138,7 @@ class PluginScriptRunner
private static ISearchService createSearchService()
{
return ServiceProvider.getSearchServiceProvider();
return ServiceProvider.getSearchService();
}
private static IMailService createMailService(DataSetProcessingContext context)
......
......@@ -28,9 +28,9 @@ public interface IEmailSender
IEmailSender withBody(String bodyText);
IEmailSender withAttachedFile(String attachmentFilePath, String attachmentName);
IEmailSender withAttachedFile(String attachmentFilePath, String attachmentFileName);
IEmailSender withAttachedText(String attachmentText, String attachmentName);
IEmailSender withAttachedText(String attachmentText, String attachmentFileName);
void send();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment