summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2011-04-19 18:30:40 (EDT)
committerRyan D. Brooks2011-04-19 18:30:40 (EDT)
commit9c780480f0021cfeb7d188287da0cb04075a8ef6 (patch)
treee91cfcb5d704ef578fdd45672b32a8e288963000
parent026a9005c44a18f7b3eb68199b5bc7a517eeae03 (diff)
downloadorg.eclipse.osee-9c780480f0021cfeb7d188287da0cb04075a8ef6.zip
org.eclipse.osee-9c780480f0021cfeb7d188287da0cb04075a8ef6.tar.gz
org.eclipse.osee-9c780480f0021cfeb7d188287da0cb04075a8ef6.tar.bz2
bug[ats_5FG1W]: Task Metrics blam fix
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/TaskMetrics.java123
-rw-r--r--plugins/org.eclipse.osee.ats/ui/TaskMetricsUi.xml7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOverviewPage.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XArtifactMultiChoiceSelect.java38
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/FrameworkXWidgetProvider.java4
6 files changed, 158 insertions, 21 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/TaskMetrics.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/TaskMetrics.java
index 0f8d9a0..ef6429d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/TaskMetrics.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/TaskMetrics.java
@@ -13,50 +13,62 @@ package org.eclipse.osee.ats.operation;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.logging.Level;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.ats.artifact.AtsAttributeTypes;
import org.eclipse.osee.ats.artifact.TaskArtifact;
import org.eclipse.osee.ats.artifact.TaskStates;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
import org.eclipse.osee.ats.internal.workflow.SMAState;
import org.eclipse.osee.ats.internal.workflow.XCurrentStateDam;
import org.eclipse.osee.ats.internal.workflow.XStateDam;
import org.eclipse.osee.ats.util.AtsArtifactTypes;
import org.eclipse.osee.ats.util.AtsRelationTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.ats.util.widgets.XHyperlabelTeamDefinitionSelection;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.jdk.core.type.CountingMap;
import org.eclipse.osee.framework.jdk.core.type.MutableInteger;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.io.CharBackedInputStream;
import org.eclipse.osee.framework.jdk.core.util.io.xml.ExcelXmlWriter;
import org.eclipse.osee.framework.jdk.core.util.io.xml.ISheetWriter;
+import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.plugin.core.util.AIFile;
import org.eclipse.osee.framework.plugin.core.util.OseeData;
import org.eclipse.osee.framework.skynet.core.User;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.eclipse.osee.framework.skynet.core.relation.RelationManager;
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.widgets.XArtifactMultiChoiceSelect;
+import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayout;
import org.eclipse.swt.program.Program;
+import org.eclipse.ui.forms.widgets.FormToolkit;
/**
* @author Ryan D. Brooks
*/
public class TaskMetrics extends AbstractBlam {
private final CountingMap<User> metrics;
- private final CharBackedInputStream charBak;
- private final ISheetWriter excelWriter;
+ private CharBackedInputStream charBak;
+ private ISheetWriter excelWriter;
- public TaskMetrics() throws IOException {
+ private XHyperlabelTeamDefinitionSelection teamCombo;
+ private XArtifactMultiChoiceSelect versionsWidget;
+
+ public TaskMetrics() {
metrics = new CountingMap<User>();
- charBak = new CharBackedInputStream();
- excelWriter = new ExcelXmlWriter(charBak.getWriter());
}
@Override
@@ -65,25 +77,51 @@ public class TaskMetrics extends AbstractBlam {
}
@Override
+ public String getDescriptionUsage() {
+ return "Generates task metrics specific to LBA artifacts.";
+ }
+
+ @Override
public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws OseeCoreException {
try {
- monitor.beginTask("TaskMetrics", 5);
+ monitor.beginTask("TaskMetrics", 100);
metrics.clear();
+ charBak = new CharBackedInputStream();
+ excelWriter = new ExcelXmlWriter(charBak.getWriter());
+
+ //IArtifactType artifctType = variableMap.getArtifactType("Artifact Type");
+
+ List<Artifact> versionArtifacts = versionsWidget.getSelected();
+
+ if (!versionArtifacts.isEmpty()) {
+ Set<Artifact> teamWorkflows =
+ RelationManager.getRelatedArtifacts(versionArtifacts, 1,
+ AtsRelationTypes.TeamWorkflowTargetedForVersion_Workflow);
+
+ int counter = 0;
+ for (Artifact art : teamWorkflows) {
+ monitor.worked(1 / teamWorkflows.size());
+ counter++;
+ if (art.isOfType(AtsArtifactTypes.TeamWorkflow)) {
+
+ TeamWorkFlowArtifact workflow = (TeamWorkFlowArtifact) art;
- IArtifactType artifctType = variableMap.getArtifactType("Artifact Type");
+ if (teamCombo.getSelectedTeamDefintions().contains(workflow.getTeamDefinition())) {
+ for (Artifact task : workflow.getTaskArtifacts()) {
+ tallyState((TaskArtifact) task);
+ }
+ }
- List<Artifact> artifacts = ArtifactQuery.getArtifactListFromType(artifctType, AtsUtil.getAtsBranch());
- Set<Artifact> tasks = RelationManager.getRelatedArtifacts(artifacts, 1, AtsRelationTypes.SmaToTask_Task);
- for (Artifact artifact : tasks) {
- if (artifact.isOfType(AtsArtifactTypes.Task)) {
- tallyState((TaskArtifact) artifact);
+ }
}
}
writeSummary();
excelWriter.endWorkbook();
- IFile iFile = OseeData.getIFile("Task_Metrics.xml");
+
+ IFile iFile = OseeData.getIFile("Task_Metrics_" + Lib.getDateTimeString() + ".xml");
+
AIFile.writeToFile(iFile, charBak);
Program.launch(iFile.getLocation().toOSString());
} catch (Exception ex) {
@@ -104,6 +142,7 @@ public class TaskMetrics extends AbstractBlam {
int percentComplete = state.getPercentComplete();
if (percentComplete == 100) {
+ task.getCompletedDate();
String resolution = task.getSoleAttributeValue(AtsAttributeTypes.Resolution, "");
if (resolution.equals("Complete")) {
@@ -129,12 +168,58 @@ public class TaskMetrics extends AbstractBlam {
}
@Override
- public String getXWidgetsXml() {
- return "<xWidgets><XWidget xwidgetType=\"XArtifactTypeComboViewer\" displayName=\"Artifact Type\" keyedBranch=\"Common\"/></xWidgets>";
+ public void widgetCreating(XWidget xWidget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) {
+ String widgetLabel = xWidget.getLabel();
+
+ if (widgetLabel.equals("Version(s)")) {
+ versionsWidget = (XArtifactMultiChoiceSelect) xWidget;
+ }
+ }
+
+ @Override
+ public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) {
+ if (xWidget instanceof XHyperlabelTeamDefinitionSelection) {
+ teamCombo = (XHyperlabelTeamDefinitionSelection) xWidget;
+ teamCombo.addXModifiedListener(new TeamSelectedListener());
+ }
+ }
+
+ @Override
+ public String getXWidgetsXml() throws OseeCoreException {
+ return getXWidgetsXmlFromUiFile(getClass().getSimpleName(), AtsPlugin.PLUGIN_ID);
}
@Override
public Collection<String> getCategories() {
return Arrays.asList("ATS.Report");
}
-} \ No newline at end of file
+
+ private class TeamSelectedListener implements XModifiedListener {
+ @Override
+ public void widgetModified(XWidget widget) {
+
+ Collection<Artifact> versions = new HashSet<Artifact>();
+
+ versionsWidget.setSelectableItems(Collections.<Artifact> emptyList());
+
+ for (TeamDefinitionArtifact teamDef : teamCombo.getSelectedTeamDefintions()) {
+ TeamDefinitionArtifact teamDefinitionHoldingVersions;
+ try {
+
+ teamDefinitionHoldingVersions = teamDef.getTeamDefinitionHoldingVersions();
+
+ if (teamDefinitionHoldingVersions != null) {
+ versions.addAll(teamDefinitionHoldingVersions.getVersionsArtifacts());
+ }
+
+ } catch (OseeCoreException ex) {
+ OseeLog.log(TaskMetrics.class, Level.SEVERE, ex.toString());
+ }
+ }
+
+ if (!versions.isEmpty()) {
+ versionsWidget.setSelectableItems(versions);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/ui/TaskMetricsUi.xml b/plugins/org.eclipse.osee.ats/ui/TaskMetricsUi.xml
new file mode 100644
index 0000000..f1cef9a
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/ui/TaskMetricsUi.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xWidgets>
+ <XWidget xwidgetType="XHyperlabelTeamDefinitionSelection"
+ displayName="Team Definition(s)" horizontalLabel="true" />
+ <XWidget xwidgetType="XArtifactMultiChoiceSelect"
+ horizontalLabel="true" displayName="Version(s)" />
+</xWidgets> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java
index 8580a0b..c16d2ba 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java
@@ -87,11 +87,14 @@ public abstract class AbstractBlam implements IDynamicWidgetLayoutListener {
Bundle bundle = Platform.getBundle(nameOfBundle);
String contents = null;
+ InputStream inStream = null;
try {
- InputStream inStream = bundle.getEntry(file).openStream();
+ inStream = bundle.getEntry(file).openStream();
contents = Lib.inputStreamToString(inStream);
} catch (IOException ex) {
OseeExceptions.wrapAndThrow(ex);
+ } finally {
+ Lib.close(inStream);
}
return contents;
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOverviewPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOverviewPage.java
index b492164..0b6719a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOverviewPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOverviewPage.java
@@ -130,4 +130,4 @@ public class BlamOverviewPage extends FormPage {
public VariableMap getInput() {
return inputSection.getData();
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XArtifactMultiChoiceSelect.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XArtifactMultiChoiceSelect.java
new file mode 100644
index 0000000..c618695
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XArtifactMultiChoiceSelect.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.Collections;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.util.ArrayTreeContentProvider;
+import org.eclipse.osee.framework.ui.skynet.util.ArtifactNameSorter;
+import org.eclipse.osee.framework.ui.skynet.util.filteredTree.MinMaxOSEECheckedFilteredTreeDialog;
+import org.eclipse.osee.framework.ui.skynet.util.filteredTree.SimpleCheckFilteredTreeDialog;
+
+public class XArtifactMultiChoiceSelect extends XSelectFromDialog<Artifact> {
+
+ public static final String WIDGET_ID = XArtifactMultiChoiceSelect.class.getSimpleName();
+
+ public XArtifactMultiChoiceSelect() {
+ super("Select Artifact (s)");
+ setSelectableItems(Collections.<Artifact> emptyList());
+ }
+
+ @Override
+ public MinMaxOSEECheckedFilteredTreeDialog createDialog() {
+ SimpleCheckFilteredTreeDialog dialog =
+ new SimpleCheckFilteredTreeDialog(getLabel(), "Select from the items below", new ArrayTreeContentProvider(),
+ new LabelProvider(), new ArtifactNameSorter(), 1, 1000);
+ return dialog;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/FrameworkXWidgetProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/FrameworkXWidgetProvider.java
index c1775db..b02a518 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/FrameworkXWidgetProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/FrameworkXWidgetProvider.java
@@ -34,6 +34,7 @@ import org.eclipse.osee.framework.ui.skynet.widgets.IArtifactWidget;
import org.eclipse.osee.framework.ui.skynet.widgets.IAttributeWidget;
import org.eclipse.osee.framework.ui.skynet.widgets.SkynetSpellModifyDictionary;
import org.eclipse.osee.framework.ui.skynet.widgets.XArtifactList;
+import org.eclipse.osee.framework.ui.skynet.widgets.XArtifactMultiChoiceSelect;
import org.eclipse.osee.framework.ui.skynet.widgets.XArtifactTypeComboViewer;
import org.eclipse.osee.framework.ui.skynet.widgets.XArtifactTypeMultiChoiceSelect;
import org.eclipse.osee.framework.ui.skynet.widgets.XAttributeTypeComboViewer;
@@ -328,6 +329,9 @@ public final class FrameworkXWidgetProvider {
} else if (xWidgetName.equals(XArtifactTypeMultiChoiceSelect.WIDGET_ID)) {
XArtifactTypeMultiChoiceSelect widget = new XArtifactTypeMultiChoiceSelect();
xWidget = widget;
+ } else if (xWidgetName.equals(XArtifactMultiChoiceSelect.WIDGET_ID)) {
+ xWidget = new XArtifactMultiChoiceSelect();
+
} else if (xWidgetName.equals(XTextFlatDam.WIDGET_ID)) {
XTextFlatDam widget = new XTextFlatDam();
xWidget = widget;