Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2017-04-24 18:05:16 -0400
committerDonald Dunne2017-04-27 20:11:31 -0400
commitda2e6995a62917169e0ae4ca12fe7f2ff5a930cb (patch)
treef66a9caa0c7b73c208babac3980523b52faef90e
parent250635bd9d66e8ed004989916e499b78bd24ae18 (diff)
downloadorg.eclipse.osee-da2e6995a62917169e0ae4ca12fe7f2ff5a930cb.tar.gz
org.eclipse.osee-da2e6995a62917169e0ae4ca12fe7f2ff5a930cb.tar.xz
org.eclipse.osee-da2e6995a62917169e0ae4ca12fe7f2ff5a930cb.zip
refactor: Move notification adds into AtsChangeSet
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsChangeSet.java6
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/DuplicateWorkflowActionTest.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java5
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/state/StateManagerStoreTest.java4
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManagerStore.java5
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/UserRoleManager.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsChangeSet.java12
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/ActionFactory.java6
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/util/DuplicateWorkflowAsIsOperation.java10
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/AtsNotificationTransitionListener.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java5
11 files changed, 36 insertions, 23 deletions
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 423a524250..b0490c6536 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
@@ -16,6 +16,8 @@ import java.util.List;
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.notify.AtsNotificationEvent;
+import org.eclipse.osee.ats.api.notify.AtsWorkItemNotificationEvent;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.api.workflow.IAttribute;
@@ -82,6 +84,10 @@ public interface IAtsChangeSet {
AtsNotificationCollector getNotifications();
+ void addWorkItemNotificationEvent(AtsWorkItemNotificationEvent workItemNotificationEvent);
+
+ void addNotificationEvent(AtsNotificationEvent notifyEvent);
+
void unrelateAll(Object object, RelationTypeSide relationType);
void setRelation(Object object1, RelationTypeSide relationType, Object object2);
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/DuplicateWorkflowActionTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/DuplicateWorkflowActionTest.java
index acdb02e077..9c496969b5 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/DuplicateWorkflowActionTest.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/DuplicateWorkflowActionTest.java
@@ -77,7 +77,7 @@ public class DuplicateWorkflowActionTest extends AbstractAtsActionRunTest {
AtsCoreUsers.SYSTEM_USER, changes);
changes.add(dupTeamWf);
- changes.getNotifications().addWorkItemNotificationEvent(
+ changes.addWorkItemNotificationEvent(
AtsNotificationEventFactory.getWorkItemNotificationEvent(teamWf.getAssignees().iterator().next(), dupTeamWf,
AtsNotifyType.Originator, AtsNotifyType.Assigned, AtsNotifyType.SubscribedTeamOrAi));
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 50975dcbee..3d96e1ae60 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
@@ -504,9 +504,8 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
changes.setSoleAttributeValue((ArtifactId) this, AtsAttributeTypes.CreatedDate, date);
}
try {
- changes.getNotifications().addWorkItemNotificationEvent(
- AtsNotificationEventFactory.getWorkItemNotificationEvent(
- AtsClientService.get().getUserService().getCurrentUser(), this, AtsNotifyType.Originator));
+ changes.addWorkItemNotificationEvent(AtsNotificationEventFactory.getWorkItemNotificationEvent(
+ AtsClientService.get().getUserService().getCurrentUser(), this, AtsNotifyType.Originator));
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, "Error adding ATS Notification Event", ex);
}
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 15022cef37..3fafe59a41 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
@@ -135,7 +135,7 @@ public class StateManagerStoreTest {
StateManagerStore.postPersistNotifyReset(asUser, workItem, stateMgr, stateMgr.getAssigneesAdded(), attrResolver,
workStateFactory, changes);
- verify(notifications).addWorkItemNotificationEvent(any(AtsWorkItemNotificationEvent.class));
+ verify(changes).addWorkItemNotificationEvent(any(AtsWorkItemNotificationEvent.class));
}
@Test
@@ -162,6 +162,6 @@ public class StateManagerStoreTest {
stateMgr.getAssigneesAdded(), attrResolver, workStateFactory, changes);
listener.changesStored(changes);
- verify(notifications).addWorkItemNotificationEvent(any(AtsWorkItemNotificationEvent.class));
+ verify(changes).addWorkItemNotificationEvent(any(AtsWorkItemNotificationEvent.class));
}
}
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 c483de73a5..84fa7f4fce 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
@@ -41,9 +41,8 @@ public class StateManagerStore {
protected static void postPersistNotifyReset(IAtsUser asUser, IAtsWorkItem workItem, IAtsStateManager stateMgr, List<IAtsUser> assigneesAdded, IAttributeResolver attrResolver, IAtsWorkStateFactory workStateFactory, IAtsChangeSet changes) throws OseeCoreException {
try {
if (!assigneesAdded.isEmpty()) {
- changes.getNotifications().addWorkItemNotificationEvent(
- AtsNotificationEventFactory.getWorkItemNotificationEvent(asUser, workItem, assigneesAdded,
- AtsNotifyType.Assigned));
+ changes.addWorkItemNotificationEvent(AtsNotificationEventFactory.getWorkItemNotificationEvent(asUser,
+ workItem, assigneesAdded, AtsNotifyType.Assigned));
}
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, "Error adding ATS Notification Event", 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
index 139d86456e..34e44b300a 100644
--- 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
@@ -213,7 +213,7 @@ public class UserRoleManager implements IAtsPeerReviewRoleManager {
}
if (numNewCompleted != numCurrentCompleted) {
try {
- changes.getNotifications().addWorkItemNotificationEvent(
+ changes.addWorkItemNotificationEvent(
AtsNotificationEventFactory.getWorkItemNotificationEvent(services.getUserService().getCurrentUser(),
(IAtsWorkItem) peerRev, AtsNotifyType.Peer_Reviewers_Completed));
} catch (OseeCoreException ex) {
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 f2d74f65cd..2ca639a834 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
@@ -19,6 +19,8 @@ import java.util.concurrent.CopyOnWriteArraySet;
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.notify.AtsNotificationEvent;
+import org.eclipse.osee.ats.api.notify.AtsWorkItemNotificationEvent;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.util.IExecuteListener;
@@ -185,4 +187,14 @@ public abstract class AbstractAtsChangeSet implements IAtsChangeSet {
setSoleAttributeValue(atsObject, CoreAttributeTypes.Name, name);
}
+ @Override
+ public void addWorkItemNotificationEvent(AtsWorkItemNotificationEvent workItemNotificationEvent) {
+ notifications.getWorkItemNotificationEvents().add(workItemNotificationEvent);
+ }
+
+ @Override
+ public void addNotificationEvent(AtsNotificationEvent notifyEvent) {
+ notifications.getNotificationEvents().add(notifyEvent);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/ActionFactory.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/ActionFactory.java
index 5e334ad835..119e2e5f50 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/ActionFactory.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/ActionFactory.java
@@ -240,7 +240,7 @@ public class ActionFactory implements IAtsActionFactory {
changes.add(teamWf);
- changes.getNotifications().addWorkItemNotificationEvent(AtsNotificationEventFactory.getWorkItemNotificationEvent(
+ changes.addWorkItemNotificationEvent(AtsNotificationEventFactory.getWorkItemNotificationEvent(
AtsCoreUsers.SYSTEM_USER, teamWf, AtsNotifyType.SubscribedTeamOrAi));
changes.addWorkflowCreated(teamWf);
@@ -307,8 +307,8 @@ public class ActionFactory implements IAtsActionFactory {
if (attrResolver.isAttributeTypeValid(workItem, AtsAttributeTypes.CreatedDate)) {
changes.setSoleAttributeValue(workItem, AtsAttributeTypes.CreatedDate, date);
}
- changes.getNotifications().addWorkItemNotificationEvent(AtsNotificationEventFactory.getWorkItemNotificationEvent(
- changes.getAsUser(), workItem, AtsNotifyType.Originator));
+ changes.addWorkItemNotificationEvent(AtsNotificationEventFactory.getWorkItemNotificationEvent(changes.getAsUser(),
+ workItem, AtsNotifyType.Originator));
}
/**
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/util/DuplicateWorkflowAsIsOperation.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/util/DuplicateWorkflowAsIsOperation.java
index 6e05cf362d..dc33a960cc 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/util/DuplicateWorkflowAsIsOperation.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/util/DuplicateWorkflowAsIsOperation.java
@@ -62,9 +62,8 @@ public class DuplicateWorkflowAsIsOperation extends AbstractDuplicateWorkflowOpe
IAtsWorkItem newTeamWf = duplicateWorkItem(changes, teamWf);
// add notification for originator, assigned and subscribed
- changes.getNotifications().addWorkItemNotificationEvent(
- AtsNotificationEventFactory.getWorkItemNotificationEvent(asUser, newTeamWf, AtsNotifyType.Originator,
- AtsNotifyType.Assigned, AtsNotifyType.SubscribedTeamOrAi));
+ changes.addWorkItemNotificationEvent(AtsNotificationEventFactory.getWorkItemNotificationEvent(asUser,
+ newTeamWf, AtsNotifyType.Originator, AtsNotifyType.Assigned, AtsNotifyType.SubscribedTeamOrAi));
if (duplicateTasks) {
for (IAtsTask task : services.getTaskService().getTask(teamWf)) {
@@ -73,9 +72,8 @@ public class DuplicateWorkflowAsIsOperation extends AbstractDuplicateWorkflowOpe
services.getUserService().getCurrentUser().getUserId());
changes.relate(newTeamWf.getStoreObject(), AtsRelationTypes.TeamWfToTask_Task, dupTaskArt);
// for tasks, add notification for subscribed only
- changes.getNotifications().addWorkItemNotificationEvent(
- AtsNotificationEventFactory.getWorkItemNotificationEvent(asUser, dupTaskArt,
- AtsNotifyType.SubscribedTeamOrAi));
+ changes.addWorkItemNotificationEvent(AtsNotificationEventFactory.getWorkItemNotificationEvent(asUser,
+ dupTaskArt, AtsNotifyType.SubscribedTeamOrAi));
changes.add(dupTaskArt);
}
}
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 8ca7d71e0c..f2a8c8f915 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
@@ -39,7 +39,7 @@ public class AtsNotificationTransitionListener implements ITransitionListener {
@Override
public void transitioned(IAtsWorkItem workItem, IStateToken fromState, IStateToken toState, Collection<? extends IAtsUser> toAssignees, IAtsChangeSet changes) throws OseeCoreException {
try {
- changes.getNotifications().addWorkItemNotificationEvent(
+ changes.addWorkItemNotificationEvent(
AtsNotificationEventFactory.getWorkItemNotificationEvent(AtsCoreUsers.SYSTEM_USER, workItem,
AtsNotifyType.Subscribed, AtsNotifyType.Completed, AtsNotifyType.Cancelled));
} catch (OseeCoreException 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 39dbb763d5..82cbe22287 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
@@ -255,9 +255,8 @@ public class ExcelAtsActionArtifactExtractor {
if (emailPOCs) {
for (IAtsTeamWorkflow teamWf : teamWfs) {
try {
- changes.getNotifications().addWorkItemNotificationEvent(
- AtsNotificationEventFactory.getWorkItemNotificationEvent(
- AtsClientService.get().getUserService().getCurrentUser(), teamWf, AtsNotifyType.Assigned));
+ changes.addWorkItemNotificationEvent(AtsNotificationEventFactory.getWorkItemNotificationEvent(
+ AtsClientService.get().getUserService().getCurrentUser(), teamWf, AtsNotifyType.Assigned));
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, "Error adding ATS Notification Event", ex);
}

Back to the top