Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
c9a29d65
by Tony Chemit at 2024-03-15T13:54:37+01:00
-
c211705f
by Tony Chemit at 2024-03-15T13:54:37+01:00
-
72f76dab
by Tony Chemit at 2024-03-15T13:54:37+01:00
4 changed files:
- client/configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
- core/services/test/src/main/java/fr/ird/observe/services/service/ReportFixture.java
- core/services/test/src/main/java/fr/ird/observe/services/service/ReportServiceFixtures.java
- src/site/markdown/report/index.md.vm
Changes:
| ... | ... | @@ -395,7 +395,7 @@ public class ClientConfig extends GeneratedClientConfig implements TripMapConfig |
| 395 | 395 | for (String location : locations) {
|
| 396 | 396 | String reportLocation = ReportDefinitionsBuilder.reportLocation(location);
|
| 397 | 397 | URL resource = getClass().getClassLoader().getResource(reportLocation);
|
| 398 | - Path reportPath = reportDirectory.toPath().resolve(reportLocation);
|
|
| 398 | + Path reportPath = reportDirectory.toPath().resolve(location);
|
|
| 399 | 399 | createDirectory(reportPath.getParent().toFile());
|
| 400 | 400 | log.info("Copy report from {} to {}", reportLocation, reportPath);
|
| 401 | 401 | Files.writeString(reportPath, ObserveUtil.loadResourceContent(resource));
|
| ... | ... | @@ -24,6 +24,7 @@ package fr.ird.observe.services.service; |
| 24 | 24 | |
| 25 | 25 | import fr.ird.observe.dto.reference.DtoReference;
|
| 26 | 26 | import fr.ird.observe.report.Report;
|
| 27 | +import fr.ird.observe.report.ReportColumnRenderersParameters;
|
|
| 27 | 28 | import fr.ird.observe.report.ReportVariable;
|
| 28 | 29 | import fr.ird.observe.report.definition.ReportRequestDefinition;
|
| 29 | 30 | import fr.ird.observe.report.definition.RequestLayout;
|
| ... | ... | @@ -116,6 +117,13 @@ public abstract class ReportFixture { |
| 116 | 117 | assertReportNbRequests(actual);
|
| 117 | 118 | }
|
| 118 | 119 | |
| 120 | + public void initColumnRendererParameters(ReportService service, Report definition) {
|
|
| 121 | + ReportColumnRenderersParameters actual = service.initColumnRendererParameters(definition.definition());
|
|
| 122 | + Assert.assertNotNull(actual);
|
|
| 123 | + Assert.assertNotNull(actual.getColumnRendererParameters());
|
|
| 124 | + Assert.assertEquals(definition.definition().getColumnRenderers().length, actual.getColumnRendererParameters().size());
|
|
| 125 | + }
|
|
| 126 | + |
|
| 119 | 127 | public final void assertResult(DataMatrix actual) {
|
| 120 | 128 | log.info(String.format("Start assertResult for %s", getReportId()));
|
| 121 | 129 | if (WITH_ASSERT) {
|
| ... | ... | @@ -94,9 +94,12 @@ public class ReportServiceFixtures extends GeneratedReportServiceFixtures { |
| 94 | 94 | }
|
| 95 | 95 | }
|
| 96 | 96 | |
| 97 | - public void executeReport(ReportService service, String id) {
|
|
| 98 | - Report definition = getReport(id);
|
|
| 99 | - executeReport(definition, service);
|
|
| 97 | + @Override
|
|
| 98 | + public void initColumnRendererParameters(ObserveServicesProvider servicesProvider, ReportService service) {
|
|
| 99 | + for (String id : ReportServiceFixtures.getReportIds()) {
|
|
| 100 | + Report definition = getReport(id);
|
|
| 101 | + initColumnRendererParameters(definition, service);
|
|
| 102 | + }
|
|
| 100 | 103 | }
|
| 101 | 104 | |
| 102 | 105 | @Override
|
| ... | ... | @@ -107,6 +110,20 @@ public class ReportServiceFixtures extends GeneratedReportServiceFixtures { |
| 107 | 110 | }
|
| 108 | 111 | }
|
| 109 | 112 | |
| 113 | + public void executeReport(ReportService service, String id) {
|
|
| 114 | + Report definition = getReport(id);
|
|
| 115 | + executeReport(definition, service);
|
|
| 116 | + }
|
|
| 117 | + |
|
| 118 | + protected void initColumnRendererParameters(Report definition, ReportService service) {
|
|
| 119 | + ReportFixture reportFixture = getReportFixture(definition);
|
|
| 120 | + if (reportFixture == null) {
|
|
| 121 | + Assume.assumeFalse(String.format("Missing report fixture for %s", definition.getId()), true);
|
|
| 122 | + return;
|
|
| 123 | + }
|
|
| 124 | + reportFixture.initColumnRendererParameters(service, definition);
|
|
| 125 | + }
|
|
| 126 | + |
|
| 110 | 127 | protected void populateVariables(Report definition, ReportService service) {
|
| 111 | 128 | ReportFixture reportFixture = getReportFixture(definition);
|
| 112 | 129 | if (reportFixture == null) {
|
| ... | ... | @@ -118,7 +118,7 @@ version applicative, à savoir dans |
| 118 | 118 | |
| 119 | 119 | Dans la configuration de l'assistant, par défaut on utilise ce fichier.
|
| 120 | 120 | |
| 121 | -Il est envisagé en *v10* de faire évoluer cela pour que chaque rapport puisse être décrit dans un fichier séparé.
|
|
| 121 | +Depuis la version **9.3.0**, chaque rapport est décrit dans un fichier séparé.
|
|
| 122 | 122 | |
| 123 | 123 | Cela aura pour avantage :
|
| 124 | 124 | |
| ... | ... | @@ -126,6 +126,54 @@ Cela aura pour avantage : |
| 126 | 126 | * de simplifier l'écriture de ceux-ci (on pourra alors supprimer tous les préfixes actuellement utilisés pour identifier un rapport).
|
| 127 | 127 | * de pouvoir organiser ces rapports par modèle métier, ou par type d'organisation
|
| 128 | 128 | |
| 129 | +Tous les rapports sont regroupés dans un répertoire des resources de la version applicative, à savoir dans
|
|
| 130 | + |
|
| 131 | +```.observe/resources-${project.version}/report/default```
|
|
| 132 | + |
|
| 133 | +dont voici le contenu (en 9.3.0)
|
|
| 134 | + |
|
| 135 | +```
|
|
| 136 | +resources-9.3.0-RC-5/report/
|
|
| 137 | +└── default
|
|
| 138 | + ├── ll
|
|
| 139 | + │ ├── llCommonTripGearUseFeatures.report
|
|
| 140 | + │ ├── llLanding.report
|
|
| 141 | + │ ├── llLogbookActivities.report
|
|
| 142 | + │ ├── llLogbookCatches.report
|
|
| 143 | + │ ├── llLogbookSamplesOnActivity.report
|
|
| 144 | + │ ├── llLogbookSamplesOnBoth.report
|
|
| 145 | + │ └── llLogbookSamplesOnTrip.report
|
|
| 146 | + └── ps
|
|
| 147 | + ├── psCommonTripGearUseFeatures.report
|
|
| 148 | + ├── psLocalmarketBatch.report
|
|
| 149 | + ├── psLocalmarketSample.report
|
|
| 150 | + ├── psLocalmarketSurvey.report
|
|
| 151 | + ├── psLogbookActivity.report
|
|
| 152 | + ├── psLogbookSampleMeasures.report
|
|
| 153 | + ├── psLogbookSampleSet.report
|
|
| 154 | + ├── psLogbookSampleSpeciesMeasuresCount.report
|
|
| 155 | + ├── psLogbookSampleSpeciesMeasures.report
|
|
| 156 | + ├── psLogbookTrip.report
|
|
| 157 | + ├── psLogbookWellPlanCheck.report
|
|
| 158 | + ├── psLogbookWellPlan.report
|
|
| 159 | + ├── psObservationActivitiesByZone.report
|
|
| 160 | + ├── psObservationActivityWithComment.report
|
|
| 161 | + ├── psObservationAllActivities.report
|
|
| 162 | + ├── psObservationCatch.report
|
|
| 163 | + ├── psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.report
|
|
| 164 | + ├── psObservationCatchTotalCountByGroupPerReasonForDiscard.report
|
|
| 165 | + ├── psObservationCatchTotalCountByGroupPerSpeciesFate.report
|
|
| 166 | + ├── psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.report
|
|
| 167 | + ├── psObservationCatchWeightByGroupPerReasonForDiscard.report
|
|
| 168 | + ├── psObservationCatchWeightByGroupPerSpeciesFate.report
|
|
| 169 | + ├── psObservationDailySetAndCatch.report
|
|
| 170 | + ├── psObservationFobUsageExtended.report
|
|
| 171 | + ├── psObservationFobUsageMinimal.report
|
|
| 172 | + ├── psObservationLengthsDistribution.report
|
|
| 173 | + ├── psObservationRepartionCaleeParCuve.report
|
|
| 174 | + └── psObservationSetByAssociation.report
|
|
| 175 | +```
|
|
| 176 | + |
|
| 129 | 177 | ## Description du fonctionnement général d'un rapport
|
| 130 | 178 | |
| 131 | 179 | ### Prération des variables
|