Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/AbstractAtsNotificationService.java9
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/OseeEmailCreator.java24
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/SendNotificationEvents.java7
-rw-r--r--plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/notify/AtsNotificationServiceImpl.java2
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/notify/AtsNotificationServiceImpl.java2
5 files changed, 35 insertions, 9 deletions
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/AbstractAtsNotificationService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/AbstractAtsNotificationService.java
index 0a1c4307ee9..c178dfe3e68 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/AbstractAtsNotificationService.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/AbstractAtsNotificationService.java
@@ -36,7 +36,7 @@ import org.eclipse.osee.framework.jdk.core.util.Strings;
/**
* @author Donald G. Dunne
*/
-public abstract class AbstractAtsNotificationService implements IAtsNotificationService {
+public abstract class AbstractAtsNotificationService implements IAtsNotificationService, OseeEmailCreator {
private volatile boolean emailEnabled = true;
protected AtsApi atsApi;
@@ -134,8 +134,8 @@ public abstract class AbstractAtsNotificationService implements IAtsNotification
@Override
public void sendNotifications(String fromUserEmail, String testingUserEmail, String subject, String body, Collection<? extends AtsNotificationEvent> notificationEvents) {
- SendNotificationEvents job = new SendNotificationEvents(createOseeEmail(), atsApi, fromUserEmail,
- testingUserEmail, subject, body, notificationEvents, atsApi.getUserService());
+ SendNotificationEvents job = new SendNotificationEvents(this, atsApi, fromUserEmail, testingUserEmail, subject,
+ body, notificationEvents, atsApi.getUserService());
job.run();
}
@@ -163,7 +163,8 @@ public abstract class AbstractAtsNotificationService implements IAtsNotification
}
}
- protected abstract OseeEmail createOseeEmail();
+ @Override
+ public abstract OseeEmail createOseeEmail();
private String getFromUserEmail(AtsNotificationCollector notifications) {
String email = atsApi.getConfigValue("NoReplyEmail");
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/OseeEmailCreator.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/OseeEmailCreator.java
new file mode 100644
index 00000000000..3911d278cd1
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/OseeEmailCreator.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2022 Boeing.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.core.notify;
+
+import org.eclipse.osee.framework.core.util.OseeEmail;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface OseeEmailCreator {
+
+ public OseeEmail createOseeEmail();
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/SendNotificationEvents.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/SendNotificationEvents.java
index 2b25d936ce9..1a540240151 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/SendNotificationEvents.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/SendNotificationEvents.java
@@ -40,12 +40,12 @@ public class SendNotificationEvents {
private final String body;
private final String fromUserEmail;
private final String testingUserEmail;
- private final OseeEmail oseeEmail;
+ private final OseeEmailCreator oseeEmailCreator;
private final AtsApi atsApi;
private final IAtsUserService userService;
- public SendNotificationEvents(OseeEmail oseeEmail, AtsApi atsApi, String fromUserEmail, String testingUserEmail, String subject, String body, Collection<? extends AtsNotificationEvent> notificationEvents, IAtsUserService userService) {
- this.oseeEmail = oseeEmail;
+ public SendNotificationEvents(OseeEmailCreator oseeEmailCreator, AtsApi atsApi, String fromUserEmail, String testingUserEmail, String subject, String body, Collection<? extends AtsNotificationEvent> notificationEvents, IAtsUserService userService) {
+ this.oseeEmailCreator = oseeEmailCreator;
this.atsApi = atsApi;
this.userService = atsApi.getUserService();
this.fromUserEmail = fromUserEmail;
@@ -187,6 +187,7 @@ public class SendNotificationEvents {
System.out.println(String.format("useFromEmail [%s]", useFromEmail));
try {
+ OseeEmail oseeEmail = oseeEmailCreator.createOseeEmail();
oseeEmail.setFrom(useFromEmail);
oseeEmail.setSubject(getNotificationEmailSubject(notificationEvents));
oseeEmail.setHTMLBody(html);
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/notify/AtsNotificationServiceImpl.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/notify/AtsNotificationServiceImpl.java
index 68224c37247..5d1b9cdb211 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/notify/AtsNotificationServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/notify/AtsNotificationServiceImpl.java
@@ -27,7 +27,7 @@ public class AtsNotificationServiceImpl extends AbstractAtsNotificationService {
}
@Override
- protected OseeEmail createOseeEmail() {
+ public OseeEmail createOseeEmail() {
return OseeEmailIde.create();
}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/notify/AtsNotificationServiceImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/notify/AtsNotificationServiceImpl.java
index 3c14d3aa9fd..8dfda5aa86a 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/notify/AtsNotificationServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/notify/AtsNotificationServiceImpl.java
@@ -27,7 +27,7 @@ public class AtsNotificationServiceImpl extends AbstractAtsNotificationService {
}
@Override
- protected OseeEmail createOseeEmail() {
+ public OseeEmail createOseeEmail() {
return OseeEmailServer.create();
}

Back to the top