Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/AtsJaxRsApi.java (renamed from plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/INotificationManager.java)21
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/IAtsWorkItem.java4
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigEndpointApi.java56
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationCollector.java66
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationEvent.java60
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationEventFactory.java78
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotifyEndpointApi.java27
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotifyType.java1
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsWorkItemNotificationEvent.java59
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/IAtsNotificationService.java34
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/IAtsNotifier.java (renamed from plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/IAtsNotificationServiceProvider.java)11
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/review/UserRole.java5
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/IAtsUserService.java2
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsChangeSet.java3
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateFactory.java3
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsCoreClient_Suite.java2
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsCoreClient_Notify_Suite.java35
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsNotificationManagerTest.java615
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsNotifyUsersTest.java285
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/MockNotificationManager.java45
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/util/DbInitTest.java5
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/OSGI-INF/ats.notify.service.xml8
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java6
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/action/ActionManager.java8
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/Activator.java19
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java19
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsJaxRsService.java37
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/notify/AtsNotificationServiceImpl.java77
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/notify/AtsNotificationManager.java160
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/notify/AtsNotifyUsers.java141
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/AbstractReviewArtifact.java6
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/role/UserRoleManager.java44
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/util/AtsChangeSet.java7
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java15
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/state/StateManagerStoreTest.java34
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkItem.java10
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/HoursSpentUtilTest.java3
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/workflow/state/StateManagerUtilityTest.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.ats.core/OSGI-INF/ats.core.service.xml1
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/AtsCoreService.java15
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/AtsStateFactory.java12
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManagerStore.java19
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/UserRoleManager.java84
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AbstractAtsUserService.java6
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsUsersUtility.java9
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsChangeSet.java9
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsCoreFactory.java5
-rw-r--r--plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.no.op.notifier.service.xml7
-rw-r--r--plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.notification.service.xml8
-rw-r--r--plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.server.service.xml2
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/IAtsServer.java12
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/AtsServerImpl.java56
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNoOpNotifierServiceImpl.java25
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNotificationEventProcessor.java59
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNotifierServiceImpl.java38
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/IAtsNotifierServer.java23
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/SendNotificationEvents.java157
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/WorkItemNotificationProcessor.java259
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsChangeSet.java3
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsNotificationServiceImpl.java57
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/WorkItem.java10
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java4
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsConfigEndpointImpl.java (renamed from plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ConfigResource.java)70
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsEndpointImpl.java49
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsNotifyEndpointImpl.java42
-rw-r--r--plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/stateItem/AtsPeerToPeerReviewReviewStateItem.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/NavigateView.java13
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/ArtifactEmailWizard.java23
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/AtsNotificationTransitionListener.java11
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/EmailActionsBlam.java38
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java8
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java6
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleLabelProvider.java14
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewer.java6
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/XUserRoleViewer.java4
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerReviewRoleColumn.java2
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/EmailGroup.java (renamed from plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/email/EmailGroup.java)10
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/EmailUtil.java (renamed from plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/IAtsNotificationListener.java)17
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/OseeNotificationEvent.java79
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationManager.java92
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotifyUsersJob.java150
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailWizard.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailWizardPage.java2
-rw-r--r--plugins/org.eclipse.osee.mail/OSGI-INF/mail.jaxrs.application.xml2
-rw-r--r--plugins/org.eclipse.osee.mail/OSGI-INF/mail.service.xml6
92 files changed, 1447 insertions, 2110 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF
index 58e6cd3d8b3..e0718a8ece0 100644
--- a/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF
@@ -26,7 +26,9 @@ Export-Package: org.eclipse.osee.ats.api,
org.eclipse.osee.ats.api.workflow.log,
org.eclipse.osee.ats.api.workflow.state,
org.eclipse.osee.ats.api.workflow.transition
-Import-Package: org.eclipse.osee.framework.core.data,
+Import-Package: javax.ws.rs;version="2.0.0",
+ javax.ws.rs.core;version="2.0.0",
+ org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.util,
org.eclipse.osee.framework.jdk.core.type,
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/INotificationManager.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/AtsJaxRsApi.java
index d93c1b42016..ad1e45f1855 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/INotificationManager.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/AtsJaxRsApi.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Boeing.
+ * Copyright (c) 2014 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,22 +8,21 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.skynet.core.utility;
+package org.eclipse.osee.ats.api;
-import java.util.List;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import javax.ws.rs.Path;
+import org.eclipse.osee.ats.api.config.AtsConfigEndpointApi;
+import org.eclipse.osee.ats.api.notify.AtsNotifyEndpointApi;
/**
* @author Donald G. Dunne
*/
-public interface INotificationManager {
+public interface AtsJaxRsApi {
- public void addNotificationEvent(OseeNotificationEvent notificationEvent);
+ @Path("notify")
+ public AtsNotifyEndpointApi getNotify();
- public void clear();
-
- public List<OseeNotificationEvent> getNotificationEvents();
-
- public void sendNotifications() throws OseeCoreException;
+ @Path("config")
+ public AtsConfigEndpointApi getConfig();
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/IAtsWorkItem.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/IAtsWorkItem.java
index e7e42c7ba07..8d622d32fc5 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/IAtsWorkItem.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/IAtsWorkItem.java
@@ -60,4 +60,8 @@ public interface IAtsWorkItem extends IAtsObject, HasAssignees {
Date getCompletedDate();
+ Date getCancelledDate();
+
+ String getCancelledReason();
+
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigEndpointApi.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigEndpointApi.java
new file mode 100644
index 00000000000..637f0a1fe38
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigEndpointApi.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.api.config;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
+
+/**
+ * @author Donald G. Dunne
+ */
+@Path("config")
+public interface AtsConfigEndpointApi {
+
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public AtsConfigurations get();
+
+ /**
+ * @return html5 action entry page
+ */
+ @Path("ui/NewAtsBranchConfig")
+ @GET
+ @Produces(MediaType.TEXT_HTML)
+ public String getNewSource();
+
+ /**
+ * Create new ATS configuration branch and ATS config object on Common branch
+ *
+ * @param form containing information to configure new ATS branch
+ * @param form.fromBranchUuid of branch to get config artifacts from
+ * @param form.newBranchName of new branch
+ * @param form.userId - userId of user performing transition
+ * @param uriInfo
+ * @return json object with new branchUuid
+ */
+ @POST
+ @Consumes("application/x-www-form-urlencoded")
+ @Produces(MediaType.APPLICATION_JSON)
+ public AtsConfiguration createConfig(MultivaluedMap<String, String> form, @Context UriInfo uriInfo);
+
+}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationCollector.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationCollector.java
new file mode 100644
index 00000000000..fda0acaf767
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationCollector.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.api.notify;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Stores notification events generated by the framework or applications. Currently, send happens upon call to
+ * sendNotifications(). Eventually, a timer will kick the send event at certain intervals. This mechanism allows for
+ * notifications to be collected for a certain period of time and rolled into a single notification. This will
+ * eventually also support other types of notifications such as popups and allow the user to configure which events are
+ * sent and how.
+ *
+ * @author Donald G. Dunne
+ */
+@XmlRootElement
+public class AtsNotificationCollector {
+
+ private String subject, body;
+ private final List<AtsNotificationEvent> notificationEvents = new ArrayList<AtsNotificationEvent>();
+ private final List<AtsWorkItemNotificationEvent> workItemNotificationEvents =
+ new ArrayList<AtsWorkItemNotificationEvent>();
+
+ public void addNotificationEvent(AtsNotificationEvent notificationEvent) {
+ notificationEvents.add(notificationEvent);
+ }
+
+ public List<AtsNotificationEvent> getNotificationEvents() {
+ return notificationEvents;
+ }
+
+ public void addWorkItemNotificationEvent(AtsWorkItemNotificationEvent workItemNotificationEvent) {
+ workItemNotificationEvents.add(workItemNotificationEvent);
+ }
+
+ public List<AtsWorkItemNotificationEvent> getWorkItemNotificationEvents() {
+ return workItemNotificationEvents;
+ }
+
+ public String getSubject() {
+ return subject;
+ }
+
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+
+ public String getBody() {
+ return body;
+ }
+
+ public void setBody(String body) {
+ this.body = body;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationEvent.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationEvent.java
index 5a846b2a0c1..0b72ba91429 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationEvent.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationEvent.java
@@ -11,36 +11,22 @@
package org.eclipse.osee.ats.api.notify;
import java.util.Collection;
-import org.eclipse.osee.ats.api.user.IAtsUser;
+import java.util.HashSet;
+import javax.xml.bind.annotation.XmlRootElement;
/**
* @author Donald G. Dunne
*/
+@XmlRootElement
public class AtsNotificationEvent {
- private Collection<IAtsUser> users;
- private final String id;
+ private Collection<String> userIds = new HashSet<String>();
+ private String id;
+ private String fromUserId;
private String type;
private String description;
private String url;
- public AtsNotificationEvent(Collection<IAtsUser> users, String id, String type, String description) {
- this.users = users;
- this.id = id;
- this.type = type;
- this.description = description;
- }
-
- public AtsNotificationEvent(Collection<IAtsUser> users, String id, String type, String description, String url) {
- this(users, id, type, description);
- this.url = url;
- }
-
- @Override
- public String toString() {
- return type + " - " + id + " - " + users + " - " + description;
- }
-
public String getId() {
return id;
}
@@ -53,14 +39,6 @@ public class AtsNotificationEvent {
return description;
}
- public Collection<IAtsUser> getUsers() {
- return users;
- }
-
- public void setUsers(Collection<IAtsUser> users) {
- this.users = users;
- }
-
public void setDescription(String description) {
this.description = description;
}
@@ -76,4 +54,30 @@ public class AtsNotificationEvent {
public void setUrl(String url) {
this.url = url;
}
+
+ public Collection<String> getUserIds() {
+ return userIds;
+ }
+
+ public void setUserIds(Collection<String> userIds) {
+ this.userIds = userIds;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getFromUserId() {
+ return fromUserId;
+ }
+
+ public void setFromUserId(String fromUserId) {
+ this.fromUserId = fromUserId;
+ }
+
+ @Override
+ public String toString() {
+ return "AtsNotificationEvent [userIds=" + userIds + ", id=" + id + ", fromUserId=" + fromUserId + ", type=" + type + ", description=" + description + "]";
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationEventFactory.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationEventFactory.java
new file mode 100644
index 00000000000..ed1ac7271d6
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotificationEventFactory.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.api.notify;
+
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
+import org.eclipse.osee.ats.api.user.IAtsUser;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsNotificationEventFactory {
+
+ public static AtsNotificationEvent getNotificationEvent(IAtsUser fromUser, Collection<IAtsUser> users, String id, String type, String description) {
+ AtsNotificationEvent event = new AtsNotificationEvent();
+ event.setType(type);
+ event.setId(id);
+ event.setDescription(description);
+ event.setFromUserId(fromUser.getUserId());
+ for (IAtsUser user : users) {
+ event.getUserIds().add(user.getUserId());
+ }
+ return event;
+ }
+
+ public static AtsNotificationEvent getNotificationEvent(IAtsUser fromUser, Collection<IAtsUser> users, String id, String type, String url, String description) {
+ AtsNotificationEvent event = getNotificationEvent(fromUser, users, id, type, description);
+ event.setUrl(url);
+ return event;
+ }
+
+ public static AtsNotificationEvent getNotificationEventFactory(IAtsUser fromUser, Collection<IAtsUser> users, String id, String type, String description, String url) {
+ AtsNotificationEvent event = getNotificationEvent(fromUser, users, id, type, description);
+ event.setUrl(url);
+ return event;
+ }
+
+ public static AtsNotificationEvent getNotificationEventByUserIds(IAtsUser fromUser, Collection<String> userIds, String id, String type, String description) {
+ AtsNotificationEvent event = new AtsNotificationEvent();
+ event.setType(type);
+ event.setId(id);
+ event.setDescription(description);
+ event.getUserIds().addAll(userIds);
+ event.setFromUserId(fromUser.getUserId());
+ return event;
+ }
+
+ public static AtsNotificationEvent getNotificationEventByUserIds(IAtsUser fromUser, Collection<String> userIds, String id, String type, String description, String url) {
+ AtsNotificationEvent event = getNotificationEventByUserIds(fromUser, userIds, id, type, description);
+ event.setUrl(url);
+ return event;
+ }
+
+ public static AtsWorkItemNotificationEvent getWorkItemNotificationEvent(IAtsUser fromUser, IAtsWorkItem workItem, List<IAtsUser> users, AtsNotifyType... notifyType) {
+ AtsWorkItemNotificationEvent event = getWorkItemNotificationEvent(fromUser, workItem, notifyType);
+ for (IAtsUser user : users) {
+ event.getUserIds().add(user.getUserId());
+ }
+ return event;
+ }
+
+ public static AtsWorkItemNotificationEvent getWorkItemNotificationEvent(IAtsUser fromUser, IAtsWorkItem workItem, AtsNotifyType... notifyType) {
+ AtsWorkItemNotificationEvent event = new AtsWorkItemNotificationEvent();
+ event.setFromUserId(fromUser.getUserId());
+ event.getAtsIds().add(workItem.getAtsId());
+ event.setNotifyType(notifyType);
+ return event;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotifyEndpointApi.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotifyEndpointApi.java
new file mode 100644
index 00000000000..834de44dd8d
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotifyEndpointApi.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.api.notify;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface AtsNotifyEndpointApi {
+
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Response sendNotifications(AtsNotificationCollector notifications);
+
+}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotifyType.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotifyType.java
index 838fcf427bc..3847bfdb359 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotifyType.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsNotifyType.java
@@ -17,4 +17,5 @@ public enum AtsNotifyType {
Assigned, // New assignee added, notify assignee
Originator, // Originator Changed, notify new originator
Peer_Reviewers_Completed, // Review has been completed , notify authors and moderators
+ SubscribedTeamOrAi // Subscribed to get email of action written against team or ai
};
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsWorkItemNotificationEvent.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsWorkItemNotificationEvent.java
new file mode 100644
index 00000000000..1ba10c538c0
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/AtsWorkItemNotificationEvent.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.api.notify;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Donald G. Dunne
+ */
+@XmlRootElement
+public class AtsWorkItemNotificationEvent {
+
+ private String fromUserId;
+ private final Collection<String> userIds = new HashSet<String>();
+ private final Collection<String> atsIds = new HashSet<String>();
+ private final Set<AtsNotifyType> notifyTypes = new HashSet<AtsNotifyType>();
+
+ public Collection<String> getAtsIds() {
+ return atsIds;
+ }
+
+ public Collection<String> getUserIds() {
+ return userIds;
+ }
+
+ public void setNotifyType(AtsNotifyType... notifyTypes) {
+ for (AtsNotifyType type : notifyTypes) {
+ this.notifyTypes.add(type);
+ }
+ }
+
+ public Set<AtsNotifyType> getNotifyTypes() {
+ return notifyTypes;
+ }
+
+ public String getFromUserId() {
+ return fromUserId;
+ }
+
+ public void setFromUserId(String fromUserId) {
+ this.fromUserId = fromUserId;
+ }
+
+ @Override
+ public String toString() {
+ return "AtsWorkItemNotificationEvent [fromUserId=" + fromUserId + ", userIds=" + userIds + ", atsIds=" + atsIds + ", notifyTypes=" + notifyTypes + "]";
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/IAtsNotificationService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/IAtsNotificationService.java
deleted file mode 100644
index 36a848bc58d..00000000000
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/IAtsNotificationService.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.api.notify;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.osee.ats.api.IAtsWorkItem;
-import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IAtsNotificationService {
-
- public void addNotificationEvent(AtsNotificationEvent notificationEvent) throws OseeCoreException;
-
- public void clear();
-
- public List<AtsNotificationEvent> getNotificationEvents() throws OseeCoreException;
-
- public void sendNotifications();
-
- public void notify(IAtsWorkItem workItem, Collection<? extends IAtsUser> notifyUsers, AtsNotifyType... notifyTypes) throws OseeCoreException;
-
-}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/IAtsNotificationServiceProvider.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/IAtsNotifier.java
index 731cdccdd50..6c095328de1 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/IAtsNotificationServiceProvider.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/notify/IAtsNotifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Boeing.
+ * Copyright (c) 2014 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,12 +10,11 @@
*******************************************************************************/
package org.eclipse.osee.ats.api.notify;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-
/**
- * @author Donald G Dunne
+ * @author Donald G. Dunne
*/
-public interface IAtsNotificationServiceProvider {
+public interface IAtsNotifier {
+
+ public abstract void sendNotifications(AtsNotificationCollector notifications);
- IAtsNotificationService getNotifyService() throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/review/UserRole.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/review/UserRole.java
index 67e444b5dc8..c9e5265c5f6 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/review/UserRole.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/review/UserRole.java
@@ -10,15 +10,12 @@
*******************************************************************************/
package org.eclipse.osee.ats.api.review;
-import java.rmi.activation.Activator;
import java.text.NumberFormat;
-import java.util.logging.Level;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.AXml;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
/**
* @author Donald G. Dunne
@@ -86,7 +83,7 @@ public class UserRole {
}
this.guid = AXml.getTagData(xml, "guid");
} catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
+ throw new OseeCoreException("Can't parse User Role", ex);
}
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/IAtsUserService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/IAtsUserService.java
index 57fb97fb0a1..877bf068211 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/IAtsUserService.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/IAtsUserService.java
@@ -46,4 +46,6 @@ public interface IAtsUserService {
boolean currentUserHasAccessToAtsBranch(Long branchUuid);
+ void releaseUser();
+
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsChangeSet.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsChangeSet.java
index 99a1ba10d46..c63fa285548 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsChangeSet.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsChangeSet.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.ats.api.util;
import java.util.Collection;
import org.eclipse.osee.ats.api.IAtsObject;
import org.eclipse.osee.ats.api.IAtsWorkItem;
+import org.eclipse.osee.ats.api.notify.AtsNotificationCollector;
import org.eclipse.osee.ats.api.workflow.IAttribute;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
@@ -64,4 +65,6 @@ public interface IAtsChangeSet {
void relate(Object object1, IRelationTypeSide relationSide, Object object2);
+ AtsNotificationCollector getNotifications();
+
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateFactory.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateFactory.java
index cf1bf3d930f..30a794e5b38 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateFactory.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateFactory.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.ats.api.workflow.state;
import org.eclipse.osee.ats.api.IAtsWorkItem;
+import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -23,7 +24,7 @@ public interface IAtsStateFactory {
IAtsStateManager getStateManager(IAtsWorkItem workItem, boolean load);
- void writeToStore(IAtsWorkItem workItem, IAtsChangeSet changes) throws OseeCoreException;
+ void writeToStore(IAtsUser atsUser, IAtsWorkItem workItem, IAtsChangeSet changes) throws OseeCoreException;
void load(IAtsWorkItem workItem, IAtsStateManager stateMgr);
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsCoreClient_Suite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsCoreClient_Suite.java
index a2199dc7dbc..097740919d5 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsCoreClient_Suite.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsCoreClient_Suite.java
@@ -13,7 +13,6 @@ package org.eclipse.osee.ats.client.integration.tests.ats.core.client;
import org.eclipse.osee.ats.client.integration.tests.ats.core.client.action.AtsCoreClient_Action_Suite;
import org.eclipse.osee.ats.client.integration.tests.ats.core.client.branch.AtsCoreClient_Branch_Suite;
import org.eclipse.osee.ats.client.integration.tests.ats.core.client.config.AtsCoreClient_Config_Suite;
-import org.eclipse.osee.ats.client.integration.tests.ats.core.client.notify.AtsCoreClient_Notify_Suite;
import org.eclipse.osee.ats.client.integration.tests.ats.core.client.operation.AtsCoreClient_Operation_Suite;
import org.eclipse.osee.ats.client.integration.tests.ats.core.client.review.AtsCoreClient_Review_Suite;
import org.eclipse.osee.ats.client.integration.tests.ats.core.client.task.AtsCoreClient_Task_Suite;
@@ -34,7 +33,6 @@ import org.junit.runners.Suite;
AtsCoreClient_Action_Suite.class,
AtsCoreClient_Branch_Suite.class,
AtsCoreClient_Config_Suite.class,
- AtsCoreClient_Notify_Suite.class,
AtsCoreClient_Operation_Suite.class,
AtsCoreClient_Review_Suite.class,
AtsCoreClient_Task_Suite.class,
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsCoreClient_Notify_Suite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsCoreClient_Notify_Suite.java
deleted file mode 100644
index 17458d0e4a2..00000000000
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsCoreClient_Notify_Suite.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.client.integration.tests.ats.core.client.notify;
-
-import org.eclipse.osee.framework.jdk.core.util.OseeProperties;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * @author Donald G. Dunne
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({AtsNotifyUsersTest.class, AtsNotificationManagerTest.class})
-public class AtsCoreClient_Notify_Suite {
- @BeforeClass
- public static void setUp() throws Exception {
- OseeProperties.setIsInTest(true);
- System.out.println("\n\nBegin " + AtsCoreClient_Notify_Suite.class.getSimpleName());
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
- System.out.println("End " + AtsCoreClient_Notify_Suite.class.getSimpleName());
- }
-}
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsNotificationManagerTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsNotificationManagerTest.java
deleted file mode 100644
index 15f7b4901ec..00000000000
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsNotificationManagerTest.java
+++ /dev/null
@@ -1,615 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.client.integration.tests.ats.core.client.notify;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import org.eclipse.osee.ats.api.data.AtsRelationTypes;
-import org.eclipse.osee.ats.api.review.Role;
-import org.eclipse.osee.ats.api.review.UserRole;
-import org.eclipse.osee.ats.api.team.ChangeType;
-import org.eclipse.osee.ats.api.workdef.ReviewBlockType;
-import org.eclipse.osee.ats.api.workflow.transition.TransitionOption;
-import org.eclipse.osee.ats.client.demo.DemoUsers;
-import org.eclipse.osee.ats.client.integration.tests.AtsClientService;
-import org.eclipse.osee.ats.client.integration.tests.ats.core.client.AtsTestUtil;
-import org.eclipse.osee.ats.client.integration.tests.ats.core.client.AtsTestUtil.AtsTestUtilState;
-import org.eclipse.osee.ats.core.client.action.ActionArtifact;
-import org.eclipse.osee.ats.core.client.action.ActionManager;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager.ConfigurationProvider;
-import org.eclipse.osee.ats.core.client.review.PeerToPeerReviewArtifact;
-import org.eclipse.osee.ats.core.client.review.PeerToPeerReviewManager;
-import org.eclipse.osee.ats.core.client.review.PeerToPeerReviewState;
-import org.eclipse.osee.ats.core.client.review.role.UserRoleManager;
-import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.core.client.util.AtsChangeSet;
-import org.eclipse.osee.ats.core.client.util.AtsUtilClient;
-import org.eclipse.osee.ats.core.util.AtsUtilCore;
-import org.eclipse.osee.ats.core.workflow.state.TeamState;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.util.Result;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
-import org.eclipse.osee.framework.skynet.core.utility.INotificationManager;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-
-/**
- * Test unit for (@link AtsNotificationManager}
- *
- * @author Donald G. Dunne
- */
-public class AtsNotificationManagerTest {
-
- @BeforeClass
- public static void setup() {
- AtsUtilClient.setEmailEnabled(true);
- }
-
- @AfterClass
- public static void cleanup() throws OseeCoreException {
- User user = UserManager.getUser(DemoUsers.Alex_Kay);
- user.setSoleAttributeValue(CoreAttributeTypes.Email, "");
- user.deleteRelations(AtsRelationTypes.SubscribedUser_Artifact);
- user.persist(AtsNotificationManagerTest.class.getSimpleName());
-
- AtsNotificationManager.setInTest(true);
- AtsTestUtil.cleanup();
- AtsUtilClient.setEmailEnabled(false);
- }
-
- @org.junit.Test
- public void testOriginatorNotification() throws OseeCoreException {
-
- //---------------------------------------------------
- // Test that notifications sent if originator changes
- //---------------------------------------------------
-
- // create a test notification manager
- MockNotificationManager mgr = new MockNotificationManager();
- // restart notification manager with this one and set to NotInTest (cause normally, testing has notification system OFF)
- MockConfigurationProvider configProvider = new MockConfigurationProvider(mgr, true);
- AtsNotificationManager.setConfigurationProvider(configProvider);
- AtsNotificationManager.setInTest(false);
- // create new action which should reset originator cache in notification manager
- AtsTestUtil.cleanupAndReset(AtsNotificationManagerTest.class.getSimpleName());
- TeamWorkFlowArtifact teamArt = AtsTestUtil.getTeamWf();
-
- // verify no notification events yet
- Assert.assertEquals(0, mgr.getNotificationEvents().size());
-
- // set valid email for Alex_Kay
- UserManager.getUser(DemoUsers.Alex_Kay).setSoleAttributeValue(CoreAttributeTypes.Email, "alex.kay@boeing.com");
- UserManager.getUser(DemoUsers.Alex_Kay).persist(getClass().getSimpleName());
-
- // reset the originator
- AtsChangeSet changes = new AtsChangeSet("Change Originator");
- teamArt.setCreatedBy(AtsClientService.get().getUserService().getUserById(DemoUsers.Alex_Kay.getUserId()), false,
- new Date(), changes);
- // persist will kick event which will log the notification event and send
- changes.execute();
-
- // verify notification exists now
- Assert.assertEquals(1, mgr.getNotificationEvents().size());
- Assert.assertTrue(mgr.getNotificationEvents().iterator().next().getDescription().startsWith(
- "You have been set as the originator"));
-
- //---------------------------------------------------
- // Test that NO notifications sent if in test mode
- //---------------------------------------------------
-
- // reset the originator back to joe smith
- teamArt.setCreatedBy(AtsClientService.get().getUserServiceClient().getUserFromToken(DemoUsers.Joe_Smith), false,
- new Date(), changes);
- // persist will kick event which will log the notification event and send
- teamArt.persist("Change originator");
- AtsNotificationManager.setInTest(true);
- mgr.clear();
-
- // verify no notification events yet
- Assert.assertEquals(0, mgr.getNotificationEvents().size());
-
- // set valid email for Alex_Kay
- UserManager.getUser(DemoUsers.Alex_Kay).setSoleAttributeValue(CoreAttributeTypes.Email, "alex.kay@boeing.com");
- UserManager.getUser(DemoUsers.Alex_Kay).persist(getClass().getSimpleName());
-
- // reset the originator
- teamArt.setCreatedBy(AtsClientService.get().getUserServiceClient().getUserFromToken(DemoUsers.Alex_Kay), false,
- new Date(), changes);
- // persist will kick event which will log the notification event and send
- teamArt.persist("Change originator");
-
- // verify NO notification exists now
- Assert.assertEquals(0, mgr.getNotificationEvents().size());
-
- //---------------------------------------------------
- // Test that NO notifications sent if user email is invalid
- //---------------------------------------------------
-
- // reset the originator back to joe smith
- teamArt.setCreatedBy(AtsClientService.get().getUserServiceClient().getUserFromToken(DemoUsers.Joe_Smith), false,
- new Date(), changes);
- // persist will kick event which will log the notification event and send
- teamArt.persist("Change originator");
- AtsNotificationManager.setInTest(true);
- mgr.clear();
-
- // verify no notification events yet
- Assert.assertEquals(0, mgr.getNotificationEvents().size());
-
- // set invalid email for Alex_Kay
- UserManager.getUser(DemoUsers.Alex_Kay).deleteAttributes(CoreAttributeTypes.Email);
- UserManager.getUser(DemoUsers.Alex_Kay).persist(getClass().getSimpleName());
-
- // reset the originator
- teamArt.setCreatedBy(AtsClientService.get().getUserServiceClient().getUserFromToken(DemoUsers.Alex_Kay), false,
- new Date(), changes);
- // persist will kick event which will log the notification event and send
- teamArt.persist("Change originator");
-
- // verify NO notification exists now
- Assert.assertEquals(0, mgr.getNotificationEvents().size());
-
- AtsTestUtil.cleanup();
- }
-
- @org.junit.Test
- public void testAddAssigneeNotification() throws OseeCoreException {
-
- // create a test notification manager
- MockNotificationManager mgr = new MockNotificationManager();
-
- // restart notification manager with this one and set to NotInTest (cause normally, testing has notification system OFF)
- MockConfigurationProvider configProvider = new MockConfigurationProvider(mgr, true);
- AtsNotificationManager.setConfigurationProvider(configProvider);
- AtsNotificationManager.setInTest(false);
-
- // create new action
- AtsTestUtil.cleanupAndReset(AtsNotificationManagerTest.class.getSimpleName());
- TeamWorkFlowArtifact teamArt = AtsTestUtil.getTeamWf();
-
- // verify no notification events yet
- Assert.assertEquals(0, mgr.getNotificationEvents().size());
-
- // set valid email for Alex_Kay
- List<User> users = new ArrayList<User>();
- User Alex_Kay = UserManager.getUser(DemoUsers.Alex_Kay);
- Alex_Kay.setSoleAttributeValue(CoreAttributeTypes.Email, "alex.kay@boeing.com");
- users.add(Alex_Kay);
-
- User Jason_Michael = UserManager.getUser(DemoUsers.Jason_Michael);
- users.add(Jason_Michael);
-
- User Inactive_Steve = UserManager.getUser(DemoUsers.Inactive_Steve);
- Inactive_Steve.setSoleAttributeValue(CoreAttributeTypes.Email, "inactive.steve@boeing.com");
- users.add(Inactive_Steve);
-
- // current assignee shouldn't be emailed
- UserManager.getUser().setEmail("joe.smith@boeing.com");
- users.add(UserManager.getUser());
-
- teamArt.getStateMgr().addAssignees(AtsClientService.get().getUserServiceClient().getAtsUsers(users));
- AtsChangeSet.execute(getClass().getSimpleName(), teamArt);
-
- // verify notification exists now only for active, valid email Alex, not for others
- Assert.assertEquals(1, mgr.getNotificationEvents().size());
- Assert.assertTrue(mgr.getNotificationEvents().iterator().next().getDescription().startsWith(
- "You have been set as the assignee"));
- // but all 4 are now assigned
- Assert.assertEquals(4, teamArt.getStateMgr().getAssignees().size());
-
- for (User user : users) {
- user.reloadAttributesAndRelations();
- }
- AtsTestUtil.cleanup();
- }
-
- @org.junit.Test
- public void testSetAssigneeNotification() throws OseeCoreException {
-
- // create a test notification manager
- MockNotificationManager mgr = new MockNotificationManager();
- // restart notification manager with this one and set to NotInTest (cause normally, testing has notification system OFF)
- MockConfigurationProvider configProvider = new MockConfigurationProvider(mgr, true);
- AtsNotificationManager.setConfigurationProvider(configProvider);
- AtsNotificationManager.setInTest(false);
-
- // create new action
- AtsTestUtil.cleanupAndReset(AtsNotificationManagerTest.class.getSimpleName());
- TeamWorkFlowArtifact teamArt = AtsTestUtil.getTeamWf();
- Assert.assertEquals("Joe should be assigned; currently = " + teamArt.getStateMgr().getAssigneesStr(), 1,
- teamArt.getStateMgr().getAssignees().size());
-
- // set valid email for Alex_Kay and add as assignee
- User Alex_Kay = UserManager.getUser(DemoUsers.Alex_Kay);
- Alex_Kay.setSoleAttributeValue(CoreAttributeTypes.Email, "alex.kay@boeing.com");
- Alex_Kay.persist(getClass().getSimpleName());
- teamArt.getStateMgr().addAssignee(AtsClientService.get().getUserServiceClient().getUserFromOseeUser(Alex_Kay));
- teamArt.persist(getClass().getSimpleName());
- Assert.assertEquals("Alex and Joe should be assigned; currently = " + teamArt.getStateMgr().getAssigneesStr(), 2,
- teamArt.getStateMgr().getAssignees().size());
- mgr.clear();
-
- // verify no notification events yet
- Assert.assertEquals(0, mgr.getNotificationEvents().size());
-
- List<User> usersToSet = new ArrayList<User>();
- User Jason_Michael = UserManager.getUser(DemoUsers.Jason_Michael);
- Jason_Michael.setEmail("jason.michael@boeing.com");
- usersToSet.add(Jason_Michael);
-
- User Inactive_Steve = UserManager.getUser(DemoUsers.Inactive_Steve);
- Inactive_Steve.setSoleAttributeValue(CoreAttributeTypes.Email, "inactive.steve@boeing.com");
- usersToSet.add(Inactive_Steve);
-
- // current assignee and Alex_Kay shouldn't be emailed cause they were already assigned
- UserManager.getUser().setEmail("joe.smith@boeing.com");
- usersToSet.add(UserManager.getUser());
- usersToSet.add(Alex_Kay);
-
- teamArt.getStateMgr().setAssignees(AtsClientService.get().getUserServiceClient().getAtsUsers(usersToSet));
- AtsChangeSet.execute(getClass().getSimpleName(), teamArt);
-
- // verify notification exists now only for Jason_Michael, not for others
- Assert.assertEquals(1, mgr.getNotificationEvents().size());
- Assert.assertTrue(mgr.getNotificationEvents().iterator().next().getDescription().startsWith(
- "You have been set as the assignee"));
- // but all 4 are now assigned
- Assert.assertEquals(4, teamArt.getStateMgr().getAssignees().size());
-
- for (User user : usersToSet) {
- user.reloadAttributesAndRelations();
- }
- AtsTestUtil.cleanup();
- }
-
- @org.junit.Test
- public void testCompletedNotification() throws OseeCoreException {
-
- // create a test notification manager
- MockNotificationManager mgr = new MockNotificationManager();
- // restart notification manager with this one and set to NotInTest (cause normally, testing has notification system OFF)
- MockConfigurationProvider configProvider = new MockConfigurationProvider(mgr, true);
- AtsNotificationManager.setConfigurationProvider(configProvider);
- AtsNotificationManager.setInTest(false);
-
- // create new action
- AtsTestUtil.cleanupAndReset(getClass().getSimpleName());
-
- // set originator as Alex Kay
- TeamWorkFlowArtifact teamArt = AtsTestUtil.getTeamWf();
- AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName() + " - set originator");
- teamArt.setCreatedBy(AtsClientService.get().getUserServiceClient().getUserFromToken(DemoUsers.Alex_Kay), false,
- new Date(), changes);
- changes.execute();
-
- // set alex kay having valid email address
- User user = UserManager.getUser(DemoUsers.Alex_Kay);
- user.setSoleAttributeValue(CoreAttributeTypes.Email, "alex.kay@boeing.com");
- user.persist(getClass().getSimpleName() + "- set alex email address");
- mgr.clear();
-
- // verify no notification events yet
- Assert.assertEquals(0, mgr.getNotificationEvents().size());
- changes.reset(getClass().getSimpleName());
- Result result =
- AtsTestUtil.transitionTo(AtsTestUtilState.Completed, AtsClientService.get().getUserService().getCurrentUser(),
- changes, TransitionOption.OverrideAssigneeCheck, TransitionOption.OverrideTransitionValidityCheck);
- Assert.assertEquals(Result.TrueResult, result);
- Assert.assertEquals(teamArt.getCurrentStateName(), TeamState.Completed.getName());
- changes.execute();
-
- // verify notification to originator
- Assert.assertEquals(1, mgr.getNotificationEvents().size());
- Assert.assertTrue(mgr.getNotificationEvents().iterator().next().getDescription().endsWith("is [Completed]"));
-
- AtsTestUtil.cleanup();
- }
-
- @org.junit.Test
- public void testCancelledNotification() throws OseeCoreException {
-
- // create a test notification manager
- MockNotificationManager mgr = new MockNotificationManager();
- // restart notification manager with this one and set to NotInTest (cause normally, testing has notification system OFF)
- MockConfigurationProvider configProvider = new MockConfigurationProvider(mgr, true);
- AtsNotificationManager.setConfigurationProvider(configProvider);
- AtsNotificationManager.setInTest(false);
-
- // create new action
- AtsTestUtil.cleanupAndReset(getClass().getSimpleName());
-
- // set originator as Alex Kay
- TeamWorkFlowArtifact teamArt = AtsTestUtil.getTeamWf();
- AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName() + " - set originator");
- teamArt.setCreatedBy(AtsClientService.get().getUserServiceClient().getUserFromToken(DemoUsers.Alex_Kay), false,
- new Date(), changes);
- changes.execute();
-
- // set alex kay having valid email address
- User user = UserManager.getUser(DemoUsers.Alex_Kay);
- user.setSoleAttributeValue(CoreAttributeTypes.Email, "alex.kay@boeing.com");
- user.persist(getClass().getSimpleName() + "-set key email address");
- mgr.clear();
-
- // verify no notification events yet
- Assert.assertEquals(0, mgr.getNotificationEvents().size());
- changes.reset(getClass().getSimpleName());
- Result result =
- AtsTestUtil.transitionTo(AtsTestUtilState.Cancelled, AtsClientService.get().getUserService().getCurrentUser(),
- changes, TransitionOption.OverrideAssigneeCheck, TransitionOption.OverrideTransitionValidityCheck);
- Assert.assertEquals(Result.TrueResult, result);
- Assert.assertEquals(teamArt.getCurrentStateName(), TeamState.Cancelled.getName());
- changes.execute();
-
- // verify notification to originator
- Assert.assertEquals(1, mgr.getNotificationEvents().size());
- Assert.assertTrue(mgr.getNotificationEvents().iterator().next().getDescription().startsWith(
- "[Team Workflow] titled [AtsTestUtil - Team WF [AtsNotificationManagerTest]] was [Cancelled] from the [Analyze]"));
-
- AtsTestUtil.cleanup();
- }
-
- @org.junit.Test
- public void testSubscribedTeam() throws OseeCoreException {
-
- // create a test notification manager
- MockNotificationManager mgr = new MockNotificationManager();
- // restart notification manager with this one and set to NotInTest (cause normally, testing has notification system OFF)
- MockConfigurationProvider configProvider = new MockConfigurationProvider(mgr, true);
- AtsNotificationManager.setConfigurationProvider(configProvider);
- AtsNotificationManager.setInTest(false);
-
- // create new action
- AtsTestUtil.cleanupAndReset(getClass().getSimpleName());
-
- // setup alex email and subscribe for team definition
- User alex = UserManager.getUser(DemoUsers.Alex_Kay);
- alex.setSoleAttributeValue(CoreAttributeTypes.Email, "alex.kay@boeing.com");
- alex.persist(getClass().getSimpleName() + "- set alex email address");
-
- AtsTestUtil.getTestTeamDef().getSubscribed().add(
- AtsClientService.get().getUserServiceClient().getUserFromOseeUser(alex));
-
- mgr.clear();
-
- // create another action
- AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName());
- ActionArtifact actionArt =
- ActionManager.createAction(null, getClass().getSimpleName() + " - testSubscribedTeam", "description",
- ChangeType.Improvement, "1", false, null, Arrays.asList(AtsTestUtil.getTestAi()), new Date(),
- AtsClientService.get().getUserService().getCurrentUser(), null, changes);
-
- // verify notification to subscriber
- Assert.assertEquals(1, mgr.getNotificationEvents().size());
- Assert.assertTrue(mgr.getNotificationEvents().iterator().next().getDescription().startsWith(
- "You have subscribed for email notification for Team "));
- changes.execute();
-
- SkynetTransaction transaction2 =
- TransactionManager.createTransaction(AtsUtilCore.getAtsBranch(), getClass().getSimpleName());
-
- actionArt.getTeams().iterator().next().deleteAndPersist(transaction2);
- actionArt.deleteAndPersist(transaction2);
-
- User user = UserManager.getUser(DemoUsers.Alex_Kay);
- user.setSoleAttributeValue(CoreAttributeTypes.Email, "");
- user.deleteRelations(AtsRelationTypes.SubscribedUser_Artifact);
- user.persist(transaction2);
-
- transaction2.execute();
-
- AtsTestUtil.cleanup();
- }
-
- @org.junit.Test
- public void testSubscribedActionableItem() throws OseeCoreException {
-
- // create a test notification manager
- MockNotificationManager mgr = new MockNotificationManager();
- // restart notification manager with this one and set to NotInTest (cause normally, testing has notification system OFF)
- MockConfigurationProvider configProvider = new MockConfigurationProvider(mgr, true);
- AtsNotificationManager.setConfigurationProvider(configProvider);
- AtsNotificationManager.setInTest(false);
-
- // create new action
- AtsTestUtil.cleanupAndReset(getClass().getSimpleName());
-
- // setup alex email and subscribe for AI
- User alex = UserManager.getUser(DemoUsers.Alex_Kay);
- alex.setSoleAttributeValue(CoreAttributeTypes.Email, "alex.kay@boeing.com");
- alex.persist(getClass().getSimpleName() + "- set alex email address");
-
- AtsTestUtil.getTestAi().getSubscribed().add(
- AtsClientService.get().getUserServiceClient().getUserFromOseeUser(alex));
-
- mgr.clear();
-
- // create another action
- AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName());
- ActionArtifact actionArt =
- ActionManager.createAction(null, getClass().getSimpleName() + " - testSubscribedAI", "description",
- ChangeType.Improvement, "1", false, null, Arrays.asList(AtsTestUtil.getTestAi()), new Date(),
- AtsClientService.get().getUserService().getCurrentUser(), null, changes);
-
- // verify notification to subscriber
- Assert.assertEquals(1, mgr.getNotificationEvents().size());
- Assert.assertTrue(mgr.getNotificationEvents().iterator().next().getDescription().startsWith(
- "You have subscribed for email notification for Actionable Item "));
- changes.execute();
-
- SkynetTransaction transaction =
- TransactionManager.createTransaction(AtsUtilCore.getAtsBranch(), getClass().getSimpleName());
-
- actionArt.getTeams().iterator().next().deleteAndPersist(transaction);
- actionArt.deleteAndPersist(transaction);
-
- User user = UserManager.getUser(DemoUsers.Alex_Kay);
- user.setSoleAttributeValue(CoreAttributeTypes.Email, "");
- user.deleteRelations(AtsRelationTypes.SubscribedUser_Artifact);
- user.persist(transaction);
-
- transaction.execute();
-
- AtsTestUtil.cleanup();
- }
-
- @org.junit.Test
- public void testSubscribedWorkflow() throws OseeCoreException {
-
- // create a test notification manager
- MockNotificationManager mgr = new MockNotificationManager();
- // restart notification manager with this one and set to NotInTest (cause normally, testing has notification system OFF)
- MockConfigurationProvider configProvider = new MockConfigurationProvider(mgr, true);
- AtsNotificationManager.setConfigurationProvider(configProvider);
- AtsNotificationManager.setInTest(false);
-
- // create new action
- AtsTestUtil.cleanupAndReset(getClass().getSimpleName());
-
- // setup alex email and subscribe for AI
- User alex = UserManager.getUser(DemoUsers.Alex_Kay);
- alex.setSoleAttributeValue(CoreAttributeTypes.Email, "alex.kay@boeing.com");
- alex.persist(getClass().getSimpleName() + "- set alex email address");
-
- TeamWorkFlowArtifact teamArt = AtsTestUtil.getTeamWf();
-
- teamArt.setRelations(AtsRelationTypes.SubscribedUser_User, Arrays.asList(alex));
- teamArt.persist(getClass().getSimpleName() + " - add Workflow subscription");
-
- mgr.clear();
-
- AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName());
- Result result =
- AtsTestUtil.transitionTo(AtsTestUtilState.Implement,
- AtsClientService.get().getUserService().getCurrentUser(), changes,
- TransitionOption.OverrideAssigneeCheck, TransitionOption.OverrideTransitionValidityCheck);
- Assert.assertEquals(Result.TrueResult, result);
- changes.execute();
-
- // verify notification to workflow subscriber
- Assert.assertEquals(1, mgr.getNotificationEvents().size());
- Assert.assertEquals(
- "[Team Workflow] titled [AtsTestUtil - Team WF [AtsNotificationManagerTest]] transitioned to [Implement] and you subscribed for notification.",
- mgr.getNotificationEvents().iterator().next().getDescription());
-
- AtsTestUtil.cleanup();
- }
-
- @org.junit.Test
- public void testReviewersCompleted() throws OseeCoreException {
-
- // create a test notification manager
- MockNotificationManager mgr = new MockNotificationManager();
-
- // restart notification manager with this one and set to NotInTest (cause normally, testing has notification system OFF)
- MockConfigurationProvider configProvider = new MockConfigurationProvider(mgr, true);
- AtsNotificationManager.setConfigurationProvider(configProvider);
- AtsNotificationManager.setInTest(false);
-
- // create new action
- AtsTestUtil.cleanupAndReset(getClass().getSimpleName());
-
- // setup alex email and subscribe for AI
- User alex = UserManager.getUser(DemoUsers.Alex_Kay);
- alex.setSoleAttributeValue(CoreAttributeTypes.Email, "alex.kay@boeing.com");
- alex.persist(getClass().getSimpleName() + "- set alex email address");
-
- User kay = UserManager.getUser(DemoUsers.Kay_Jones);
- kay.setSoleAttributeValue(CoreAttributeTypes.Email, "kay.jones@boeing.com");
- kay.persist(getClass().getSimpleName() + "- set kay email address");
-
- AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName());
-
- PeerToPeerReviewArtifact peerArt =
- AtsTestUtil.getOrCreatePeerReview(ReviewBlockType.None, AtsTestUtilState.Analyze, changes);
- List<UserRole> roles = new ArrayList<UserRole>();
- UserRole author =
- new UserRole(Role.Author, AtsClientService.get().getUserServiceClient().getUserFromOseeUser(alex));
- roles.add(author);
- UserRole moderator =
- new UserRole(Role.Moderator, AtsClientService.get().getUserServiceClient().getUserFromOseeUser(kay));
- roles.add(moderator);
- UserRole reviewer1 = new UserRole(Role.Reviewer, AtsClientService.get().getUserService().getCurrentUser());
- roles.add(reviewer1);
- UserRole reviewer2 =
- new UserRole(Role.Reviewer, AtsClientService.get().getUserServiceClient().getUserFromToken(
- DemoUsers.Jason_Michael));
- roles.add(reviewer2);
-
- Result result =
- PeerToPeerReviewManager.transitionTo(peerArt, PeerToPeerReviewState.Review, roles, null,
- AtsClientService.get().getUserService().getCurrentUser(), false, changes);
- Assert.assertEquals(Result.TrueResult, result);
- changes.execute();
- mgr.clear();
-
- peerArt.getCurrentStateName();
-
- // complete reviewer1 role
- changes.reset(getClass().getSimpleName() + " - update reviewer 1");
- UserRoleManager roleMgr = new UserRoleManager(peerArt);
- reviewer1.setHoursSpent(1.0);
- reviewer1.setCompleted(true);
- roleMgr.addOrUpdateUserRole(reviewer1, peerArt);
- roleMgr.saveToArtifact(changes);
- changes.execute();
-
- // no notifications sent
- Assert.assertEquals(0, mgr.getNotificationEvents().size());
-
- // complete reviewer2 role
- changes.reset(getClass().getSimpleName() + " - update reviewer 2");
- reviewer2.setHoursSpent(1.0);
- reviewer2.setCompleted(true);
- roleMgr.addOrUpdateUserRole(reviewer2, peerArt);
- roleMgr.saveToArtifact(changes);
- changes.execute();
-
- // notification sent to author/moderator
- Assert.assertEquals(1, mgr.getNotificationEvents().size());
- Assert.assertTrue(mgr.getNotificationEvents().iterator().next().getDescription().equals(
- "You are Author/Moderator of [PeerToPeer Review] titled [AtsTestUtil Test Peer Review] which has been reviewed by all reviewers"));
- // email both moderator and author
- Assert.assertEquals(2, mgr.getNotificationEvents().iterator().next().getUsers().size());
- peerArt.deleteAndPersist();
- AtsTestUtil.cleanup();
- }
-
- private static final class MockConfigurationProvider implements ConfigurationProvider {
-
- private final INotificationManager notificationManager;
- private final boolean isProduction;
-
- public MockConfigurationProvider(INotificationManager notificationManager, boolean isProduction) {
- super();
- this.notificationManager = notificationManager;
- this.isProduction = isProduction;
- }
-
- @Override
- public INotificationManager getNotificationManager() {
- return notificationManager;
- }
-
- @Override
- public boolean isProduction() {
- return isProduction;
- }
- }
-}
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsNotifyUsersTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsNotifyUsersTest.java
deleted file mode 100644
index 707456aad7c..00000000000
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/AtsNotifyUsersTest.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.client.integration.tests.ats.core.client.notify;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import org.eclipse.osee.ats.api.notify.AtsNotifyType;
-import org.eclipse.osee.ats.api.team.ChangeType;
-import org.eclipse.osee.ats.api.workflow.transition.IAtsTransitionManager;
-import org.eclipse.osee.ats.api.workflow.transition.TransitionOption;
-import org.eclipse.osee.ats.api.workflow.transition.TransitionResults;
-import org.eclipse.osee.ats.client.demo.DemoActionableItems;
-import org.eclipse.osee.ats.client.demo.DemoUsers;
-import org.eclipse.osee.ats.client.integration.tests.AtsClientService;
-import org.eclipse.osee.ats.client.integration.tests.ats.core.client.AtsTestUtil;
-import org.eclipse.osee.ats.core.client.action.ActionManager;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager.ConfigurationProvider;
-import org.eclipse.osee.ats.core.client.notify.AtsNotifyUsers;
-import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.core.client.util.AtsChangeSet;
-import org.eclipse.osee.ats.core.client.util.AtsUtilClient;
-import org.eclipse.osee.ats.core.client.util.SubscribeManager;
-import org.eclipse.osee.ats.core.config.ActionableItems;
-import org.eclipse.osee.ats.core.util.AtsUtilCore;
-import org.eclipse.osee.ats.core.workflow.state.StateManagerUtility;
-import org.eclipse.osee.ats.core.workflow.state.TeamState;
-import org.eclipse.osee.ats.core.workflow.transition.TransitionFactory;
-import org.eclipse.osee.ats.core.workflow.transition.TransitionHelper;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.artifact.search.QueryOptions;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
-import org.eclipse.osee.framework.skynet.core.utility.INotificationManager;
-import org.eclipse.osee.framework.skynet.core.utility.OseeNotificationEvent;
-import org.junit.Assert;
-
-/**
- * Test unit for {@link AtsNotifyUsers}
- *
- * @author Donald G. Dunne
- */
-public class AtsNotifyUsersTest {
- @org.junit.BeforeClass
- public static void setup() throws OseeCoreException {
- AtsUtilClient.setEmailEnabled(true);
- AtsTestUtil.cleanupAndReset(AtsNotificationManagerTest.class.getSimpleName());
- cleanUpAction();
- }
-
- @org.junit.AfterClass
- public static void cleanup() throws OseeCoreException {
- UserManager.getUser(DemoUsers.Jason_Michael).reloadAttributesAndRelations();
- UserManager.getUser(DemoUsers.Kay_Jones).reloadAttributesAndRelations();
- UserManager.getUser(DemoUsers.Alex_Kay).reloadAttributesAndRelations();
- UserManager.getUser(DemoUsers.Joe_Smith).reloadAttributesAndRelations();
- UserManager.getUser(DemoUsers.Inactive_Steve).reloadAttributesAndRelations();
- AtsTestUtil.cleanup();
- cleanUpAction();
-
- AtsUtilClient.setEmailEnabled(false);
-
- AtsTestUtil.validateArtifactCache();
- AtsUtilClient.setEmailEnabled(false);
-
- }
-
- private static void cleanUpAction() throws OseeCoreException {
- SkynetTransaction changes =
- TransactionManager.createTransaction(AtsUtilCore.getAtsBranch(), AtsNotifyUsersTest.class.getSimpleName());
- for (Artifact art : ArtifactQuery.getArtifactListFromAttribute(CoreAttributeTypes.Name,
- AtsNotifyUsersTest.class.getSimpleName(), AtsUtilCore.getAtsBranch(), QueryOptions.CONTAINS_MATCH_OPTIONS)) {
- art.deleteAndPersist(changes);
- }
- changes.execute();
- }
-
- @org.junit.Test
- public void testNotify() throws OseeCoreException {
- User jason_ValidEmail = UserManager.getUser(DemoUsers.Jason_Michael);
- jason_ValidEmail.setEmail("jason@boeing.com");
- User alex_NoValidEmail = UserManager.getUser(DemoUsers.Alex_Kay);
- alex_NoValidEmail.setEmail("");
- User kay_ValidEmail = UserManager.getUser(DemoUsers.Kay_Jones);
- kay_ValidEmail.setEmail("kay@boeing.com");
- User joeSmith_CurrentUser = UserManager.getUser(DemoUsers.Joe_Smith);
- joeSmith_CurrentUser.setEmail("joe@boeing.com");
- User inactiveSteve = UserManager.getUser(DemoUsers.Inactive_Steve);
- inactiveSteve.setEmail("inactiveSteves@boeing.com");
-
- MockNotificationManager notifyManager = new MockNotificationManager();
- MockConfigurationProvider configProvider = new MockConfigurationProvider(notifyManager, true);
- AtsNotificationManager.setConfigurationProvider(configProvider);
- AtsNotificationManager.setInTest(false);
-
- AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName());
- TeamWorkFlowArtifact teamArt = AtsTestUtil.getTeamWf();
- teamArt.setName(AtsNotifyUsersTest.class.getSimpleName() + "-testNotify");
- teamArt.internalSetCreatedBy(AtsClientService.get().getUserServiceClient().getUserFromOseeUser(kay_ValidEmail),
- changes);
- List<User> assignees = new ArrayList<User>();
- assignees.addAll(Arrays.asList(inactiveSteve, alex_NoValidEmail, jason_ValidEmail, kay_ValidEmail,
- joeSmith_CurrentUser));
- teamArt.getStateMgr().setAssignees(AtsClientService.get().getUserServiceClient().getAtsUsers(assignees));
- changes.add(teamArt);
- changes.execute();
-
- notifyManager.clear();
- AtsNotificationManager.notify(teamArt, AtsNotifyType.Originator);
- Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
- OseeNotificationEvent event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(AtsNotifyType.Originator.name(), event.getType());
- Assert.assertEquals(kay_ValidEmail, event.getUsers().iterator().next());
- Assert.assertEquals(
- "You have been set as the originator of [Team Workflow] state [Analyze] titled [AtsNotifyUsersTest-testNotify]",
- event.getDescription());
-
- notifyManager.clear();
- teamArt.internalSetCreatedBy(AtsClientService.get().getUserServiceClient().getUserFromOseeUser(inactiveSteve),
- changes);
- teamArt.persist(getClass().getSimpleName());
- AtsNotificationManager.notify(teamArt, AtsNotifyType.Originator);
- Assert.assertEquals(0, notifyManager.getNotificationEvents().size());
- teamArt.internalSetCreatedBy(AtsClientService.get().getUserServiceClient().getUserFromOseeUser(kay_ValidEmail),
- changes);
- teamArt.persist(getClass().getSimpleName());
-
- notifyManager.clear();
- AtsNotificationManager.notify(teamArt, AtsNotifyType.Assigned);
- Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
- event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(AtsNotifyType.Assigned.name(), event.getType());
- // joe smith should be removed from list cause it's current user
- // alex should be removed cause not valid email
- List<User> expected = new ArrayList<User>();
- expected.add(jason_ValidEmail);
- expected.add(kay_ValidEmail);
- List<User> users = new ArrayList<User>();
- users.addAll(event.getUsers());
- Assert.assertTrue(org.eclipse.osee.framework.jdk.core.util.Collections.isEqual(expected, users));
- Assert.assertEquals(
- "You have been set as the assignee of [Team Workflow] in state [Analyze] titled [AtsNotifyUsersTest-testNotify]",
- event.getDescription());
-
- notifyManager.clear();
- AtsNotificationManager.notify(teamArt,
- Collections.singleton(AtsClientService.get().getUserServiceClient().getUserFromOseeUser(jason_ValidEmail)),
- AtsNotifyType.Assigned);
- Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
- event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(AtsNotifyType.Assigned.name(), event.getType());
- // only alex should be emailed cause sent in list
- Assert.assertEquals(1, event.getUsers().size());
- Assert.assertEquals(jason_ValidEmail, event.getUsers().iterator().next());
- Assert.assertEquals(
- "You have been set as the assignee of [Team Workflow] in state [Analyze] titled [AtsNotifyUsersTest-testNotify]",
- event.getDescription());
-
- notifyManager.clear();
- SubscribeManager.toggleSubscribe(teamArt);
- changes.clear();
- SubscribeManager.addSubscribed(teamArt,
- AtsClientService.get().getUserServiceClient().getUserFromOseeUser(inactiveSteve), changes);
- changes.execute();
- AtsNotificationManager.notify(teamArt, AtsNotifyType.Subscribed);
- Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
- event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(AtsNotifyType.Subscribed.name(), event.getType());
- Assert.assertEquals(UserManager.getUser(), event.getUsers().iterator().next());
- Assert.assertEquals(
- "[Team Workflow] titled [AtsNotifyUsersTest-testNotify] transitioned to [Analyze] and you subscribed for notification.",
- event.getDescription());
- SubscribeManager.toggleSubscribe(teamArt);
-
- notifyManager.clear();
- AtsNotificationManager.notify(teamArt, AtsNotifyType.Completed);
- Assert.assertEquals(0, notifyManager.getNotificationEvents().size());
-
- notifyManager.clear();
- StateManagerUtility.initializeStateMachine(teamArt.getStateMgr(), TeamState.Completed, null,
- AtsClientService.get().getUserService().getCurrentUser(), changes);
- AtsNotificationManager.notify(teamArt, AtsNotifyType.Completed);
- event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(AtsNotifyType.Completed.name(), event.getType());
- Assert.assertEquals(kay_ValidEmail, event.getUsers().iterator().next());
- Assert.assertEquals("[Team Workflow] titled [AtsNotifyUsersTest-testNotify] is [Completed]",
- event.getDescription());
-
- notifyManager.clear();
- teamArt.internalSetCreatedBy(AtsClientService.get().getUserServiceClient().getUserFromOseeUser(inactiveSteve),
- changes);
- teamArt.persist(getClass().getSimpleName());
- StateManagerUtility.initializeStateMachine(teamArt.getStateMgr(), TeamState.Completed, null,
- AtsClientService.get().getUserService().getCurrentUser(), changes);
- AtsNotificationManager.notify(teamArt, AtsNotifyType.Completed);
- Assert.assertEquals(0, notifyManager.getNotificationEvents().size());
- teamArt.internalSetCreatedBy(AtsClientService.get().getUserServiceClient().getUserFromOseeUser(kay_ValidEmail),
- changes);
- teamArt.persist(getClass().getSimpleName());
-
- notifyManager.clear();
- StateManagerUtility.initializeStateMachine(teamArt.getStateMgr(), TeamState.Analyze, null,
- AtsClientService.get().getUserService().getCurrentUser(), changes);
- TransitionHelper helper =
- new TransitionHelper(getClass().getSimpleName(), Arrays.asList(teamArt), TeamState.Cancelled.getName(), null,
- "this is the reason", changes, TransitionOption.OverrideTransitionValidityCheck);
- changes.clear();
- IAtsTransitionManager transitionMgr = TransitionFactory.getTransitionManager(helper);
- TransitionResults results = transitionMgr.handleAllAndPersist();
- Assert.assertTrue("Transition should have no errors", results.isEmpty());
-
- Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
- event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(AtsNotifyType.Cancelled.name(), event.getType());
- Assert.assertEquals(kay_ValidEmail, event.getUsers().iterator().next());
- Assert.assertTrue(event.getDescription().startsWith(
- "[Team Workflow] titled [AtsNotifyUsersTest-testNotify] was [Cancelled] from the [Analyze] state on"));
- Assert.assertTrue(event.getDescription().endsWith(".<br>Reason: [this is the reason]"));
-
- }
-
- @org.junit.Test
- public void testNotifyOnNewAction() throws OseeCoreException {
-
- User kay_ValidEmail = UserManager.getUser(DemoUsers.Kay_Jones);
- kay_ValidEmail.setEmail("kay@boeing.com");
-
- MockNotificationManager notifyManager = new MockNotificationManager();
- MockConfigurationProvider configProvider = new MockConfigurationProvider(notifyManager, true);
- AtsNotificationManager.setConfigurationProvider(configProvider);
- AtsNotificationManager.setInTest(false);
-
- AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName());
- ActionManager.createAction(null, getClass().getSimpleName() + "-OnNewAction", "Description",
- ChangeType.Improvement, "2", false, null,
- ActionableItems.getActionableItems(Arrays.asList(DemoActionableItems.SAW_SW_Design.getName())), new Date(),
- AtsClientService.get().getUserService().getCurrentUser(), null, changes);
- changes.execute();
-
- Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
- OseeNotificationEvent event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(AtsNotifyType.Assigned.name(), event.getType());
- Assert.assertEquals(kay_ValidEmail, event.getUsers().iterator().next());
- Assert.assertEquals(
- "You have been set as the assignee of [Team Workflow] in state [Endorse] titled [AtsNotifyUsersTest-OnNewAction]",
- event.getDescription());
- }
- private static final class MockConfigurationProvider implements ConfigurationProvider {
-
- private final INotificationManager notificationManager;
- private final boolean isProduction;
-
- public MockConfigurationProvider(INotificationManager notificationManager, boolean isProduction) {
- super();
- this.notificationManager = notificationManager;
- this.isProduction = isProduction;
- }
-
- @Override
- public INotificationManager getNotificationManager() {
- return notificationManager;
- }
-
- @Override
- public boolean isProduction() {
- return isProduction;
- }
- }
-}
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/MockNotificationManager.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/MockNotificationManager.java
deleted file mode 100644
index f50c1e35e2f..00000000000
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/notify/MockNotificationManager.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.client.integration.tests.ats.core.client.notify;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.skynet.core.utility.INotificationManager;
-import org.eclipse.osee.framework.skynet.core.utility.OseeNotificationEvent;
-
-/**
- * @author Donald G. Dunne
- */
-public class MockNotificationManager implements INotificationManager {
-
- private final List<OseeNotificationEvent> notificationEvents = new ArrayList<OseeNotificationEvent>();
-
- @Override
- public void addNotificationEvent(OseeNotificationEvent notificationEvent) {
- notificationEvents.add(notificationEvent);
- }
-
- @Override
- public void clear() {
- notificationEvents.clear();
- }
-
- @Override
- public List<OseeNotificationEvent> getNotificationEvents() {
- return notificationEvents;
- }
-
- @Override
- public void sendNotifications() {
- // do nothings
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/util/DbInitTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/util/DbInitTest.java
index 3301b20ed1c..ee9e013d674 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/util/DbInitTest.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/util/DbInitTest.java
@@ -14,6 +14,7 @@ import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.logging.Level;
import org.eclipse.osee.ats.client.demo.DemoChoice;
+import org.eclipse.osee.ats.client.integration.tests.AtsClientService;
import org.eclipse.osee.framework.core.client.ClientSessionManager;
import org.eclipse.osee.framework.database.init.DatabaseInitOpFactory;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
@@ -65,10 +66,14 @@ public class DbInitTest {
ClientSessionManager.releaseSession();
ClientSessionManager.getSession();
UserManager.releaseUser();
+ AtsClientService.get().getUserService().releaseUser();
if (UserManager.getUser().getUserId().equals("bootstrap")) {
throw new OseeStateException("Should not be bootstrap user here");
}
+ if (AtsClientService.get().getUserService().getCurrentUser().getUserId().equals("bootstrap")) {
+ throw new OseeStateException("Should not be bootstrap user here");
+ }
}
System.out.println("End database initialization...\n");
diff --git a/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF
index 30d599321b6..e212d6873ab 100644
--- a/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF
@@ -8,6 +8,8 @@ Bundle-Activator: org.eclipse.osee.ats.core.client.internal.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.google.inject,
+ javax.ws.rs.client;version="2.0.0",
+ javax.ws.rs.core;version="2.0.0",
org.eclipse.core.runtime,
org.eclipse.core.runtime.jobs,
org.eclipse.emf.common.util,
@@ -39,7 +41,6 @@ Import-Package: com.google.inject,
org.eclipse.osee.ats.core.config,
org.eclipse.osee.ats.core.model,
org.eclipse.osee.ats.core.model.impl,
- org.eclipse.osee.ats.core.notify,
org.eclipse.osee.ats.core.users,
org.eclipse.osee.ats.core.util,
org.eclipse.osee.ats.core.validator,
@@ -84,6 +85,7 @@ Import-Package: com.google.inject,
org.eclipse.osee.framework.ui.skynet.results.table,
org.eclipse.osee.framework.ui.skynet.results.table.xresults,
org.eclipse.osee.framework.ui.skynet.util,
+ org.eclipse.osee.jaxrs.client,
org.eclipse.xtext.resource,
org.osgi.framework
Export-Package: org.eclipse.osee.ats.core.client,
@@ -94,7 +96,6 @@ Export-Package: org.eclipse.osee.ats.core.client,
org.eclipse.osee.ats.core.client.branch,
org.eclipse.osee.ats.core.client.config,
org.eclipse.osee.ats.core.client.ev,
- org.eclipse.osee.ats.core.client.notify,
org.eclipse.osee.ats.core.client.operation,
org.eclipse.osee.ats.core.client.review,
org.eclipse.osee.ats.core.client.review.defect,
diff --git a/plugins/org.eclipse.osee.ats.core.client/OSGI-INF/ats.notify.service.xml b/plugins/org.eclipse.osee.ats.core.client/OSGI-INF/ats.notify.service.xml
deleted file mode 100644
index 20a39865c1a..00000000000
--- a/plugins/org.eclipse.osee.ats.core.client/OSGI-INF/ats.notify.service.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osee.ats.core.client.internal.notify.AtsNotificationServiceImpl">
- <implementation class="org.eclipse.osee.ats.core.client.internal.notify.AtsNotificationServiceImpl"/>
- <service>
- <provide interface="org.eclipse.osee.ats.api.notify.IAtsNotificationServiceProvider"/>
- <provide interface="org.eclipse.osee.ats.api.notify.IAtsNotificationService"/>
- </service>
-</scr:component>
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java
index bb39046f7db..832cabf0c6c 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java
@@ -16,7 +16,7 @@ import org.eclipse.osee.ats.api.IAtsConfigObject;
import org.eclipse.osee.ats.api.IAtsObject;
import org.eclipse.osee.ats.api.ev.IAtsEarnedValueService;
import org.eclipse.osee.ats.api.ev.IAtsEarnedValueServiceProvider;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
+import org.eclipse.osee.ats.api.notify.IAtsNotifier;
import org.eclipse.osee.ats.api.query.IAtsQueryService;
import org.eclipse.osee.ats.api.review.IAtsReviewService;
import org.eclipse.osee.ats.api.review.IAtsReviewServiceProvider;
@@ -49,7 +49,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
/**
* @author Donald G. Dunne
*/
-public interface IAtsClient extends IAttributeResolverProvider, IAtsReviewServiceProvider, IAtsBranchServiceProvider, IAtsWorkItemArtifactServiceProvider, IAtsWorkItemServiceProvider, IAtsConfigProvider, ITeamDefinitionFactory, IActionableItemFactory, IArtifactProvider, IVersionFactory, IAtsQueryService, IAtsVersionServiceProvider, IAtsEarnedValueServiceProvider {
+public interface IAtsClient extends IAtsNotifier, IAttributeResolverProvider, IAtsReviewServiceProvider, IAtsBranchServiceProvider, IAtsWorkItemArtifactServiceProvider, IAtsWorkItemServiceProvider, IAtsConfigProvider, ITeamDefinitionFactory, IActionableItemFactory, IArtifactProvider, IVersionFactory, IAtsQueryService, IAtsVersionServiceProvider, IAtsEarnedValueServiceProvider {
<T extends IAtsConfigObject> Artifact storeConfigObject(T configObject, IAtsChangeSet changes) throws OseeCoreException;
@@ -110,8 +110,6 @@ public interface IAtsClient extends IAttributeResolverProvider, IAtsReviewServic
IAtsLogFactory getLogFactory();
- IAtsNotificationService getNotifyService();
-
IAtsColumnUtilities getColumnUtilities();
IAtsUtilService getUtilService();
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/action/ActionManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/action/ActionManager.java
index 6a40398c691..74a0050c507 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/action/ActionManager.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/action/ActionManager.java
@@ -19,18 +19,20 @@ import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEventFactory;
+import org.eclipse.osee.ats.api.notify.AtsNotifyType;
import org.eclipse.osee.ats.api.team.ChangeType;
import org.eclipse.osee.ats.api.team.CreateTeamOption;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowManager;
import org.eclipse.osee.ats.core.client.util.AtsUtilClient;
import org.eclipse.osee.ats.core.client.workflow.ChangeTypeUtil;
import org.eclipse.osee.ats.core.config.TeamDefinitions;
+import org.eclipse.osee.ats.core.users.AtsCoreUsers;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
@@ -163,7 +165,9 @@ public class ActionManager {
addActionToConfiguredGoal(teamDef, teamArt, actionableItems, changes);
changes.add(teamArt);
- AtsNotificationManager.notifySubscribedByTeamOrActionableItem(teamArt);
+ changes.getNotifications().addWorkItemNotificationEvent(
+ AtsNotificationEventFactory.getWorkItemNotificationEvent(AtsCoreUsers.SYSTEM_USER, teamArt,
+ AtsNotifyType.SubscribedTeamOrAi));
return teamArt;
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/Activator.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/Activator.java
index dfc1cc96f26..adea10e5b47 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/Activator.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/Activator.java
@@ -10,12 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.ats.core.client.internal;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager.ConfigurationProvider;
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.utility.INotificationManager;
-import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationManager;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -25,18 +19,7 @@ public class Activator implements BundleActivator {
@Override
public void start(BundleContext bundleContext) throws Exception {
- AtsNotificationManager.setConfigurationProvider(new ConfigurationProvider() {
-
- @Override
- public INotificationManager getNotificationManager() {
- return OseeNotificationManager.getInstance();
- }
-
- @Override
- public boolean isProduction() throws OseeCoreException {
- return ClientSessionManager.isProductionDataStore();
- }
- });
+ //
}
@Override
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java
index 5af0e01900f..acda4a2676c 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java
@@ -22,7 +22,7 @@ import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
import org.eclipse.osee.ats.api.data.AtsArtifactToken;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.ev.IAtsEarnedValueService;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
+import org.eclipse.osee.ats.api.notify.AtsNotificationCollector;
import org.eclipse.osee.ats.api.query.IAtsQuery;
import org.eclipse.osee.ats.api.review.IAtsReviewService;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
@@ -49,7 +49,6 @@ import org.eclipse.osee.ats.core.client.internal.config.AtsConfigCacheProvider;
import org.eclipse.osee.ats.core.client.internal.config.TeamDefinitionFactory;
import org.eclipse.osee.ats.core.client.internal.config.VersionFactory;
import org.eclipse.osee.ats.core.client.internal.ev.AtsEarnedValueImpl;
-import org.eclipse.osee.ats.core.client.internal.notify.AtsNotificationServiceImpl;
import org.eclipse.osee.ats.core.client.internal.query.AtsQuery;
import org.eclipse.osee.ats.core.client.internal.review.AtsReviewServiceImpl;
import org.eclipse.osee.ats.core.client.internal.store.ActionableItemArtifactReader;
@@ -119,7 +118,6 @@ public class AtsClientImpl implements IAtsClient {
private ISequenceProvider sequenceProvider;
private IAtsWorkStateFactory workStateFactory;
private IAtsLogFactory logFactory;
- private IAtsNotificationService notificationService;
private IAtsColumnUtilities columnUtilities;
private IAtsUtilService utilService;
private IOseeDatabaseService dbService;
@@ -446,7 +444,7 @@ public class AtsClientImpl implements IAtsClient {
@Override
public IAtsStateFactory getStateFactory() {
if (stateFactory == null) {
- stateFactory = AtsCoreFactory.newStateFactory(getAttributeResolver(), getUserService(), getNotifyService());
+ stateFactory = AtsCoreFactory.newStateFactory(getAttributeResolver(), getUserService());
}
return stateFactory;
}
@@ -468,14 +466,6 @@ public class AtsClientImpl implements IAtsClient {
}
@Override
- public IAtsNotificationService getNotifyService() {
- if (notificationService == null) {
- notificationService = new AtsNotificationServiceImpl();
- }
- return notificationService;
- }
-
- @Override
public IAtsColumnUtilities getColumnUtilities() {
if (columnUtilities == null) {
columnUtilities = AtsCoreFactory.getColumnUtilities(getReviewService(), getWorkItemService());
@@ -492,6 +482,11 @@ public class AtsClientImpl implements IAtsClient {
}
@Override
+ public void sendNotifications(AtsNotificationCollector notifications) {
+ AtsJaxRsService.get().getNotify().sendNotifications(notifications);
+ }
+
+ @Override
public String getConfigValue(String key) {
String result = null;
Artifact atsConfig = ArtifactQuery.getArtifactFromToken(AtsArtifactToken.AtsConfig, AtsUtilCore.getAtsBranch());
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsJaxRsService.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsJaxRsService.java
new file mode 100644
index 00000000000..887924028f0
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsJaxRsService.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.core.client.internal;
+
+import org.eclipse.osee.ats.api.AtsJaxRsApi;
+import org.eclipse.osee.framework.core.client.OseeClientProperties;
+import org.eclipse.osee.jaxrs.client.JaxRsClient;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsJaxRsService {
+
+ private static AtsJaxRsApi atsEndpoint;
+
+ public static AtsJaxRsApi get() {
+ if (atsEndpoint == null) {
+ String appServer = OseeClientProperties.getOseeApplicationServer();
+ String atsUri = String.format("%s/ats", appServer);
+
+ atsEndpoint = JaxRsClient.newBuilder() //
+ .createThreadSafeProxyClients(true) // if the client needs to be shared between threads
+ .build() //
+ .targetProxy(atsUri, AtsJaxRsApi.class);
+ }
+ return atsEndpoint;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/notify/AtsNotificationServiceImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/notify/AtsNotificationServiceImpl.java
deleted file mode 100644
index da3078cf57f..00000000000
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/notify/AtsNotificationServiceImpl.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.core.client.internal.notify;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.osee.ats.api.IAtsWorkItem;
-import org.eclipse.osee.ats.api.notify.AtsNotificationEvent;
-import org.eclipse.osee.ats.api.notify.AtsNotifyType;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationServiceProvider;
-import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.core.client.internal.AtsClientService;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
-import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.utility.OseeNotificationEvent;
-import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsNotificationServiceImpl implements IAtsNotificationService, IAtsNotificationServiceProvider {
-
- public AtsNotificationServiceImpl() {
- }
-
- @Override
- public void addNotificationEvent(AtsNotificationEvent notificationEvent) throws OseeCoreException {
- OseeNotificationManager.getInstance().addNotificationEvent(
- new OseeNotificationEvent(AtsClientService.get().getUserServiceClient().getOseeUsers(
- notificationEvent.getUsers()), notificationEvent.getId(), notificationEvent.getType(),
- notificationEvent.getDescription()));
- }
-
- @Override
- public void clear() {
- OseeNotificationManager.getInstance().clear();
- }
-
- @Override
- public List<AtsNotificationEvent> getNotificationEvents() throws OseeCoreException {
- List<AtsNotificationEvent> events = new ArrayList<AtsNotificationEvent>();
- for (OseeNotificationEvent event : OseeNotificationManager.getInstance().getNotificationEvents()) {
- events.add(new AtsNotificationEvent(
- AtsClientService.get().getUserServiceClient().getAtsUsers(event.getUsers()), event.getId(),
- event.getType(), event.getDescription()));
- }
- return events;
- }
-
- @Override
- public void sendNotifications() {
- OseeNotificationManager.getInstance().sendNotifications();
- }
-
- @Override
- public void notify(IAtsWorkItem workItem, Collection<? extends IAtsUser> notifyUsers, AtsNotifyType... notifyTypes) throws OseeCoreException {
- AtsNotificationManager.notify((AbstractWorkflowArtifact) AtsClientService.get().getArtifact(workItem),
- notifyUsers, notifyTypes);
- }
-
- @Override
- public IAtsNotificationService getNotifyService() {
- return this;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/notify/AtsNotificationManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/notify/AtsNotificationManager.java
deleted file mode 100644
index 93672e36828..00000000000
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/notify/AtsNotificationManager.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.core.client.notify;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
-import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
-import org.eclipse.osee.ats.api.notify.AtsNotifyType;
-import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
-import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.core.client.internal.Activator;
-import org.eclipse.osee.ats.core.client.internal.AtsClientService;
-import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.core.client.util.AtsUtilClient;
-import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.email.EmailGroup;
-import org.eclipse.osee.framework.skynet.core.utility.INotificationManager;
-import org.eclipse.osee.framework.skynet.core.utility.OseeNotificationEvent;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsNotificationManager {
-
- private static boolean inTest = false;
-
- private static ConfigurationProvider provider;
-
- public static interface ConfigurationProvider {
- INotificationManager getNotificationManager();
-
- boolean isProduction() throws OseeCoreException;
- }
-
- private AtsNotificationManager() {
- //
- }
-
- /**
- * Handle notifications for subscription by IAtsTeamDefinition and ActionableItem
- */
- public static void notifySubscribedByTeamOrActionableItem(TeamWorkFlowArtifact teamArt) {
- if (isInTest() || !AtsUtilClient.isEmailEnabled() || !isProduction()) {
- return;
- }
- try {
-
- Collection<IAtsUser> subscribedUsers = new HashSet<IAtsUser>();
- // Handle Team Definitions
- IAtsTeamDefinition teamDef = teamArt.getTeamDefinition();
- subscribedUsers.addAll(teamDef.getSubscribed());
- if (subscribedUsers.size() > 0) {
- getNotificationManager().addNotificationEvent(
- new OseeNotificationEvent(
- AtsClientService.get().getUserServiceClient().getOseeUsers(subscribedUsers),
- getIdString(teamArt),
- "Workflow Creation",
- "You have subscribed for email notification for Team \"" + teamArt.getTeamName() + "\"; New Team Workflow created with title \"" + teamArt.getName() + "\""));
- }
-
- // Handle Actionable Items
- for (IAtsActionableItem aia : teamArt.getActionableItemsDam().getActionableItems()) {
- subscribedUsers = aia.getSubscribed();
- if (subscribedUsers.size() > 0) {
- getNotificationManager().addNotificationEvent(
- new OseeNotificationEvent(
- AtsClientService.get().getUserServiceClient().getOseeUsers(subscribedUsers),
- getIdString(teamArt),
- "Workflow Creation",
- "You have subscribed for email notification for Actionable Item \"" + teamArt.getTeamName() + "\"; New Team Workflow created with title \"" + teamArt.getName() + "\""));
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
-
- protected static String getIdString(AbstractWorkflowArtifact sma) {
- try {
- String legacyPcrId = sma.getSoleAttributeValue(AtsAttributeTypes.LegacyPcrId, "");
- if (!legacyPcrId.equals("")) {
- return "ID: " + sma.getAtsId() + " / LegacyId: " + legacyPcrId;
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- return "ID: " + sma.getAtsId();
- }
-
- public static void notify(AbstractWorkflowArtifact sma, AtsNotifyType... notifyTypes) throws OseeCoreException {
- notify(sma, null, notifyTypes);
- }
-
- public static void notify(AbstractWorkflowArtifact awa, Collection<? extends IAtsUser> notifyUsers, AtsNotifyType... notifyTypes) throws OseeCoreException {
- if (isInTest() || !AtsUtilClient.isEmailEnabled() || !isProduction() || awa.getName().startsWith("tt ")) {
- return;
- }
- AtsNotifyUsers.notify(getNotificationManager(), awa, notifyUsers, notifyTypes);
- }
-
- public static List<EmailGroup> getEmailableGroups(AbstractWorkflowArtifact workflow) throws OseeCoreException {
- ArrayList<EmailGroup> groupNames = new ArrayList<EmailGroup>();
- ArrayList<String> emails = new ArrayList<String>();
- emails.add(workflow.getCreatedBy().getEmail());
- groupNames.add(new EmailGroup("Originator", emails));
- if (workflow.getStateMgr().getAssignees().size() > 0) {
- emails = new ArrayList<String>();
- for (IAtsUser user : workflow.getStateMgr().getAssignees()) {
- emails.add(user.getEmail());
- }
- groupNames.add(new EmailGroup("Assignees", emails));
- }
- return groupNames;
- }
-
- //////////////////////////////////// FOR TEST ////////////////////////////////////
- private static INotificationManager getNotificationManager() {
- return getConfigurationProvider().getNotificationManager();
- }
-
- public static void setConfigurationProvider(ConfigurationProvider provider) {
- AtsNotificationManager.provider = provider;
- }
-
- protected static ConfigurationProvider getConfigurationProvider() {
- return AtsNotificationManager.provider;
- }
-
- public static boolean isProduction() {
- boolean result = false;
- try {
- result = getConfigurationProvider().isProduction();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- return result;
- }
-
- protected static boolean isInTest() {
- return AtsNotificationManager.inTest;
- }
-
- public static void setInTest(boolean inTest) {
- AtsNotificationManager.inTest = inTest;
- }
-}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/notify/AtsNotifyUsers.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/notify/AtsNotifyUsers.java
deleted file mode 100644
index 0beeac80b36..00000000000
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/notify/AtsNotifyUsers.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.core.client.notify;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.api.notify.AtsNotifyType;
-import org.eclipse.osee.ats.api.review.Role;
-import org.eclipse.osee.ats.api.review.UserRole;
-import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.core.client.internal.Activator;
-import org.eclipse.osee.ats.core.client.internal.AtsClientService;
-import org.eclipse.osee.ats.core.client.review.AbstractReviewArtifact;
-import org.eclipse.osee.ats.core.client.review.role.UserRoleManager;
-import org.eclipse.osee.ats.core.client.util.SubscribeManager;
-import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
-import org.eclipse.osee.ats.core.users.AtsCoreUsers;
-import org.eclipse.osee.ats.core.users.AtsUsersUtility;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.DateUtil;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.utility.EmailUtil;
-import org.eclipse.osee.framework.skynet.core.utility.INotificationManager;
-import org.eclipse.osee.framework.skynet.core.utility.OseeNotificationEvent;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsNotifyUsers {
-
- /**
- * @param notifyUsers only valid for assignees notifyType. if null or any other type, the users will be computed
- */
- protected static void notify(INotificationManager oseeNotificationManager, AbstractWorkflowArtifact awa, Collection<? extends IAtsUser> notifyUsers, AtsNotifyType... notifyTypes) throws OseeCoreException {
- List<AtsNotifyType> types = Collections.getAggregate(notifyTypes);
-
- if (types.contains(AtsNotifyType.Originator)) {
- IAtsUser originator = awa.getCreatedBy();
- if (originator.isActive()) {
- if (!EmailUtil.isEmailValid(originator.getEmail()) && !AtsCoreUsers.isAtsCoreUser(originator)) {
- OseeLog.logf(Activator.class, Level.INFO, "Email [%s] invalid for user [%s]", originator.getEmail(),
- originator.getName());
- } else if (!AtsClientService.get().getUserService().getCurrentUser().equals(originator)) {
- oseeNotificationManager.addNotificationEvent(new OseeNotificationEvent(
- Arrays.asList(AtsClientService.get().getUserServiceClient().getOseeUser(originator)),
- AtsNotificationManager.getIdString(awa), AtsNotifyType.Originator.name(), String.format(
- "You have been set as the originator of [%s] state [%s] titled [%s]", awa.getArtifactTypeName(),
- awa.getStateMgr().getCurrentStateName(), awa.getName())));
- }
- }
- }
- if (types.contains(AtsNotifyType.Assigned)) {
- Collection<IAtsUser> assignees = new HashSet<IAtsUser>();
- if (notifyUsers != null) {
- assignees.addAll(notifyUsers);
- } else {
- assignees.addAll(awa.getStateMgr().getAssignees());
- }
- assignees.remove(AtsClientService.get().getUserService().getCurrentUser());
- assignees = AtsUsersUtility.getValidEmailUsers(assignees);
- assignees = AtsUsersUtility.getActiveEmailUsers(assignees);
- if (assignees.size() > 0) {
- oseeNotificationManager.addNotificationEvent(new OseeNotificationEvent(
- AtsClientService.get().getUserServiceClient().getOseeUsers(assignees),
- AtsNotificationManager.getIdString(awa), AtsNotifyType.Assigned.name(), String.format(
- "You have been set as the assignee of [%s] in state [%s] titled [%s]", awa.getArtifactTypeName(),
- awa.getStateMgr().getCurrentStateName(), awa.getName())));
- }
- }
- if (types.contains(AtsNotifyType.Subscribed)) {
- Collection<IAtsUser> subscribed = new HashSet<IAtsUser>();
- subscribed.addAll(SubscribeManager.getSubscribed(awa));
- subscribed = AtsUsersUtility.getValidEmailUsers(subscribed);
- subscribed = AtsUsersUtility.getActiveEmailUsers(subscribed);
- if (subscribed.size() > 0) {
- oseeNotificationManager.addNotificationEvent(new OseeNotificationEvent(
- AtsClientService.get().getUserServiceClient().getOseeUsers(subscribed),
- AtsNotificationManager.getIdString(awa), AtsNotifyType.Subscribed.name(), String.format(
- "[%s] titled [%s] transitioned to [%s] and you subscribed for notification.",
- awa.getArtifactTypeName(), awa.getName(), awa.getStateMgr().getCurrentStateName())));
- }
- }
- if (types.contains(AtsNotifyType.Cancelled) || types.contains(AtsNotifyType.Completed) && (!awa.isTask() && (awa.isCompleted() || awa.isCancelled()))) {
- IAtsUser originator = awa.getCreatedBy();
- if (originator.isActive()) {
- if (!EmailUtil.isEmailValid(originator.getEmail())) {
- OseeLog.logf(Activator.class, Level.INFO, "Email [%s] invalid for user [%s]", originator.getEmail(),
- originator.getName());
- } else if (!AtsClientService.get().getUserService().getCurrentUser().equals(originator)) {
- if (awa.isCompleted()) {
- oseeNotificationManager.addNotificationEvent(new OseeNotificationEvent(
- Arrays.asList(AtsClientService.get().getUserServiceClient().getOseeUser(originator)),
- AtsNotificationManager.getIdString(awa), awa.getCurrentStateName(),
- String.format("[%s] titled [%s] is [%s]", awa.getArtifactTypeName(), awa.getName(),
- awa.getCurrentStateName())));
- }
- if (awa.isCancelled()) {
- oseeNotificationManager.addNotificationEvent(new OseeNotificationEvent(
- Arrays.asList(AtsClientService.get().getUserServiceClient().getOseeUser(originator)),
- AtsNotificationManager.getIdString(awa), awa.getCurrentStateName(), String.format(
- "[%s] titled [%s] was [%s] from the [%s] state on [%s].<br>Reason: [%s]",
- awa.getArtifactTypeName(), awa.getName(), awa.getCurrentStateName(),
- awa.getCancelledFromState(), DateUtil.getMMDDYYHHMM(awa.internalGetCancelledDate()),
- awa.getCancelledReason())));
- }
- }
- }
- }
- if (types.contains(AtsNotifyType.Peer_Reviewers_Completed) && awa instanceof AbstractReviewArtifact) {
- UserRoleManager roleMgr = new UserRoleManager(awa);
- Collection<IAtsUser> authorModerator = new ArrayList<IAtsUser>();
- for (UserRole role : roleMgr.getUserRoles()) {
- if (role.getRole() == Role.Author || role.getRole() == Role.Moderator) {
- authorModerator.add(AtsClientService.get().getUserService().getUserById(role.getUserId()));
- }
- }
- authorModerator = AtsUsersUtility.getValidEmailUsers(authorModerator);
- authorModerator = AtsUsersUtility.getActiveEmailUsers(authorModerator);
- if (authorModerator.size() > 0) {
- oseeNotificationManager.addNotificationEvent(new OseeNotificationEvent(
- AtsClientService.get().getUserServiceClient().getOseeUsers(authorModerator),
- AtsNotificationManager.getIdString(awa), AtsNotifyType.Peer_Reviewers_Completed.name(), String.format(
- "You are Author/Moderator of [%s] titled [%s] which has been reviewed by all reviewers",
- awa.getArtifactTypeName(), awa.getName())));
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/AbstractReviewArtifact.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/AbstractReviewArtifact.java
index c9fe1358777..cff0aaabd2d 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/AbstractReviewArtifact.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/AbstractReviewArtifact.java
@@ -28,7 +28,6 @@ import org.eclipse.osee.ats.api.workdef.ReviewBlockType;
import org.eclipse.osee.ats.core.client.action.ActionArtifact;
import org.eclipse.osee.ats.core.client.config.ActionableItemManager;
import org.eclipse.osee.ats.core.client.internal.Activator;
-import org.eclipse.osee.ats.core.client.internal.AtsClientService;
import org.eclipse.osee.ats.core.client.review.role.UserRoleManager;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
@@ -59,9 +58,8 @@ public abstract class AbstractReviewArtifact extends AbstractWorkflowArtifact im
} else {
List<IAtsUser> users = getImplementersByState(this, PeerToPeerReviewState.Review);
for (UserRole role : UserRoleManager.getUserRoles(this)) {
- IAtsUser atsUser = AtsClientService.get().getUserService().getUserById(role.getUserId());
- if (!users.contains(atsUser)) {
- users.add(atsUser);
+ if (!users.contains(UserRoleManager.getUser(role))) {
+ users.add(UserRoleManager.getUser(role));
}
}
return users;
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/role/UserRoleManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/role/UserRoleManager.java
index 1ddd19177a1..2faadaba617 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/role/UserRoleManager.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/role/UserRoleManager.java
@@ -16,7 +16,9 @@ import java.util.List;
import java.util.logging.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEventFactory;
import org.eclipse.osee.ats.api.notify.AtsNotifyType;
import org.eclipse.osee.ats.api.review.Role;
import org.eclipse.osee.ats.api.review.UserRole;
@@ -24,7 +26,6 @@ import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.core.client.internal.Activator;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
import org.eclipse.osee.ats.core.client.review.PeerToPeerReviewArtifact;
import org.eclipse.osee.ats.core.client.review.defect.ReviewDefectManager;
import org.eclipse.osee.ats.core.client.validator.ArtifactValueProvider;
@@ -108,9 +109,8 @@ public class UserRoleManager {
public List<IAtsUser> getRoleUsers(Role role) throws OseeCoreException {
List<IAtsUser> users = new ArrayList<IAtsUser>();
for (UserRole uRole : getUserRoles()) {
- if (uRole.getRole() == role && !users.contains(AtsClientService.get().getUserService().getUserById(
- uRole.getUserId()))) {
- users.add(AtsClientService.get().getUserService().getUserById(uRole.getUserId()));
+ if (uRole.getRole() == role && !users.contains(getUser(uRole))) {
+ users.add(getUser(uRole));
}
}
return users;
@@ -167,14 +167,14 @@ public class UserRoleManager {
artifact.addAttributeFromString(ATS_ROLE_STORAGE_TYPE, AXml.addTagData(ROLE_ITEM_TAG, newRole.toXml()));
}
rollupHoursSpentToReviewState(artifact);
- validateUserRolesCompleted(artifact, storedUserRoles, userRoles);
+ validateUserRolesCompleted(artifact, storedUserRoles, userRoles, changes);
changes.add(artifact);
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Can't create ats review role document", ex);
}
}
- private void validateUserRolesCompleted(Artifact artifact, List<UserRole> currentUserRoles, List<UserRole> newUserRoles) {
+ private void validateUserRolesCompleted(Artifact artifact, List<UserRole> currentUserRoles, List<UserRole> newUserRoles, IAtsChangeSet changes) {
//all reviewers are complete; send notification to author/moderator
int numCurrentCompleted = 0, numNewCompleted = 0;
for (UserRole role : newUserRoles) {
@@ -195,7 +195,10 @@ public class UserRoleManager {
}
if (numNewCompleted != numCurrentCompleted) {
try {
- AtsNotificationManager.notify((AbstractWorkflowArtifact) artifact, AtsNotifyType.Peer_Reviewers_Completed);
+ changes.getNotifications().addWorkItemNotificationEvent(
+ AtsNotificationEventFactory.getWorkItemNotificationEvent(
+ AtsClientService.get().getUserService().getCurrentUser(), (IAtsWorkItem) artifact,
+ AtsNotifyType.Peer_Reviewers_Completed));
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
}
@@ -213,9 +216,8 @@ public class UserRoleManager {
}
if (!found) {
roleItems.add(userRole);
- IAtsUser atsUser = AtsClientService.get().getUserService().getUserById(userRole.getUserId());
- if (!peerArt.getAssignees().contains(atsUser)) {
- peerArt.getStateMgr().addAssignee(atsUser);
+ if (!peerArt.getAssignees().contains(getUser(userRole))) {
+ peerArt.getStateMgr().addAssignee(getUser(userRole));
}
}
}
@@ -229,23 +231,23 @@ public class UserRoleManager {
StringBuilder builder = new StringBuilder();
builder.append("<TABLE BORDER=\"1\" cellspacing=\"1\" cellpadding=\"3%\" width=\"100%\"><THEAD><TR><TH>Role</TH>" + "<TH>User</TH><TH>Hours</TH><TH>Major</TH><TH>Minor</TH><TH>Issues</TH>");
for (UserRole item : getUserRoles(peerArt)) {
- IAtsUser atsUser = AtsClientService.get().getUserService().getUserById(item.getUserId());
+ IAtsUser user = getUser(item);
String name = "";
- if (atsUser != null) {
- name = atsUser.getName();
+ if (user != null) {
+ name = user.getName();
if (!Strings.isValid(name)) {
- name = atsUser.getName();
+ name = user.getName();
}
}
builder.append("<TR>");
builder.append("<TD>" + item.getRole().name() + "</TD>");
- builder.append("<TD>" + atsUser.getName() + "</TD>");
- builder.append("<TD>" + AtsUtilCore.doubleToI18nString(item.getHoursSpent(), true) + "</TD>");
+ builder.append("<TD>" + user.getName() + "</TD>");
+ builder.append("<TD>" + AtsUtilCore.doubleToI18nString(item.getHoursSpent()) + "</TD>");
ReviewDefectManager defectMgr = new ReviewDefectManager(peerArt);
- builder.append("<TD>" + defectMgr.getNumMajor(atsUser) + "</TD>");
- builder.append("<TD>" + defectMgr.getNumMinor(atsUser) + "</TD>");
- builder.append("<TD>" + defectMgr.getNumIssues(atsUser) + "</TD>");
+ builder.append("<TD>" + defectMgr.getNumMajor(user) + "</TD>");
+ builder.append("<TD>" + defectMgr.getNumMinor(user) + "</TD>");
+ builder.append("<TD>" + defectMgr.getNumIssues(user) + "</TD>");
builder.append("</TR>");
}
builder.append("</TABLE>");
@@ -262,4 +264,8 @@ public class UserRoleManager {
awa.getStateMgr().getPercentComplete(awa.getCurrentStateName()), true,
AtsClientService.get().getUserService().getCurrentUser(), new Date());
}
+
+ public static IAtsUser getUser(UserRole item) {
+ return AtsClientService.get().getUserService().getUserById(item.getUserId());
+ }
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/util/AtsChangeSet.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/util/AtsChangeSet.java
index 89c51a02d24..fce38eaac3c 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/util/AtsChangeSet.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/util/AtsChangeSet.java
@@ -36,7 +36,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
-import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationManager;
/**
* @author Donald G. Dunne
@@ -44,7 +43,7 @@ import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationManager;
public class AtsChangeSet extends AbstractAtsChangeSet {
public AtsChangeSet(String comment) {
- super(comment, null);
+ super(comment, AtsClientService.get().getUserService().getCurrentUser());
}
@Override
@@ -59,7 +58,7 @@ public class AtsChangeSet extends AbstractAtsChangeSet {
if (obj instanceof IAtsWorkItem) {
IAtsWorkItem workItem = (IAtsWorkItem) obj;
if (workItem.getStateMgr().isDirty()) {
- AtsClientService.get().getStateFactory().writeToStore(workItem, this);
+ AtsClientService.get().getStateFactory().writeToStore(user, workItem, this);
((Artifact) workItem.getStoreObject()).persist(transaction);
}
if (workItem.getLog().isDirty()) {
@@ -96,7 +95,7 @@ public class AtsChangeSet extends AbstractAtsChangeSet {
for (IExecuteListener listener : listeners) {
listener.changesStored(this);
}
- OseeNotificationManager.getInstance().sendNotifications();
+ AtsClientService.get().sendNotifications(getNotifications());
}
private void execute(AtsRelationChange relChange, SkynetTransaction transaction) {
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java
index e35fbc4196d..6d308105af6 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEventFactory;
import org.eclipse.osee.ats.api.notify.AtsNotifyType;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
import org.eclipse.osee.ats.api.user.IAtsUser;
@@ -39,7 +40,6 @@ import org.eclipse.osee.ats.core.client.action.ActionArtifact;
import org.eclipse.osee.ats.core.client.artifact.AbstractAtsArtifact;
import org.eclipse.osee.ats.core.client.internal.Activator;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
import org.eclipse.osee.ats.core.client.review.AbstractReviewArtifact;
import org.eclipse.osee.ats.core.client.review.ReviewManager;
import org.eclipse.osee.ats.core.client.task.AbstractTaskableArtifact;
@@ -505,7 +505,9 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
changes.setSoleAttributeValue(this, AtsAttributeTypes.CreatedDate, date);
}
}
- AtsNotificationManager.notify(this, AtsNotifyType.Originator);
+ changes.getNotifications().addWorkItemNotificationEvent(
+ AtsNotificationEventFactory.getWorkItemNotificationEvent(
+ AtsClientService.get().getUserService().getCurrentUser(), this, AtsNotifyType.Originator));
}
private void logCreatedByChange(IAtsUser user, Date date) throws OseeCoreException {
@@ -532,14 +534,17 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
}
}
+ @Override
public Date getCreatedDate() throws OseeCoreException {
return getSoleAttributeValue(AtsAttributeTypes.CreatedDate, null);
}
+ @Override
public Date getCancelledDate() throws OseeCoreException {
return getSoleAttributeValue(AtsAttributeTypes.CancelledDate, null);
}
+ @Override
public IAtsUser getCreatedBy() throws OseeCoreException {
String userId = getSoleAttributeValue(AtsAttributeTypes.CreatedBy, null);
if (Strings.isValid(userId)) {
@@ -552,6 +557,7 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
return getSoleAttributeValue(AtsAttributeTypes.CancelledDate, null);
}
+ @Override
public IAtsUser getCancelledBy() throws OseeCoreException {
String userId = getSoleAttributeValue(AtsAttributeTypes.CancelledBy, null);
if (Strings.isValid(userId)) {
@@ -560,6 +566,7 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
return null;
}
+ @Override
public String getCancelledReason() throws OseeCoreException {
String reason = getSoleAttributeValue(AtsAttributeTypes.CancelledReason, null);
if (!Strings.isValid(reason)) {
@@ -576,14 +583,17 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
}
}
+ @Override
public String getCancelledFromState() throws OseeCoreException {
return getSoleAttributeValue(AtsAttributeTypes.CancelledFromState, null);
}
+ @Override
public Date getCompletedDate() throws OseeCoreException {
return getSoleAttributeValue(AtsAttributeTypes.CompletedDate, null);
}
+ @Override
public IAtsUser getCompletedBy() throws OseeCoreException {
String userId = getSoleAttributeValue(AtsAttributeTypes.CompletedBy, null);
if (Strings.isValid(userId)) {
@@ -608,6 +618,7 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
return getLog().getStateEvent(LogType.StateCancelled, stateName);
}
+ @Override
public String getCompletedFromState() throws OseeCoreException {
String fromState = getSoleAttributeValue(AtsAttributeTypes.CompletedFromState, null);
if (!Strings.isValid(fromState)) {
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/state/StateManagerStoreTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/state/StateManagerStoreTest.java
index 76113e11e47..c7f443cfc93 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/state/StateManagerStoreTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/state/StateManagerStoreTest.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.ats.core.internal.state;
+import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -18,8 +19,8 @@ import java.util.Arrays;
import java.util.List;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
-import org.eclipse.osee.ats.api.notify.AtsNotifyType;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
+import org.eclipse.osee.ats.api.notify.AtsNotificationCollector;
+import org.eclipse.osee.ats.api.notify.AtsWorkItemNotificationEvent;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.user.IAtsUserService;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
@@ -31,8 +32,6 @@ import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workflow.WorkState;
import org.eclipse.osee.ats.api.workflow.state.IAtsStateManager;
import org.eclipse.osee.ats.api.workflow.state.IAtsWorkStateFactory;
-import org.eclipse.osee.ats.core.internal.state.StateManager;
-import org.eclipse.osee.ats.core.internal.state.StateManagerStore;
import org.eclipse.osee.ats.core.model.impl.WorkStateImpl;
import org.eclipse.osee.ats.core.workflow.TestState;
import org.eclipse.osee.ats.core.workflow.state.StateManagerUtility;
@@ -52,7 +51,7 @@ public class StateManagerStoreTest {
// @formatter:off
@Mock IAtsWorkItem workItem;
- @Mock IAtsUser Joe, Kay;
+ @Mock IAtsUser Joe, Kay, asUser;
@Mock IAtsChangeSet changes;
@Mock IAtsWorkDefinition workDef;
@Mock IAtsStateDefinition analyzeState, completedState;
@@ -60,7 +59,7 @@ public class StateManagerStoreTest {
@Mock IAtsStateManager stateMgr;
@Mock IAtsWorkStateFactory workStateFactory;
@Mock IAtsUserService userService;
- @Mock IAtsNotificationService notifyService;
+ @Mock AtsNotificationCollector notifications;
// @formatter:on
@Before
@@ -89,7 +88,7 @@ public class StateManagerStoreTest {
Assert.assertEquals("Analyze", stateMgr.getCurrentStateName());
Assert.assertEquals(2, stateMgr.getAssignees().size());
when(workStateFactory.toStoreStr(stateMgr, "Analyze")).thenReturn("Analyze;<Joe><Kay>;;");
- StateManagerStore.writeToStore(workItem, stateMgr, attrResolver, changes, workStateFactory, notifyService);
+ StateManagerStore.writeToStore(asUser, workItem, stateMgr, attrResolver, changes, workStateFactory);
verify(attrResolver).setSoleAttributeValue(eq(workItem), eq(AtsAttributeTypes.CurrentState),
eq("Analyze;<Joe><Kay>;;"), eq(changes));
@@ -125,12 +124,12 @@ public class StateManagerStoreTest {
"Analyze;<Joe><Kay>;;");
WorkState currentState = new WorkStateImpl("Analyze", Arrays.asList(Joe, Kay), 0, 0);
when(workStateFactory.fromStoreStr(eq("Analyze;<Joe><Kay>;;"))).thenReturn(currentState);
+ when(changes.getNotifications()).thenReturn(notifications);
- StateManagerStore.postPersistNotifyReset(workItem, stateMgr, stateMgr.getAssigneesAdded(), attrResolver,
- workStateFactory, notifyService);
+ StateManagerStore.postPersistNotifyReset(asUser, workItem, stateMgr, stateMgr.getAssigneesAdded(), attrResolver,
+ workStateFactory, changes);
- List<IAtsUser> assigneesAdded = Arrays.asList(Joe, Kay);
- verify(notifyService).notify(workItem, assigneesAdded, AtsNotifyType.Assigned);
+ verify(notifications).addWorkItemNotificationEvent(any(AtsWorkItemNotificationEvent.class));
}
@Test
@@ -146,24 +145,23 @@ public class StateManagerStoreTest {
List<Object> objects = new ArrayList<Object>();
when(changes.getObjects()).thenReturn(objects);
IExecuteListener listener =
- StateManagerStore.getPostPersistExecutionListener(workItem, stateMgr, stateMgr.getAssigneesAdded(),
- attrResolver, workStateFactory, notifyService);
+ StateManagerStore.getPostPersistExecutionListener(asUser, workItem, stateMgr, stateMgr.getAssigneesAdded(),
+ attrResolver, workStateFactory, changes);
when(attrResolver.getSoleAttributeValue(workItem, AtsAttributeTypes.CurrentState, "")).thenReturn(
"Analyze;<Joe><Kay>;;");
WorkState currentState = new WorkStateImpl("Analyze", Arrays.asList(Joe, Kay), 0, 0);
when(workStateFactory.fromStoreStr(eq("Analyze;<Joe><Kay>;;"))).thenReturn(currentState);
+ when(changes.getNotifications()).thenReturn(notifications);
objects.add(workItem);
objects.add("now");
listener =
- StateManagerStore.getPostPersistExecutionListener(workItem, stateMgr, stateMgr.getAssigneesAdded(),
- attrResolver, workStateFactory, notifyService);
+ StateManagerStore.getPostPersistExecutionListener(asUser, workItem, stateMgr, stateMgr.getAssigneesAdded(),
+ attrResolver, workStateFactory, changes);
listener.changesStored(changes);
- List<IAtsUser> assigneesAdded = Arrays.asList(Joe, Kay);
- verify(notifyService).notify(workItem, assigneesAdded, AtsNotifyType.Assigned);
+ verify(notifications).addWorkItemNotificationEvent(any(AtsWorkItemNotificationEvent.class));
}
-
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkItem.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkItem.java
index 5732640e7b6..7bbe637c607 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkItem.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkItem.java
@@ -213,4 +213,14 @@ public class MockWorkItem implements IAtsWorkItem {
this.cancelledFromState = stateName;
}
+ @Override
+ public Date getCancelledDate() {
+ return null;
+ }
+
+ @Override
+ public String getCancelledReason() {
+ return null;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/HoursSpentUtilTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/HoursSpentUtilTest.java
index 96629a93cb2..ecc1b7e35d7 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/HoursSpentUtilTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/HoursSpentUtilTest.java
@@ -13,7 +13,6 @@ package org.eclipse.osee.ats.core.util;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Arrays;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationServiceProvider;
import org.eclipse.osee.ats.api.review.IAtsAbstractReview;
import org.eclipse.osee.ats.api.review.IAtsReviewServiceProvider;
import org.eclipse.osee.ats.api.user.IAtsUserService;
@@ -54,7 +53,6 @@ public class HoursSpentUtilTest {
@Mock IAtsWorkDefinitionService workDefService;
@Mock IAtsWorkItemServiceProvider workItemServiceProvider;
@Mock IAttributeResolver attrResolver;
- @Mock IAtsNotificationServiceProvider notifyServiceProvider ;
@Mock IAtsBranchServiceProvider branchServiceProvider;
@Mock IAtsReviewServiceProvider reviewServiceProvider;
@@ -70,7 +68,6 @@ public class HoursSpentUtilTest {
AtsCoreService.setAtsWorkDefService(workDefService);
AtsCoreService.setAtsWorkItemServiceProvider(workItemServiceProvider);
AtsCoreService.setAtsAttributeResolver(attrResolver);
- AtsCoreService.setAtsNotificationServiceProvider(notifyServiceProvider);
AtsCoreService.setAtsBranchServiceProvider(branchServiceProvider);
AtsCoreService.setAtsReviewServiceProvider(reviewServiceProvider);
atsCore.start();
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/workflow/state/StateManagerUtilityTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/workflow/state/StateManagerUtilityTest.java
index a3cb013dc20..d92c060f4a9 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/workflow/state/StateManagerUtilityTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/workflow/state/StateManagerUtilityTest.java
@@ -16,7 +16,6 @@ import java.util.Arrays;
import java.util.List;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.user.IAtsUserService;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
@@ -56,7 +55,6 @@ public class StateManagerUtilityTest {
@Mock IAtsStateManager stateMgr;
@Mock IAtsWorkStateFactory workStateFactory;
@Mock IAtsUserService userService;
- @Mock IAtsNotificationService notifyService;
// @formatter:on
@Before
diff --git a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
index ad72bab6099..b6c2ab2bd7a 100644
--- a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
@@ -58,7 +58,7 @@ Export-Package: org.eclipse.osee.ats.core,
org.eclipse.osee.ats.core.internal.state,
org.eclipse.osee.ats.core.model,
org.eclipse.osee.ats.core.model.impl,
- org.eclipse.osee.ats.core.notify,
+ org.eclipse.osee.ats.core.review,
org.eclipse.osee.ats.core.users,
org.eclipse.osee.ats.core.util,
org.eclipse.osee.ats.core.validator,
diff --git a/plugins/org.eclipse.osee.ats.core/OSGI-INF/ats.core.service.xml b/plugins/org.eclipse.osee.ats.core/OSGI-INF/ats.core.service.xml
index 6948f5f74a3..a0b945aa447 100644
--- a/plugins/org.eclipse.osee.ats.core/OSGI-INF/ats.core.service.xml
+++ b/plugins/org.eclipse.osee.ats.core/OSGI-INF/ats.core.service.xml
@@ -7,6 +7,5 @@
<reference bind="setAtsWorkItemServiceProvider" cardinality="1..1" interface="org.eclipse.osee.ats.api.workflow.IAtsWorkItemServiceProvider" name="IAtsWorkItemServiceProvider" policy="static"/>
<reference bind="setAtsReviewServiceProvider" cardinality="1..1" interface="org.eclipse.osee.ats.api.review.IAtsReviewServiceProvider" name="IAtsReviewServiceProvider" policy="static"/>
<reference bind="setAtsBranchServiceProvider" cardinality="1..1" interface="org.eclipse.osee.ats.api.workflow.IAtsBranchServiceProvider" name="IAtsBranchServiceProvider" policy="static"/>
- <reference bind="setAtsNotificationServiceProvider" cardinality="1..1" interface="org.eclipse.osee.ats.api.notify.IAtsNotificationServiceProvider" name="IAtsNotificationServiceProvider" policy="static"/>
<reference bind="setAtsConfigProvider" cardinality="1..1" interface="org.eclipse.osee.ats.core.config.IAtsConfigProvider" name="IAtsConfigProvider" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/AtsCoreService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/AtsCoreService.java
index c9dd6d8de16..3a1e5eb9d57 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/AtsCoreService.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/AtsCoreService.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.ats.core.internal;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationServiceProvider;
import org.eclipse.osee.ats.api.review.IAtsReviewService;
import org.eclipse.osee.ats.api.review.IAtsReviewServiceProvider;
import org.eclipse.osee.ats.api.user.IAtsUserService;
@@ -48,7 +46,6 @@ public class AtsCoreService {
private static IAtsStateFactory stateFactory;
private static IAttributeResolver attrResolver;
private static IAtsWorkDefinitionService workDefService;
- private static IAtsNotificationServiceProvider notifyServiceProvider;
private static IAtsUserService userService;
private static Boolean started = null;
private static IAtsWorkItemServiceProvider workItemServiceProvider;
@@ -70,10 +67,6 @@ public class AtsCoreService {
AtsCoreService.workDefService = workDefService;
}
- public static void setAtsNotificationServiceProvider(IAtsNotificationServiceProvider notifyServiceProvider) {
- AtsCoreService.notifyServiceProvider = notifyServiceProvider;
- }
-
public static void setAtsWorkItemServiceProvider(IAtsWorkItemServiceProvider workItemServiceProvider) {
AtsCoreService.workItemServiceProvider = workItemServiceProvider;
}
@@ -95,7 +88,6 @@ public class AtsCoreService {
Conditions.checkNotNull(workDefService, "IAtsWorkDefinitionService");
Conditions.checkNotNull(workItemServiceProvider, "IAtsWorkItemServiceProvider");
Conditions.checkNotNull(attrResolver, "IAttributeResolver");
- Conditions.checkNotNull(notifyServiceProvider, "IAtsNotificationService");
Conditions.checkNotNull(branchServiceProvider, "IAtsBranchServiceProvider");
Conditions.checkNotNull(reviewServiceProvider, "IAtsReviewServiceProvider");
@@ -126,11 +118,6 @@ public class AtsCoreService {
return workDefService;
}
- public static IAtsNotificationService getNotifyService() throws OseeCoreException {
- checkStarted();
- return notifyServiceProvider.getNotifyService();
- }
-
public static IAtsUserService getUserService() throws OseeStateException {
checkStarted();
return userService;
@@ -147,7 +134,7 @@ public class AtsCoreService {
public static IAtsStateFactory getStateFactory() {
if (stateFactory == null) {
- stateFactory = new AtsStateFactory(attrResolver, getWorkStateFactory(), getNotifyService());
+ stateFactory = new AtsStateFactory(attrResolver, getWorkStateFactory());
}
return stateFactory;
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/AtsStateFactory.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/AtsStateFactory.java
index 3bbcb1120d4..9cc25fd3971 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/AtsStateFactory.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/AtsStateFactory.java
@@ -11,7 +11,7 @@
package org.eclipse.osee.ats.core.internal.state;
import org.eclipse.osee.ats.api.IAtsWorkItem;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
+import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.workdef.IAttributeResolver;
import org.eclipse.osee.ats.api.workflow.state.IAtsStateFactory;
@@ -26,12 +26,10 @@ public class AtsStateFactory implements IAtsStateFactory {
private final IAttributeResolver attrResolver;
private final IAtsWorkStateFactory workStateFactory;
- private final IAtsNotificationService notifyService;
- public AtsStateFactory(IAttributeResolver attrResolver, IAtsWorkStateFactory workStateFactory, IAtsNotificationService notifyService) {
+ public AtsStateFactory(IAttributeResolver attrResolver, IAtsWorkStateFactory workStateFactory) {
this.attrResolver = attrResolver;
this.workStateFactory = workStateFactory;
- this.notifyService = notifyService;
}
@Override
@@ -50,9 +48,9 @@ public class AtsStateFactory implements IAtsStateFactory {
}
@Override
- public void writeToStore(IAtsWorkItem workItem, IAtsChangeSet changes) throws OseeCoreException {
- StateManagerStore.writeToStore(workItem, (StateManager) workItem.getStateMgr(), attrResolver, changes,
- workStateFactory, notifyService);
+ public void writeToStore(IAtsUser asUser, IAtsWorkItem workItem, IAtsChangeSet changes) throws OseeCoreException {
+ StateManagerStore.writeToStore(asUser, workItem, (StateManager) workItem.getStateMgr(), attrResolver, changes,
+ workStateFactory);
}
@Override
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManagerStore.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManagerStore.java
index 1a884ce2a59..6e51ca29359 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManagerStore.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManagerStore.java
@@ -13,8 +13,8 @@ package org.eclipse.osee.ats.core.internal.state;
import java.util.List;
import java.util.logging.Level;
import org.eclipse.osee.ats.api.IAtsWorkItem;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEventFactory;
import org.eclipse.osee.ats.api.notify.AtsNotifyType;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.util.IExecuteListener;
@@ -30,26 +30,29 @@ import org.eclipse.osee.framework.logging.OseeLog;
*/
public class StateManagerStore {
- public static void writeToStore(IAtsWorkItem workItem, StateManager stateMgr, IAttributeResolver attrResolver, IAtsChangeSet changes, IAtsWorkStateFactory workStateFactory, IAtsNotificationService notifyService) throws OseeCoreException {
+ public static void writeToStore(IAtsUser asUser, IAtsWorkItem workItem, StateManager stateMgr, IAttributeResolver attrResolver, IAtsChangeSet changes, IAtsWorkStateFactory workStateFactory) throws OseeCoreException {
StateManagerWriter writer = new StateManagerWriter(workItem, stateMgr, attrResolver, changes, workStateFactory);
List<IAtsUser> assigneesAdded = stateMgr.getAssigneesAdded();
writer.writeToStore();
- changes.addExecuteListener(getPostPersistExecutionListener(workItem, stateMgr, assigneesAdded, attrResolver,
- workStateFactory, notifyService));
+ changes.addExecuteListener(getPostPersistExecutionListener(asUser, workItem, stateMgr, assigneesAdded,
+ attrResolver, workStateFactory, changes));
}
- protected static void postPersistNotifyReset(IAtsWorkItem workItem, IAtsStateManager stateMgr, List<IAtsUser> assigneesAdded, IAttributeResolver attrResolver, IAtsWorkStateFactory workStateFactory, IAtsNotificationService notifyService) throws OseeCoreException {
- notifyService.notify(workItem, assigneesAdded, AtsNotifyType.Assigned);
+ protected static void postPersistNotifyReset(IAtsUser asUser, IAtsWorkItem workItem, IAtsStateManager stateMgr, List<IAtsUser> assigneesAdded, IAttributeResolver attrResolver, IAtsWorkStateFactory workStateFactory, IAtsChangeSet changes) throws OseeCoreException {
+ changes.getNotifications().addWorkItemNotificationEvent(
+ AtsNotificationEventFactory.getWorkItemNotificationEvent(asUser, workItem, assigneesAdded,
+ AtsNotifyType.Assigned));
load(workItem, stateMgr, attrResolver, workStateFactory);
}
- protected static IExecuteListener getPostPersistExecutionListener(final IAtsWorkItem workItem, final IAtsStateManager stateMgr, final List<IAtsUser> assigneesAdded, final IAttributeResolver attrResolver, final IAtsWorkStateFactory workStateFactory, final IAtsNotificationService notifyService) {
+ protected static IExecuteListener getPostPersistExecutionListener(final IAtsUser asUser, final IAtsWorkItem workItem, final IAtsStateManager stateMgr, final List<IAtsUser> assigneesAdded, final IAttributeResolver attrResolver, final IAtsWorkStateFactory workStateFactory, final IAtsChangeSet changes) {
return new IExecuteListener() {
@Override
public void changesStored(IAtsChangeSet changes) {
try {
- postPersistNotifyReset(workItem, stateMgr, assigneesAdded, attrResolver, workStateFactory, notifyService);
+ postPersistNotifyReset(asUser, workItem, stateMgr, assigneesAdded, attrResolver, workStateFactory,
+ changes);
} catch (OseeCoreException ex) {
OseeLog.log(AtsCoreService.class, Level.SEVERE, ex);
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/UserRoleManager.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/UserRoleManager.java
new file mode 100644
index 00000000000..479ff989727
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/UserRoleManager.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.core.review;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
+import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.api.review.Role;
+import org.eclipse.osee.ats.api.review.UserRole;
+import org.eclipse.osee.ats.api.user.IAtsUser;
+import org.eclipse.osee.ats.api.user.IAtsUserService;
+import org.eclipse.osee.ats.api.workdef.IAttributeResolver;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class UserRoleManager {
+
+ private final static String ROLE_ITEM_TAG = "Role";
+
+ private final Matcher roleMatcher = java.util.regex.Pattern.compile(
+ "<" + ROLE_ITEM_TAG + ">(.*?)</" + ROLE_ITEM_TAG + ">", Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+ private List<UserRole> roles;
+ private final IAtsUserService userService;
+ private final IAttributeResolver attrResolver;
+ private final IAtsWorkItem workItem;
+
+ public UserRoleManager(IAttributeResolver attrResolver, IAtsUserService userService, IAtsWorkItem workItem) {
+ this.attrResolver = attrResolver;
+ this.userService = userService;
+ this.workItem = workItem;
+ }
+
+ public void ensureLoaded() throws OseeCoreException {
+ if (roles == null) {
+ roles = new ArrayList<UserRole>();
+ for (String xml : attrResolver.getAttributesToStringList(workItem, AtsAttributeTypes.Role)) {
+ roleMatcher.reset(xml);
+ while (roleMatcher.find()) {
+ UserRole item = new UserRole(roleMatcher.group());
+ roles.add(item);
+ }
+ }
+ }
+ }
+
+ public List<UserRole> getUserRoles() throws OseeCoreException {
+ ensureLoaded();
+ return roles;
+ }
+
+ public List<UserRole> getUserRoles(Role role) throws OseeCoreException {
+ List<UserRole> roles = new ArrayList<UserRole>();
+ for (UserRole uRole : getUserRoles()) {
+ if (uRole.getRole() == role) {
+ roles.add(uRole);
+ }
+ }
+ return roles;
+ }
+
+ public List<IAtsUser> getRoleUsers(Role role) throws OseeCoreException {
+ List<IAtsUser> users = new ArrayList<IAtsUser>();
+ for (UserRole uRole : getUserRoles()) {
+ if (uRole.getRole() == role && !users.contains(userService.getUserById(uRole.getUserId()))) {
+ users.add(userService.getUserById(uRole.getUserId()));
+ }
+ }
+ return users;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AbstractAtsUserService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AbstractAtsUserService.java
index b96198d2d71..8c0ded8da3f 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AbstractAtsUserService.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AbstractAtsUserService.java
@@ -113,6 +113,12 @@ public abstract class AbstractAtsUserService implements IAtsUserService {
}
@Override
+ public void releaseUser() {
+ currentUser = null;
+ currentUserId = null;
+ }
+
+ @Override
public void clearCache() {
userIdToAdmin.clear();
userIdToAtsUser.clear();
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsUsersUtility.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsUsersUtility.java
index b900256d29f..711840d5662 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsUsersUtility.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsUsersUtility.java
@@ -15,6 +15,7 @@ import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
import org.eclipse.osee.ats.api.user.IAtsUser;
+import org.eclipse.osee.ats.core.internal.AtsCoreService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -55,4 +56,12 @@ public final class AtsUsersUtility {
}
return false;
}
+
+ public static Collection<? extends IAtsUser> getUsers(Collection<String> userIds) {
+ Set<IAtsUser> users = new HashSet<IAtsUser>();
+ for (String userId : userIds) {
+ users.add(AtsCoreService.getUserService().getUserById(userId));
+ }
+ return users;
+ }
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsChangeSet.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsChangeSet.java
index 7a1045b8758..84f0a29cafb 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsChangeSet.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsChangeSet.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.ats.core.util;
import java.util.Collection;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
+import org.eclipse.osee.ats.api.notify.AtsNotificationCollector;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.util.IExecuteListener;
@@ -29,10 +30,13 @@ public abstract class AbstractAtsChangeSet implements IAtsChangeSet {
protected final Set<Object> deleteObjects = new CopyOnWriteArraySet<Object>();
protected final Set<IExecuteListener> listeners = new CopyOnWriteArraySet<IExecuteListener>();
protected final IAtsUser user;
+ protected final AtsNotificationCollector notifications = new AtsNotificationCollector();
public AbstractAtsChangeSet(String comment, IAtsUser user) {
this.comment = comment;
this.user = user;
+ Conditions.checkNotNullOrEmpty(comment, "comment");
+ Conditions.checkNotNull(user, "user");
}
@Override
@@ -99,4 +103,9 @@ public abstract class AbstractAtsChangeSet implements IAtsChangeSet {
return comment;
}
+ @Override
+ public AtsNotificationCollector getNotifications() {
+ return notifications;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsCoreFactory.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsCoreFactory.java
index 7dfb0757322..2cc1da743a5 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsCoreFactory.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsCoreFactory.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.ats.core.util;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
import org.eclipse.osee.ats.api.review.IAtsReviewService;
import org.eclipse.osee.ats.api.user.IAtsUserService;
import org.eclipse.osee.ats.api.util.IAtsUtilService;
@@ -36,8 +35,8 @@ public final class AtsCoreFactory {
//
}
- public static IAtsStateFactory newStateFactory(IAttributeResolver attrResolver, IAtsUserService userService, IAtsNotificationService notifyService) {
- return new AtsStateFactory(attrResolver, new AtsWorkStateFactory(userService), notifyService);
+ public static IAtsStateFactory newStateFactory(IAttributeResolver attrResolver, IAtsUserService userService) {
+ return new AtsStateFactory(attrResolver, new AtsWorkStateFactory(userService));
}
public static IAtsLogFactory newLogFactory() {
diff --git a/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF
index 8922535fa12..3a1ce89f5fa 100644
--- a/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF
@@ -34,6 +34,7 @@ Import-Package: com.google.inject,
org.eclipse.osee.ats.core,
org.eclipse.osee.ats.core.config,
org.eclipse.osee.ats.core.model.impl,
+ org.eclipse.osee.ats.core.review,
org.eclipse.osee.ats.core.users,
org.eclipse.osee.ats.core.util,
org.eclipse.osee.ats.core.workdef,
@@ -54,6 +55,7 @@ Import-Package: com.google.inject,
org.eclipse.osee.framework.jdk.core.util,
org.eclipse.osee.framework.logging,
org.eclipse.osee.logger,
+ org.eclipse.osee.mail.api,
org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data,
org.eclipse.osee.orcs.search,
diff --git a/plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.no.op.notifier.service.xml b/plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.no.op.notifier.service.xml
new file mode 100644
index 00000000000..18b0ec1ee67
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.no.op.notifier.service.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
+ <implementation class="org.eclipse.osee.ats.impl.internal.notify.AtsNoOpNotifierServiceImpl"/>
+ <service>
+ <provide interface="org.eclipse.osee.ats.impl.internal.notify.IAtsNotifierServer"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.notification.service.xml b/plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.notification.service.xml
new file mode 100644
index 00000000000..545f8ea2d86
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.notification.service.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
+ <implementation class="org.eclipse.osee.ats.impl.internal.notify.AtsNotifierServiceImpl"/>
+ <reference bind="setMailService" cardinality="1..1" interface="org.eclipse.osee.mail.api.MailService" name="MailService" policy="static"/>
+ <service>
+ <provide interface="org.eclipse.osee.ats.impl.internal.notify.IAtsNotifierServer"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.server.service.xml b/plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.server.service.xml
index e7dd742c3b3..bb6aa5118fc 100644
--- a/plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.server.service.xml
+++ b/plugins/org.eclipse.osee.ats.impl/OSGI-INF/ats.server.service.xml
@@ -8,9 +8,9 @@
<provide interface="org.eclipse.osee.ats.api.workflow.IAtsWorkItemServiceProvider"/>
<provide interface="org.eclipse.osee.ats.api.review.IAtsReviewServiceProvider"/>
<provide interface="org.eclipse.osee.ats.api.workflow.IAtsBranchServiceProvider"/>
- <provide interface="org.eclipse.osee.ats.api.notify.IAtsNotificationServiceProvider"/>
<provide interface="org.eclipse.osee.ats.core.config.IAtsConfigProvider"/>
<provide interface="org.eclipse.osee.ats.impl.IAtsServer"/>
</service>
<reference bind="setDatabaseService" cardinality="1..1" interface="org.eclipse.osee.framework.database.IOseeDatabaseService" name="IOseeDatabaseService" policy="static"/>
+ <reference bind="addNotifier" cardinality="1..n" interface="org.eclipse.osee.ats.impl.internal.notify.IAtsNotifierServer" name="IAtsNotifierServer" policy="dynamic" unbind="removeNotifier"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/IAtsServer.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/IAtsServer.java
index f08da6335c1..7c8aacc0514 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/IAtsServer.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/IAtsServer.java
@@ -12,8 +12,7 @@ package org.eclipse.osee.ats.impl;
import java.util.List;
import org.eclipse.osee.ats.api.IAtsObject;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationServiceProvider;
+import org.eclipse.osee.ats.api.notify.IAtsNotifier;
import org.eclipse.osee.ats.api.review.IAtsReviewServiceProvider;
import org.eclipse.osee.ats.api.team.IAtsConfigItemFactory;
import org.eclipse.osee.ats.api.team.IAtsConfigItemFactoryProvider;
@@ -42,7 +41,7 @@ import org.eclipse.osee.orcs.search.QueryBuilder;
/**
* @author Donald G Dunne
*/
-public interface IAtsServer extends IAtsConfigItemFactoryProvider, IAtsConfigProvider, IAtsNotificationServiceProvider, IAtsReviewServiceProvider, IAtsBranchServiceProvider, IAtsWorkItemServiceProvider, IAtsWorkDefinitionServiceProvider, IArtifactProvider {
+public interface IAtsServer extends IAtsNotifier, IAtsConfigItemFactoryProvider, IAtsConfigProvider, IAtsReviewServiceProvider, IAtsBranchServiceProvider, IAtsWorkItemServiceProvider, IAtsWorkDefinitionServiceProvider, IArtifactProvider {
OrcsApi getOrcsApi() throws OseeCoreException;
@@ -53,9 +52,6 @@ public interface IAtsServer extends IAtsConfigItemFactoryProvider, IAtsConfigPro
@Override
ArtifactReadable getArtifact(IAtsObject atsObject) throws OseeCoreException;
- @Override
- IAtsNotificationService getNotifyService() throws OseeCoreException;
-
IAtsWorkDefinitionAdmin getWorkDefAdmin();
ArtifactReadable getArtifactByGuid(String guid);
@@ -87,6 +83,8 @@ public interface IAtsServer extends IAtsConfigItemFactoryProvider, IAtsConfigPro
QueryBuilder getQuery();
+ boolean isProduction();
+
String getConfigValue(String key);
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/AtsServerImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/AtsServerImpl.java
index 17704aa37b4..42ecb05f7f9 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/AtsServerImpl.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/AtsServerImpl.java
@@ -11,9 +11,11 @@
package org.eclipse.osee.ats.impl.internal;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Level;
import org.eclipse.osee.ats.api.IAtsObject;
import org.eclipse.osee.ats.api.data.AtsArtifactToken;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
+import org.eclipse.osee.ats.api.notify.AtsNotificationCollector;
import org.eclipse.osee.ats.api.review.IAtsReviewService;
import org.eclipse.osee.ats.api.team.IAtsConfigItemFactory;
import org.eclipse.osee.ats.api.team.IAtsWorkItemFactory;
@@ -38,10 +40,13 @@ import org.eclipse.osee.ats.impl.action.IAtsActionFactory;
import org.eclipse.osee.ats.impl.action.IWorkItemPage;
import org.eclipse.osee.ats.impl.internal.action.ActionFactory;
import org.eclipse.osee.ats.impl.internal.convert.AtsDatabaseConversions;
+import org.eclipse.osee.ats.impl.internal.notify.AtsNotificationEventProcessor;
+import org.eclipse.osee.ats.impl.internal.notify.AtsNotifierServiceImpl;
+import org.eclipse.osee.ats.impl.internal.notify.IAtsNotifierServer;
+import org.eclipse.osee.ats.impl.internal.notify.WorkItemNotificationProcessor;
import org.eclipse.osee.ats.impl.internal.util.AtsArtifactConfigCache;
import org.eclipse.osee.ats.impl.internal.util.AtsAttributeResolverServiceImpl;
import org.eclipse.osee.ats.impl.internal.util.AtsBranchServiceImpl;
-import org.eclipse.osee.ats.impl.internal.util.AtsNotificationServiceImpl;
import org.eclipse.osee.ats.impl.internal.util.AtsReviewServiceImpl;
import org.eclipse.osee.ats.impl.internal.util.AtsStoreFactoryImpl;
import org.eclipse.osee.ats.impl.internal.util.AtsUtilServer;
@@ -57,8 +62,8 @@ import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
-import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.data.ArtifactReadable;
@@ -76,7 +81,6 @@ public class AtsServerImpl implements IAtsServer {
private static AtsServerImpl instance;
private static IAtsWorkDefinitionService workDefService;
private static IAtsUserService userService;
- private static IAtsNotificationService notifyService;
private IAtsWorkItemService workItemService;
private IAtsBranchService branchService;
private IAtsReviewService reviewService;
@@ -96,6 +100,9 @@ public class AtsServerImpl implements IAtsServer {
private IAtsActionFactory actionFactory;
private ActionableItemManager actionableItemManager;
private IOseeDatabaseService dbService;
+ private final List<IAtsNotifierServer> notifiers = new CopyOnWriteArrayList<IAtsNotifierServer>();
+ private WorkItemNotificationProcessor workItemNotificationProcessor;
+ private AtsNotificationEventProcessor notificationEventProcessor;
public static AtsServerImpl get() {
checkStarted();
@@ -127,14 +134,18 @@ public class AtsServerImpl implements IAtsServer {
AtsServerImpl.userService = userService;
}
+ public void addNotifier(IAtsNotifierServer notifier) {
+ notifiers.add(notifier);
+ }
+
+ public void removeNotifier(IAtsNotifierServer notifier) {
+ notifiers.remove(notifier);
+ }
+
public void start() throws OseeCoreException {
- Conditions.checkNotNull(orcsApi, "OrcsApi");
- Conditions.checkNotNull(workDefService, "IAtsWorkDefinitionService");
- Conditions.checkNotNull(userService, "IAtsUserService");
instance = this;
workItemFactory = new WorkItemFactory(logger, this);
configItemFactory = new ConfigItemFactory(logger, this);
- notifyService = new AtsNotificationServiceImpl();
workItemService = new AtsWorkItemServiceImpl(this, this);
branchService = new AtsBranchServiceImpl(orcsApi);
@@ -149,7 +160,7 @@ public class AtsServerImpl implements IAtsServer {
attributeResolverService);
atsLogFactory = AtsCoreFactory.newLogFactory();
- atsStateFactory = AtsCoreFactory.newStateFactory(attributeResolverService, userService, notifyService);
+ atsStateFactory = AtsCoreFactory.newStateFactory(attributeResolverService, userService);
atsStoreFactory = new AtsStoreFactoryImpl(this);
utilService = AtsCoreFactory.getUtilService(attributeResolverService);
@@ -202,12 +213,6 @@ public class AtsServerImpl implements IAtsServer {
}
@Override
- public IAtsNotificationService getNotifyService() throws OseeCoreException {
- checkStarted();
- return notifyService;
- }
-
- @Override
public IAtsWorkItemService getWorkItemService() throws OseeStateException {
checkStarted();
return workItemService;
@@ -329,4 +334,25 @@ public class AtsServerImpl implements IAtsServer {
return result;
}
+ @Override
+ public boolean isProduction() {
+ return getDatabaseService().isProduction();
+ }
+
+ @Override
+ public void sendNotifications(AtsNotificationCollector notifications) {
+ if (notificationEventProcessor == null) {
+ workItemNotificationProcessor =
+ new WorkItemNotificationProcessor(this, orcsApi, workItemFactory, userService, attributeResolverService);
+ notificationEventProcessor =
+ new AtsNotificationEventProcessor(workItemNotificationProcessor, userService,
+ getConfigValue("NoReplyEmail"));
+ }
+ if (notifiers.isEmpty() || !isProduction()) {
+ OseeLog.log(AtsNotifierServiceImpl.class, Level.INFO, "Osee Notification Disabled");
+ return;
+ } else {
+ notificationEventProcessor.sendNotifications(notifications, notifiers);
+ }
+ }
}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNoOpNotifierServiceImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNoOpNotifierServiceImpl.java
new file mode 100644
index 00000000000..f4868479f8b
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNoOpNotifierServiceImpl.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.impl.internal.notify;
+
+import java.util.Collection;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEvent;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsNoOpNotifierServiceImpl implements IAtsNotifierServer {
+
+ @Override
+ public void sendNotifications(String fromUserEmail, String testingUserEmail, String subject, String body, Collection<? extends AtsNotificationEvent> notificationEvents) {
+ // do nothing
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNotificationEventProcessor.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNotificationEventProcessor.java
new file mode 100644
index 00000000000..ce392fac6c3
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNotificationEventProcessor.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.impl.internal.notify;
+
+import java.util.List;
+import org.eclipse.osee.ats.api.notify.AtsNotificationCollector;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEvent;
+import org.eclipse.osee.ats.api.notify.AtsWorkItemNotificationEvent;
+import org.eclipse.osee.ats.api.user.IAtsUserService;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+public class AtsNotificationEventProcessor {
+
+ private final String noReplyEmail;
+ private final WorkItemNotificationProcessor workItemNotificationProcessor;
+ private final IAtsUserService userService;
+
+ public AtsNotificationEventProcessor(WorkItemNotificationProcessor workItemNotificationProcessor, IAtsUserService userService, String noReplyEmail) {
+ this.workItemNotificationProcessor = workItemNotificationProcessor;
+ this.userService = userService;
+ this.noReplyEmail = noReplyEmail;
+ }
+
+ public void sendNotifications(AtsNotificationCollector notifications, List<IAtsNotifierServer> notifiers) {
+
+ // convert all WorkItem notifications to AtsNotificationEvent
+ for (AtsWorkItemNotificationEvent workItemEvent : notifications.getWorkItemNotificationEvents()) {
+ workItemNotificationProcessor.run(notifications, workItemEvent);
+ }
+
+ String testingUserEmail = "donald.g.dunne@boeing.com"; // change to email address for testing purposes; all emails will go there
+ String fromUserEmail = getFromUserEmail(notifications);
+
+ for (IAtsNotifierServer notifier : notifiers) {
+ notifier.sendNotifications(fromUserEmail, testingUserEmail, notifications.getSubject(),
+ notifications.getBody(), notifications.getNotificationEvents());
+ }
+ }
+
+ private String getFromUserEmail(AtsNotificationCollector notifications) {
+ String email = noReplyEmail;
+ for (AtsNotificationEvent event : notifications.getNotificationEvents()) {
+ if (Strings.isValid(event.getFromUserId())) {
+ email = userService.getUserById(event.getFromUserId()).getEmail();
+ break;
+ }
+ }
+ return email;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNotifierServiceImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNotifierServiceImpl.java
new file mode 100644
index 00000000000..4e68b114e0d
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/AtsNotifierServiceImpl.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.impl.internal.notify;
+
+import java.util.Collection;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEvent;
+import org.eclipse.osee.mail.api.MailService;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsNotifierServiceImpl implements IAtsNotifierServer {
+
+ private MailService mailService;
+
+ public void setMailService(MailService mailService) {
+ this.mailService = mailService;
+ }
+
+ /**
+ * Send notifications
+ */
+ @Override
+ public void sendNotifications(String fromUserEmail, String testingUserEmail, String subject, String body, Collection<? extends AtsNotificationEvent> notificationEvents) {
+ SendNotificationEvents job =
+ new SendNotificationEvents(mailService, fromUserEmail, testingUserEmail, subject, body, notificationEvents);
+ job.run();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/IAtsNotifierServer.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/IAtsNotifierServer.java
new file mode 100644
index 00000000000..eb06276487f
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/IAtsNotifierServer.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.impl.internal.notify;
+
+import java.util.Collection;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEvent;
+
+public interface IAtsNotifierServer {
+
+ /**
+ * Send notifications
+ */
+ public void sendNotifications(String fromUserEmail, String testingUserEmail, String subject, String body, Collection<? extends AtsNotificationEvent> notificationEvents);
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/SendNotificationEvents.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/SendNotificationEvents.java
new file mode 100644
index 00000000000..fb999c9e929
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/SendNotificationEvents.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.impl.internal.notify;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEvent;
+import org.eclipse.osee.ats.api.user.IAtsUser;
+import org.eclipse.osee.ats.core.users.AtsUsersUtility;
+import org.eclipse.osee.framework.core.enums.SystemUser;
+import org.eclipse.osee.framework.core.util.Result;
+import org.eclipse.osee.framework.core.util.XResultData;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.mail.api.MailMessage;
+import org.eclipse.osee.mail.api.MailService;
+import org.eclipse.osee.mail.api.MailStatus;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SendNotificationEvents {
+ private final Collection<? extends AtsNotificationEvent> notificationEvents;
+ private final String subject;
+ private final String body;
+ private final MailService mailService;
+ private final String fromUserEmail;
+ private final String testingUserEmail;
+
+ protected SendNotificationEvents(MailService mailService, String fromUserEmail, String testingUserEmail, String subject, String body, Collection<? extends AtsNotificationEvent> notificationEvents) {
+ this.mailService = mailService;
+ this.fromUserEmail = fromUserEmail;
+ this.testingUserEmail = testingUserEmail;
+ this.subject = subject;
+ this.body = body;
+ this.notificationEvents = notificationEvents;
+ if (isTesting()) {
+ OseeLog.log(SendNotificationEvents.class, Level.SEVERE,
+ "OseeNotifyUsersJob: testing is enabled....turn off for production.");
+ }
+ }
+
+ public Result run() {
+ try {
+ Set<IAtsUser> uniqueUusers = new HashSet<IAtsUser>();
+ for (AtsNotificationEvent notificationEvent : notificationEvents) {
+ uniqueUusers.addAll(AtsUsersUtility.getUsers(notificationEvent.getUserIds()));
+ }
+ XResultData resultData = new XResultData();
+ if (isTesting()) {
+ resultData.logErrorWithFormat("Testing Results Report for Osee Notification; Email to user [%s].<br>",
+ testingUserEmail);
+ }
+ for (IAtsUser user : AtsUsersUtility.getValidEmailUsers(uniqueUusers)) {
+ List<AtsNotificationEvent> notifyEvents = new ArrayList<AtsNotificationEvent>();
+ for (AtsNotificationEvent notificationEvent : notificationEvents) {
+ if (isTesting() || AtsUsersUtility.getUsers(notificationEvent.getUserIds()).contains(user)) {
+ notifyEvents.add(notificationEvent);
+ }
+ }
+ notifyUser(user, notifyEvents, resultData);
+ }
+ return Result.TrueResult;
+ } catch (Exception ex) {
+ OseeLog.log(SendNotificationEvents.class, OseeLevel.SEVERE_POPUP, ex);
+ return new Result("Error notifying users [%s]", ex.getMessage());
+ }
+ }
+
+ private String notificationEventsToHtml(List<AtsNotificationEvent> notificationEvents) {
+ StringBuffer sb = new StringBuffer();
+ sb.append(AHTML.beginMultiColumnTable(100, 1));
+ sb.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Reason", "Description", "Id", "URL"}));
+ for (AtsNotificationEvent notificationEvent : notificationEvents) {
+ sb.append(AHTML.addRowMultiColumnTable(new String[] {
+ notificationEvent.getType(),
+ notificationEvent.getDescription(),
+ notificationEvent.getId(),
+ getHyperlink(notificationEvent)}));
+ }
+ sb.append(AHTML.endMultiColumnTable());
+ return sb.toString().replaceAll("\n", "");
+ }
+
+ private String getHyperlink(AtsNotificationEvent notificationEvent) {
+ return Strings.isValid(notificationEvent.getUrl()) ? AHTML.getHyperlink(notificationEvent.getUrl(), "More Info") : "";
+ }
+
+ private void notifyUser(IAtsUser user, List<AtsNotificationEvent> notificationEvents, XResultData resultData) throws OseeCoreException {
+ if (user.getUserId().equals(SystemUser.OseeSystem.getUserId()) || user.getUserId().equals(
+ SystemUser.UnAssigned.getUserId()) || user.getUserId().equals(SystemUser.Guest.getUserId())) {
+ // do nothing
+ return;
+ }
+ if (!AtsUsersUtility.isEmailValid(user.getEmail())) {
+ // do nothing; can't send email from user with invalid email address
+ return;
+ }
+ String html = "";
+ if (Strings.isValid(body)) {
+ html += "<pre>" + body + "</pre>";
+ }
+ html += notificationEventsToHtml(notificationEvents);
+ String email = user.getEmail();
+ if (!Strings.isValid(email)) {
+ // do nothing
+ return;
+ } else {
+
+ String useEmail = isTesting() ? testingUserEmail : email;
+
+ MailMessage msg = MailMessage.newBuilder() //
+ .from(fromUserEmail) //
+ .recipients(Arrays.asList(useEmail)) //
+ .subject(getNotificationEmailSubject(notificationEvents)) //
+ .addHtml(html)//
+ .build();
+
+ List<MailStatus> sendMessages = mailService.sendMessages(msg);
+ System.out.println(sendMessages);
+ }
+ }
+
+ private boolean isTesting() {
+ return Strings.isValid(testingUserEmail);
+ }
+
+ private String getNotificationEmailSubject(List<AtsNotificationEvent> notificationEvents) {
+ String result = subject;
+ if (!Strings.isValid(result)) {
+ if (notificationEvents.size() == 1) {
+ AtsNotificationEvent event = notificationEvents.iterator().next();
+ result =
+ Strings.truncate("OSEE Notification" + " - " + event.getType() + " - " + event.getDescription(), 128);
+ } else {
+ result = "OSEE Notification";
+ }
+ }
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/WorkItemNotificationProcessor.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/WorkItemNotificationProcessor.java
new file mode 100644
index 00000000000..2540ff35914
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/notify/WorkItemNotificationProcessor.java
@@ -0,0 +1,259 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.impl.internal.notify;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
+import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
+import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.api.data.AtsRelationTypes;
+import org.eclipse.osee.ats.api.notify.AtsNotificationCollector;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEventFactory;
+import org.eclipse.osee.ats.api.notify.AtsNotifyType;
+import org.eclipse.osee.ats.api.notify.AtsWorkItemNotificationEvent;
+import org.eclipse.osee.ats.api.review.IAtsAbstractReview;
+import org.eclipse.osee.ats.api.review.Role;
+import org.eclipse.osee.ats.api.review.UserRole;
+import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
+import org.eclipse.osee.ats.api.team.IAtsWorkItemFactory;
+import org.eclipse.osee.ats.api.user.IAtsUser;
+import org.eclipse.osee.ats.api.user.IAtsUserService;
+import org.eclipse.osee.ats.api.workdef.IAttributeResolver;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
+import org.eclipse.osee.ats.core.review.UserRoleManager;
+import org.eclipse.osee.ats.core.users.AtsCoreUsers;
+import org.eclipse.osee.ats.core.users.AtsUsersUtility;
+import org.eclipse.osee.ats.impl.IAtsServer;
+import org.eclipse.osee.ats.impl.internal.util.AtsUtilServer;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.DateUtil;
+import org.eclipse.osee.framework.jdk.core.util.EmailUtil;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorkItemNotificationProcessor {
+
+ private final IAtsUserService userService;
+ private final IAttributeResolver attrResolver;
+ private final OrcsApi orcsApi;
+ private final IAtsWorkItemFactory workItemFactory;
+ private final IAtsServer atsServer;
+ private static String actionUrl;
+
+ public WorkItemNotificationProcessor(IAtsServer atsServer, OrcsApi orcsApi, IAtsWorkItemFactory workItemFactory, IAtsUserService userService, IAttributeResolver attrResolver) throws OseeCoreException {
+ this.atsServer = atsServer;
+ this.orcsApi = orcsApi;
+ this.workItemFactory = workItemFactory;
+ this.userService = userService;
+ this.attrResolver = attrResolver;
+ }
+
+ /**
+ * @param notifyUsers only valid for assignees notifyType. if null or any other type, the users will be computed
+ */
+ public void run(AtsNotificationCollector notifications, AtsWorkItemNotificationEvent event) throws OseeCoreException {
+ Collection<AtsNotifyType> types = event.getNotifyTypes();
+ List<IAtsUser> notifyUsers = new ArrayList<IAtsUser>();
+ IAtsUser fromUser = AtsCoreUsers.SYSTEM_USER;
+ if (Strings.isValid(event.getFromUserId())) {
+ fromUser = userService.getUserById(event.getFromUserId());
+ }
+ for (String userId : event.getUserIds()) {
+ notifyUsers.add(userService.getUserById(userId));
+ }
+ for (String atsId : event.getAtsIds()) {
+ IAtsWorkItem workItem = workItemFactory.getWorkItem(AtsUtilServer.getArtifactByAtsId(orcsApi, atsId));
+
+ if (types.contains(AtsNotifyType.Originator)) {
+ IAtsUser originator = workItem.getCreatedBy();
+ if (originator.isActive()) {
+ if (!EmailUtil.isEmailValid(originator.getEmail()) && !AtsCoreUsers.isAtsCoreUser(originator)) {
+ OseeLog.logf(WorkItemNotificationProcessor.class, Level.INFO, "Email [%s] invalid for user [%s]",
+ originator.getEmail(), originator.getName());
+ } else if (!fromUser.equals(originator)) {
+ notifications.addNotificationEvent(AtsNotificationEventFactory.getNotificationEvent(
+ getFromUser(event),
+ Arrays.asList(originator),
+ getIdString(workItem),
+ AtsNotifyType.Originator.name(),
+ getUrl(workItem),
+ String.format("You have been set as the originator of [%s] state [%s] titled [%s]",
+ workItem.getArtifactTypeName(), workItem.getStateMgr().getCurrentStateName(),
+ workItem.getName())));
+ }
+ }
+ }
+ if (types.contains(AtsNotifyType.Assigned)) {
+ Collection<IAtsUser> assignees = new HashSet<IAtsUser>();
+ if (!notifyUsers.isEmpty()) {
+ assignees.addAll(notifyUsers);
+ } else {
+ assignees.addAll(workItem.getStateMgr().getAssignees());
+ }
+ assignees.remove(fromUser);
+ assignees = AtsUsersUtility.getValidEmailUsers(assignees);
+ assignees = AtsUsersUtility.getActiveEmailUsers(assignees);
+ if (assignees.size() > 0) {
+ notifications.addNotificationEvent(AtsNotificationEventFactory.getNotificationEvent(
+ getFromUser(event),
+ assignees,
+ getIdString(workItem),
+ AtsNotifyType.Assigned.name(),
+ getUrl(workItem),
+ String.format("You have been set as the assignee of [%s] in state [%s] titled [%s]",
+ workItem.getArtifactTypeName(), workItem.getStateMgr().getCurrentStateName(), workItem.getName())));
+ }
+ }
+ if (types.contains(AtsNotifyType.Subscribed)) {
+ Collection<IAtsUser> subscribed = new HashSet<IAtsUser>();
+ subscribed.addAll(getSubscribed(workItem));
+ subscribed = AtsUsersUtility.getValidEmailUsers(subscribed);
+ subscribed = AtsUsersUtility.getActiveEmailUsers(subscribed);
+ if (subscribed.size() > 0) {
+ notifications.addNotificationEvent(AtsNotificationEventFactory.getNotificationEvent(
+ getFromUser(event),
+ subscribed,
+ getIdString(workItem),
+ AtsNotifyType.Subscribed.name(),
+ getUrl(workItem),
+ String.format("[%s] titled [%s] transitioned to [%s] and you subscribed for notification.",
+ workItem.getArtifactTypeName(), workItem.getName(), workItem.getStateMgr().getCurrentStateName())));
+ }
+ }
+ if (types.contains(AtsNotifyType.Cancelled) || types.contains(AtsNotifyType.Completed) && (!workItem.isTask() && (workItem.getStateDefinition().getStateType().isCompleted() || workItem.getStateDefinition().getStateType().isCancelled()))) {
+ IAtsUser originator = workItem.getCreatedBy();
+ if (originator.isActive()) {
+ if (!EmailUtil.isEmailValid(originator.getEmail())) {
+ OseeLog.logf(WorkItemNotificationProcessor.class, Level.INFO, "Email [%s] invalid for user [%s]",
+ originator.getEmail(), originator.getName());
+ } else if (!fromUser.equals(originator)) {
+ if (workItem.getStateDefinition().getStateType().isCompleted()) {
+ notifications.addNotificationEvent(AtsNotificationEventFactory.getNotificationEvent(
+ getFromUser(event), Arrays.asList(originator), getIdString(workItem),
+ workItem.getStateMgr().getCurrentStateName(), getUrl(workItem), String.format(
+ "[%s] titled [%s] is [%s]", workItem.getArtifactTypeName(), workItem.getName(),
+ workItem.getStateMgr().getCurrentStateName())));
+ }
+ if (workItem.getStateDefinition().getStateType().isCancelled()) {
+ notifications.addNotificationEvent(AtsNotificationEventFactory.getNotificationEvent(
+ getFromUser(event), Arrays.asList(originator), getIdString(workItem),
+ workItem.getStateMgr().getCurrentStateName(), getUrl(workItem), String.format(
+ "[%s] titled [%s] was [%s] from the [%s] state on [%s].<br>Reason: [%s]",
+ workItem.getArtifactTypeName(), workItem.getName(),
+ workItem.getStateMgr().getCurrentStateName(), workItem.getCancelledFromState(),
+ DateUtil.getMMDDYYHHMM(workItem.getCancelledDate()), workItem.getCancelledReason())));
+ }
+ }
+ }
+ }
+ if (types.contains(AtsNotifyType.Peer_Reviewers_Completed) && workItem instanceof IAtsAbstractReview) {
+ UserRoleManager roleMgr = new UserRoleManager(attrResolver, userService, workItem);
+ Collection<IAtsUser> authorModerator = new ArrayList<IAtsUser>();
+ for (UserRole role : roleMgr.getUserRoles()) {
+ if (role.getRole() == Role.Author || role.getRole() == Role.Moderator) {
+ authorModerator.add(userService.getUserById(role.getUserId()));
+ }
+ }
+ authorModerator = AtsUsersUtility.getValidEmailUsers(authorModerator);
+ authorModerator = AtsUsersUtility.getActiveEmailUsers(authorModerator);
+ if (authorModerator.size() > 0) {
+ notifications.addNotificationEvent(AtsNotificationEventFactory.getNotificationEvent(getFromUser(event),
+ authorModerator, getIdString(workItem), AtsNotifyType.Peer_Reviewers_Completed.name(), String.format(
+ "You are Author/Moderator of [%s] titled [%s] which has been reviewed by all reviewers",
+ workItem.getArtifactTypeName(), workItem.getName())));
+ }
+ }
+ if (types.contains(AtsNotifyType.SubscribedTeamOrAi)) {
+ if (workItem.isTeamWorkflow()) {
+ IAtsTeamWorkflow teamWf = (IAtsTeamWorkflow) workItem;
+ try {
+ Collection<IAtsUser> subscribedUsers = new HashSet<IAtsUser>();
+ // Handle Team Definitions
+ IAtsTeamDefinition teamDef = teamWf.getTeamDefinition();
+ subscribedUsers.addAll(teamDef.getSubscribed());
+ if (subscribedUsers.size() > 0) {
+ notifications.addNotificationEvent(AtsNotificationEventFactory.getNotificationEvent(
+ AtsCoreUsers.SYSTEM_USER,
+ subscribedUsers,
+ getIdString(teamWf),
+ "Workflow Creation",
+ getUrl(workItem),
+ "You have subscribed for email notification for Team \"" + teamWf.getTeamDefinition().getName() + "\"; New Team Workflow created with title \"" + teamWf.getName() + "\""));
+ }
+
+ // Handle Actionable Items
+ for (IAtsActionableItem aia : teamWf.getActionableItems()) {
+ subscribedUsers = aia.getSubscribed();
+ if (subscribedUsers.size() > 0) {
+ notifications.addNotificationEvent(AtsNotificationEventFactory.getNotificationEvent(
+ AtsCoreUsers.SYSTEM_USER,
+ subscribedUsers,
+ getIdString(teamWf),
+ "Workflow Creation",
+ getUrl(workItem),
+ "You have subscribed for email notification for Actionable Item \"" + teamWf.getTeamDefinition().getName() + "\"; New Team Workflow created with title \"" + teamWf.getName() + "\""));
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsNotifierServiceImpl.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ }
+
+ private String getUrl(IAtsWorkItem workItem) {
+ if (actionUrl == null) {
+ actionUrl = atsServer.getConfigValue("ActionUrl");
+ }
+ return actionUrl.replaceFirst("UUID", workItem.getGuid());
+ }
+
+ private IAtsUser getFromUser(AtsWorkItemNotificationEvent event) {
+ IAtsUser fromUser = AtsCoreUsers.SYSTEM_USER;
+ if (Strings.isValid(event.getFromUserId())) {
+ fromUser = userService.getUserById(event.getFromUserId());
+ }
+ return fromUser;
+ }
+
+ private List<IAtsUser> getSubscribed(IAtsWorkItem workItem) throws OseeCoreException {
+ ArrayList<IAtsUser> arts = new ArrayList<IAtsUser>();
+ for (ArtifactReadable art : ((ArtifactReadable) workItem).getRelated(AtsRelationTypes.SubscribedUser_User)) {
+ arts.add(userService.getUserById((String) art.getSoleAttributeValue(CoreAttributeTypes.UserId)));
+ }
+ return arts;
+ }
+
+ private String getIdString(IAtsWorkItem workItem) {
+ try {
+ String legacyPcrId = attrResolver.getSoleAttributeValue(workItem, AtsAttributeTypes.LegacyPcrId, "");
+ if (!legacyPcrId.equals("")) {
+ return "ID: " + workItem.getAtsId() + " / LegacyId: " + legacyPcrId;
+ }
+ } catch (Exception ex) {
+ OseeLog.log(WorkItemNotificationProcessor.class, Level.SEVERE, ex);
+ }
+ return "ID: " + workItem.getAtsId();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsChangeSet.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsChangeSet.java
index 5940e7206ec..c6bfb104087 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsChangeSet.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsChangeSet.java
@@ -70,7 +70,7 @@ public class AtsChangeSet extends AbstractAtsChangeSet {
IAtsWorkItem workItem = (IAtsWorkItem) obj;
IAtsStateManager stateMgr = workItem.getStateMgr();
if (stateMgr.isDirty()) {
- atsServer.getStateFactory().writeToStore(workItem, this);
+ atsServer.getStateFactory().writeToStore(user, workItem, this);
}
if (workItem.getLog().isDirty()) {
atsServer.getLogFactory().writeToStore(workItem, AtsServerService.get().getAttributeResolver(), this);
@@ -89,6 +89,7 @@ public class AtsChangeSet extends AbstractAtsChangeSet {
for (IExecuteListener listener : listeners) {
listener.changesStored(this);
}
+ atsServer.sendNotifications(getNotifications());
}
public static void execute(IAtsServer atsServer, String comment, IAtsUser user, Object object, Object... objects) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsNotificationServiceImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsNotificationServiceImpl.java
deleted file mode 100644
index 07b9cdd9ae4..00000000000
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsNotificationServiceImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.impl.internal.util;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.osee.ats.api.IAtsWorkItem;
-import org.eclipse.osee.ats.api.notify.AtsNotificationEvent;
-import org.eclipse.osee.ats.api.notify.AtsNotifyType;
-import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
-import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsNotificationServiceImpl implements IAtsNotificationService {
-
- public AtsNotificationServiceImpl() {
- }
-
- @Override
- public void addNotificationEvent(AtsNotificationEvent notificationEvent) throws OseeCoreException {
- // TODO - feature[ats_<QPLVQ>]: Add notification for ATS cancel to the server
- }
-
- @Override
- public void clear() {
- // TODO - feature[ats_<QPLVQ>]: Add notification for ATS cancel to the server
- }
-
- @Override
- public List<AtsNotificationEvent> getNotificationEvents() throws OseeCoreException {
- // TODO - feature[ats_<QPLVQ>]: Add notification for ATS cancel to the server
- return Collections.emptyList();
- }
-
- @Override
- public void sendNotifications() {
- // TODO - feature[ats_<QPLVQ>]: Add notification for ATS cancel to the server
- }
-
- @Override
- public void notify(IAtsWorkItem workItem, Collection<? extends IAtsUser> notifyUsers, AtsNotifyType... notifyTypes) throws OseeCoreException {
- // TODO - feature[ats_<QPLVQ>]: Add notification for ATS cancel to the server
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/WorkItem.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/WorkItem.java
index e3ad9cb1b96..5e584897c9f 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/WorkItem.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/WorkItem.java
@@ -238,4 +238,14 @@ public class WorkItem extends AtsObject implements IAtsWorkItem {
return artifact.getSoleAttributeValue(AtsAttributeTypes.CompletedDate, null);
}
+ @Override
+ public Date getCancelledDate() {
+ return artifact.getSoleAttributeValue(AtsAttributeTypes.CancelledDate, null);
+ }
+
+ @Override
+ public String getCancelledReason() {
+ return artifact.getSoleAttributeValue(AtsAttributeTypes.CancelledReason, null);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java
index 6eab81c6d72..4da90e73ede 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java
@@ -21,7 +21,6 @@ import org.eclipse.osee.ats.rest.internal.cpa.CpaResource;
import org.eclipse.osee.ats.rest.internal.cpa.CpaServiceRegistry;
import org.eclipse.osee.ats.rest.internal.resources.ActionResource;
import org.eclipse.osee.ats.rest.internal.resources.AtsUiResource;
-import org.eclipse.osee.ats.rest.internal.resources.ConfigResource;
import org.eclipse.osee.ats.rest.internal.resources.ConvertResource;
import org.eclipse.osee.ats.rest.internal.resources.TeamResource;
import org.eclipse.osee.ats.rest.internal.resources.UserResource;
@@ -72,10 +71,11 @@ public class AtsApplication extends Application {
singletons.add(new ConvertResource(atsServer, registry));
singletons.add(new TeamResource(atsServer));
singletons.add(new VersionResource(atsServer));
- singletons.add(new ConfigResource(atsServer, orcsApi, logger, registry));
singletons.add(new CpaResource(orcsApi, atsServer, cpaRegistry));
singletons.add(new UserResource(atsServer.getUserService()));
+ singletons.add(new AtsEndpointImpl(atsServer, logger, registry));
+
singletons.add(new AtsUiResource(registry, atsServer));
System.out.println("ATS - Application started - " + System.getProperty("OseeApplicationServer"));
}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ConfigResource.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsConfigEndpointImpl.java
index b2a939d2843..f58e5912aa3 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ConfigResource.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsConfigEndpointImpl.java
@@ -8,18 +8,14 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.rest.internal.resources;
+package org.eclipse.osee.ats.rest.internal;
import java.util.concurrent.Callable;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
+import org.eclipse.osee.ats.api.config.AtsConfigEndpointApi;
import org.eclipse.osee.ats.api.config.AtsConfiguration;
import org.eclipse.osee.ats.api.config.AtsConfigurations;
import org.eclipse.osee.ats.api.config.AtsViews;
@@ -32,13 +28,14 @@ import org.eclipse.osee.ats.impl.resource.AtsResourceTokens;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.model.BranchReadable;
import org.eclipse.osee.framework.jdk.core.type.IResourceRegistry;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.jaxrs.OseeWebApplicationException;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.data.ArtifactId;
@@ -51,8 +48,7 @@ import com.google.gson.Gson;
/**
* @author Donald G. Dunne
*/
-@Path("config")
-public final class ConfigResource {
+public final class AtsConfigEndpointImpl implements AtsConfigEndpointApi {
private static final String VIEWS_KEY = "views";
private final OrcsApi orcsApi;
@@ -61,17 +57,15 @@ public final class ConfigResource {
private final IResourceRegistry registry;
private final Gson gson = new Gson();
- public ConfigResource(IAtsServer atsServer, OrcsApi orcsApi, Log logger, IResourceRegistry registry) {
+ public AtsConfigEndpointImpl(IAtsServer atsServer, OrcsApi orcsApi, Log logger, IResourceRegistry registry) {
this.atsServer = atsServer;
this.orcsApi = orcsApi;
this.logger = logger;
this.registry = registry;
}
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- @SuppressWarnings("unchecked")
- public AtsConfigurations get() throws Exception {
+ @Override
+ public AtsConfigurations get() {
ResultSet<ArtifactReadable> artifacts =
orcsApi.getQueryFactory(null).fromBranch(CoreBranches.COMMON).andTypeEquals(AtsArtifactTypes.Configuration).getResults();
AtsConfigurations configs = new AtsConfigurations();
@@ -83,45 +77,22 @@ public final class ConfigResource {
config.setBranchUuid(Long.valueOf(art.getSoleAttributeValue(AtsAttributeTypes.AtsConfiguredBranch, "0L")));
config.setIsDefault(art.getSoleAttributeValue(AtsAttributeTypes.Default, false));
}
- ArtifactReadable atsConfig =
- orcsApi.getQueryFactory(null).fromBranch(CoreBranches.COMMON).andIds(AtsArtifactToken.AtsConfig).getResults().getExactlyOne();
- if (atsConfig != null) {
- for (Object obj : atsConfig.getAttributeValues(CoreAttributeTypes.GeneralStringData)) {
- String str = (String) obj;
- if (str.startsWith(VIEWS_KEY)) {
- AtsViews views = gson.fromJson(str.replaceFirst(VIEWS_KEY + "=", ""), AtsViews.class);
- configs.setViews(views);
- }
- }
+ String viewsStr = atsServer.getConfigValue(VIEWS_KEY);
+ if (Strings.isValid(viewsStr)) {
+ AtsViews views = gson.fromJson(viewsStr, AtsViews.class);
+ configs.setViews(views);
}
return configs;
}
- /**
- * @return html5 action entry page
- */
- @Path("ui/NewAtsBranchConfig")
- @GET
- @Produces(MediaType.TEXT_HTML)
- public String getNewSource() throws Exception {
+ @Override
+ public String getNewSource() {
PageCreator page = PageFactory.newPageCreator(registry);
return page.realizePage(AtsResourceTokens.AtsNewAtsConfigBranchHtml);
}
- /**
- * Create new ATS configuration branch and ATS config object on Common branch
- *
- * @param form containing information to configure new ATS branch
- * @param form.fromBranchUuid of branch to get config artifacts from
- * @param form.newBranchName of new branch
- * @param form.userId - userId of user performing transition
- * @param uriInfo
- * @return json object with new branchUuid
- */
- @POST
- @Consumes("application/x-www-form-urlencoded")
- @Produces(MediaType.APPLICATION_JSON)
- public AtsConfiguration createConfig(MultivaluedMap<String, String> form, @Context UriInfo uriInfo) throws Exception {
+ @Override
+ public AtsConfiguration createConfig(MultivaluedMap<String, String> form, @Context UriInfo uriInfo) {
// get parameters
String query = uriInfo.getPath();
@@ -142,7 +113,12 @@ public final class ConfigResource {
// Create new baseline branch off Root
Callable<BranchReadable> newBranchCallable =
orcsApi.getBranchOps(null).createTopLevelBranch(TokenFactory.createBranch(newBranchName), userArt);
- BranchReadable newBranch = newBranchCallable.call();
+ BranchReadable newBranch;
+ try {
+ newBranch = newBranchCallable.call();
+ } catch (Exception ex) {
+ throw new OseeWebApplicationException(ex, Status.INTERNAL_SERVER_ERROR, "Error creating new branch");
+ }
long newBranchUuid = newBranch.getUuid();
// Introduce all ATS heading artifacts to new branch
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsEndpointImpl.java
new file mode 100644
index 00000000000..b22f9e38660
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsEndpointImpl.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.rest.internal;
+
+import org.eclipse.osee.ats.api.AtsJaxRsApi;
+import org.eclipse.osee.ats.api.config.AtsConfigEndpointApi;
+import org.eclipse.osee.ats.impl.IAtsServer;
+import org.eclipse.osee.framework.jdk.core.type.IResourceRegistry;
+import org.eclipse.osee.logger.Log;
+
+public class AtsEndpointImpl implements AtsJaxRsApi {
+
+ private final IAtsServer atsServer;
+ private final Log logger;
+ private final IResourceRegistry registry;
+ private AtsNotifyEndpointImpl atsNotifyEndpointImpl;
+ private AtsConfigEndpointImpl atsConfigEndpointImpl;
+
+ public AtsEndpointImpl(IAtsServer atsServer, Log logger, IResourceRegistry registry) {
+ this.atsServer = atsServer;
+ this.logger = logger;
+ this.registry = registry;
+ }
+
+ @Override
+ public AtsNotifyEndpointImpl getNotify() {
+ if (atsNotifyEndpointImpl == null) {
+ atsNotifyEndpointImpl = new AtsNotifyEndpointImpl(atsServer);
+ }
+ return atsNotifyEndpointImpl;
+ }
+
+ @Override
+ public AtsConfigEndpointApi getConfig() {
+ if (atsConfigEndpointImpl == null) {
+ atsConfigEndpointImpl = new AtsConfigEndpointImpl(atsServer, atsServer.getOrcsApi(), logger, registry);
+ }
+ return atsConfigEndpointImpl;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsNotifyEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsNotifyEndpointImpl.java
new file mode 100644
index 00000000000..d69b7e8fd54
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsNotifyEndpointImpl.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.rest.internal;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.core.Response;
+import org.eclipse.osee.ats.api.notify.AtsNotificationCollector;
+import org.eclipse.osee.ats.api.notify.AtsNotifyEndpointApi;
+import org.eclipse.osee.ats.impl.IAtsServer;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsNotifyEndpointImpl implements AtsNotifyEndpointApi {
+
+ private final IAtsServer atsServer;
+
+ public AtsNotifyEndpointImpl(IAtsServer atsServer) {
+ this.atsServer = atsServer;
+ }
+
+ @GET
+ public String get() {
+ return AHTML.simplePage("ATS Notify Resource");
+ }
+
+ @Override
+ public Response sendNotifications(AtsNotificationCollector notifications) {
+ atsServer.sendNotifications(notifications);
+ return Response.ok().build();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
index abe7c501a56..8d7e752b2ac 100644
--- a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
@@ -100,7 +100,6 @@ Import-Package: com.google.gson,
org.eclipse.osee.ats.core.client.branch,
org.eclipse.osee.ats.core.client.config,
org.eclipse.osee.ats.core.client.ev,
- org.eclipse.osee.ats.core.client.notify,
org.eclipse.osee.ats.core.client.operation,
org.eclipse.osee.ats.core.client.review,
org.eclipse.osee.ats.core.client.review.defect,
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/stateItem/AtsPeerToPeerReviewReviewStateItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/stateItem/AtsPeerToPeerReviewReviewStateItem.java
index 73d55975a70..340cb48e126 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/stateItem/AtsPeerToPeerReviewReviewStateItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/stateItem/AtsPeerToPeerReviewReviewStateItem.java
@@ -49,7 +49,7 @@ public class AtsPeerToPeerReviewReviewStateItem extends AtsStateItem implements
PeerToPeerReviewArtifact peerArt = (PeerToPeerReviewArtifact) workItem;
for (UserRole uRole : UserRoleManager.getUserRoles(peerArt)) {
if (!uRole.isCompleted()) {
- assignees.add(AtsClientService.get().getUserService().getUserById(uRole.getUserId()));
+ assignees.add(UserRoleManager.getUser(uRole));
}
}
assignees.addAll(workItem.getStateMgr().getAssignees());
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/NavigateView.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/NavigateView.java
index 924c77cf4b8..7fb259f26c0 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/NavigateView.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/NavigateView.java
@@ -49,14 +49,11 @@ import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
import org.eclipse.osee.framework.ui.skynet.OseeStatusContributionItemFactory;
import org.eclipse.osee.framework.ui.skynet.action.CollapseAllAction;
import org.eclipse.osee.framework.ui.skynet.action.ExpandAllAction;
-import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationManager;
import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
import org.eclipse.osee.framework.ui.skynet.util.LoadingComposite;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.Widgets;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
@@ -136,15 +133,7 @@ public class NavigateView extends ViewPart implements IXNavigateEventListener {
HelpUtil.setHelp(xNavComp, AtsHelpContext.NAVIGATOR);
createToolBar();
- // add search text box
- AtsQuickSearchComposite composite = new AtsQuickSearchComposite(xNavComp, SWT.NONE);
- composite.addDisposeListener(new DisposeListener() {
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- OseeNotificationManager.getInstance().sendNotifications();
- }
- });
+ new AtsQuickSearchComposite(xNavComp, SWT.NONE);
userLabel = new Label(xNavComp, SWT.None);
userLabel.addListener(SWT.MouseDoubleClick, new Listener() {
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/ArtifactEmailWizard.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/ArtifactEmailWizard.java
index 94f98c87990..f5880efe5f9 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/ArtifactEmailWizard.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/ArtifactEmailWizard.java
@@ -10,11 +10,14 @@
*******************************************************************************/
package org.eclipse.osee.ats.notify;
+import java.util.ArrayList;
import java.util.List;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
+import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.ats.util.Overview.PreviewStyle;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.EmailGroup;
import org.eclipse.osee.framework.ui.skynet.util.email.EmailWizard;
/**
@@ -29,8 +32,22 @@ public class ArtifactEmailWizard extends EmailWizard {
public ArtifactEmailWizard(AbstractWorkflowArtifact sma, List<Object> toAddress) throws OseeCoreException {
super(
AtsNotificationManagerUI.getPreviewHtml(sma, PreviewStyle.HYPEROPEN, PreviewStyle.NO_SUBSCRIBE_OR_FAVORITE),
- " Regarding " + sma.getArtifactTypeName() + " - " + sma.getName(),
- AtsNotificationManager.getEmailableGroups(sma), toAddress);
+ " Regarding " + sma.getArtifactTypeName() + " - " + sma.getName(), getEmailableGroups(sma), toAddress);
+ }
+
+ public static List<EmailGroup> getEmailableGroups(IAtsWorkItem workItem) throws OseeCoreException {
+ ArrayList<EmailGroup> groupNames = new ArrayList<EmailGroup>();
+ ArrayList<String> emails = new ArrayList<String>();
+ emails.add(workItem.getCreatedBy().getEmail());
+ groupNames.add(new EmailGroup("Originator", emails));
+ if (workItem.getStateMgr().getAssignees().size() > 0) {
+ emails = new ArrayList<String>();
+ for (IAtsUser user : workItem.getStateMgr().getAssignees()) {
+ emails.add(user.getEmail());
+ }
+ groupNames.add(new EmailGroup("Assignees", emails));
+ }
+ return groupNames;
}
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/AtsNotificationTransitionListener.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/AtsNotificationTransitionListener.java
index 867223d4003..ac762b9fddf 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/AtsNotificationTransitionListener.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/AtsNotificationTransitionListener.java
@@ -12,15 +12,14 @@ package org.eclipse.osee.ats.notify;
import java.util.Collection;
import org.eclipse.osee.ats.api.IAtsWorkItem;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEventFactory;
import org.eclipse.osee.ats.api.notify.AtsNotifyType;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.workdef.IStateToken;
import org.eclipse.osee.ats.api.workflow.transition.ITransitionListener;
import org.eclipse.osee.ats.api.workflow.transition.TransitionResults;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
-import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
-import org.eclipse.osee.ats.internal.AtsClientService;
+import org.eclipse.osee.ats.core.users.AtsCoreUsers;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
/**
@@ -36,9 +35,9 @@ public class AtsNotificationTransitionListener implements ITransitionListener {
@Override
public void transitioned(IAtsWorkItem workItem, IStateToken fromState, IStateToken toState, Collection<? extends IAtsUser> toAssignees, IAtsChangeSet changes) throws OseeCoreException {
- AtsNotificationManager.notify((AbstractWorkflowArtifact) AtsClientService.get().getArtifact(workItem),
- AtsNotifyType.Subscribed, AtsNotifyType.Completed, AtsNotifyType.Cancelled);
+ changes.getNotifications().addWorkItemNotificationEvent(
+ AtsNotificationEventFactory.getWorkItemNotificationEvent(AtsCoreUsers.SYSTEM_USER, workItem,
+ AtsNotifyType.Subscribed, AtsNotifyType.Completed, AtsNotifyType.Cancelled));
}
-
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/EmailActionsBlam.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/EmailActionsBlam.java
index 58b589d70a7..637b055bb12 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/EmailActionsBlam.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/EmailActionsBlam.java
@@ -17,8 +17,11 @@ import java.util.List;
import java.util.logging.Level;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.api.notify.AtsNotificationCollector;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEventFactory;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
+import org.eclipse.osee.ats.core.users.AtsUsersUtility;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.internal.AtsClientService;
import org.eclipse.osee.ats.notify.EmailActionsData.EmailRecipient;
@@ -28,14 +31,11 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.DateUtil;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.utility.EmailUtil;
-import org.eclipse.osee.framework.skynet.core.utility.OseeNotificationEvent;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationManager;
import org.eclipse.osee.framework.ui.skynet.widgets.XButtonPush;
import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
@@ -92,28 +92,29 @@ public class EmailActionsBlam extends AbstractBlam {
}
private void sendEmailNotifications(EmailActionsData data) throws Exception {
-
- OseeNotificationManager oseeNotificationManager = OseeNotificationManager.getInstance();
+ AtsNotificationCollector notifications = new AtsNotificationCollector();
for (Artifact art : data.getWorkflows()) {
if (art instanceof AbstractWorkflowArtifact) {
- addNotification(data, (AbstractWorkflowArtifact) art, oseeNotificationManager);
+ addNotification(data, (AbstractWorkflowArtifact) art, notifications);
}
}
- int sent = oseeNotificationManager.getNotificationEvents().size();
- oseeNotificationManager.sendNotifications(data.getSubject(), data.getBody());
+ int sent = notifications.getNotificationEvents().size();
+ notifications.setSubject(data.getSubject());
+ notifications.setBody(data.getBody());
+ AtsClientService.get().sendNotifications(notifications);
logf("Sent %s notifications.", sent);
}
- private void addNotification(EmailActionsData data, final AbstractWorkflowArtifact awa, OseeNotificationManager oseeNotificationManager) throws OseeCoreException {
- Collection<User> recipients = getRecipients(data.getEmailRecipient(), awa);
- Collection<User> activeEmailUsers = EmailUtil.getActiveEmailUsers(recipients);
+ private void addNotification(EmailActionsData data, final AbstractWorkflowArtifact awa, AtsNotificationCollector notifications) throws OseeCoreException {
+ Collection<IAtsUser> recipients = getRecipients(data.getEmailRecipient(), awa);
+ Collection<IAtsUser> activeEmailUsers = AtsUsersUtility.getActiveEmailUsers(recipients);
if (recipients.isEmpty()) {
logf("No active " + data.getEmailRecipient() + " for workflow [%s].", awa.toStringWithId());
return;
}
List<String> emailAddresses = new ArrayList<String>();
- for (User basicUser : activeEmailUsers) {
+ for (IAtsUser basicUser : activeEmailUsers) {
if (EmailUtil.isEmailValid(basicUser.getEmail())) {
emailAddresses.add(basicUser.getEmail());
}
@@ -130,7 +131,8 @@ public class EmailActionsBlam extends AbstractBlam {
return;
}
- oseeNotificationManager.addNotificationEvent(new OseeNotificationEvent(recipients, getIdString(awa),
+ notifications.addNotificationEvent(AtsNotificationEventFactory.getNotificationEvent(
+ AtsClientService.get().getUserService().getCurrentUser(), recipients, getIdString(awa),
data.getEmailRecipient().name(), String.format(
"You are the %s of [%s] in state [%s] titled [%s] created on [%s]", data.getEmailRecipient().name(),
awa.getArtifactTypeName(), awa.getStateMgr().getCurrentStateName(), awa.getName(),
@@ -138,11 +140,11 @@ public class EmailActionsBlam extends AbstractBlam {
}
- private Collection<User> getRecipients(EmailRecipient emailRecipient, AbstractWorkflowArtifact awa) {
- List<User> recipients = new ArrayList<User>();
+ private Collection<IAtsUser> getRecipients(EmailRecipient emailRecipient, AbstractWorkflowArtifact awa) {
+ List<IAtsUser> recipients = new ArrayList<IAtsUser>();
if (emailRecipient == EmailRecipient.Assignees) {
try {
- recipients.addAll(AtsClientService.get().getUserServiceClient().getOseeUsers(awa.getAssignees()));
+ recipients.addAll(awa.getAssignees());
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
}
@@ -150,7 +152,7 @@ public class EmailActionsBlam extends AbstractBlam {
try {
IAtsUser createdBy = awa.getCreatedBy();
if (createdBy.isActive()) {
- recipients.add(AtsClientService.get().getUserServiceClient().getOseeUser(awa.getCreatedBy()));
+ recipients.add(awa.getCreatedBy());
}
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
@@ -158,7 +160,7 @@ public class EmailActionsBlam extends AbstractBlam {
}
if (recipients.isEmpty()) {
try {
- recipients.add(AtsClientService.get().getUserServiceClient().getCurrentOseeUser());
+ recipients.add(AtsClientService.get().getUserService().getCurrentUser());
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java
index 90de3f4faed..31b16c3dd27 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java
@@ -30,6 +30,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEventFactory;
import org.eclipse.osee.ats.api.notify.AtsNotifyType;
import org.eclipse.osee.ats.api.team.ChangeType;
import org.eclipse.osee.ats.api.team.CreateTeamOption;
@@ -40,7 +41,6 @@ import org.eclipse.osee.ats.api.version.IAtsVersion;
import org.eclipse.osee.ats.api.workflow.IAtsGoal;
import org.eclipse.osee.ats.core.client.action.ActionManager;
import org.eclipse.osee.ats.core.client.artifact.GoalArtifact;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.util.AtsUtilClient;
import org.eclipse.osee.ats.core.config.ActionableItems;
@@ -233,8 +233,10 @@ public class ExcelAtsActionArtifactExtractor {
}
AtsUtilClient.setEmailEnabled(true);
if (emailPOCs) {
- for (TeamWorkFlowArtifact team : teamWfs) {
- AtsNotificationManager.notify(team, AtsNotifyType.Assigned);
+ for (TeamWorkFlowArtifact teamWf : teamWfs) {
+ changes.getNotifications().addWorkItemNotificationEvent(
+ AtsNotificationEventFactory.getWorkItemNotificationEvent(
+ AtsClientService.get().getUserService().getCurrentUser(), teamWf, AtsNotifyType.Assigned));
}
}
} catch (OseeCoreException ex) {
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java
index b41d2effcb0..78fdad57012 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java
@@ -21,10 +21,10 @@ import java.util.logging.Level;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.api.notify.AtsNotificationEventFactory;
import org.eclipse.osee.ats.api.notify.AtsNotifyType;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
-import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
import org.eclipse.osee.ats.core.client.task.AbstractTaskableArtifact;
import org.eclipse.osee.ats.core.client.task.TaskArtifact;
import org.eclipse.osee.ats.core.client.task.TaskManager;
@@ -197,7 +197,9 @@ public class ExcelAtsTaskArtifactExtractor {
// always persist
changes.add(taskArt);
if (emailPOCs && !taskArt.isCompleted() && !taskArt.isCancelled()) {
- AtsNotificationManager.notify(sma, AtsNotifyType.Assigned);
+ changes.getNotifications().addWorkItemNotificationEvent(
+ AtsNotificationEventFactory.getWorkItemNotificationEvent(
+ AtsClientService.get().getUserService().getCurrentUser(), sma, AtsNotifyType.Assigned));
}
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleLabelProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleLabelProvider.java
index 3e7c3e0db66..2ddac78a749 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleLabelProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleLabelProvider.java
@@ -46,9 +46,9 @@ public class UserRoleLabelProvider extends XViewerLabelProvider {
public Image getColumnImage(Object element, XViewerColumn dCol, int columnIndex) {
UserRole roleItem = (UserRole) element;
try {
+ IAtsUser user = org.eclipse.osee.ats.core.client.review.role.UserRoleManager.getUser(roleItem);
if (dCol.equals(UserRoleXViewerFactory.User_Col)) {
- return ArtifactImageManager.getImage(AtsClientService.get().getUserServiceClient().getOseeUser(
- AtsClientService.get().getUserService().getUserById(roleItem.getUserId())));
+ return ArtifactImageManager.getImage(AtsClientService.get().getUserServiceClient().getOseeUser(user));
} else if (dCol.equals(UserRoleXViewerFactory.Role_Col)) {
return ImageManager.getImage(AtsImage.ROLE);
} else if (dCol.equals(UserRoleXViewerFactory.Hours_Spent_Col)) {
@@ -72,9 +72,9 @@ public class UserRoleLabelProvider extends XViewerLabelProvider {
public String getColumnText(Object element, XViewerColumn aCol, int columnIndex) throws OseeCoreException {
UserRole defectItem = (UserRole) element;
- IAtsUser atsUser = AtsClientService.get().getUserService().getUserById(defectItem.getUserId());
+ IAtsUser user = org.eclipse.osee.ats.core.client.review.role.UserRoleManager.getUser(defectItem);
if (aCol.equals(UserRoleXViewerFactory.User_Col)) {
- return atsUser.getName();
+ return user.getName();
} else if (aCol.equals(UserRoleXViewerFactory.Hours_Spent_Col)) {
return defectItem.getHoursSpent() == null ? "" : AtsUtilCore.doubleToI18nString(defectItem.getHoursSpent(),
false);
@@ -84,13 +84,13 @@ public class UserRoleLabelProvider extends XViewerLabelProvider {
return String.valueOf(defectItem.isCompleted());
} else if (aCol.equals(UserRoleXViewerFactory.Num_Major_Col)) {
ReviewDefectManager defectMgr = new ReviewDefectManager(xViewer.getXUserRoleViewer().getReviewArt());
- return defectMgr.getNumMajor(atsUser) + "";
+ return defectMgr.getNumMajor(user) + "";
} else if (aCol.equals(UserRoleXViewerFactory.Num_Minor_Col)) {
ReviewDefectManager defectMgr = new ReviewDefectManager(xViewer.getXUserRoleViewer().getReviewArt());
- return defectMgr.getNumMinor(atsUser) + "";
+ return defectMgr.getNumMinor(user) + "";
} else if (aCol.equals(UserRoleXViewerFactory.Num_Issues_Col)) {
ReviewDefectManager defectMgr = new ReviewDefectManager(xViewer.getXUserRoleViewer().getReviewArt());
- return defectMgr.getNumIssues(atsUser) + "";
+ return defectMgr.getNumIssues(user) + "";
}
return "unhandled column";
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewer.java
index 36db9b12c7e..8a704d8f488 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewer.java
@@ -23,6 +23,7 @@ import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
import org.eclipse.nebula.widgets.xviewer.util.EnumStringSingleSelectionDialog;
import org.eclipse.osee.ats.api.review.Role;
import org.eclipse.osee.ats.api.review.UserRole;
+import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.core.client.util.AtsChangeSet;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.internal.AtsClientService;
@@ -203,8 +204,9 @@ public class UserRoleXViewer extends XViewer {
private boolean setUser(Collection<UserRole> userRoles, User user) throws OseeCoreException {
boolean modified = false;
for (UserRole userRole : userRoles) {
- if (user != null && !userRole.getUserId().equals(user.getUserId())) {
- userRole.setUserId(user.getUserId());
+ IAtsUser atsUser = AtsClientService.get().getUserService().getUserById(userRole.getUserId());
+ if (user != null && !atsUser.equals(user)) {
+ userRole.setUserId(atsUser.getUserId());
if (!modified) {
modified = true;
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/XUserRoleViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/XUserRoleViewer.java
index 5e37fd5f0ae..fafc69c09ef 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/XUserRoleViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/XUserRoleViewer.java
@@ -435,11 +435,11 @@ public class XUserRoleViewer extends GenericXWidget implements IArtifactWidget,
"Issues"}));
ReviewDefectManager defectMgr = new ReviewDefectManager(reviewArt);
for (UserRole item : roleMgr.getUserRoles()) {
- IAtsUser atsUser = AtsClientService.get().getUserService().getUserById(item.getUserId());
+ IAtsUser atsUser = UserRoleManager.getUser(item);
html.append(AHTML.addRowMultiColumnTable(new String[] {
item.getRole().name(),
atsUser.getName(),
- AtsUtilCore.doubleToI18nString(item.getHoursSpent(), true),
+ AtsUtilCore.doubleToI18nString(item.getHoursSpent()),
defectMgr.getNumMajor(atsUser) + "",
defectMgr.getNumMinor(atsUser) + "",
defectMgr.getNumIssues(atsUser) + ""}));
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerReviewRoleColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerReviewRoleColumn.java
index 5c58a809698..21bfdb5ab38 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerReviewRoleColumn.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerReviewRoleColumn.java
@@ -63,7 +63,7 @@ public class XViewerReviewRoleColumn extends XViewerValueColumn {
private static String getRolesStr(AbstractReviewArtifact reviewArt, IAtsUser user) throws OseeCoreException {
StringBuilder builder = new StringBuilder();
for (UserRole role : UserRoleManager.getUserRoles(reviewArt)) {
- if (AtsClientService.get().getUserService().getUserById(role.getUserId()).equals(user)) {
+ if (UserRoleManager.getUser(role).equals(user)) {
builder.append(role.getRole().name());
builder.append(", ");
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/email/EmailGroup.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/EmailGroup.java
index 1522bef3744..9d213253ae5 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/email/EmailGroup.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/EmailGroup.java
@@ -8,16 +8,10 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.skynet.core.email;
+package org.eclipse.osee.framework.jdk.core.util;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-import org.eclipse.osee.framework.skynet.core.utility.EmailUtil;
/**
* @author Donald G. Dunne
@@ -62,8 +56,6 @@ public class EmailGroup {
for (String str : emails) {
if (EmailUtil.isEmailValid(str)) {
this.emails.add(str);
- } else if (Strings.isValid(str)) {
- OseeLog.logf(Activator.class, Level.SEVERE, "Invalid Email [%s]", str);
}
}
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/IAtsNotificationListener.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/EmailUtil.java
index 2f31f599035..30a52812508 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/notify/IAtsNotificationListener.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/EmailUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Boeing.
+ * Copyright (c) 2004, 2007 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,16 +8,19 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.core.notify;
+package org.eclipse.osee.framework.jdk.core.util;
-import java.util.List;
-import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import java.util.regex.Pattern;
/**
* @author Donald G. Dunne
*/
-public interface IAtsNotificationListener {
+public class EmailUtil {
+
+ private static Pattern addressPattern = Pattern.compile(".+?@.+?\\.[a-z]+");
+
+ public static boolean isEmailValid(String email) {
+ return addressPattern.matcher(email).matches();
+ }
- public void notifyAssigned(List<IAtsUser> notifyAssignees) throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
index 343361668d1..776f314b366 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
@@ -26,7 +26,6 @@ Export-Package: org.eclipse.osee.framework.skynet.core,
org.eclipse.osee.framework.skynet.core.change,
org.eclipse.osee.framework.skynet.core.commit.actions,
org.eclipse.osee.framework.skynet.core.conflict,
- org.eclipse.osee.framework.skynet.core.email,
org.eclipse.osee.framework.skynet.core.event,
org.eclipse.osee.framework.skynet.core.event.filter,
org.eclipse.osee.framework.skynet.core.event.listener,
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/OseeNotificationEvent.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/OseeNotificationEvent.java
deleted file mode 100644
index 4709db12323..00000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/OseeNotificationEvent.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.skynet.core.utility;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.skynet.core.User;
-
-/**
- * @author Donald G. Dunne
- */
-public class OseeNotificationEvent {
-
- private Collection<User> users;
- private final String id;
- private String type;
- private String description;
- private String url;
-
- public OseeNotificationEvent(Collection<User> users, String id, String type, String description) {
- this.users = users;
- this.id = id;
- this.type = type;
- this.description = description;
- }
-
- public OseeNotificationEvent(Collection<User> users, String id, String type, String description, String url) {
- this(users, id, type, description);
- this.url = url;
- }
-
- @Override
- public String toString() {
- return type + " - " + id + " - " + Artifacts.toString("; ", users) + " - " + description;
- }
-
- public String getId() {
- return id;
- }
-
- public String getType() {
- return type;
- }
-
- public String getDescription() {
- return description;
- }
-
- public Collection<User> getUsers() {
- return users;
- }
-
- public void setUsers(Collection<User> users) {
- this.users = users;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
index eedb7f91e31..13b21a64480 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
@@ -109,7 +109,6 @@ Import-Package: com.google.common.base,
org.eclipse.osee.framework.skynet.core.attribute,
org.eclipse.osee.framework.skynet.core.change,
org.eclipse.osee.framework.skynet.core.conflict,
- org.eclipse.osee.framework.skynet.core.email,
org.eclipse.osee.framework.skynet.core.event,
org.eclipse.osee.framework.skynet.core.event.filter,
org.eclipse.osee.framework.skynet.core.event.listener,
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationManager.java
deleted file mode 100644
index f9451d0c46c..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationManager.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.notify;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.utility.INotificationManager;
-import org.eclipse.osee.framework.skynet.core.utility.OseeNotificationEvent;
-import org.eclipse.osee.framework.ui.skynet.internal.Activator;
-
-/**
- * Stores notification events generated by the framework or applications. Currently, send happens upon call to
- * sendNotifications(). Eventually, a timer will kick the send event at certain intervals. This mechanism allows for
- * notifications to be collected for a certain period of time and rolled into a single notification. This will
- * eventually also support other types of notifications such as popups and allow the user to configure which events are
- * sent and how.
- *
- * @author Donald G. Dunne
- */
-public class OseeNotificationManager implements INotificationManager {
-
- private boolean emailEnabled = true;
- private static OseeNotificationManager instance = new OseeNotificationManager();
- private final List<OseeNotificationEvent> notificationEvents = new ArrayList<OseeNotificationEvent>();
-
- private OseeNotificationManager() {
- instance = this;
- }
-
- @Override
- public void addNotificationEvent(OseeNotificationEvent notificationEvent) {
- notificationEvents.add(notificationEvent);
- }
-
- @Override
- public void clear() {
- notificationEvents.clear();
- }
-
- @Override
- public void sendNotifications() {
- sendNotifications(null, null);
- }
-
- /**
- * Send notifications
- *
- * @param subject or null will use default
- * @param body or null will not include additional message
- */
- public void sendNotifications(String subject, String body) {
- if (!emailEnabled) {
- OseeLog.log(Activator.class, Level.INFO, "Osee Notification Disabled");
- return;
- }
- List<OseeNotificationEvent> sendEvents = new ArrayList<OseeNotificationEvent>();
- sendEvents.addAll(notificationEvents);
- notificationEvents.clear();
- OseeNotifyUsersJob job = new OseeNotifyUsersJob(subject, body, sendEvents);
- job.setPriority(Job.SHORT);
- job.schedule();
- }
-
- public boolean isEmailEnabled() {
- return emailEnabled;
- }
-
- public void setEmailEnabled(boolean emailEnabled) {
- this.emailEnabled = emailEnabled;
- }
-
- @Override
- public List<OseeNotificationEvent> getNotificationEvents() {
- return notificationEvents;
- }
-
- public static OseeNotificationManager getInstance() {
- return instance;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotifyUsersJob.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotifyUsersJob.java
deleted file mode 100644
index 70d7c3357a4..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotifyUsersJob.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.notify;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.framework.core.enums.SystemUser;
-import org.eclipse.osee.framework.core.util.XResultData;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.utility.EmailUtil;
-import org.eclipse.osee.framework.skynet.core.utility.OseeNotificationEvent;
-import org.eclipse.osee.framework.ui.skynet.internal.Activator;
-import org.eclipse.osee.framework.ui.skynet.notify.OseeEmail.BodyType;
-
-/**
- * @author Donald G. Dunne
- */
-public class OseeNotifyUsersJob extends Job {
- private final boolean testing = false; // Email goes to current user
- private final Collection<? extends OseeNotificationEvent> notificationEvents;
- private final String subject;
- private final String body;
-
- public OseeNotifyUsersJob(String subject, String body, Collection<? extends OseeNotificationEvent> notificationEvents) {
- super("Notifying Users");
- this.subject = subject;
- this.body = body;
- this.notificationEvents = notificationEvents;
- }
-
- public OseeNotifyUsersJob(Collection<? extends OseeNotificationEvent> notificationEvents) {
- this(null, null, notificationEvents);
- if (testing) {
- OseeLog.log(Activator.class, Level.SEVERE,
- "OseeNotifyUsersJob: testing is enabled....turn off for production.");
- }
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- Set<User> uniqueUusers = new HashSet<User>();
- for (OseeNotificationEvent notificationEvent : notificationEvents) {
- uniqueUusers.addAll(notificationEvent.getUsers());
- }
- XResultData resultData = new XResultData();
- if (testing) {
- resultData.log("Testing Results Report for Osee Notification; Email to current user.<br>");
- uniqueUusers.clear();
- uniqueUusers.addAll(Arrays.asList(UserManager.getUser()));
- }
- for (User user : EmailUtil.getValidEmailUsers(uniqueUusers)) {
- List<OseeNotificationEvent> notifyEvents = new ArrayList<OseeNotificationEvent>();
- for (OseeNotificationEvent notificationEvent : notificationEvents) {
- if (testing || notificationEvent.getUsers().contains(user)) {
- notifyEvents.add(notificationEvent);
- }
- }
- notifyUser(user, notifyEvents, resultData);
- }
- monitor.done();
- return Status.OK_STATUS;
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getMessage(), ex);
- }
- }
-
- private String notificationEventsToHtml(List<OseeNotificationEvent> notificationEvents) {
- StringBuffer sb = new StringBuffer();
- sb.append(AHTML.beginMultiColumnTable(100, 1));
- sb.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Reason", "Description", "Id", "URL"}));
- for (OseeNotificationEvent notificationEvent : notificationEvents) {
- sb.append(AHTML.addRowMultiColumnTable(new String[] {
- notificationEvent.getType(),
- notificationEvent.getDescription(),
- notificationEvent.getId(),
- getHyperlink(notificationEvent)}));
- }
- sb.append(AHTML.endMultiColumnTable());
- return sb.toString().replaceAll("\n", "");
- }
-
- public static String getHyperlink(OseeNotificationEvent notificationEvent) {
- return Strings.isValid(notificationEvent.getUrl()) ? AHTML.getHyperlink(notificationEvent.getUrl(), "More Info") : "";
- }
-
- private void notifyUser(User user, List<OseeNotificationEvent> notificationEvents, XResultData resultData) throws OseeCoreException {
- if (user == UserManager.getUser(SystemUser.OseeSystem) || user == UserManager.getUser(SystemUser.UnAssigned) || user == UserManager.getUser(SystemUser.Guest)) {
- // do nothing
- return;
- }
- if (!EmailUtil.isEmailValid(UserManager.getUser())) {
- // do nothing; can't send email from user with invalid email address
- return;
- }
- String html = "";
- if (Strings.isValid(body)) {
- html += "<pre>" + body + "</pre>";
- }
- html += notificationEventsToHtml(notificationEvents);
- String email = user.getEmail();
- if (!Strings.isValid(email)) {
- // do nothing
- return;
- } else {
- OseeEmail emailMessage =
- new OseeEmail(Arrays.asList(email), UserManager.getUser().getEmail(), UserManager.getUser().getEmail(),
- getNotificationEmailSubject(notificationEvents), html, BodyType.Html);
- emailMessage.send();
- }
- }
-
- private String getNotificationEmailSubject(List<OseeNotificationEvent> notificationEvents) {
- String result = subject;
- if (!Strings.isValid(result)) {
- if (notificationEvents.size() == 1) {
- OseeNotificationEvent event = notificationEvents.iterator().next();
- result =
- Strings.truncate("OSEE Notification" + " - " + event.getType() + " - " + event.getDescription(), 128);
- } else {
- result = "OSEE Notification";
- }
- }
- return result;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailWizard.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailWizard.java
index 95c97cfcc27..8b127c02264 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailWizard.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailWizard.java
@@ -17,8 +17,8 @@ import javax.mail.Message;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.EmailGroup;
import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.email.EmailGroup;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.skynet.notify.OseeEmail;
import org.eclipse.osee.framework.ui.skynet.notify.OseeEmail.BodyType;
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailWizardPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailWizardPage.java
index 1ea740e2725..1d09879d12c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailWizardPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailWizardPage.java
@@ -23,11 +23,11 @@ import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.EmailGroup;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.User;
import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.email.EmailGroup;
import org.eclipse.osee.framework.skynet.core.utility.EmailUtil;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.plugin.util.ArrayTreeContentProvider;
diff --git a/plugins/org.eclipse.osee.mail/OSGI-INF/mail.jaxrs.application.xml b/plugins/org.eclipse.osee.mail/OSGI-INF/mail.jaxrs.application.xml
index 0ff3c509d49..e583b45ebeb 100644
--- a/plugins/org.eclipse.osee.mail/OSGI-INF/mail.jaxrs.application.xml
+++ b/plugins/org.eclipse.osee.mail/OSGI-INF/mail.jaxrs.application.xml
@@ -4,5 +4,5 @@
<service>
<provide interface="javax.ws.rs.core.Application"/>
</service>
- <reference bind="setMailService" cardinality="1..1" interface="org.eclipse.osee.mail.api.MailService" name="MailService" policy="static"/>
+ <reference bind="setMailservice" cardinality="1..1" interface="org.eclipse.osee.mail.api.MailService" name="MailService" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.mail/OSGI-INF/mail.service.xml b/plugins/org.eclipse.osee.mail/OSGI-INF/mail.service.xml
index 585e37bc2d7..0ff53a3e323 100644
--- a/plugins/org.eclipse.osee.mail/OSGI-INF/mail.service.xml
+++ b/plugins/org.eclipse.osee.mail/OSGI-INF/mail.service.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" configuration-policy="require" deactivate="stop" modified="update">
<implementation class="org.eclipse.osee.mail.internal.MailServiceImpl"/>
- <service>
- <provide interface="org.eclipse.osee.mail.api.MailService"/>
- </service>
<reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
<reference bind="setExecutorAdmin" cardinality="1..1" interface="org.eclipse.osee.executor.admin.ExecutorAdmin" name="ExecutorAdmin" policy="static"/>
+ <service>
+ <provide interface="org.eclipse.osee.mail.api.MailService"/>
+ </service>
</scr:component>

Back to the top