Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-09-27 16:24:21 -0400
committerMegumi Telles2016-09-29 09:54:32 -0400
commit21f2491ae0c5c085c3121fb3f990df021f58bace (patch)
treead16fd54e885690e4f9b96e549616a706fc6289f
parenta0796e5f1adaf423b6bc500637bed87684343d3d (diff)
downloadorg.eclipse.osee-21f2491ae0c5c085c3121fb3f990df021f58bace.tar.gz
org.eclipse.osee-21f2491ae0c5c085c3121fb3f990df021f58bace.tar.xz
org.eclipse.osee-21f2491ae0c5c085c3121fb3f990df021f58bace.zip
bug[ats_ATS317009]: ATS Workflows incorrectly assigned to OSEE System
- Ensure OSEE System is not assigned in StateManager - Fix Safety workflow creation to assign UnAssigned Change-Id: I3228563e2c1ec49953163adfdafb2a6fdf819cb6
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java11
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/ActionFactory.java3
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/state/StateManagerUtility.java7
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/SafetyWorkflowEventHandler.java26
4 files changed, 34 insertions, 13 deletions
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java
index 445cccc9d2..157180d449 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java
@@ -193,6 +193,9 @@ public class StateManager implements IAtsStateManager {
if (AtsCoreUsers.isGuestUser(assignee)) {
throw new OseeArgumentException("Can not assign workflow to Guest");
}
+ if (AtsCoreUsers.isSystemUser(assignee)) {
+ throw new OseeArgumentException("Can not assign workflow to System User");
+ }
}
WorkState state = getState(stateName);
@@ -250,6 +253,10 @@ public class StateManager implements IAtsStateManager {
if (AtsCoreUsers.isGuestUser(assignee)) {
throw new OseeArgumentException("Can not assign workflow to Guest");
}
+ if (AtsCoreUsers.isSystemUser(assignee)) {
+ throw new OseeArgumentException("Can not assign workflow to System User");
+ }
+
}
// Note: current and next state could be same
@@ -269,6 +276,10 @@ public class StateManager implements IAtsStateManager {
if (getAssignees().size() > 1 && getAssignees().contains(AtsCoreUsers.UNASSIGNED_USER)) {
removeAssignee(getCurrentStateName(), AtsCoreUsers.UNASSIGNED_USER);
}
+ if (getAssignees().size() > 1 && getAssignees().contains(AtsCoreUsers.SYSTEM_USER)) {
+ removeAssignee(getCurrentStateName(), AtsCoreUsers.SYSTEM_USER);
+ }
+
setDirty(true);
}
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 c8f4f63383..f977d75a8c 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
@@ -110,6 +110,9 @@ public class ActionFactory implements IAtsActionFactory {
List<IAtsTeamWorkflow> teamWfs = new ArrayList<>();
for (IAtsTeamDefinition teamDef : teamDefs) {
List<IAtsUser> leads = new LinkedList<>(teamDef.getLeads(actionableItems));
+ if (leads.isEmpty()) {
+ leads.add(AtsCoreUsers.UNASSIGNED_USER);
+ }
IAtsTeamWorkflow teamWf = createTeamWorkflow(action, teamDef, actionableItems, leads, changes, createdDate,
createdBy, newActionListener);
teamWfs.add(teamWf);
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/state/StateManagerUtility.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/state/StateManagerUtility.java
index 1ad5f39199..50a1ba839e 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/state/StateManagerUtility.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/state/StateManagerUtility.java
@@ -22,6 +22,7 @@ import org.eclipse.osee.ats.api.workdef.IStateToken;
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.users.AtsCoreUsers;
import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -41,7 +42,11 @@ public class StateManagerUtility {
}
if (workPage.getStateType().isWorkingState()) {
if (assignees.isEmpty()) {
- stateMgr.setAssignees(Arrays.asList(currentUser));
+ if (!currentUser.equals(AtsCoreUsers.SYSTEM_USER)) {
+ stateMgr.setAssignees(Arrays.asList(currentUser));
+ } else {
+ stateMgr.setAssignee(AtsCoreUsers.UNASSIGNED_USER);
+ }
} else {
stateMgr.setAssignees(assignees);
}
diff --git a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/SafetyWorkflowEventHandler.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/SafetyWorkflowEventHandler.java
index 2d9340526b..9019dd162f 100644
--- a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/SafetyWorkflowEventHandler.java
+++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/SafetyWorkflowEventHandler.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.define.report.internal.wordupdate;
+import java.util.Arrays;
import java.util.Date;
import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
import org.eclipse.osee.ats.api.data.AtsArtifactToken;
@@ -128,13 +129,13 @@ public class SafetyWorkflowEventHandler implements EventHandler {
private IAtsTeamWorkflow createSafetyAction(IAtsTeamWorkflow teamWf, ArtifactReadable userArt) {
IAtsTeamWorkflow teamWorkflow = null;
try {
- IAtsActionableItem ai = atsServer.getCache().getByUuid(AtsArtifactToken.SafetyActionableItem.getUuid(),
- IAtsActionableItem.class);
+ IAtsActionableItem ai =
+ atsServer.getCache().getByUuid(AtsArtifactToken.SafetyActionableItem.getUuid(), IAtsActionableItem.class);
if (ai == null) {
throw new OseeCoreException("Safety Actionable Item not configured");
}
- IAtsTeamDefinition teamDef = atsServer.getCache().getByUuid(
- AtsArtifactToken.SafetyTeamDefinition.getUuid(), IAtsTeamDefinition.class);
+ IAtsTeamDefinition teamDef =
+ atsServer.getCache().getByUuid(AtsArtifactToken.SafetyTeamDefinition.getUuid(), IAtsTeamDefinition.class);
if (teamDef == null) {
throw new OseeCoreException("Safety Team Definition not configured");
}
@@ -142,16 +143,17 @@ public class SafetyWorkflowEventHandler implements EventHandler {
IAtsChangeSet changes = atsServer.getStoreService().createAtsChangeSet("Create System Safety Workflow",
atsServer.getUserService().getUserById(userArt.getSoleAttributeAsString(CoreAttributeTypes.UserId)));
IAtsAction action = atsServer.getActionFactory().getAction(teamWf);
- teamWorkflow = atsServer.getActionFactory().createTeamWorkflow(action, teamDef,
- java.util.Collections.singleton(ai), null, changes, new Date(), createdBy, new NewActionAdapter() {
+ teamWorkflow =
+ atsServer.getActionFactory().createTeamWorkflow(action, teamDef, java.util.Collections.singleton(ai),
+ Arrays.asList(AtsCoreUsers.UNASSIGNED_USER), changes, new Date(), createdBy, new NewActionAdapter() {
- @Override
- public void teamCreated(IAtsAction action, IAtsTeamWorkflow teamWf, IAtsChangeSet changes) throws OseeCoreException {
- changes.setSoleAttributeValue(teamWf, AtsAttributeTypes.Description,
- "Review System Safety Changes for the associated RPCR to Complete the Workflow");
- }
+ @Override
+ public void teamCreated(IAtsAction action, IAtsTeamWorkflow teamWf, IAtsChangeSet changes) throws OseeCoreException {
+ changes.setSoleAttributeValue(teamWf, AtsAttributeTypes.Description,
+ "Review System Safety Changes for the associated RPCR to Complete the Workflow");
+ }
- });
+ });
changes.setSoleAttributeValue(teamWorkflow, CoreAttributeTypes.Name,
"Safety Workflow for " + teamWf.getAtsId());
changes.execute();

Back to the top