/src/main/java/com/atlassian/bamboo/plugin/dotnet/ncover/ViewNCoverCoverageSummary.java
Java | 121 lines | 68 code | 21 blank | 32 comment | 5 complexity | 00823bbd60b36696748f8b10a001a578 MD5 | raw file
Possible License(s): BSD-3-Clause
- package com.atlassian.bamboo.plugin.dotnet.ncover;
-
- import com.atlassian.bamboo.build.FilterController;
- import com.atlassian.bamboo.plugin.dotnet.DotNetPlugin;
- import com.atlassian.bamboo.reports.collector.ReportCollector;
- import com.atlassian.bamboo.ww2.actions.BuildActionSupport;
- import com.atlassian.bamboo.ww2.aware.ResultsListAware;
- import com.atlassian.bamboo.ww2.aware.permissions.PlanReadSecurityAware;
- import com.atlassian.plugin.ModuleDescriptor;
- import org.jfree.data.time.TimeTableXYDataset;
- import org.jfree.data.xy.XYDataset;
-
- import java.util.Collections;
- import java.util.List;
-
- /**
- * Action class used as part of NCover report display.
- *
- * @author Ross Rowe
- *
- */
- public class ViewNCoverCoverageSummary extends BuildActionSupport implements ResultsListAware, PlanReadSecurityAware
- {
- private static final long serialVersionUID = -3731695875856341713L;
-
- private static final String COVERAGE_REPORT_KEY = DotNetPlugin.PLUGIN_KEY + ":ncoverCoverage";
-
- // --------------------------------------------------------------------------------------------------Dependencies
- // --------------------------------------------------------------------------------------------------
- // Charting
- List resultsList;
-
- XYDataset dataset;
-
- String reportKey = COVERAGE_REPORT_KEY; // default.
-
- // --------------------------------------------------------------------------------------------------
- // Filter
- FilterController filterController;
-
- /**
- * Runs the viewCoverage action.
- *
- * @return the success status
- * @throws Exception
- * if any errors are thrown during the action processing
- */
- public String doViewCoverage() throws Exception {
- setReportKey(COVERAGE_REPORT_KEY);
- return run();
- }
-
- /**
- *
- * @return the success status
- * @throws Exception
- * if any errors are thrown during the action processing
- */
- @Override
- public String execute() throws Exception {
- return run();
- }
-
- /**
- * Sets the dataset variable as per the <code>ReportCollector</code> that
- * is applicable for the plugin descriptor.
- *
- * @return the success status
- */
- private String run() {
- if (resultsList != null && !resultsList.isEmpty()) {
- ModuleDescriptor descriptor = getPluginAccessor().getPluginModule(getReportKey());
-
- if (descriptor != null) {
- ReportCollector collector = (ReportCollector) descriptor
- .getModule();
- collector.setResultsList(getResultsList());
- collector.setParams(Collections.EMPTY_MAP);
- dataset = (TimeTableXYDataset) collector.getDataset();
- }
- }
-
- return SUCCESS;
- }
-
- @Override
- public List getResultsList() {
- return resultsList;
- }
-
- @Override
- public void setResultsList(List resultsList) {
- this.resultsList = resultsList;
- }
-
- public XYDataset getDataset() {
- return dataset;
- }
-
- public void setDataset(XYDataset dataset) {
- this.dataset = dataset;
- }
-
- public String getReportKey() {
- return reportKey;
- }
-
- public void setReportKey(String reportKey) {
- this.reportKey = reportKey;
- }
-
- // --------------------------------------------------------------------------------------------------
- // Dependencies
- public FilterController getFilterController() {
- return filterController;
- }
-
- public void setFilterController(FilterController filterController) {
- this.filterController = filterController;
- }
- }