Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumy Joseph2012-10-10 23:52:25 +0000
committerRoberto E. Escobar2012-10-10 23:52:25 +0000
commite05e3b81efa3680451d9ff76abd090c328f287e1 (patch)
treebd5ae21d6f1d18341603761d08fb544690a99611 /plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse
parentdeeca56703b9059e6223bc94267ada8ba8c5b2f8 (diff)
downloadorg.eclipse.osee-e05e3b81efa3680451d9ff76abd090c328f287e1.tar.gz
org.eclipse.osee-e05e3b81efa3680451d9ff76abd090c328f287e1.tar.xz
org.eclipse.osee-e05e3b81efa3680451d9ff76abd090c328f287e1.zip
feature[bgz_391218]: Add project management team efficieny report
Diffstat (limited to 'plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse')
-rw-r--r--plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/Activator.java58
-rw-r--r--plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/TeamEfficiencyModel.java32
-rw-r--r--plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/VersionEfficiency.java96
-rw-r--r--plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/EfficiencyItem.java98
-rw-r--r--plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyLineTab.java88
-rw-r--r--plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyTab.java88
6 files changed, 460 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/Activator.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/Activator.java
new file mode 100644
index 00000000000..14d11fcc0c9
--- /dev/null
+++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/Activator.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2012 Robert Bosch Engineering and Business Solutions Ltd India. 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
+ */
+package org.eclipse.osee.reports.efficiency;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /**
+ * The plug-in ID
+ */
+ public static final String PLUGIN_ID = "org.eclipse.osee.reports.efficiency"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/TeamEfficiencyModel.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/TeamEfficiencyModel.java
new file mode 100644
index 00000000000..3741e97641f
--- /dev/null
+++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/TeamEfficiencyModel.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2012 Robert Bosch Engineering and Business Solutions Ltd India. 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
+ */
+package org.eclipse.osee.reports.efficiency.team;
+
+import java.util.List;
+
+/**
+ * Model Class to store the version efficiency list
+ *
+ * @author Praveen Joseph
+ */
+public class TeamEfficiencyModel {
+
+ private static List<VersionEfficiency> versionEfficiency;
+
+ /**
+ * @param versionEfficiency sets the version efficiency list
+ */
+ public static void setVersionEfficiency(final List<VersionEfficiency> versionEfficiency) {
+ TeamEfficiencyModel.versionEfficiency = versionEfficiency;
+ }
+
+ /**
+ * @return the version efficiency list
+ */
+ public static List<VersionEfficiency> getVersionEfficiency() {
+ return versionEfficiency;
+ }
+}
diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/VersionEfficiency.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/VersionEfficiency.java
new file mode 100644
index 00000000000..ab5744125a1
--- /dev/null
+++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/VersionEfficiency.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2012 Robert Bosch Engineering and Business Solutions Ltd India. 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
+ */
+package org.eclipse.osee.reports.efficiency.team;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.ats.api.version.IAtsVersion;
+import org.eclipse.osee.ats.core.client.config.VersionsClient;
+import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.core.client.workflow.HoursSpentUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.reports.efficiency.Activator;
+
+
+/**
+ * Class to collect the list of artifacts and compute work done
+ *
+ * @author Praveen Joseph
+ */
+public class VersionEfficiency {
+
+ private final IAtsVersion version;
+ private final Map<String, Double> efficiency;
+ /**
+ * Constructor to set the version
+ *
+ * @param version :
+ */
+ public VersionEfficiency(final IAtsVersion version) {
+ this.version = version;
+ this.efficiency = new HashMap<String, Double>();
+ }
+
+ /**
+ * Method to collect the list of artifacts and compute work done
+ *
+ * @throws OseeCoreException :
+ */
+ public void compute() throws OseeCoreException {
+ final Map<String, List<TeamWorkFlowArtifact>> teams = new HashMap<String, List<TeamWorkFlowArtifact>>();
+
+ // 1. For each team, collect the list of artifacts.
+ for (TeamWorkFlowArtifact teamWorkflow : VersionsClient.getTargetedForTeamWorkflows(this.version)) {
+ if (teams.containsKey(teamWorkflow.getTeamName())) {
+ teams.get(teamWorkflow.getTeamName()).add(teamWorkflow);
+ }
+ else {
+ List<TeamWorkFlowArtifact> team = new ArrayList<TeamWorkFlowArtifact>();
+ team.add(teamWorkflow);
+ teams.put(teamWorkflow.getTeamName(), team);
+ }
+ }
+ // 2. compute work done
+ Iterator<String> teamNames = teams.keySet().iterator();
+ while (teamNames.hasNext()) {
+ String teamName = teamNames.next();
+ double estimated = 0;
+ double actual = 0;
+ for (TeamWorkFlowArtifact twa : teams.get(teamName)) {
+ estimated += twa.getEstimatedHoursTotal();
+ actual += HoursSpentUtil.getHoursSpentTotal(twa);
+ }
+ if (actual != 0) {
+ this.efficiency.put(teamName, estimated / actual);
+ }
+ else {
+ Activator.getDefault().getLog()
+ .log(new Status(IStatus.INFO, Activator.PLUGIN_ID, "Actual hours spent by team : " + teamName + " was 0"));
+ }
+ }
+
+ }
+
+ /**
+ * @return the map
+ */
+ public Map<String, Double> getEfficiency() {
+ return this.efficiency;
+ }
+
+ /**
+ * @return the version artifact
+ */
+ public IAtsVersion getVersion() {
+ return this.version;
+ }
+}
diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/EfficiencyItem.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/EfficiencyItem.java
new file mode 100644
index 00000000000..574ec062b09
--- /dev/null
+++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/EfficiencyItem.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2012 Robert Bosch Engineering and Business Solutions Ltd India. 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
+ */
+package org.eclipse.osee.reports.efficiency.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
+import org.eclipse.osee.ats.core.config.TeamDefinitions;
+import org.eclipse.osee.ats.api.version.IAtsVersion;
+import org.eclipse.osee.ats.util.widgets.dialog.TeamDefinitionDialog;
+import org.eclipse.osee.framework.core.enums.Active;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItemAction;
+import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorProvider;
+import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
+import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
+import org.eclipse.osee.reports.efficiency.team.TeamEfficiencyModel;
+import org.eclipse.osee.reports.efficiency.team.VersionEfficiency;
+
+
+/**
+ * Class to take inputs from user and populate TeamEfficiencyModel
+ *
+ * @author Praveen Joseph
+ */
+public class EfficiencyItem extends XNavigateItemAction {
+
+ /**
+ * Constructor that calls its parent constructor
+ *
+ * @param parent :
+ */
+ public EfficiencyItem(final XNavigateItem parent) {
+ super(parent, "Efficiency Report", AtsImage.REPORT);
+ }
+
+ @Override
+ public void run(final TableLoadOption... tableLoadOptions) throws Exception {
+ // Get input from the user.
+ TeamDefinitionDialog dlg = new TeamDefinitionDialog("Team Efficiency Report", "Please Select the Team Definition");
+ dlg.setInput(TeamDefinitions.getTeamReleaseableDefinitions(Active.Both));
+ int open = dlg.open();
+ if (open == 0) {
+ populateModel(dlg);
+ ResultsEditor.open(new IResultsEditorProvider() {
+
+ @Override
+ public String getEditorName() {
+ return "Efficiency Report";
+ }
+
+ @Override
+ public List<IResultsEditorTab> getResultsEditorTabs() {
+ List<IResultsEditorTab> tabs = new ArrayList<IResultsEditorTab>();
+ tabs.add(new TeamEfficiencyTab());
+ tabs.add(new TeamEfficiencyLineTab());
+ return tabs;
+ }
+
+ });
+ }
+ }
+
+ private boolean populateModel(final TeamDefinitionDialog dlg) {
+ try {
+ Object[] result = dlg.getResult();
+ if ((result == null) || (result.length == 0)) {
+ return false;
+ }
+ Object res = result[0];
+ if (res instanceof IAtsTeamDefinition) {
+ IAtsTeamDefinition teamDef = (IAtsTeamDefinition) res;
+ List<VersionEfficiency> verEffs = new ArrayList<VersionEfficiency>();
+ for (IAtsVersion version : teamDef.getVersions()) {
+ VersionEfficiency eff = new VersionEfficiency(version);
+ eff.compute();
+ verEffs.add(eff);
+ }
+ TeamEfficiencyModel.setVersionEfficiency(verEffs);
+ }
+ }
+ catch (OseeCoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyLineTab.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyLineTab.java
new file mode 100644
index 00000000000..0a3ac634689
--- /dev/null
+++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyLineTab.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012 Robert Bosch Engineering and Business Solutions Ltd India. 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
+ */
+package org.eclipse.osee.reports.efficiency.ui;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.birt.report.viewer.utilities.WebViewer;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
+import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
+import org.eclipse.osee.reports.efficiency.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.widgets.Composite;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * Class to create the tab in the ui
+ *
+ * @author Praveen Joseph
+ */
+public class TeamEfficiencyLineTab implements IResultsEditorTab {
+
+ private Browser browser;
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public Composite createTab(final Composite parent, final ResultsEditor resultsEditor) throws OseeCoreException {
+
+ String path = getReportPath();
+ this.browser = new Browser(parent, SWT.NONE);
+ WebViewer.display(path, WebViewer.HTML, this.browser, "frameset");
+ this.browser.refresh();
+ return this.browser;
+ }
+
+ /**
+ * Method to return the report path
+ *
+ * @return the report path
+ */
+ public String getReportPath() {
+ String path = null;
+ try {
+ Bundle bundle = Platform.getBundle(getPluginID());
+ URL url = FileLocator.find(bundle, new Path("reports/" + getReport()), null);
+ path = FileLocator.toFileURL(url).getPath();
+ }
+ catch (MalformedURLException me) {
+ System.out.println("Fehler bei URL " + me.getStackTrace());
+ return null;
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ return path;
+ }
+
+ /**
+ * @return the plugin ID
+ */
+ public String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+ /**
+ * @return the name of the report
+ */
+ public String getReport() {
+ return "TeamEfficiencyLine.rptdesign";
+ }
+
+ @Override
+ public String getTabName() {
+ return "Team Efficiency Trend";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyTab.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyTab.java
new file mode 100644
index 00000000000..f28c88f6c9a
--- /dev/null
+++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyTab.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012 Robert Bosch Engineering and Business Solutions Ltd India. 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
+ */
+package org.eclipse.osee.reports.efficiency.ui;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.birt.report.viewer.utilities.WebViewer;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
+import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
+import org.eclipse.osee.reports.efficiency.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.widgets.Composite;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * Class to create the tab in UI
+ *
+ * @author Praveen Joseph
+ */
+public class TeamEfficiencyTab implements IResultsEditorTab {
+
+ private Browser browser;
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public Composite createTab(final Composite parent, final ResultsEditor resultsEditor) throws OseeCoreException {
+
+ String path = getReportPath();
+ this.browser = new Browser(parent, SWT.NONE);
+ WebViewer.display(path, WebViewer.HTML, this.browser, "frameset");
+ this.browser.refresh();
+ return this.browser;
+ }
+
+ /**
+ * Method to return the report path
+ *
+ * @return the report path
+ */
+ public String getReportPath() {
+ String path = null;
+ try {
+ Bundle bundle = Platform.getBundle(getPluginID());
+ URL url = FileLocator.find(bundle, new Path("reports/" + getReport()), null);
+ path = FileLocator.toFileURL(url).getPath();
+ }
+ catch (MalformedURLException me) {
+ System.out.println("Fehler bei URL " + me.getStackTrace());
+ return null;
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ return path;
+ }
+
+ /**
+ * @return the plugin ID
+ */
+ public String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+ /**
+ * @return the report name
+ */
+ public String getReport() {
+ return "TeamEfficiencyBar.rptdesign";
+ }
+
+ @Override
+ public String getTabName() {
+ return "Team Efficiency";
+ }
+
+}

Back to the top