Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2014-01-06 23:14:59 +0000
committerRoberto E. Escobar2014-01-08 18:31:16 +0000
commit8a5c2c92a352d97b774dbb19cd2ddd0d0f89fa02 (patch)
tree9cdc33c9cb6b88903d6ba70bcc3a1c3d68baa021 /plugins
parent3ea8e3d9d3a8ad0c92d17a51fe900c059f51f236 (diff)
downloadorg.eclipse.osee-8a5c2c92a352d97b774dbb19cd2ddd0d0f89fa02.tar.gz
org.eclipse.osee-8a5c2c92a352d97b774dbb19cd2ddd0d0f89fa02.tar.xz
org.eclipse.osee-8a5c2c92a352d97b774dbb19cd2ddd0d0f89fa02.zip
bug[ats_ATS8669]: Unable to add child related AIs to current workflow
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ActionableItems.java33
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ModifyActionableItemsBlam.java22
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/WorkflowsActiveAisContentProvider.java106
3 files changed, 120 insertions, 41 deletions
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 2930136380..7129d6d5ba 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
@@ -158,37 +158,4 @@ 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/src/org/eclipse/osee/ats/operation/ModifyActionableItemsBlam.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ModifyActionableItemsBlam.java
index bc447f562a..4ee657aeb6 100644
--- 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
@@ -31,7 +31,6 @@ 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;
@@ -138,7 +137,7 @@ public class ModifyActionableItemsBlam extends AbstractBlam {
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().setContentProvider(new WorkflowsActiveAisContentProvider(defaultTeamWorkflow, Active.Active));
wfTree.getViewer().setLabelProvider(new AtsObjectLabelProvider());
wfTree.getViewer().setSorter(new AtsObjectNameSorter());
wfTree.setLayoutData(data);
@@ -227,10 +226,7 @@ public class ModifyActionableItemsBlam extends AbstractBlam {
clearTables();
} else {
try {
- IAtsTeamDefinition teamDef = teamWf.getTeamDefinition();
- Set<IAtsActionableItem> activeForTeam = new HashSet<IAtsActionableItem>();
- activeForTeam.addAll(ActionableItems.getActiveForTeam(teamDef, Active.Active));
- wfTree.getViewer().setInput(activeForTeam);
+ wfTree.getViewer().setInput(teamWf);
Set<IAtsActionableItem> actionableItems = teamWf.getActionableItems();
wfTree.setInitalChecked(Arrays.asList(actionableItems.toArray()));
@@ -319,6 +315,7 @@ public class ModifyActionableItemsBlam extends AbstractBlam {
public void done(IJobChangeEvent event) {
super.done(event);
List<TeamWorkFlowArtifact> newTeamWfs = op.getNewTeamWfs();
+ refreshTables(op.getTeamWf());
if (!newTeamWfs.isEmpty()) {
AtsUtil.openInAtsWorldEditor("New Team Workflows", newTeamWfs);
}
@@ -330,10 +327,15 @@ public class ModifyActionableItemsBlam extends AbstractBlam {
private final ModifyActionableItems job;
List<TeamWorkFlowArtifact> newTeamWfs = new ArrayList<TeamWorkFlowArtifact>();
private final TeamWorkFlowArtifact teamWf;
+
+ public TeamWorkFlowArtifact getTeamWf() {
+ return teamWf;
+ }
+
private final XResultData results;
public ModifyActionableItemOperation(TeamWorkFlowArtifact teamWf, XResultData results, ModifyActionableItems job) {
- super("Create Team Workflow(s)", Activator.PLUGIN_ID);
+ super("Modify Actionable Items", Activator.PLUGIN_ID);
this.teamWf = teamWf;
this.results = results;
this.job = job;
@@ -354,12 +356,16 @@ public class ModifyActionableItemsBlam extends AbstractBlam {
for (IAtsActionableItem checkedAi : job.getAddAis()) {
results.logWithFormat("Actionable Item [%s] will be added to this workflow\n", checkedAi);
teamWf.getActionableItemsDam().addActionableItem(checkedAi);
+ changes.add(teamWf);
}
for (IAtsActionableItem currAi : job.getRemoveAis()) {
results.logWithFormat("Actionable Item [%s] will be removed from this workflow\n", currAi);
teamWf.getActionableItemsDam().removeActionableItem(currAi);
+ changes.add(teamWf);
+ }
+ if (!changes.isEmpty()) {
+ changes.execute();
}
- changes.execute();
}
public List<TeamWorkFlowArtifact> getNewTeamWfs() {
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/WorkflowsActiveAisContentProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/WorkflowsActiveAisContentProvider.java
new file mode 100644
index 0000000000..06a1487d36
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/WorkflowsActiveAisContentProvider.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * 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.operation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
+import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
+import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+import org.eclipse.osee.framework.core.enums.Active;
+
+/**
+ * Provide AIs from given Team WF's team definition and all children matching active parameter.
+ *
+ * @author Donald G. Dunne
+ */
+public class WorkflowsActiveAisContentProvider implements ITreeContentProvider {
+
+ private final Active active;
+ private final TeamWorkFlowArtifact teamWf;
+
+ public WorkflowsActiveAisContentProvider(TeamWorkFlowArtifact teamWf, Active active) {
+ this.teamWf = teamWf;
+ this.active = active;
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ Collection<IAtsActionableItem> ais = new ArrayList<IAtsActionableItem>();
+ if (inputElement instanceof TeamWorkFlowArtifact) {
+ TeamWorkFlowArtifact teamWf = (TeamWorkFlowArtifact) inputElement;
+ ais.addAll(teamWf.getTeamDefinition().getActionableItems());
+ }
+ return ais.toArray(new Object[ais.size()]);
+ }
+
+ @Override
+ public Object[] getChildren(Object inputElement) {
+ Collection<IAtsActionableItem> ais = new ArrayList<IAtsActionableItem>();
+ if (inputElement instanceof IAtsActionableItem) {
+ IAtsActionableItem ai = (IAtsActionableItem) inputElement;
+ for (IAtsActionableItem childAi : ai.getChildrenActionableItems()) {
+ ais.addAll(getActiveChildrenForTeamAndAi(teamWf.getTeamDefinition(), active, childAi));
+ }
+ }
+ return ais.toArray(new Object[ais.size()]);
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ Object parent = null;
+ if (element instanceof IAtsActionableItem) {
+ IAtsActionableItem ai = (IAtsActionableItem) element;
+ parent = ai.getParentActionableItem();
+ }
+ return parent;
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ /**
+ * Add ai to results if owned by teamDef an matches active status
+ */
+ private static List<IAtsActionableItem> getActiveChildrenForTeamAndAi(IAtsTeamDefinition teamDef, Active active, IAtsActionableItem ai) {
+ List<IAtsActionableItem> results = new ArrayList<IAtsActionableItem>();
+ 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);
+ }
+ }
+ }
+ return results;
+ }
+
+ @Override
+ public void dispose() {
+ // do nothing
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // do nothing
+ }
+
+}

Back to the top