diff options
Diffstat (limited to 'plugins/org.eclipse.osee.ats.reports.split/src/org')
6 files changed, 138 insertions, 349 deletions
diff --git a/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/DistributionAtsReport.java b/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/DistributionAtsReport.java new file mode 100644 index 00000000000..8ec394b71c4 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/DistributionAtsReport.java @@ -0,0 +1,84 @@ +/* + * 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.ats.reports.split.ui; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.osee.ats.AtsImage; +import org.eclipse.osee.ats.api.version.IAtsVersion; +import org.eclipse.osee.ats.reports.AtsReport; +import org.eclipse.osee.ats.reports.ReportTabFactory; +import org.eclipse.osee.ats.reports.split.Activator; +import org.eclipse.osee.ats.util.widgets.dialog.TeamVersionListDialog; +import org.eclipse.osee.framework.core.enums.Active; +import org.eclipse.osee.framework.core.operation.IOperation; +import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption; +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.framework.ui.swt.KeyedImage; + +/** + * @author Praveen Joseph + */ +public class DistributionAtsReport implements AtsReport<IAtsVersion, Object> { + + @Override + public String getName() { + return "Distribution Reports"; + } + + @Override + public KeyedImage getKeyedImage() { + return AtsImage.REPORT; + } + + @Override + public IAtsVersion getInputParameters() { + IAtsVersion param = null; + TeamVersionListDialog dlg = new TeamVersionListDialog(Active.Both); + int open = dlg.open(); + if (open == 0) { + param = dlg.getSelectedVersion(); + } + return param; + } + + @Override + public IOperation createReportOperation(IAtsVersion input, Object output, TableLoadOption... tableLoadOptions) { + return new LoadDistributionDataOperation(input); + } + + @Override + public Object createOutputParameters() { + // None using a static shared object + return null; + } + + @Override + public void displayResults(Object output) { + ResultsEditor.open(new IResultsEditorProvider() { + + @Override + public String getEditorName() { + return getName(); + } + + @Override + public List<IResultsEditorTab> getResultsEditorTabs() { + List<IResultsEditorTab> tabs = new ArrayList<IResultsEditorTab>(); + tabs.add(createTab("Actionable Item", "reports/aiDistribution.rptdesign")); + tabs.add(createTab("Team-Work", "reports/teamWorkDistribution.rptdesign")); + tabs.add(createTab("Workflow State", "reports/stateWorkDistribution.rptdesign")); + return tabs; + } + }); + } + + private IResultsEditorTab createTab(String name, String rptDesingName) { + return ReportTabFactory.createBirtReportTab(Activator.PLUGIN_ID, name, rptDesingName); + } +} diff --git a/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/DistributionItem.java b/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/DistributionItem.java deleted file mode 100644 index 6aba780213e..00000000000 --- a/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/DistributionItem.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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.ats.reports.split.ui; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.osee.ats.AtsImage; -import org.eclipse.osee.ats.api.version.IAtsVersion; -import org.eclipse.osee.ats.core.client.config.store.VersionArtifactStore; -import org.eclipse.osee.ats.reports.split.model.AIDistributionEntry; -import org.eclipse.osee.ats.reports.split.model.DistributionModel; -import org.eclipse.osee.ats.reports.split.model.StateDistributionEntry; -import org.eclipse.osee.ats.reports.split.model.TeamDistributionEntry; -import org.eclipse.osee.ats.reports.split.ui.ai.AITab; -import org.eclipse.osee.ats.reports.split.ui.state.StateTab; -import org.eclipse.osee.ats.reports.split.ui.team.TeamTab; -import org.eclipse.osee.ats.util.widgets.dialog.TeamVersionListDialog; -import org.eclipse.osee.framework.core.enums.Active; -import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -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; - -/** - * Class to create the navigate item in the UI and to populate the model - * - * @author Chandan Bandemutt - */ -public class DistributionItem extends XNavigateItemAction { - - /** - * Constructor that calls super - * - * @param parent : - */ - public DistributionItem(final XNavigateItem parent) { - super(parent, "Distribution Reports", AtsImage.REPORT); - } - - @Override - public void run(final TableLoadOption... tableLoadOptions) throws Exception { - // Get input from the user. - TeamVersionListDialog dlg = new TeamVersionListDialog(Active.Both); - int open = dlg.open(); - if (open == 0) { - populateModel(dlg); - ResultsEditor.open(new IResultsEditorProvider() { - - @Override - public String getEditorName() { - return "Distribution Reports"; - } - - @Override - public List<IResultsEditorTab> getResultsEditorTabs() { - List<IResultsEditorTab> tabs = new ArrayList<IResultsEditorTab>(); - tabs.add(new AITab()); - tabs.add(new TeamTab()); - tabs.add(new StateTab()); - return tabs; - } - - }); - } - } - - private boolean populateModel(final TeamVersionListDialog dlg) { - try { - // AI Split - @SuppressWarnings("cast") - IAtsVersion version = (IAtsVersion) dlg.getSelectedVersion(); - VersionArtifactStore artifactStore = new VersionArtifactStore(version); - Artifact artifact = artifactStore.getArtifact(); - - AIDistributionEntry aiSplitEntry = new AIDistributionEntry(artifact); - aiSplitEntry.computeAISplit(); - - TeamDistributionEntry teamSplitEntry = new TeamDistributionEntry(artifact); - teamSplitEntry.computeTeamSplit(); - - StateDistributionEntry stateSplitEntry = new StateDistributionEntry(artifact); - stateSplitEntry.computeStateSplit(); - - DistributionModel.setAiSplitEntry(aiSplitEntry); - DistributionModel.setTeamSplitEntry(teamSplitEntry); - DistributionModel.setStateSplitEntry(stateSplitEntry); - - } catch (OseeCoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return false; - } - - return true; - } - -} diff --git a/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/LoadDistributionDataOperation.java b/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/LoadDistributionDataOperation.java new file mode 100644 index 00000000000..46a34573980 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/LoadDistributionDataOperation.java @@ -0,0 +1,54 @@ +/* + * 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.ats.reports.split.ui; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.ats.api.version.IAtsVersion; +import org.eclipse.osee.ats.core.client.config.store.VersionArtifactStore; +import org.eclipse.osee.ats.reports.split.Activator; +import org.eclipse.osee.ats.reports.split.model.AIDistributionEntry; +import org.eclipse.osee.ats.reports.split.model.DistributionModel; +import org.eclipse.osee.ats.reports.split.model.StateDistributionEntry; +import org.eclipse.osee.ats.reports.split.model.TeamDistributionEntry; +import org.eclipse.osee.framework.core.operation.AbstractOperation; +import org.eclipse.osee.framework.core.util.Conditions; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; + +/** + * Class to extract data from workflows and fills the DistributionModel + * + * @author Praveen Joseph + */ +public class LoadDistributionDataOperation extends AbstractOperation { + + private final IAtsVersion version; + + public LoadDistributionDataOperation(IAtsVersion version) { + super("Load Work Distribution Data", Activator.PLUGIN_ID); + this.version = version; + } + + @Override + protected void doWork(IProgressMonitor monitor) throws Exception { + Conditions.checkNotNull(version, "teamDefinition"); + VersionArtifactStore artifactStore = new VersionArtifactStore(version); + Artifact artifact = artifactStore.getArtifact(); + + AIDistributionEntry aiSplitEntry = new AIDistributionEntry(artifact); + aiSplitEntry.computeAISplit(); + + TeamDistributionEntry teamSplitEntry = new TeamDistributionEntry(artifact); + teamSplitEntry.computeTeamSplit(); + + StateDistributionEntry stateSplitEntry = new StateDistributionEntry(artifact); + stateSplitEntry.computeStateSplit(); + + DistributionModel.setAiSplitEntry(aiSplitEntry); + DistributionModel.setTeamSplitEntry(teamSplitEntry); + DistributionModel.setStateSplitEntry(stateSplitEntry); + } + +} diff --git a/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/ai/AITab.java b/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/ai/AITab.java deleted file mode 100644 index 0fe52c42651..00000000000 --- a/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/ai/AITab.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ats.reports.split.ui.ai; - -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.ats.reports.split.Activator; -import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab; -import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor; -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 Chandan Bandemutt - */ -public class AITab implements IResultsEditorTab { - - private Browser browser; - - @SuppressWarnings("deprecation") - @Override - public Composite createTab(final Composite parent, final ResultsEditor resultsEditor) { - - 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 tab - */ - 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 teh plug in ID - */ - public String getPluginID() { - return Activator.PLUGIN_ID; - } - - /** - * @return the report name - */ - public String getReport() { - return "aiDistribution.rptdesign"; - } - - @Override - public String getTabName() { - return "Actionable Item"; - } - -} diff --git a/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/state/StateTab.java b/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/state/StateTab.java deleted file mode 100644 index a0d22f36691..00000000000 --- a/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/state/StateTab.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ats.reports.split.ui.state; - -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.ats.reports.split.Activator; -import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab; -import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor; -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 Chandan Bandemutt - */ -public class StateTab implements IResultsEditorTab { - - private Browser browser; - - @SuppressWarnings("deprecation") - @Override - public Composite createTab(final Composite parent, final ResultsEditor resultsEditor) { - - String path = getReportPath(); - this.browser = new Browser(parent, SWT.NONE); - WebViewer.display(path, WebViewer.HTML, this.browser, "frameset"); - this.browser.refresh(); - return this.browser; - } - - /** - * @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 "stateWorkDistribution.rptdesign"; - } - - @Override - public String getTabName() { - return "Workflow State"; - } - -} diff --git a/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/team/TeamTab.java b/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/team/TeamTab.java deleted file mode 100644 index 7e7100bcae7..00000000000 --- a/plugins/org.eclipse.osee.ats.reports.split/src/org/eclipse/osee/ats/reports/split/ui/team/TeamTab.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ats.reports.split.ui.team; - -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.ats.reports.split.Activator; -import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab; -import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor; -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 teh tab in UI - * - * @author Chandan Bandemutt - */ -public class TeamTab implements IResultsEditorTab { - - private Browser browser; - - @SuppressWarnings("deprecation") - @Override - public Composite createTab(final Composite parent, final ResultsEditor resultsEditor) { - - String path = getReportPath(); - this.browser = new Browser(parent, SWT.NONE); - WebViewer.display(path, WebViewer.HTML, this.browser, "frameset"); - this.browser.refresh(); - return this.browser; - } - - /** - * @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 "teamWorkDistribution.rptdesign"; - } - - @Override - public String getTabName() { - return "Team-Work"; - } - -} |