Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2013-09-27 15:51:25 -0400
committerRyan D. Brooks2013-10-03 18:30:11 -0400
commite4c18e1a68a2e9df9b7e928eaeb21e6864e08af8 (patch)
tree7c59e686d8f64409715e8ed4edca3e4a335e5d63
parent4e936a969cf0eaa056049825bd2d88ecf425caa8 (diff)
downloadorg.eclipse.osee-e4c18e1a68a2e9df9b7e928eaeb21e6864e08af8.tar.gz
org.eclipse.osee-e4c18e1a68a2e9df9b7e928eaeb21e6864e08af8.tar.xz
org.eclipse.osee-e4c18e1a68a2e9df9b7e928eaeb21e6864e08af8.zip
bug[ats_QRS81]: Actionable Items issue with duplicated workflow
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/CreateTeamData.java65
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/CreateTeamOption.java (renamed from plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/CreateTeamOption.java)5
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/action/ActionManager.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/CreateTasksOperation.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/AllAtsCoreTestSuite.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/ai/AtsCore_AI_Suite.java23
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/ai/ModifyActionableItemsTest.java162
-rw-r--r--plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/ai/ModifyActionableItems.java157
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ActionableItems.java45
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ITeamDefinitionUtility.java25
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinitionUtility.java28
-rw-r--r--plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.osee.ats/plugin.xml8
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/WorkflowPortingBlam.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/DuplicateWorkflowAction.java4
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/EditActionableItemsAction.java8
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/ModifyActionableItemAction.java45
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/EditActionableItems.java134
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAActionableItemHeader.java9
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAOperationsSection.java3
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DuplicateWorkflowBlam.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ModifyActionableItemsBlam.java460
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java24
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java8
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Collections.java9
28 files changed, 1054 insertions, 191 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/CreateTeamData.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/CreateTeamData.java
new file mode 100644
index 0000000000..3a3bde255b
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/CreateTeamData.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.api.team;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
+import org.eclipse.osee.ats.api.user.IAtsUser;
+
+/**
+ * @author Donald G Dunne
+ */
+public class CreateTeamData {
+
+ private final IAtsTeamDefinition teamDef;
+ private final Collection<IAtsActionableItem> actionableItems;
+ private final List<? extends IAtsUser> assignees;
+ private final Date createdDate;
+ private final IAtsUser createdBy;
+ private final CreateTeamOption[] createTeamOption;
+
+ public CreateTeamData(IAtsTeamDefinition teamDef, Collection<IAtsActionableItem> actionableItems, List<? extends IAtsUser> assignees, Date createdDate, IAtsUser createdBy, CreateTeamOption... createTeamOption) {
+ this.teamDef = teamDef;
+ this.actionableItems = new ArrayList<IAtsActionableItem>(actionableItems);
+ this.assignees = assignees;
+ this.createdDate = createdDate;
+ this.createdBy = createdBy;
+ this.createTeamOption = createTeamOption;
+
+ }
+
+ public IAtsTeamDefinition getTeamDef() {
+ return teamDef;
+ }
+
+ public Collection<IAtsActionableItem> getActionableItems() {
+ return actionableItems;
+ }
+
+ public List<? extends IAtsUser> getAssignees() {
+ return assignees;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public IAtsUser getCreatedBy() {
+ return createdBy;
+ }
+
+ public CreateTeamOption[] getCreateTeamOption() {
+ return createTeamOption;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/CreateTeamOption.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/CreateTeamOption.java
index 56a96328eb..963d548453 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/CreateTeamOption.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/CreateTeamOption.java
@@ -8,8 +8,11 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.core.client.team;
+package org.eclipse.osee.ats.api.team;
+/**
+ * @author Donald G Dunne
+ */
public enum CreateTeamOption {
Duplicate_If_Exists; // If option exists, then duplication of workflow of same team definition is allowed
};
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 fbf473e84e..6b03ab0b8d 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,11 +19,11 @@ 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.team.CreateTeamOption;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
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.team.CreateTeamOption;
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.AtsUtilCore;
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/CreateTasksOperation.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/CreateTasksOperation.java
index 450ffac278..dba3efe452 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/CreateTasksOperation.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/CreateTasksOperation.java
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
+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.version.IAtsVersion;
@@ -30,7 +31,6 @@ 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.task.TaskArtifact;
-import org.eclipse.osee.ats.core.client.team.CreateTeamOption;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.config.AtsVersionService;
import org.eclipse.osee.ats.core.config.TeamDefinitions;
diff --git a/plugins/org.eclipse.osee.ats.core.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core.test/META-INF/MANIFEST.MF
index 76f76e70a7..f5f0ef2fae 100644
--- a/plugins/org.eclipse.osee.ats.core.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.core.test/META-INF/MANIFEST.MF
@@ -13,4 +13,8 @@ Bundle-Vendor: Eclipse Open System Engineering Environment
Export-Package: org.eclipse.osee.ats.core
Import-Package: org.eclipse.emf.ecore.util,
org.eclipse.osee.ats.core,
- org.eclipse.osee.ats.mocks
+ org.eclipse.osee.ats.mocks,
+ org.mockito;bundle-version="1.9.0",
+ org.hamcrest.core,
+ org.objenesis
+
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/AllAtsCoreTestSuite.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/AllAtsCoreTestSuite.java
index d88ecff584..1ccf28e5e8 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/AllAtsCoreTestSuite.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/AllAtsCoreTestSuite.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.ats.core;
+import org.eclipse.osee.ats.core.ai.AtsCore_AI_Suite;
import org.eclipse.osee.ats.core.column.AtsCore_Column_JT_Suite;
import org.eclipse.osee.ats.core.internal.column.ev.AtsCore_InternalColumnEv_JT_Suite;
import org.eclipse.osee.ats.core.model.impl.AtsCore_ModelImpl_JT_Suite;
@@ -24,6 +25,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
+ AtsCore_AI_Suite.class,
AtsCore_Column_JT_Suite.class,
AtsCore_InternalColumnEv_JT_Suite.class,
AtsCore_ModelImpl_JT_Suite.class,
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/ai/AtsCore_AI_Suite.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/ai/AtsCore_AI_Suite.java
new file mode 100644
index 0000000000..bbecab76ee
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/ai/AtsCore_AI_Suite.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 20013 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.ai;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ModifyActionableItemsTest.class})
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsCore_AI_Suite {
+ // Test Suite
+}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/ai/ModifyActionableItemsTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/ai/ModifyActionableItemsTest.java
new file mode 100644
index 0000000000..f323814f10
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/ai/ModifyActionableItemsTest.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * 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.ai;
+
+import static org.mockito.Mockito.when;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
+import org.eclipse.osee.ats.api.team.CreateTeamData;
+import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
+import org.eclipse.osee.ats.api.user.IAtsUser;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
+import org.eclipse.osee.ats.core.config.ITeamDefinitionUtility;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.util.XResultData;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+/**
+ * Test unit for {@link ModifyActionableItems}
+ *
+ * @author Donald G Dunne
+ */
+public class ModifyActionableItemsTest {
+
+ // @formatter:off
+ @Mock private IAtsTeamWorkflow teamWf;
+ @Mock private IAtsUser modifiedBy;
+ @Mock private IAtsActionableItem ai1, ai2, ai3;
+ @Mock private ITeamDefinitionUtility teamDefUtil;
+ @Mock private IAtsTeamDefinition teamDef;
+ // @formatter:on
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void test_addAi() throws OseeCoreException {
+ when(teamWf.getActionableItems()).thenReturn(org.eclipse.osee.framework.jdk.core.util.Collections.hashSet(ai1));
+ XResultData results = new XResultData(false);
+ List<IAtsActionableItem> currAIsForAllWfs = Arrays.asList(ai1);
+ List<IAtsActionableItem> currWorkflowDesiredAIs = Arrays.asList(ai1, ai2);
+ List<IAtsActionableItem> newAIs = Collections.emptyList();
+
+ ModifyActionableItems job =
+ new ModifyActionableItems(results, teamWf, currAIsForAllWfs, currWorkflowDesiredAIs, newAIs, modifiedBy,
+ teamDefUtil);
+ job.performModification();
+
+ Assert.assertEquals(1, job.getAddAis().size());
+ Assert.assertEquals(0, job.getRemoveAis().size());
+ Assert.assertEquals(0, job.getTeamDatas().size());
+ }
+
+ @Test
+ public void test_removeAi() throws OseeCoreException {
+ when(teamWf.getActionableItems()).thenReturn(
+ org.eclipse.osee.framework.jdk.core.util.Collections.hashSet(ai1, ai2));
+ XResultData results = new XResultData(false);
+ List<IAtsActionableItem> currAIsForAllWfs = Arrays.asList(ai1);
+ List<IAtsActionableItem> currWorkflowDesiredAIs = Arrays.asList(ai1);
+ List<IAtsActionableItem> newAIs = Collections.emptyList();
+
+ ModifyActionableItems job =
+ new ModifyActionableItems(results, teamWf, currAIsForAllWfs, currWorkflowDesiredAIs, newAIs, modifiedBy,
+ teamDefUtil);
+ job.performModification();
+
+ Assert.assertEquals(0, job.getAddAis().size());
+ Assert.assertEquals(1, job.getRemoveAis().size());
+ Assert.assertEquals(0, job.getTeamDatas().size());
+ }
+
+ @Test
+ public void test_removeAllAi() throws OseeCoreException {
+ when(teamWf.getActionableItems()).thenReturn(
+ org.eclipse.osee.framework.jdk.core.util.Collections.hashSet(ai1, ai2));
+ XResultData results = new XResultData(false);
+ List<IAtsActionableItem> currAIsForAllWfs = Arrays.asList(ai1);
+ List<IAtsActionableItem> currWorkflowDesiredAIs = Collections.emptyList();
+ List<IAtsActionableItem> newAIs = Collections.emptyList();
+
+ ModifyActionableItems job =
+ new ModifyActionableItems(results, teamWf, currAIsForAllWfs, currWorkflowDesiredAIs, newAIs, modifiedBy,
+ teamDefUtil);
+ job.performModification();
+
+ Assert.assertTrue(results.toString().contains("Error: All AIs can not be removed"));
+ Assert.assertEquals(0, job.getAddAis().size());
+ Assert.assertEquals(0, job.getRemoveAis().size());
+ Assert.assertEquals(0, job.getTeamDatas().size());
+ }
+
+ @Test
+ public void test_newAi() throws OseeCoreException {
+ when(teamWf.getActionableItems()).thenReturn(
+ org.eclipse.osee.framework.jdk.core.util.Collections.hashSet(ai1, ai2));
+ when(ai3.isActionable()).thenReturn(true);
+ when(teamDefUtil.getImpactedTeamDefs(Arrays.asList(ai3))).thenReturn(Collections.singleton(teamDef));
+
+ XResultData results = new XResultData(false);
+ List<IAtsActionableItem> currAIsForAllWfs = Arrays.asList(ai1, ai2);
+ List<IAtsActionableItem> currWorkflowDesiredAIs = Arrays.asList(ai1, ai2);
+ List<IAtsActionableItem> newAIs = Arrays.asList(ai3);
+
+ ModifyActionableItems job =
+ new ModifyActionableItems(results, teamWf, currAIsForAllWfs, currWorkflowDesiredAIs, newAIs, modifiedBy,
+ teamDefUtil);
+ job.performModification();
+
+ Assert.assertEquals(0, job.getAddAis().size());
+ Assert.assertEquals(0, job.getRemoveAis().size());
+ Assert.assertEquals(1, job.getTeamDatas().size());
+ Assert.assertFalse(results.isErrors());
+ CreateTeamData data = job.getTeamDatas().iterator().next();
+ Assert.assertEquals(1, data.getActionableItems().size());
+ Assert.assertEquals(ai3, data.getActionableItems().iterator().next());
+ Assert.assertEquals(modifiedBy, data.getCreatedBy());
+ Assert.assertEquals(teamDef, data.getTeamDef());
+ Assert.assertFalse(results.toString().contains("impacted by an existing"));
+ }
+
+ @Test
+ public void test_duplicateAi() throws OseeCoreException {
+ when(teamWf.getActionableItems()).thenReturn(
+ org.eclipse.osee.framework.jdk.core.util.Collections.hashSet(ai1, ai2));
+ when(ai2.isActionable()).thenReturn(true);
+ when(teamDefUtil.getImpactedTeamDefs(Arrays.asList(ai2))).thenReturn(Collections.singleton(teamDef));
+
+ XResultData results = new XResultData(false);
+ List<IAtsActionableItem> currAIsForAllWfs = Arrays.asList(ai1, ai2);
+ List<IAtsActionableItem> currWorkflowDesiredAIs = Arrays.asList(ai1, ai2);
+ List<IAtsActionableItem> newAIs = Arrays.asList(ai2);
+
+ ModifyActionableItems job =
+ new ModifyActionableItems(results, teamWf, currAIsForAllWfs, currWorkflowDesiredAIs, newAIs, modifiedBy,
+ teamDefUtil);
+ job.performModification();
+
+ Assert.assertEquals(0, job.getAddAis().size());
+ Assert.assertEquals(0, job.getRemoveAis().size());
+ Assert.assertEquals(1, job.getTeamDatas().size());
+ CreateTeamData data = job.getTeamDatas().iterator().next();
+ Assert.assertEquals(ai2, data.getActionableItems().iterator().next());
+ Assert.assertTrue(results.toString().contains("impacted by an existing"));
+ }
+
+}
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 7f0e64bd0a..c3b4b9659c 100644
--- a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
@@ -44,6 +44,7 @@ Import-Package: com.google.inject,
org.osgi.framework
Bundle-Vendor: Eclipse Open System Engineering Environment
Export-Package: org.eclipse.osee.ats.core,
+ org.eclipse.osee.ats.core.ai,
org.eclipse.osee.ats.core.column,
org.eclipse.osee.ats.core.config,
org.eclipse.osee.ats.core.model,
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/ai/ModifyActionableItems.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/ai/ModifyActionableItems.java
new file mode 100644
index 0000000000..64e7b6942b
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/ai/ModifyActionableItems.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * 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.ai;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
+import org.eclipse.osee.ats.api.team.CreateTeamData;
+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.workflow.IAtsTeamWorkflow;
+import org.eclipse.osee.ats.core.config.ITeamDefinitionUtility;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.framework.core.util.XResultData;
+
+/**
+ * @author Donald G Dunne
+ */
+public class ModifyActionableItems {
+
+ private final XResultData results;
+ private final IAtsTeamWorkflow teamWf;
+ private final Collection<IAtsActionableItem> currAIsForAllWfs;
+ private final Collection<IAtsActionableItem> currWorkflowDesiredAIs;
+ private final Collection<IAtsActionableItem> newAIs;
+ private final IAtsUser modifiedBy;
+ private final List<CreateTeamData> teamDatas = new ArrayList<CreateTeamData>();
+ private final List<IAtsActionableItem> addAis = new ArrayList<IAtsActionableItem>();
+ private final List<IAtsActionableItem> removeAis = new ArrayList<IAtsActionableItem>();
+ private final Map<IAtsTeamDefinition, CreateTeamData> teamDefToTeamDataMap =
+ new HashMap<IAtsTeamDefinition, CreateTeamData>();
+ private final ITeamDefinitionUtility teamDefUtil;
+
+ public ModifyActionableItems(XResultData results, IAtsTeamWorkflow teamWf, Collection<IAtsActionableItem> currAIsForAllWfs, Collection<IAtsActionableItem> currWorkflowDesiredAIs, Collection<IAtsActionableItem> newAIs, IAtsUser modifiedBy, ITeamDefinitionUtility teamDefUtil) {
+ this.results = results;
+ this.teamWf = teamWf;
+ this.currAIsForAllWfs = currAIsForAllWfs;
+ this.currWorkflowDesiredAIs = currWorkflowDesiredAIs;
+ this.newAIs = newAIs;
+ this.modifiedBy = modifiedBy;
+ this.teamDefUtil = teamDefUtil;
+ }
+
+ public void performModification() throws OseeCoreException {
+ Conditions.checkNotNull(results, "results");
+ Conditions.checkNotNull(teamWf, "teamWf");
+ Conditions.checkNotNull(modifiedBy, "modifiedBy");
+ // Determine if changes to this workflow's actionable items
+ processAisAddedRemovedFromSelectedTeamWf();
+ // Determine what workflows to add
+ processAisAddedForNewWorkflows();
+ }
+
+ private void processAisAddedForNewWorkflows() throws OseeCoreException {
+ Set<IAtsActionableItem> allAIsForNewWorkflow = new HashSet<IAtsActionableItem>();
+ Set<IAtsActionableItem> duplicatedAIs = new HashSet<IAtsActionableItem>();
+ // determine AIs that already have a team workflow associated
+ for (IAtsActionableItem checkAi : newAIs) {
+ if (!checkAi.isActionable()) {
+ results.logErrorWithFormat("Actionable Item [%s] is not actionable; select item lower in hierarchy",
+ checkAi);
+ } else {
+ if (currAIsForAllWfs.contains(checkAi)) {
+ duplicatedAIs.add(checkAi);
+ }
+ allAIsForNewWorkflow.add(checkAi);
+ }
+ }
+ Date createdDate = new Date();
+ // process new and duplicated workflows
+ for (IAtsActionableItem ai : allAIsForNewWorkflow) {
+ IAtsTeamDefinition teamDef = getImpactedTeamDef(ai);
+ if (teamDefToTeamDataMap.containsKey(teamDef)) {
+ CreateTeamData createTeamData = teamDefToTeamDataMap.get(teamDef);
+ createTeamData.getActionableItems().add(ai);
+ } else {
+ CreateTeamData createTeamData =
+ new CreateTeamData(teamDef, Arrays.asList(ai), new LinkedList<IAtsUser>(teamDef.getLeads()),
+ createdDate, modifiedBy, CreateTeamOption.Duplicate_If_Exists);
+ teamDatas.add(createTeamData);
+ teamDefToTeamDataMap.put(teamDef, createTeamData);
+ }
+ }
+ // add messages to results
+ for (CreateTeamData data : teamDatas) {
+ results.log(String.format("Create New Team Workflow for Actionable Item(s) %s", data.getActionableItems()));
+ for (IAtsActionableItem ai : data.getActionableItems()) {
+ if (duplicatedAIs.contains(ai)) {
+ results.logWithFormat(" - Note: Actionable Item [%s] is impacted by an existing Team Workflow\n", ai);
+ }
+ }
+ }
+ }
+
+ /**
+ * Return single Team Definition associated with this Actionable Item
+ */
+ private IAtsTeamDefinition getImpactedTeamDef(IAtsActionableItem ai) throws OseeCoreException {
+ IAtsTeamDefinition teamDef = null;
+ Collection<IAtsTeamDefinition> impactedTeamDefs = teamDefUtil.getImpactedTeamDefs(Arrays.asList(ai));
+ if (impactedTeamDefs.size() > 0) {
+ teamDef = impactedTeamDefs.iterator().next();
+ }
+ return teamDef;
+ }
+
+ private void processAisAddedRemovedFromSelectedTeamWf() throws OseeCoreException {
+ Set<IAtsActionableItem> currAIs = teamWf.getActionableItems();
+ if (currWorkflowDesiredAIs.isEmpty()) {
+ results.logError("All AIs can not be removed from a Team Workflow; Cancel workflow instead");
+ } else {
+ for (IAtsActionableItem checkedAi : currWorkflowDesiredAIs) {
+ if (!currAIs.contains(checkedAi)) {
+ results.logWithFormat("Add Actionable Item [%s] to the selected Team Workflow\n", checkedAi);
+ addAis.add(checkedAi);
+ }
+ }
+ for (IAtsActionableItem currAi : currAIs) {
+ if (!currWorkflowDesiredAIs.contains(currAi)) {
+ results.logWithFormat("Remove Actionable Item [%s] to the selected Team Workflow\n", currAi);
+ removeAis.add(currAi);
+ }
+ }
+ }
+ }
+
+ public List<CreateTeamData> getTeamDatas() {
+ return teamDatas;
+ }
+
+ public List<IAtsActionableItem> getAddAis() {
+ return addAis;
+ }
+
+ public List<IAtsActionableItem> getRemoveAis() {
+ return removeAis;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ActionableItems.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ActionableItems.java
index 80173b916f..3ca7e87c67 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ActionableItems.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ActionableItems.java
@@ -129,18 +129,18 @@ public class ActionableItems {
return Collections.castAll(getActive(getChildren(topAi, false), active));
}
- public static List<IAtsActionableItem> getActive(Collection<IAtsActionableItem> teamDefs, Active active) {
+ public static List<IAtsActionableItem> getActive(Collection<IAtsActionableItem> ais, Active active) {
List<IAtsActionableItem> results = new ArrayList<IAtsActionableItem>();
- for (IAtsActionableItem aia : teamDefs) {
+ for (IAtsActionableItem ai : ais) {
if (active == Active.Both) {
- results.add(aia);
+ results.add(ai);
} else {
// assume active unless otherwise specified
- boolean attributeActive = aia.isActive();
+ boolean attributeActive = ai.isActive();
if (active == Active.Active && attributeActive) {
- results.add(aia);
+ results.add(ai);
} else if (active == Active.InActive && !attributeActive) {
- results.add(aia);
+ results.add(ai);
}
}
}
@@ -158,4 +158,37 @@ public class ActionableItems {
return children;
}
+ /**
+ * Return all active actionable items that this team is responsible for
+ */
+ public static List<IAtsActionableItem> getActiveForTeam(IAtsTeamDefinition teamDef, Active active) {
+ List<IAtsActionableItem> results = new ArrayList<IAtsActionableItem>();
+ for (IAtsActionableItem ai : teamDef.getActionableItems()) {
+ getActiveForTeam(teamDef, active, results, ai);
+ for (IAtsActionableItem childAi : ai.getChildrenActionableItems()) {
+ getActiveForTeam(teamDef, active, results, childAi);
+ }
+ }
+ return results;
+ }
+
+ /**
+ * Add ai to results if owned by teamDef an matches active status
+ */
+ private static void getActiveForTeam(IAtsTeamDefinition teamDef, Active active, List<IAtsActionableItem> results, IAtsActionableItem ai) {
+ if (ai.getTeamDefinition() == null || ai.getTeamDefinition().equals(teamDef)) {
+ if (active == Active.Both) {
+ results.add(ai);
+ } else {
+ // assume active unless otherwise specified
+ boolean attributeActive = ai.isActive();
+ if (active == Active.Active && attributeActive) {
+ results.add(ai);
+ } else if (active == Active.InActive && !attributeActive) {
+ results.add(ai);
+ }
+ }
+ }
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ITeamDefinitionUtility.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ITeamDefinitionUtility.java
new file mode 100644
index 0000000000..2d5e349ca3
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ITeamDefinitionUtility.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.config;
+
+import java.util.Collection;
+import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
+import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Donald G Dunne
+ */
+public interface ITeamDefinitionUtility {
+
+ public Collection<IAtsTeamDefinition> getImpactedTeamDefs(Collection<IAtsActionableItem> aias) throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinitionUtility.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinitionUtility.java
new file mode 100644
index 0000000000..9b2a5ec3a1
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinitionUtility.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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.config;
+
+import java.util.Collection;
+import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
+import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Donald G Dunne
+ */
+public class TeamDefinitionUtility implements ITeamDefinitionUtility {
+
+ @Override
+ public Collection<IAtsTeamDefinition> getImpactedTeamDefs(Collection<IAtsActionableItem> aias) throws OseeCoreException {
+ return TeamDefinitions.getImpactedTeamDefs(aias);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
index 2888424285..7ccffb7df3 100644
--- a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
@@ -26,7 +26,8 @@ Require-Bundle: org.eclipse.gef,
org.eclipse.birt.chart.engine,
org.eclipse.search,
org.eclipse.osee.ats.help.ui,
- org.eclipse.osee.ats.core
+ org.eclipse.osee.ats.core,
+ org.eclipse.core.jobs
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.osee.ats,
org.eclipse.osee.ats.access,
@@ -102,6 +103,7 @@ Import-Package: com.google.inject,
org.eclipse.osee.ats.core.client.workflow.note,
org.eclipse.osee.ats.core.client.workflow.stateitem,
org.eclipse.osee.ats.core.client.workflow.transition,
+ org.eclipse.osee.ats.core.ai,
org.eclipse.osee.ats.core.column,
org.eclipse.osee.ats.core.workdef,
org.eclipse.osee.ats.core.workdef.provider,
diff --git a/plugins/org.eclipse.osee.ats/plugin.xml b/plugins/org.eclipse.osee.ats/plugin.xml
index e2f79b8f1d..d2dc86d770 100644
--- a/plugins/org.eclipse.osee.ats/plugin.xml
+++ b/plugins/org.eclipse.osee.ats/plugin.xml
@@ -381,6 +381,14 @@
</Operation>
</extension>
<extension
+ id="ModifyActionableItemsBlam"
+ name="ModifyActionableItemsBlam"
+ point="org.eclipse.osee.framework.ui.skynet.BlamOperation">
+ <Operation
+ className="org.eclipse.osee.ats.operation.ModifyActionableItemsBlam">
+ </Operation>
+ </extension>
+ <extension
point="org.eclipse.osee.ats.AtsWorldEditorItem">
<AtsWorldEditorItem
classname="org.eclipse.osee.ats.world.AtsWorldEditorItem">
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/WorkflowPortingBlam.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/WorkflowPortingBlam.java
index c03d29e6bc..0f65965141 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/WorkflowPortingBlam.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/WorkflowPortingBlam.java
@@ -18,10 +18,10 @@ import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
+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.core.client.action.ActionManager;
-import org.eclipse.osee.ats.core.client.team.CreateTeamOption;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.internal.AtsClientService;
import org.eclipse.osee.ats.util.AtsUtil;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/DuplicateWorkflowAction.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/DuplicateWorkflowAction.java
index 6937b9b4d9..475ce98a3c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/DuplicateWorkflowAction.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/DuplicateWorkflowAction.java
@@ -34,7 +34,9 @@ public class DuplicateWorkflowAction extends Action {
@Override
public void run() {
DuplicateWorkflowBlam blamOperation = new DuplicateWorkflowBlam();
- blamOperation.setDefaultTeamWorkflows(teams);
+ if (teams != null && !teams.isEmpty()) {
+ blamOperation.setDefaultTeamWorkflows(teams);
+ }
BlamEditor.edit(blamOperation);
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/EditActionableItemsAction.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/EditActionableItemsAction.java
index 58d769cb67..69057781b1 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/EditActionableItemsAction.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/EditActionableItemsAction.java
@@ -11,11 +11,9 @@
package org.eclipse.osee.ats.actions;
import org.eclipse.osee.ats.AtsImage;
-import org.eclipse.osee.ats.core.client.action.ActionArtifact;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.ui.swt.ImageManager;
/**
@@ -33,11 +31,7 @@ public class EditActionableItemsAction extends AbstractAtsAction {
@Override
public void runWithException() throws OseeCoreException {
- ActionArtifact parentAction = teamWf.getParentActionArtifact();
- if (parentAction == null) {
- throw new OseeStateException("No Parent Action; Aborting");
- }
- AtsUtil.editActionableItems(parentAction);
+ AtsUtil.editActionableItems(teamWf);
}
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/ModifyActionableItemAction.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/ModifyActionableItemAction.java
new file mode 100644
index 0000000000..1d0264adbc
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/ModifyActionableItemAction.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.operation.ModifyActionableItemsBlam;
+import org.eclipse.osee.framework.ui.skynet.blam.BlamEditor;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ModifyActionableItemAction extends Action {
+
+ private final TeamWorkFlowArtifact team;
+
+ public ModifyActionableItemAction(TeamWorkFlowArtifact team) {
+ super("Modify Actionable Item(s)");
+ this.team = team;
+ }
+
+ @Override
+ public void run() {
+ ModifyActionableItemsBlam blamOperation = new ModifyActionableItemsBlam();
+ blamOperation.setDefaultTeamWorkflow(team);
+ BlamEditor.edit(blamOperation);
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(AtsImage.ACTIONABLE_ITEM);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/EditActionableItems.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/EditActionableItems.java
deleted file mode 100644
index 58b1542d40..0000000000
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/EditActionableItems.java
+++ /dev/null
@@ -1,134 +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.artifact;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
-import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
-import org.eclipse.osee.ats.api.user.IAtsUser;
-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.team.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.core.config.TeamDefinitions;
-import org.eclipse.osee.ats.internal.AtsClientService;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.widgets.dialog.AICheckTreeDialog;
-import org.eclipse.osee.framework.core.enums.Active;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.util.Result;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class EditActionableItems {
-
- public static Result editActionableItems(ActionArtifact actionArt) throws OseeCoreException {
- final AICheckTreeDialog diag =
- new AICheckTreeDialog(
- "Add Impacted Actionable Items",
- "Select New Impacted Actionable Items\n\n" + "Note: Un-selecting existing items will NOT remove the impact.\n" + "Team Workflow with no impact should be transitioned to Cancelled.",
- Active.Active);
-
- diag.setInitialAias(actionArt.getActionableItems());
- if (diag.open() != 0) {
- return Result.FalseResult;
- }
-
- // ensure that at least one actionable item exists for each team after aias added/removed
- for (TeamWorkFlowArtifact team : ActionManager.getTeams(actionArt)) {
- Set<IAtsActionableItem> currentAias = team.getActionableItemsDam().getActionableItems();
- Collection<IAtsActionableItem> checkedAias = diag.getChecked();
- for (IAtsActionableItem aia : new CopyOnWriteArrayList<IAtsActionableItem>(currentAias)) {
- if (!checkedAias.contains(aia)) {
- currentAias.remove(aia);
- }
- }
- if (currentAias.isEmpty()) {
- return new Result("Can not remove all actionable items for a team.\n\nActionable Items will go to 0 for [" +
- //
- team.getTeamName() + "][" + team.getHumanReadableId() + "]\n\nCancel team workflow instead.");
- }
- }
-
- final StringBuffer sb = new StringBuffer();
- SkynetTransaction transaction =
- TransactionManager.createTransaction(AtsUtil.getAtsBranch(), "Edit Actionable Items");
- Date createdDate = new Date();
- IAtsUser createdBy = AtsClientService.get().getUserAdmin().getCurrentUser();
-
- // Add new aias
- for (IAtsActionableItem aia : diag.getChecked()) {
- Result result = addActionableItemToTeamsOrAddTeams(actionArt, aia, createdDate, createdBy, transaction);
- sb.append(result.getText());
- }
- // Remove unchecked aias
- for (TeamWorkFlowArtifact team : ActionManager.getTeams(actionArt)) {
- for (IAtsActionableItem aia : team.getActionableItemsDam().getActionableItems()) {
- if (!diag.getChecked().contains(aia)) {
- team.getActionableItemsDam().removeActionableItem(aia);
- }
- }
- team.persist(transaction);
- }
-
- transaction.execute();
- return new Result(true, sb.toString());
- }
-
- public static Result addActionableItemToTeamsOrAddTeams(Artifact actionArt, IAtsActionableItem aia, Date createdDate, IAtsUser createdBy, SkynetTransaction transaction) throws OseeCoreException {
- StringBuffer sb = new StringBuffer();
- for (IAtsTeamDefinition tda : TeamDefinitions.getImpactedTeamDefs(Arrays.asList(aia))) {
- boolean teamExists = false;
- // Look for team workflow that is associated with this tda
- for (TeamWorkFlowArtifact teamArt : ActionManager.getTeams(actionArt)) {
- // If found
- if (teamArt.getTeamDefinition().equals(tda)) {
- // And workflow doesn't already have this actionable item,
- // ADD it
- if (!teamArt.getActionableItemsDam().getActionableItems().contains(aia)) {
- teamArt.getActionableItemsDam().addActionableItem(aia);
- teamArt.saveSMA(transaction);
- sb.append(aia.getName() + " => added to existing team workflow \"" + tda.getName() + "\"\n");
- teamExists = true;
- } else {
- sb.append(aia.getName() + " => already exists in team workflow \"" + tda.getName() + "\"\n");
- teamExists = true;
- }
- }
- }
- if (!teamExists) {
- TeamWorkFlowArtifact teamArt =
- ActionManager.createTeamWorkflow(actionArt, tda, Arrays.asList(aia),
- new LinkedList<IAtsUser>(tda.getLeads()), transaction, createdDate, createdBy, null);
- teamArt.persist(transaction);
- sb.append(aia.getName() + " => added team workflow \"" + tda.getName() + "\"\n");
- }
- }
- return new Result(true, sb.toString());
- }
-
- public static Result editActionableItems(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
- ActionArtifact parentAction = teamArt.getParentActionArtifact();
- if (parentAction == null) {
- return new Result("No Parent Action; Aborting");
- }
- return EditActionableItems.editActionableItems(parentAction);
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAActionableItemHeader.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAActionableItemHeader.java
index 337619c870..f464db1aab 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAActionableItemHeader.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAActionableItemHeader.java
@@ -21,7 +21,6 @@ import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.skynet.XFormToolkit;
import org.eclipse.osee.framework.ui.swt.ALayout;
import org.eclipse.osee.framework.ui.swt.Displays;
@@ -73,13 +72,7 @@ public class SMAActionableItemHeader extends Composite {
if (editor.isDirty()) {
editor.doSave(null);
}
-
- ActionArtifact parentAction = teamWf.getParentActionArtifact();
- if (parentAction == null) {
- AWorkbench.popup("No Parent Action; Aborting");
- return;
- }
- AtsUtil.editActionableItems(parentAction);
+ AtsUtil.editActionableItems(teamWf);
} catch (Exception ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAOperationsSection.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAOperationsSection.java
index 7bb2f15121..13e673f6f4 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAOperationsSection.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAOperationsSection.java
@@ -22,6 +22,7 @@ import org.eclipse.osee.ats.actions.DuplicateWorkflowAction;
import org.eclipse.osee.ats.actions.EditActionableItemsAction;
import org.eclipse.osee.ats.actions.EmailActionAction;
import org.eclipse.osee.ats.actions.FavoriteAction;
+import org.eclipse.osee.ats.actions.ModifyActionableItemAction;
import org.eclipse.osee.ats.actions.OpenInArtifactEditorAction;
import org.eclipse.osee.ats.actions.OpenInAtsWorldAction;
import org.eclipse.osee.ats.actions.OpenInSkyWalkerAction;
@@ -144,6 +145,8 @@ public class SMAOperationsSection extends SectionPart {
new XButtonViaAction(
new DuplicateWorkflowAction(Collections.singleton((TeamWorkFlowArtifact) editor.getAwa()))).createWidgets(
sectionBody, 2);
+ new XButtonViaAction(new ModifyActionableItemAction((TeamWorkFlowArtifact) editor.getAwa())).createWidgets(
+ sectionBody, 2);
new XButtonViaAction(new AccessControlAction(editor.getAwa())).createWidgets(sectionBody, 2);
}
if (editor.getAwa().isTask()) {
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DuplicateWorkflowBlam.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DuplicateWorkflowBlam.java
index 32e945c9b5..073f88bd4b 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DuplicateWorkflowBlam.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DuplicateWorkflowBlam.java
@@ -20,11 +20,11 @@ import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
+import org.eclipse.osee.ats.api.team.CreateTeamOption;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.core.client.action.ActionManager;
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.team.CreateTeamOption;
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.AtsUtilCore;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ModifyActionableItemsBlam.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ModifyActionableItemsBlam.java
new file mode 100644
index 0000000000..5f23ac70e2
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ModifyActionableItemsBlam.java
@@ -0,0 +1,460 @@
+/*******************************************************************************
+ * Copyright (c) 20013 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.operation;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.actions.DuplicateWorkflowAction;
+import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
+import org.eclipse.osee.ats.api.team.CreateTeamData;
+import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
+import org.eclipse.osee.ats.api.user.IAtsUser;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
+import org.eclipse.osee.ats.core.ai.ModifyActionableItems;
+import org.eclipse.osee.ats.core.client.action.ActionManager;
+import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.core.config.ActionableItems;
+import org.eclipse.osee.ats.core.config.TeamDefinitionUtility;
+import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.ats.internal.AtsClientService;
+import org.eclipse.osee.ats.util.AtsObjectLabelProvider;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.widgets.dialog.AITreeContentProvider;
+import org.eclipse.osee.ats.util.widgets.dialog.AtsObjectNameSorter;
+import org.eclipse.osee.framework.core.enums.Active;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.operation.OperationLogger;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.core.util.XResultData;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.ArrayTreeContentProvider;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+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.results.XResultDataUI;
+import org.eclipse.osee.framework.ui.skynet.util.filteredTree.OSEECheckedFilteredTree;
+import org.eclipse.osee.framework.ui.skynet.widgets.XListDropViewer;
+import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
+import org.eclipse.osee.framework.ui.skynet.widgets.XText;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ModifyActionableItemsBlam extends AbstractBlam {
+
+ private final static String TEAM_WORKFLOW = "Team Workflow (drop here)";
+ private TeamWorkFlowArtifact defaultTeamWorkflow;
+ private OSEECheckedFilteredTree wfTree;
+ private OSEECheckedFilteredTree otherTree;
+ private OSEECheckedFilteredTree newTree;
+ private XListDropViewer dropViewer;
+ private XText resultsText;
+ private Set<IAtsActionableItem> currAIsForAllWfs;
+ private List<IAtsActionableItem> currWorkflowDesiredAIs;
+ private List<IAtsActionableItem> newAIs;
+
+ public ModifyActionableItemsBlam() {
+ // do nothing
+ }
+
+ @Override
+ public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, SwtXWidgetRenderer dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
+ super.widgetCreated(xWidget, toolkit, art, dynamicXWidgetLayout, modListener, isEditable);
+ if (xWidget.getLabel().equals(TEAM_WORKFLOW)) {
+ createTreeViewers(xWidget.getControl().getParent());
+
+ dropViewer = (XListDropViewer) xWidget;
+ dropViewer.addXModifiedListener(new DropListener());
+ Control control = dropViewer.getControl();
+ GridData data = new GridData(SWT.FILL, SWT.NONE, true, false);
+ data.heightHint = 20;
+ control.setLayoutData(data);
+
+ if (xWidget.getLabel().equals(TEAM_WORKFLOW) && defaultTeamWorkflow != null) {
+ dropViewer.setInput(defaultTeamWorkflow);
+ }
+ }
+ }
+
+ private void createTreeViewers(Composite parent) {
+
+ Composite treeComp = new Composite(parent, SWT.BORDER);
+ treeComp.setLayout(new GridLayout(3, true));
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ data.heightHint = 300;
+ treeComp.setLayoutData(data);
+
+ Label wfLabel = new Label(treeComp, SWT.BOLD | SWT.CENTER);
+ wfLabel.setText("This Workflow's Actionable Items\n(select to add to this workflow)");
+
+ Label otherLabel = new Label(treeComp, SWT.BOLD | SWT.CENTER);
+ otherLabel.setText("Actionable Items in other Team Workflows\n(readonly)");
+
+ Label newLabel = new Label(treeComp, SWT.BOLD | SWT.CENTER);
+ newLabel.setText("New Workflows\n(select to create new workflows)");
+
+ wfTree = new OSEECheckedFilteredTree(treeComp, SWT.CHECK | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ wfTree.getViewer().setContentProvider(new ArrayTreeContentProvider());
+ wfTree.getViewer().setLabelProvider(new AtsObjectLabelProvider());
+ wfTree.getViewer().setSorter(new AtsObjectNameSorter());
+ wfTree.setLayoutData(data);
+ wfTree.getViewer().addSelectionChangedListener(new ModificationListener());
+
+ otherTree = new OSEECheckedFilteredTree(treeComp, SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ otherTree.getViewer().setContentProvider(new ArrayTreeContentProvider());
+ otherTree.getViewer().setLabelProvider(new AtsObjectLabelProvider());
+ otherTree.getViewer().setSorter(new AtsObjectNameSorter());
+ otherTree.setLayoutData(data);
+
+ newTree = new OSEECheckedFilteredTree(treeComp, SWT.CHECK | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ newTree.getViewer().setContentProvider(new AITreeContentProvider(Active.Active));
+ newTree.getViewer().setLabelProvider(new AtsObjectLabelProvider());
+ newTree.getViewer().setSorter(new AtsObjectNameSorter());
+ newTree.setLayoutData(data);
+ newTree.getViewer().addSelectionChangedListener(new ModificationListener());
+
+ resultsText = new XText("Results if run");
+ resultsText.setVerticalLabel(true);
+ GridData data2 = new GridData(SWT.FILL, SWT.NONE, true, false);
+ data2.heightHint = 100;
+ resultsText.setFillHorizontally(true);
+ resultsText.setFillVertically(true);
+ resultsText.createWidgets(parent, 1);
+ resultsText.getStyledText().setLayoutData(data2);
+
+ Composite buttonComp = new Composite(parent, SWT.NONE);
+ buttonComp.setLayout(new GridLayout(2, true));
+ buttonComp.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ Button executeButton = new Button(buttonComp, SWT.PUSH | SWT.LEFT);
+ executeButton.setText("Run");
+ executeButton.setImage(ImageManager.getImage(FrameworkImage.RUN_EXC));
+ executeButton.setLayoutData(new GridData(SWT.NONE, SWT.NONE, true, false));
+ executeButton.addListener(SWT.MouseUp, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ runOperation(null, null);
+ }
+
+ });
+
+ Button advancedDuplicate = new Button(buttonComp, SWT.PUSH | SWT.RIGHT);
+ advancedDuplicate.setText("Open Advanced Duplicate Workflow");
+ advancedDuplicate.setImage(ImageManager.getImage(FrameworkImage.DUPLICATE));
+ advancedDuplicate.setLayoutData(new GridData(SWT.NONE, SWT.NONE, true, false));
+ advancedDuplicate.addListener(SWT.MouseUp, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ TeamWorkFlowArtifact teamWf = getDroppedTeamWf();
+ List<TeamWorkFlowArtifact> teams = new ArrayList<TeamWorkFlowArtifact>();
+ if (teamWf != null) {
+ teams.add(teamWf);
+ }
+ new DuplicateWorkflowAction(teams).run();
+ }
+
+ });
+
+ if (defaultTeamWorkflow != null) {
+ refreshTables(defaultTeamWorkflow);
+ }
+ }
+ private class ModificationListener implements ISelectionChangedListener {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ refreshResultsArea(getDroppedTeamWf());
+ }
+ }
+
+ private class DropListener implements XModifiedListener {
+
+ @Override
+ public void widgetModified(XWidget widget) {
+ refreshTables(getDroppedTeamWf());
+ }
+
+ }
+
+ private void refreshTables(TeamWorkFlowArtifact teamWf) {
+ if (teamWf == null) {
+ clearTables();
+ } else {
+ try {
+ IAtsTeamDefinition teamDef = teamWf.getTeamDefinition();
+ Set<IAtsActionableItem> activeForTeam = new HashSet<IAtsActionableItem>();
+ activeForTeam.addAll(ActionableItems.getActiveForTeam(teamDef, Active.Active));
+ wfTree.getViewer().setInput(activeForTeam);
+ Set<IAtsActionableItem> actionableItems = teamWf.getActionableItems();
+ wfTree.setInitalChecked(Arrays.asList(actionableItems.toArray()));
+
+ Set<IAtsActionableItem> ais = new HashSet<IAtsActionableItem>();
+ for (TeamWorkFlowArtifact team : teamWf.getParentActionArtifact().getTeams()) {
+ if (!team.equals(teamWf)) {
+ ais.addAll(team.getActionableItems());
+ }
+ }
+ otherTree.getViewer().setInput(ais);
+
+ newTree.getViewer().setInput(ActionableItems.getTopLevelActionableItems(Active.Active));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ refreshResultsArea(teamWf);
+ }
+
+ private void clearTables() {
+ List<Object> emptyList = Collections.emptyList();
+ wfTree.getViewer().setInput(emptyList);
+ wfTree.clearChecked();
+ otherTree.getViewer().setInput(emptyList);
+ newTree.getViewer().setInput(emptyList);
+ newTree.clearChecked();
+ }
+
+ private void refreshResultsArea(TeamWorkFlowArtifact teamWf) {
+ XResultData results = new XResultData(false);
+ performModification(teamWf, results, true);
+ resultsText.setText(results.toString());
+ }
+
+ private TeamWorkFlowArtifact getDroppedTeamWf() {
+ TeamWorkFlowArtifact teamWf = null;
+ List<Artifact> artifacts = dropViewer.getArtifacts();
+ if (artifacts.size() == 1) {
+ teamWf = (TeamWorkFlowArtifact) artifacts.iterator().next();
+ }
+ return teamWf;
+ }
+
+ private void performModification(TeamWorkFlowArtifact teamWf, XResultData results, boolean logOnly) {
+ if (teamWf == null) {
+ AWorkbench.popup("Must drop a Team Workflow to modify");
+ return;
+ }
+ try {
+ currAIsForAllWfs = new HashSet<IAtsActionableItem>();
+ for (TeamWorkFlowArtifact team : teamWf.getParentActionArtifact().getTeams()) {
+ currAIsForAllWfs.addAll(team.getActionableItems());
+ }
+ currWorkflowDesiredAIs = org.eclipse.osee.framework.jdk.core.util.Collections.castAll(wfTree.getChecked());
+ newAIs = org.eclipse.osee.framework.jdk.core.util.Collections.castAll(newTree.getChecked());
+ IAtsUser modifiedBy = AtsClientService.get().getUserAdmin().getCurrentUser();
+
+ ModifyActionableItems job =
+ new ModifyActionableItems(results, teamWf, currAIsForAllWfs, currWorkflowDesiredAIs, newAIs, modifiedBy,
+ new TeamDefinitionUtility());
+ job.performModification();
+
+ if (!logOnly) {
+ if (results.isErrors()) {
+ AWorkbench.popup("Must resolve all errors before running");
+ return;
+ }
+ ModifyActionableItemOperation op = new ModifyActionableItemOperation(teamWf, results, job);
+ Operations.executeAsJob(op, false, Job.SHORT, new ModifyActionableItemListener(op));
+ }
+
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public class ModifyActionableItemListener extends JobChangeAdapter {
+
+ private final ModifyActionableItemOperation op;
+
+ public ModifyActionableItemListener(ModifyActionableItemOperation op) {
+ this.op = op;
+ }
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ super.done(event);
+ List<TeamWorkFlowArtifact> newTeamWfs = op.getNewTeamWfs();
+ if (!newTeamWfs.isEmpty()) {
+ AtsUtil.openInAtsWorldEditor("New Team Workflows", newTeamWfs);
+ }
+ }
+ }
+
+ public class ModifyActionableItemOperation extends AbstractOperation {
+
+ private final ModifyActionableItems job;
+ List<TeamWorkFlowArtifact> newTeamWfs = new ArrayList<TeamWorkFlowArtifact>();
+ private final TeamWorkFlowArtifact teamWf;
+ private final XResultData results;
+
+ public ModifyActionableItemOperation(TeamWorkFlowArtifact teamWf, XResultData results, ModifyActionableItems job) {
+ super("Create Team Workflow(s)", Activator.PLUGIN_ID);
+ this.teamWf = teamWf;
+ this.results = results;
+ this.job = job;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtil.getAtsBranchToken(), getName());
+ Date createdDate = new Date();
+ for (CreateTeamData data : job.getTeamDatas()) {
+ TeamWorkFlowArtifact teamArt =
+ ActionManager.createTeamWorkflow(teamWf.getParentActionArtifact(), data.getTeamDef(),
+ data.getActionableItems(), new LinkedList<IAtsUser>(data.getAssignees()), transaction, createdDate,
+ data.getCreatedBy(), null, data.getCreateTeamOption());
+ teamArt.persist(transaction);
+ newTeamWfs.add(teamArt);
+ }
+
+ for (IAtsActionableItem checkedAi : job.getAddAis()) {
+ results.logWithFormat("Actionable Item [%s] will be added to this workflow\n", checkedAi);
+ teamWf.getActionableItemsDam().addActionableItem(checkedAi);
+ teamWf.persist(transaction);
+ }
+ for (IAtsActionableItem currAi : job.getRemoveAis()) {
+ results.logWithFormat("Actionable Item [%s] will be removed from this workflow\n", currAi);
+ teamWf.getActionableItemsDam().removeActionableItem(currAi);
+ teamWf.persist(transaction);
+ }
+ transaction.execute();
+ }
+
+ public List<TeamWorkFlowArtifact> getNewTeamWfs() {
+ return newTeamWfs;
+ }
+ }
+
+ @Override
+ public void runOperation(final VariableMap variableMap, IProgressMonitor monitor) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ List<Artifact> artifacts = dropViewer.getArtifacts();
+ if (artifacts.isEmpty()) {
+ AWorkbench.popup("ERROR", "Must drag in a Team Workflow to duplicate.");
+ return;
+ } else if (artifacts.size() != 1 || !(artifacts.iterator().next() instanceof IAtsTeamWorkflow)) {
+ AWorkbench.popup("ERROR", "Only one Team Workflow can be processed at a time");
+ }
+ XResultData data = new XResultData(false);
+ TeamWorkFlowArtifact teamWf = (TeamWorkFlowArtifact) artifacts.iterator().next();
+ performModification(teamWf, data, false);
+ if (data.isErrors()) {
+ XResultDataUI.report(data, getName());
+ }
+ clearTables();
+ refreshTables(teamWf);
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ };
+ });
+ }
+
+ @Override
+ public boolean showExecuteSection() {
+ return false;
+ }
+
+ @Override
+ public String getXWidgetsXml() {
+ return "<xWidgets>"
+ //
+ + "<XWidget xwidgetType=\"XListDropViewer\" displayName=\"" + TEAM_WORKFLOW + "\" />" +
+ //
+ "</xWidgets>";
+ }
+
+ @Override
+ public String getDescriptionUsage() {
+ return "Add, remove or modify actionable items impacted in this Action.";
+ }
+
+ public void setDefaultTeamWorkflow(TeamWorkFlowArtifact team) {
+ this.defaultTeamWorkflow = team;
+ }
+
+ @Override
+ public String getName() {
+ return "Modify Actionable Items";
+ }
+
+ @Override
+ public Collection<String> getCategories() {
+ return Arrays.asList("ATS");
+ }
+
+ @Override
+ public void execute(OperationLogger logger, VariableMap variableMap, IJobChangeListener jobChangeListener) {
+ runOperation(null, null);
+ }
+
+ @Override
+ public String getTabTitle() {
+ return getName();
+ }
+
+ @Override
+ public String getTitle() {
+ return getName();
+ }
+
+ @Override
+ public Image getImage() {
+ return ImageManager.getImage(AtsImage.ACTIONABLE_ITEM);
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(AtsImage.ACTIONABLE_ITEM);
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java
index 2968bfaeab..bea9b0cf4e 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java
@@ -21,11 +21,10 @@ import java.util.logging.Level;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.osee.ats.AtsOpenOption;
+import org.eclipse.osee.ats.actions.ModifyActionableItemAction;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.artifact.EditActionableItems;
import org.eclipse.osee.ats.artifact.TeamWorkflowLabelProvider;
-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.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
@@ -44,7 +43,6 @@ import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -165,24 +163,8 @@ public final class AtsUtil {
return toolBar;
}
- public static void editActionableItems(ActionArtifact actionArt) throws OseeCoreException {
- Result result = EditActionableItems.editActionableItems(actionArt);
- if (result.isFalse() && result.getText().equals("")) {
- return;
- }
- if (result.isFalse()) {
- AWorkbench.popup(result);
- }
- }
-
- public static void editActionableItems(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
- Result result = EditActionableItems.editActionableItems(teamArt);
- if (result.isFalse() && result.getText().equals("")) {
- return;
- }
- if (result.isFalse() && !result.getText().equals("")) {
- AWorkbench.popup(result);
- }
+ public static void editActionableItems(TeamWorkFlowArtifact teamArt) {
+ new ModifyActionableItemAction(teamArt).run();
}
public static void openArtifact(String guidOrHrid, Integer branchId, OseeCmEditor view) {
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 a99c756299..fbd23140ca 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.team.CreateTeamOption;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.version.IAtsVersion;
@@ -38,7 +39,6 @@ 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.notify.AtsNotifyType;
-import org.eclipse.osee.ats.core.client.team.CreateTeamOption;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.util.AtsUtilCore;
import org.eclipse.osee.ats.core.client.workflow.ChangeType;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
index c29c306c80..c0818bb37a 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
@@ -192,11 +192,7 @@ public class WorldXViewer extends XViewer implements ISelectedAtsArtifacts, IPer
@Override
public void run() {
try {
- if (getSelectedActionArtifacts().size() == 1) {
- ActionArtifact actionArt = getSelectedActionArtifacts().iterator().next();
- AtsUtil.editActionableItems(actionArt);
- refresh(getSelectedArtifactItems().iterator().next());
- } else {
+ if (getSelectedTeamWorkflowArtifacts().size() == 1) {
TeamWorkFlowArtifact teamArt = getSelectedTeamWorkflowArtifacts().iterator().next();
AtsUtil.editActionableItems(teamArt);
refresh(getSelectedArtifactItems().toArray()[0]);
@@ -381,7 +377,7 @@ public class WorldXViewer extends XViewer implements ISelectedAtsArtifacts, IPer
editAssigneeAction.setEnabled(getSelectedSMAArtifacts().size() > 0);
mm.insertBefore(MENU_GROUP_PRE, editActionableItemsAction);
- editActionableItemsAction.setEnabled(getSelectedActionArtifacts().size() == 1 || getSelectedTeamWorkflowArtifacts().size() == 1);
+ editActionableItemsAction.setEnabled(getSelectedTeamWorkflowArtifacts().size() == 1);
mm.insertBefore(MENU_GROUP_PRE, convertActionableItemsAction);
convertActionableItemsAction.updateEnablement();
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Collections.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Collections.java
index 2794cc16a8..b86d3820a2 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Collections.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Collections.java
@@ -349,4 +349,13 @@ public class Collections {
}
}
}
+
+ public static <T> Set<T> hashSet(T... items) {
+ Set<T> result = new HashSet<T>();
+ for (T item : items) {
+ result.add(item);
+ }
+ return result;
+ }
+
} \ No newline at end of file

Back to the top