This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository nuiton-config. See https://gitlab.nuiton.org/nuiton/nuiton-config.git commit 5177df67ec219d82548a293e8d25daab54975fbe Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Oct 7 18:04:40 2016 +0200 Report for actions are not complete (Fixes #4060) --- .../nuiton/config/plugin/ReportMojoSupport.java | 19 +-- .../org/nuiton/config/plugin/ReportRenderer.java | 178 +++------------------ .../src/main/resources/config-report.properties | 4 + .../src/main/resources/config-report_fr.properties | 5 + 4 files changed, 35 insertions(+), 171 deletions(-) diff --git a/nuiton-config-maven-plugin/src/main/java/org/nuiton/config/plugin/ReportMojoSupport.java b/nuiton-config-maven-plugin/src/main/java/org/nuiton/config/plugin/ReportMojoSupport.java index bb6a9d9..0fbaa93 100644 --- a/nuiton-config-maven-plugin/src/main/java/org/nuiton/config/plugin/ReportMojoSupport.java +++ b/nuiton-config-maven-plugin/src/main/java/org/nuiton/config/plugin/ReportMojoSupport.java @@ -108,12 +108,6 @@ abstract class ReportMojoSupport extends AbstractMavenReport { private boolean verbose; /** - * Flag to render option in detail (add a section for each option). - */ - @Parameter(property = "config.showOptionDetail", defaultValue = "true") - private boolean showOptionDetail; - - /** * Skip to generate the report. */ @Parameter(property = "config.skip") @@ -202,12 +196,11 @@ abstract class ReportMojoSupport extends AbstractMavenReport { } ReportRenderer renderer = new ReportRenderer(getSink(), - i18n, - locale, - getOutputName(), - getOutputName(), - configProviders, - showOptionDetail); + i18n, + locale, + getOutputName(), + getOutputName(), + configProviders); renderer.render(); } @@ -227,7 +220,7 @@ abstract class ReportMojoSupport extends AbstractMavenReport { I18nInitializer initializer; if (StringUtils.isNotEmpty(i18nBundleName)) { initializer = new DefaultI18nInitializer(i18nBundleName, - newClassLoader); + newClassLoader); } else { initializer = new ClassPathI18nInitializer(newClassLoader); } diff --git a/nuiton-config-maven-plugin/src/main/java/org/nuiton/config/plugin/ReportRenderer.java b/nuiton-config-maven-plugin/src/main/java/org/nuiton/config/plugin/ReportRenderer.java index cfa1476..3ee2990 100644 --- a/nuiton-config-maven-plugin/src/main/java/org/nuiton/config/plugin/ReportRenderer.java +++ b/nuiton-config-maven-plugin/src/main/java/org/nuiton/config/plugin/ReportRenderer.java @@ -22,9 +22,9 @@ package org.nuiton.config.plugin; * #L% */ +import com.google.common.base.Joiner; import org.apache.commons.collections4.CollectionUtils; import org.apache.maven.doxia.sink.Sink; -import org.apache.maven.doxia.sink.SinkEventAttributes; import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet; import org.apache.maven.reporting.AbstractMavenReportRenderer; import org.codehaus.plexus.i18n.I18N; @@ -33,12 +33,6 @@ import org.nuiton.config.ApplicationConfigProvider; import org.nuiton.config.ConfigActionDef; import org.nuiton.config.ConfigOptionDef; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; import java.util.Locale; import java.util.Set; @@ -77,18 +71,12 @@ class ReportRenderer extends AbstractMavenReportRenderer { */ private final Set<ApplicationConfigProvider> configProviders; - /** - * To show option in detail. - */ - private final boolean optionWithDetail; - ReportRenderer(Sink sink, I18N i18n, Locale locale, String reportName, String bundleName, - Set<ApplicationConfigProvider> configProviders, - boolean optionWithDetail) { + Set<ApplicationConfigProvider> configProviders) { super(sink); this.i18n = i18n; this.locale = locale; @@ -96,7 +84,6 @@ class ReportRenderer extends AbstractMavenReportRenderer { this.bundleName = bundleName; this.sink = sink; this.configProviders = configProviders; - this.optionWithDetail = optionWithDetail; } @Override @@ -181,12 +168,10 @@ class ReportRenderer extends AbstractMavenReportRenderer { sink.section2(); sink.sectionTitle2(); sink.anchor("detail_" + configProvider.getName()); - sink.text(getText("report.detail.configuration.title") + " " + - configProvider.getName()); + sink.text(getText("report.detail.configuration.title") + " " + configProvider.getName()); sink.anchor_(); sink.sectionTitle2_(); - sink.lineBreak(); sink.paragraph(); sink.text(getText("report.config.name") + " : "); sink.bold(); @@ -194,7 +179,6 @@ class ReportRenderer extends AbstractMavenReportRenderer { sink.bold_(); sink.paragraph_(); - sink.lineBreak(); sink.paragraph(); sink.text(getText("report.config.description") + " : "); sink.bold(); @@ -211,24 +195,15 @@ class ReportRenderer extends AbstractMavenReportRenderer { sink.sectionTitle3_(); sink.lineBreak(); - Collection<ConfigOptionDef> options = - getOptions(configProvider); - - renderOptionDefsTable(configProvider, options); - - if (optionWithDetail) { - - for (ConfigOptionDef option : options) { - - renderProviderOptionDetail(configProvider, option); - } - } + renderOptionDefsTable(configProvider.getOptions()); sink.section3_(); sink.section3(); sink.sectionTitle3(); + sink.anchor("detail_actions_" + configProvider.getName()); sink.text(getText("report.detail.actions.title")); + sink.anchor_(); sink.sectionTitle3_(); sink.lineBreak(); @@ -239,9 +214,9 @@ class ReportRenderer extends AbstractMavenReportRenderer { sink.section2_(); } - private void renderOptionDefsTable(ApplicationConfigProvider configProvider, Collection<ConfigOptionDef> options) { + private void renderOptionDefsTable(ConfigOptionDef... options) { - if (options.isEmpty()) { + if (options.length == 0) { sink.paragraph(); sink.bold(); @@ -256,36 +231,22 @@ class ReportRenderer extends AbstractMavenReportRenderer { sinkHeaderCellText(getText("report.config.option.key")); sinkHeaderCellText(getText("report.config.option.description")); - if (!optionWithDetail) { - sinkHeaderCellText(getText("report.config.option.type")); - } sinkHeaderCellText(getText("report.config.option.defaultValue")); - - if (!optionWithDetail) { - sinkHeaderCellText(getText("report.config.option.final")); - sinkHeaderCellText(getText("report.config.option.transient")); - } + sinkHeaderCellText(getText("report.config.option.final")); + sinkHeaderCellText(getText("report.config.option.transient")); + sinkHeaderCellText(getText("report.config.option.type")); sink.tableRow_(); for (ConfigOptionDef option : options) { sink.tableRow(); - if (optionWithDetail) { - sinkCellLink( - option.getKey(), - "detail_" + configProvider.getName() + "_" + option.getKey()); - } else { - sinkCellText(option.getKey()); - } + sinkCellText(option.getKey()); sinkCellText(l(locale, option.getDescription())); - if (!optionWithDetail) { - sinkCellText(option.getType().getName()); - } sinkCellVerbatimText(getDefaultValue(option)); - if (!optionWithDetail) { - sinkCellText(getText(!option.isFinal())); - sinkCellText(getText(!option.isTransient())); - } + sinkCellText(getText(!option.isFinal())); + sinkCellText(getText(!option.isTransient())); + sinkCellVerbatimText(option.getType().getName()); + sink.tableRow_(); } @@ -309,14 +270,16 @@ class ReportRenderer extends AbstractMavenReportRenderer { sink.table(); sink.tableRow(); - sinkHeaderCellText(getText("report.config.action.action")); + sinkHeaderCellText(getText("report.config.action.description")); sinkHeaderCellText(getText("report.config.action.aliases")); + sinkHeaderCellText(getText("report.config.action.action")); sink.tableRow_(); for (ConfigActionDef action : actions) { sink.tableRow(); + sinkCellText(l(locale, action.getDescription())); + sinkCellText(Joiner.on(",").join(action.getAliases())); sinkCellText(action.getAction()); - sinkCellText(l(locale, Arrays.toString(action.getAliases()))); sink.tableRow_(); } @@ -324,90 +287,6 @@ class ReportRenderer extends AbstractMavenReportRenderer { } } - private void renderProviderOptionDetail(ApplicationConfigProvider configProvider, - ConfigOptionDef option) { - - final SinkEventAttributes cellWidth = new SinkEventAttributeSet(); - cellWidth.addAttribute(SinkEventAttributes.WIDTH, "80%"); - - final SinkEventAttributes headerWidth = new SinkEventAttributeSet(); - headerWidth.addAttribute(SinkEventAttributes.WIDTH, "20%"); -// final String cellWidth = "80%"; -// final String headerWidth = "20%"; - - sink.section4(); - sink.sectionTitle4(); - sink.anchor("detail_" + configProvider.getName() + "_" + option.getKey()); - sink.text(getText("report.config.option.detail") + " '" + option.getKey() - + "'"); - sink.sectionTitle4_(); - sink.lineBreak(); - - sink.table(); - sink.tableRows(new int[]{Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_LEFT}, false); - - sink.tableRow(); - sinkHeaderCellText(headerWidth, getText("report.config.option.key")); - sink.tableCell(cellWidth); - sink.nonBreakingSpace(); - sink.bold(); - sink.text(option.getKey()); - sink.bold_(); - sink.tableCell_(); - sink.tableRow_(); - - sink.tableRow(); - sinkHeaderCellText(headerWidth, getText("report.config.option.description")); - sink.tableCell(cellWidth); - sink.nonBreakingSpace(); - sink.text(l(locale, option.getDescription())); - sink.tableCell_(); - sink.tableRow_(); - - sink.tableRow(); - sinkHeaderCellText(headerWidth, getText("report.config.option.defaultValue")); - sink.tableCell(cellWidth); - sink.nonBreakingSpace(); - sink.bold(); - sink.text(getDefaultValue(option)); - sink.bold_(); - sink.tableCell_(); - sink.tableRow_(); - - sink.tableRow(); - sinkHeaderCellText(headerWidth, getText("report.config.option.type")); - sink.tableCell(cellWidth); - sink.nonBreakingSpace(); - sink.text(option.getType().getName()); - sink.tableCell_(); - sink.tableRow_(); - - sink.tableRow(); - sinkHeaderCellText(headerWidth, getText("report.config.option.final")); - sink.tableCell(cellWidth); - sink.nonBreakingSpace(); - sink.text(getText(!option.isFinal())); - sink.tableCell_(); - sink.tableRow_(); - - sink.tableRow(); - sinkHeaderCellText(headerWidth, getText("report.config.option.transient")); - sink.tableCell(cellWidth); - sink.nonBreakingSpace(); - sink.text(getText(!option.isTransient())); - sink.tableCell_(); - sink.tableRow_(); - - sink.table_(); - - sink.paragraph(); - sinkLinkToAnchor(getText("report.back.options.table"), "detail_options_" + configProvider.getName()); - sink.paragraph_(); - - sink.section4_(); - - } - private String getText(boolean key) { return getText("report." + String.valueOf(key)); } @@ -430,12 +309,6 @@ class ReportRenderer extends AbstractMavenReportRenderer { sink.tableHeaderCell_(); } - private void sinkHeaderCellText(SinkEventAttributes width, String text) { - sink.tableHeaderCell(width); - sink.text(text); - sink.tableHeaderCell_(); - } - private void sinkCellText(String text) { sink.tableCell(); sink.text(text); @@ -462,15 +335,4 @@ class ReportRenderer extends AbstractMavenReportRenderer { sink.link_(); } - private Collection<ConfigOptionDef> getOptions(ApplicationConfigProvider configProvider) { - List<ConfigOptionDef> result = new ArrayList<>(Arrays.asList(configProvider.getOptions())); - Collections.sort(result, new Comparator<ConfigOptionDef>() { - @Override - public int compare(ConfigOptionDef o1, - ConfigOptionDef o2) { - return o1.getKey().compareTo(o2.getKey()); - } - }); - return result; - } } diff --git a/nuiton-config-maven-plugin/src/main/resources/config-report.properties b/nuiton-config-maven-plugin/src/main/resources/config-report.properties index 6301781..7db4cd5 100644 --- a/nuiton-config-maven-plugin/src/main/resources/config-report.properties +++ b/nuiton-config-maven-plugin/src/main/resources/config-report.properties @@ -44,8 +44,12 @@ report.detail.title=Detail of configurations report.detail.text=We give details of each configuration of the project report.detail.configuration.title=Configuration report.detail.options.title=Configuration options +report.detail.options.details.title=Details of configuration's options report.detail.actions.title=Configuration actions report.detail.options.noOptions=No option found for this configuration report.detail.actions.noActions=No action found for this configuration +report.config.action.description=Description +report.config.action.aliases=Aliases +report.config.action.action=Action diff --git a/nuiton-config-maven-plugin/src/main/resources/config-report_fr.properties b/nuiton-config-maven-plugin/src/main/resources/config-report_fr.properties index 4d39419..5d01c59 100644 --- a/nuiton-config-maven-plugin/src/main/resources/config-report_fr.properties +++ b/nuiton-config-maven-plugin/src/main/resources/config-report_fr.properties @@ -44,6 +44,11 @@ report.detail.title=D\u00E9tail des configurations report.detail.text=On d\u00E9taille ici une par une les configurations d\u00E9finies pour le projet report.detail.configuration.title=Configuration report.detail.options.title=Options de la configuration +report.detail.options.details.title=Détails des options de la configuration report.detail.actions.title=Actions de la configuration report.detail.options.noOptions=Aucune option d\u00E9finie pour cette configuration report.detail.actions.noActions=Aucune action d\u00E9finie pour cette configuration + +report.config.action.description=Description +report.config.action.aliases=Aliases +report.config.action.action=Action -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.