Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below. Deleted commits: 18be9c7c by Tony Chemit at 2022-11-13T15:28:50+01:00 Rapports Captures/Rejets selon le type d'association - Closes #2530 - - - - - eadf39d0 by Tony Chemit at 2022-11-13T16:05:04+01:00 Rapport Dénombrement des captures accessoires et devenir, filtrées par groupe - Closes #2534 - - - - - 6cc3444c by Tony Chemit at 2022-11-14T07:34:11+01:00 Tck Report - columnHeaders can be null Tck Report - Improve when to deliver asserts - - - - - 5973b503 by Tony Chemit at 2022-11-14T13:38:45+01:00 Rapports Distributions de tailles - Closes #2533 - - - - - 5829f08b by Tony Chemit at 2022-11-14T13:38:45+01:00 Report API - add safe guard tests (to be able to copy partial matrix) - - - - - 21b35310 by Tony Chemit at 2022-11-14T13:38:45+01:00 Report GUI - Manage report with no columns and row headers (everything is coming from the report result to be able to manage dynamic columns) - - - - - 246f57a8 by Tony Chemit at 2022-11-14T13:38:45+01:00 Report model - Fix psObservationFobUsageMinimal report (one line escape was missing) - - - - - 832e14f1 by Tony Chemit at 2022-11-14T13:38:45+01:00 Report API - Be able to order variables and repeat variables - - - - - 78659144 by Tony Chemit at 2022-11-14T13:38:45+01:00 Report GUI - Respect report variables order in Report model - - - - - 22 changed files: - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportModel.java - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ResultTableModel.java - core/api/dto/src/main/resources/observe-reports.properties - + core/persistence/java/src/main/java/fr/ird/observe/spi/report/ComputePsObservationLengthsDistribution.java - − core/services/local/src/test/java/fr/ird/observe/services/local/service/ReportServiceLocalReadTest.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/report/ps/PsObservationAccessoryCatchByGroupReportFixture.java → core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchByGroupReportFixture.java - core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetStoredDistributionLengthsLFReportFixture.java → core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationLengthsDistributionReportFixture.java - − core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationNonTargetDistributionLengthsReportFixture.java - − core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetDiscardedDistributionLengthsLD1ReportFixture.java - − core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetDiscardedDistributionLengthsLFReportFixture.java - − core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetStoredDistributionLengthsLD1ReportFixture.java - core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationAccessoryCatchByGroup.properties → core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatchByGroup.properties - core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationNonTargetDistributionLengths.properties → core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationLengthsDistribution.properties - core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetCatchByAssociation.properties - core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetDiscardedByAssociation.properties - − core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetDiscardedDistributionLengthsLD1.properties - − core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetDiscardedDistributionLengthsLF.properties - − core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetStoredDistributionLengthsLD1.properties - − core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetStoredDistributionLengthsLF.properties - toolkit/api/src/main/java/fr/ird/observe/dto/report/DataMatrix.java - toolkit/api/src/main/java/fr/ird/observe/dto/report/ReportBuilder.java Changes: ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportModel.java ===================================== @@ -43,10 +43,10 @@ import java.net.URL; import java.nio.file.Files; import java.util.Collections; import java.util.Date; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.TreeMap; import java.util.stream.Collectors; /** @@ -81,7 +81,7 @@ public class ReportModel extends AdminActionModel { /** * les variables utilisées pour le report. */ - protected final Map<String, Object> variables; + protected final Map<String, Object> variables = new LinkedHashMap<>(); /** * la fichier contenant la définition des reports. */ @@ -128,7 +128,6 @@ public class ReportModel extends AdminActionModel { public ReportModel() { super(AdminStep.REPORT); - variables = new TreeMap<>(); // quand le type de modèle change, on mets à jour les rapports disponibles addPropertyChangeListener(REPORT_FILE_PROPERTY_NAME, evt -> updateReports()); } ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ResultTableModel.java ===================================== @@ -149,12 +149,11 @@ public class ResultTableModel extends AbstractTableModel { rowNames.addAll(Arrays.asList(report.getRowHeaders())); } - withColumnHeader = !columnNames.isEmpty(); - withRowHeader = !rowNames.isEmpty(); - table.setTableHeader(!withColumnHeader ? null : tableHeader); - table.createDefaultColumnsFromModel(); int nbRows = incomingData.getHeight(); int nbCols = incomingData.getWidth(); + + withColumnHeader = !columnNames.isEmpty(); + withRowHeader = !rowNames.isEmpty(); if (withRowHeader) { // on ajoute une première colonne aux données nbCols += 1; @@ -162,6 +161,22 @@ public class ResultTableModel extends AbstractTableModel { incomingData.setX(1); } + if (!withColumnHeader && !withRowHeader) { + // let's say we always use columns from incomingData + table.setTableHeader(tableHeader); + for (int i = 0; i < nbCols; i++) { + columnNames.add((String) incomingData.getValue(i, 0)); + } + incomingData.setY(-1); + withColumnHeader = true; + nbRows--; + + } else { + table.setTableHeader(!withColumnHeader ? null : tableHeader); + } + table.createDefaultColumnsFromModel(); + + data.setHeight(nbRows); data.setWidth(nbCols); @@ -185,7 +200,9 @@ public class ResultTableModel extends AbstractTableModel { } else if (withColumnHeader) { } - data.copyData(incomingData); + if (nbCols > 0) { + data.copyData(incomingData); + } fireTableStructureChanged(); table.revalidate(); table.repaint(); @@ -220,7 +237,7 @@ public class ResultTableModel extends AbstractTableModel { } public String getClipboardContent(boolean copyRowHeaders, boolean copyColumnHeaders) { - return getDataContent(copyRowHeaders, copyColumnHeaders, true,'\t'); + return getDataContent(copyRowHeaders, copyColumnHeaders, true, '\t'); } public String getCsvContent() { ===================================== core/api/dto/src/main/resources/observe-reports.properties ===================================== @@ -157,8 +157,8 @@ report.psObservationFobUsageMinimal.request.3=2,0|row|\ Where \ m.id In :tripId \ and dcp.computedWhenArrivingSimplifiedObjectType = :typeObjetId \ - and a.vesselActivity.id != 'fr.ird.referential.ps.common.VesselActivity#1239832675369#0.12552908048322586' -and (dcp.objectOperation.id = 'fr.ird.referential.ps.common.ObjectOperation#0#2' \ + and a.vesselActivity.id != 'fr.ird.referential.ps.common.VesselActivity#1239832675369#0.12552908048322586' \ + and (dcp.objectOperation.id = 'fr.ird.referential.ps.common.ObjectOperation#0#2' \ or dcp.objectOperation.id = 'fr.ird.referential.ps.common.ObjectOperation#0#8' \ or dcp.objectOperation.id = 'fr.ird.referential.ps.common.ObjectOperation#0#4' \ or dcp.objectOperation.id = 'fr.ird.referential.ps.common.ObjectOperation#0#5' \ @@ -567,6 +567,140 @@ report.psObservationSetByAssociation.request.8=3,1|column|\ and os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \ and os not in elements(a.observedSystem) ################################################################################ +## Captures thons selon le type d'association +################################################################################ +report.psObservationTargetCatchByAssociation.modelType=PS +report.psObservationTargetCatchByAssociation.name=Observations - Captures de thons selon le type d’association (en t) +report.psObservationTargetCatchByAssociation.description=Afficher la répartitions des captures de thons selon le type d'association +report.psObservationTargetCatchByAssociation.columns=YFT, SKJ, BET, LTA, FRI, Autres, Total +report.psObservationTargetCatchByAssociation.rows=BL sans baleine, BL avec baleine, BO avec requin-baleine, BO sans requin-baleine, Total +report.psObservationTargetCatchByAssociation.operations.1=SumRow +report.psObservationTargetCatchByAssociation.operations.2=SumColumn +# ligne 1 +report.psObservationTargetCatchByAssociation.request.1=0,0|row|\ + Select \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.8943253454598569' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.975344121171992' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685475#0.13349466123905152' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685477#0.8024257002747615' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685477#0.3846921632590058' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.8943253454598569' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685474#0.975344121171992' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685475#0.13349466123905152' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685477#0.8024257002747615' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685477#0.3846921632590058' Then 0.0 \ + Else ct.catchWeight End) \ + From TripImpl m \ + Join m.routeObs r \ + Join r.activity a \ + Join a.set c \ + with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#2' \ + Join c.catches ct \ + Join ct.speciesFate sf with sf.discard = FALSE, \ + ObservedSystemImpl os \ + Where \ + m.id In :tripId \ + and os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9395222812356602' \ + and os not in elements(a.observedSystem) +# ligne 2 +report.psObservationTargetCatchByAssociation.request.7=0,1|row|\ + Select \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.8943253454598569' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.975344121171992' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685475#0.13349466123905152' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685477#0.8024257002747615' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685477#0.3846921632590058' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.8943253454598569' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685474#0.975344121171992' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685475#0.13349466123905152' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685477#0.8024257002747615' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685477#0.3846921632590058' Then 0.0 \ + Else ct.catchWeight End) \ + From TripImpl m \ + Join m.routeObs r \ + Join r.activity a \ + Join a.set c \ + with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#2' \ + Join c.catches ct \ + Join ct.speciesFate sf with sf.discard = FALSE, \ + ObservedSystemImpl os \ + Where \ + m.id In :tripId \ + and os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9395222812356602' \ + and os in elements(a.observedSystem) +# ligne 3 +report.psObservationTargetCatchByAssociation.request.13=0,2|row|\ + Select \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.8943253454598569' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.975344121171992' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685475#0.13349466123905152' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685477#0.8024257002747615' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685477#0.3846921632590058' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.8943253454598569' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685474#0.975344121171992' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685475#0.13349466123905152' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685477#0.8024257002747615' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685477#0.3846921632590058' Then 0.0 \ + Else ct.catchWeight End) \ + From TripImpl m \ + Join m.routeObs r \ + Join r.activity a \ + Join a.set c \ + with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#1' \ + Join c.catches ct \ + Join ct.speciesFate sf with sf.discard = FALSE, \ + ObservedSystemImpl os \ + Where \ + m.id In :tripId \ + and os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \ + and os in elements(a.observedSystem) +# ligne 4 +report.psObservationTargetCatchByAssociation.request.19=0,3|row|\ + Select \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.8943253454598569' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.975344121171992' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685475#0.13349466123905152' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685477#0.8024257002747615' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685477#0.3846921632590058' Then ct.catchWeight \ + Else 0.0 End), \ + Sum(CASE ct.species.topiaId When 'fr.ird.referential.common.Species#1239832685474#0.8943253454598569' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685474#0.975344121171992' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685475#0.13349466123905152' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685477#0.8024257002747615' Then 0.0 \ + When 'fr.ird.referential.common.Species#1239832685477#0.3846921632590058' Then 0.0 \ + Else ct.catchWeight End) \ + From TripImpl m \ + Join m.routeObs r \ + Join r.activity a \ + Join a.set c \ + with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#1' \ + Join c.catches ct \ + Join ct.speciesFate sf with sf.discard = FALSE, \ + ObservedSystemImpl os \ + Where \ + m.id In :tripId \ + and os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \ + and os not in elements(a.observedSystem) +################################################################################ ## Rejets thons selon le type d'association ################################################################################ report.psObservationTargetDiscardedByAssociation.modelType=PS @@ -600,7 +734,8 @@ report.psObservationTargetDiscardedByAssociation.request.1=0,0|row|\ Join r.activity a \ Join a.set c \ with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#2' \ - Join c.catches ct, \ + Join c.catches ct \ + Join ct.speciesFate sf with sf.discard = TRUE, \ ObservedSystemImpl os \ Where \ m.id In :tripId \ @@ -630,7 +765,8 @@ report.psObservationTargetDiscardedByAssociation.request.7=0,1|row|\ Join r.activity a \ Join a.set c \ with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#2' \ - Join c.catches ct, \ + Join c.catches ct \ + Join ct.speciesFate sf with sf.discard = TRUE, \ ObservedSystemImpl os \ Where \ m.id In :tripId \ @@ -660,7 +796,8 @@ report.psObservationTargetDiscardedByAssociation.request.13=0,2|row|\ Join r.activity a \ Join a.set c \ with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#1' \ - Join c.catches ct, \ + Join c.catches ct \ + Join ct.speciesFate sf with sf.discard = TRUE, \ ObservedSystemImpl os \ Where \ m.id In :tripId \ @@ -690,7 +827,8 @@ report.psObservationTargetDiscardedByAssociation.request.19=0,3|row|\ Join r.activity a \ Join a.set c \ with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#1' \ - Join c.catches ct, \ + Join c.catches ct \ + Join ct.speciesFate sf with sf.discard = TRUE, \ ObservedSystemImpl os \ Where \ m.id In :tripId \ @@ -749,14 +887,14 @@ report.psObservationCatch.request.3=2,0|row|\ Where m.id In :tripId report.psObservationCatch.request.3.repeat=speciesId|column ################################################################################ -## Captures accessoires par speciesGroup d'espèces +## Captures par groupe d'espèces ################################################################################ -report.psObservationAccessoryCatchByGroup.modelType=PS -report.psObservationAccessoryCatchByGroup.name=Observations - Dénombrement des captures accessoires et devenir, filtrés par groupe -report.psObservationAccessoryCatchByGroup.description=Afficher les nombres de captures accessoires par groupe d'espèce selon le type de banc et le devenir -report.psObservationAccessoryCatchByGroup.columns=Espèce, Total BL, Total BO, Sorti vivant/échappé, Sorti mort, Rejeté vivant, Rejeté mort, Partiellement conservé, Cuve, Cuisine, Autre -report.psObservationAccessoryCatchByGroup.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code -report.psObservationAccessoryCatchByGroup.request.1=0,0|row|\ +report.psObservationCatchByGroup.modelType=PS +report.psObservationCatchByGroup.name=Observations - Dénombrement des captures par devenir, filtrés par groupe +report.psObservationCatchByGroup.description=Afficher les nombres de captures par groupe d'espèce selon le type de banc et le devenir +report.psObservationCatchByGroup.columns=Espèce, Total BL, Total BO, Sorti vivant/échappé, Sorti mort, Rejeté vivant, Rejeté mort, Partiellement conservé, Cuve, Cuisine, Conservé pour le marché local ou poisson séché/salé à bord, Ailerons seulements, Rejeté statut inconnu (seulement pour l'observation électronique), Conservé à des fins scientifiques, Rejeté suffocant, Rejeté blessé, Autre +report.psObservationCatchByGroup.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code +report.psObservationCatchByGroup.request.1=0,0|row|\ Select \ concat(\ '[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \ @@ -779,6 +917,12 @@ report.psObservationAccessoryCatchByGroup.request.1=0,0|row|\ else 0.0 end), \ Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683621#0.6728026426066158' then ca.totalCount \ else 0.0 end), \ + Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1464000000000#15' then ca.totalCount else 0.0 end), \ + Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1467372855729#0.568287924081734' then ca.totalCount else 0.0 end), \ + Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1501492537510#0.9210847837998154' then ca.totalCount else 0.0 end), \ + Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1501492831539#0.9377232562184147' then ca.totalCount else 0.0 end), \ + Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1544448835551#0.620629930572886' then ca.totalCount else 0.0 end), \ + Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1544448977865#0.24265421995390768' then ca.totalCount else 0.0 end), \ Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.9931091059863436' then 0.0 \ when 'fr.ird.referential.ps.common.SpeciesFate#1239832683618#0.06155887805368032' then 0.0 \ when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.11883784875534997' then 0.0 \ @@ -787,6 +931,12 @@ report.psObservationAccessoryCatchByGroup.request.1=0,0|row|\ when 'fr.ird.referential.ps.common.SpeciesFate#1239832683620#0.46609703818634485' then 0.0 \ when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5722739932065866' then 0.0 \ when 'fr.ird.referential.ps.common.SpeciesFate#1239832683621#0.6728026426066158' then 0.0 \ + when 'fr.ird.referential.ps.common.SpeciesFate#1464000000000#15' then 0.0 \ + when 'fr.ird.referential.ps.common.SpeciesFate#1467372855729#0.568287924081734' then 0.0 \ + when 'fr.ird.referential.ps.common.SpeciesFate#1501492537510#0.9210847837998154' then 0.0 \ + when 'fr.ird.referential.ps.common.SpeciesFate#1501492831539#0.9377232562184147' then 0.0 \ + when 'fr.ird.referential.ps.common.SpeciesFate#1544448835551#0.620629930572886' then 0.0 \ + when 'fr.ird.referential.ps.common.SpeciesFate#1544448977865#0.24265421995390768' then 0.0 \ else ca.totalCount end) \ From TripImpl m \ Join m.routeObs r \ @@ -799,14 +949,13 @@ report.psObservationAccessoryCatchByGroup.request.1=0,0|row|\ Group by e \ Order By e.homeId ########################################################### -## Distribution des tailles par espèces non ciblées +## Distribution des tailles par espèces et type de mesure ########################################################### -report.psObservationNonTargetDistributionLengths.modelType=PS -report.psObservationNonTargetDistributionLengths.name=Observations - Distribution des tailles par espèces non ciblées -report.psObservationNonTargetDistributionLengths.description=Afficher la nombre d'individus mesurés par classe de taille pour les espèces non ciblées -report.psObservationNonTargetDistributionLengths.columns=Classe de taille,Effectif -report.psObservationNonTargetDistributionLengths.operations.1=GroupByLength -report.psObservationNonTargetDistributionLengths.variable.speciesId=fr.ird.observe.dto.referential.common.SpeciesDto|\ +report.psObservationLengthsDistribution.modelType=PS +report.psObservationLengthsDistribution.name=Observations - Distribution des tailles par espèces et type de mesure +report.psObservationLengthsDistribution.description=Afficher la nombre d'individus mesurés par classe de taille pour les espèces et le type de mesure +report.psObservationLengthsDistribution.operations.1=ComputePsObservationLengthsDistribution +report.psObservationLengthsDistribution.variable.1.species=fr.ird.observe.dto.referential.common.SpeciesDto|\ Select distinct ntl.species \ From TripImpl t \ Join t.routeObs r \ @@ -814,133 +963,32 @@ Join r.activity a \ Join a.set.sample nts \ Join nts.sampleMeasure ntl \ Where t.id In :tripId -report.psObservationNonTargetDistributionLengths.request.1=0,0|row| \ -Select ntl.length, sum(ntl.count) \ +report.psObservationLengthsDistribution.variable.2.sizeMeasureType=fr.ird.observe.dto.referential.common.SizeMeasureTypeDto|\ +Select distinct ntl.sizeMeasureType \ From TripImpl t \ Join t.routeObs r \ Join r.activity a \ Join a.set.sample nts \ Join nts.sampleMeasure ntl \ -Where t.id In :tripId \ -And ntl.species.id = :speciesId \ -Group By ntl.length \ -Order By ntl.length -#################################################################### -## Distribution des tailles des conservés par espèces ciblées (LD1) -#################################################################### -report.psObservationTargetStoredDistributionLengthsLD1.modelType=PS -report.psObservationTargetStoredDistributionLengthsLD1.name=Observations - Distribution des tailles des captures par espèces ciblées (mesure LD1) -report.psObservationTargetStoredDistributionLengthsLD1.description=Afficher le nombre d'individus capturés, mesurés par classe de taille LD1 pour les espèces ciblées -report.psObservationTargetStoredDistributionLengthsLD1.columns=Classe de taille,Effectif -report.psObservationTargetStoredDistributionLengthsLD1.operations.1=GroupByLength -report.psObservationTargetStoredDistributionLengthsLD1.variable.speciesId=fr.ird.observe.dto.referential.common.SpeciesDto|\ -Select distinct tl.species \ -From TripImpl t \ -Join t.routeObs r \ -Join r.activity a \ -Join a.set.sample ts \ -Join ts.sampleMeasure tl \ -Where t.id In :tripId \ -And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499466774#0.529249255312607' -report.psObservationTargetStoredDistributionLengthsLD1.request.1=0,0|row| \ -Select tl.length , Sum(tl.count) \ -From TripImpl t \ -Join t.routeObs r \ -Join r.activity a \ -Join a.set.sample ts \ -Join ts.sampleMeasure tl \ -Where t.id In :tripId \ - And tl.species.id = :speciesId \ - And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499466774#0.529249255312607' \ -Group By tl.length \ -Order By tl.length -################################################################ -## Distribution des tailles des rejets par espèces ciblées (LD1) -################################################################ -report.psObservationTargetDiscardedDistributionLengthsLD1.modelType=PS -report.psObservationTargetDiscardedDistributionLengthsLD1.name=Observations - Distribution des tailles des rejets par espèces ciblées (mesure LD1) -report.psObservationTargetDiscardedDistributionLengthsLD1.description=Afficher la nombre d'individus rejetés, mesurés par classe de taille LD1 pour les espèces ciblées -report.psObservationTargetDiscardedDistributionLengthsLD1.columns=Classe de taille,Effectif -report.psObservationTargetDiscardedDistributionLengthsLD1.operations.1=GroupByLength -report.psObservationTargetDiscardedDistributionLengthsLD1.variable.speciesId=fr.ird.observe.dto.referential.common.SpeciesDto|\ -Select distinct tl.species \ -From TripImpl t \ -Join t.routeObs r \ -Join r.activity a \ -Join a.set.sample ts \ -Join ts.sampleMeasure tl \ -Where t.id In :tripId \ -And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499466774#0.529249255312607' -report.psObservationTargetDiscardedDistributionLengthsLD1.request.1=0,0|row| \ -Select tl.length , Sum(tl.count) \ -From TripImpl t \ -Join t.routeObs r \ -Join r.activity a \ -Join a.set.sample ts \ -Join ts.sampleMeasure tl \ -Where t.id In :tripId \ - And tl.species.id = :speciesId \ - And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499466774#0.529249255312607'\ -Group By tl.length \ -Order By tl.length -############################################################### -## Distribution des tailles des conservés par espèces ciblées (LF) -############################################################### -report.psObservationTargetStoredDistributionLengthsLF.modelType=PS -report.psObservationTargetStoredDistributionLengthsLF.name=Observations - Distribution des tailles des captures par espèces ciblées (mesure LF) -report.psObservationTargetStoredDistributionLengthsLF.description=Afficher le nombre d'individus capturés, mesurés par classe de taille LF pour les espèces ciblées -report.psObservationTargetStoredDistributionLengthsLF.columns=Classe de taille,Effectif -report.psObservationTargetStoredDistributionLengthsLF.operations.1=GroupByLength -report.psObservationTargetStoredDistributionLengthsLF.variable.speciesId=fr.ird.observe.dto.referential.common.SpeciesDto|\ -Select distinct tl.species \ -From TripImpl t \ -Join t.routeObs r \ -Join r.activity a \ -Join a.set.sample ts \ -Join ts.sampleMeasure tl \ -Where t.id In :tripId \ -And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336' -report.psObservationTargetStoredDistributionLengthsLF.request.1=0,0|row| \ -Select tl.length , Sum(tl.count) \ -From TripImpl t \ -Join t.routeObs r \ -Join r.activity a \ -Join a.set.sample ts \ -Join ts.sampleMeasure tl \ -Where t.id In :tripId \ - And tl.species.id = :speciesId \ - And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336' \ -Group By tl.length \ -Order By tl.length -############################################################### -## Distribution des tailles des rejets par espèces ciblées (LF) -############################################################### -report.psObservationTargetDiscardedDistributionLengthsLF.modelType=PS -report.psObservationTargetDiscardedDistributionLengthsLF.name=Observations - Distribution des tailles des rejets par espèces ciblées (mesure LF) -report.psObservationTargetDiscardedDistributionLengthsLF.description=Afficher le nombre d'individus rejetés, mesurés par classe de taille LF pour les espèces ciblées -report.psObservationTargetDiscardedDistributionLengthsLF.columns=Classe de taille,Effectif -report.psObservationTargetDiscardedDistributionLengthsLF.operations.1=GroupByLength -report.psObservationTargetDiscardedDistributionLengthsLF.variable.speciesId=fr.ird.observe.dto.referential.common.SpeciesDto|\ -Select distinct tl.species \ +Where t.id In :tripId +report.psObservationLengthsDistribution.repeatVariable.speciesFate=fr.ird.observe.entities.referential.ps.common.SpeciesFate|\ +Select distinct sf \ From TripImpl t \ Join t.routeObs r \ Join r.activity a \ -Join a.set.sample ts \ -Join ts.sampleMeasure tl \ -Where t.id In :tripId \ -And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336' -report.psObservationTargetDiscardedDistributionLengthsLF.request.1=0,0|row| \ -Select tl.length , Sum(tl.count) \ +Join a.set.sample nts \ +Join nts.sampleMeasure ntl with ntl.species.id = :species And ntl.sizeMeasureType.id = :sizeMeasureType \ +Left Join ntl.speciesFate sf \ +Where t.id In :tripId +report.psObservationLengthsDistribution.repeatVariable.length=java.lang.Float|\ +Select distinct ntl.length \ From TripImpl t \ Join t.routeObs r \ Join r.activity a \ -Join a.set.sample ts \ -Join ts.sampleMeasure tl \ +Join a.set.sample nts \ +Join nts.sampleMeasure ntl with ntl.species.id = :species And ntl.sizeMeasureType.id = :sizeMeasureType \ Where t.id In :tripId \ - And tl.species.id = :speciesId \ - And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336' \ -Group By tl.length \ -Order By tl.length +Order By ntl.length ############################################ ## Répartition des calées par cuves ############################################ ===================================== core/persistence/java/src/main/java/fr/ird/observe/spi/report/ComputePsObservationLengthsDistribution.java ===================================== @@ -0,0 +1,161 @@ +package fr.ird.observe.spi.report; + +/*- + * #%L + * ObServe Core :: Persistence :: Java + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.auto.service.AutoService; +import fr.ird.observe.dto.report.DataMatrix; +import fr.ird.observe.dto.report.Report; +import fr.ird.observe.dto.report.ReportOperationConsumer; +import fr.ird.observe.dto.report.ReportRequestExecutor; +import fr.ird.observe.dto.report.ReportVariable; +import fr.ird.observe.entities.referential.ps.common.SpeciesFate; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; + +/** + * Created on 13/11/2022. + * + * @author Tony Chemit - dev@tchemit.fr + * @since 9.0.17 + */ +@AutoService(ReportOperationConsumer.class) +public class ComputePsObservationLengthsDistribution implements ReportOperationConsumer { + + /** + * To get total count per length. + */ + public static final String TOTAL_COUNT_REQUEST = "" + + "Select sum(ntl.count) \n" + + "From TripImpl t \n" + + "Join t.routeObs r \n" + + "Join r.activity a \n" + + "Join a.set.sample nts \n" + + "Join nts.sampleMeasure ntl With ntl.species.id = :species And ntl.sizeMeasureType.id = :sizeMeasureType \n" + + "Where t.id In :tripId \n" + + "Group By ntl.length \n" + + "Order By ntl.length"; + + /** + * To get species fate count per length + */ + public static final String SPECIES_FATE_COUNT_REQUEST = "" + + "Select ntl.length, sum(ntl.count) \n" + + "From TripImpl t \n" + + "Join t.routeObs r \n" + + "Join r.activity a \n" + + "Join a.set.sample nts \n" + + "Join nts.sampleMeasure ntl With ntl.species.id = :species And ntl.sizeMeasureType.id = :sizeMeasureType And ntl.speciesFate.id = :speciesFate\n" + + "Where t.id In :tripId \n" + + "Group By ntl.length \n" + + "Order By ntl.length"; + + /** + * To get null species fate count per length + */ + public static final String NULL_SPECIES_FATE_COUNT_REQUEST = "" + + "Select ntl.length, sum(ntl.count) \n" + + "From TripImpl t \n" + + "Join t.routeObs r \n" + + "Join r.activity a \n" + + "Join a.set.sample nts \n" + + "Join nts.sampleMeasure ntl With ntl.species.id = :species And ntl.sizeMeasureType.id = :sizeMeasureType And ntl.speciesFate Is Null\n" + + "Where t.id In :tripId \n" + + "Group By ntl.length \n" + + "Order By ntl.length"; + + @Override + public DataMatrix consume(String parameters, ReportRequestExecutor requestExecutor, Report report, Set<String> tripId, DataMatrix incoming) { + + Map<String, Object> queryParameters = new TreeMap<>(); + queryParameters.put("tripId", tripId); + for (ReportVariable<?> variable : report.getVariables()) { + queryParameters.put(variable.getName(), variable.getSelectedValue()); + } + + Set<SpeciesFate> speciesFateList = report.<SpeciesFate>getRepeatVariable("speciesFate").getValues(); + List<String> lengthList = report.getRepeatVariable("length").getValues().stream().map(Object::toString).collect(Collectors.toList()); + + DataMatrix result = createTmpMatrix(0, 0, 2 + speciesFateList.size(), 1 + lengthList.size()); + boolean useNullSpeciesFate = speciesFateList.remove(null); + int columnIndex = 0; + fillLengthsColumn(result, columnIndex++, lengthList); + + for (SpeciesFate speciesFate : speciesFateList) { + fillSpeciesFateCountColumn(result, columnIndex++, queryParameters, speciesFate, lengthList, requestExecutor); + } + + if (useNullSpeciesFate) { + fillSpeciesFateCountColumn(result, columnIndex++, queryParameters, null, lengthList, requestExecutor); + } + + fillTotalCountColumn(result, columnIndex, queryParameters, requestExecutor); + + return result; + } + + private void fillLengthsColumn(DataMatrix result, int columnIndex, List<String> lengthList) { + int index = 0; + result.setValue(columnIndex, index++, "Classe de taille (cm)"); + for (String length : lengthList) { + result.setValue(columnIndex, index++, length); + } + } + + private void fillSpeciesFateCountColumn(DataMatrix result, int columnIndex, Map<String, Object> queryParameters, SpeciesFate speciesFate, List<String> lengthList, ReportRequestExecutor requestExecutor) { + String header; + List<Object[]> rows; + if (speciesFate == null) { + header = "Aucun"; + queryParameters.remove("speciesFate"); + rows = requestExecutor.executeRequest(NULL_SPECIES_FATE_COUNT_REQUEST, queryParameters); + } else { + header = speciesFate.getLabel2(); + queryParameters.put("speciesFate", speciesFate.getId()); + rows = requestExecutor.executeRequest(SPECIES_FATE_COUNT_REQUEST, queryParameters); + } + result.setValue(columnIndex, 0, String.format("Effectif ( devenir - %s )", header)); + + for (Object[] row : rows) { + String length = row[0].toString(); + Number count = (Number) row[1]; + int index = lengthList.indexOf(length); + result.setValue(columnIndex, index + 1, count); + } + } + + private void fillTotalCountColumn(DataMatrix result, int columnIndex, Map<String, Object> queryParameters, ReportRequestExecutor requestExecutor) { + result.setValue(columnIndex, 0, "Effectif total"); + List<Object> rows = requestExecutor.executeRequest(TOTAL_COUNT_REQUEST, queryParameters); + int index = 1; + for (Object row : rows) { + Number count = (Number) row; + result.setValue(columnIndex, index++, count); + } + } + +} + ===================================== core/services/local/src/test/java/fr/ird/observe/services/local/service/ReportServiceLocalReadTest.java deleted ===================================== @@ -1,38 +0,0 @@ -package fr.ird.observe.services.local.service; - -/*- - * #%L - * ObServe Core :: Services :: Local - * %% - * Copyright (C) 2008 - 2022 IRD, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.services.service.ReportServiceFixtures; -import org.junit.AfterClass; - -public class ReportServiceLocalReadTest extends GeneratedReportServiceLocalReadTest { - - @AfterClass - public static void afterClass() { - if (!ReportServiceFixtures.WITH_ASSERT) { - System.out.println("New asserts:\n" + String.join("\n", ReportServiceFixtures.getAsserts())); - ReportServiceFixtures.getAsserts().clear(); - } - } - -} ===================================== core/services/test/src/main/java/fr/ird/observe/services/service/ReportFixture.java ===================================== @@ -76,6 +76,7 @@ public abstract class ReportFixture { } public final DataMatrix execute(ReportService service, Report report) { + log.warn("Starting report {}", report.getName()); return service.executeReport(report, getTripIds()); } @@ -127,6 +128,8 @@ public abstract class ReportFixture { for (int i = 0; i < rows; i++) { ReportServiceFixtures.writeArrayAssert(String.format("result.%d", i), actual.getData()[i]); } + System.out.println("New asserts:\n" + String.join("\n", ReportServiceFixtures.getAsserts())); + ReportServiceFixtures.getAsserts().clear(); } } @@ -159,7 +162,11 @@ public abstract class ReportFixture { Assert.assertEquals(rows, report.getRows()); Assert.assertEquals(columns, report.getColumns()); - Assert.assertArrayEquals(columnsHeader, report.getColumnHeaders()); + if (report.getColumnHeaders() == null) { + Assert.assertEquals(0, columnsHeader.length); + } else { + Assert.assertArrayEquals(columnsHeader, report.getColumnHeaders()); + } if (report.getRowHeaders() == null) { Assert.assertEquals(0, rowsHeader.length); } else { @@ -168,7 +175,11 @@ public abstract class ReportFixture { } else { ReportServiceFixtures.addAssert("syntax.rows", report.getRows()); ReportServiceFixtures.addAssert("syntax.columns", report.getColumns()); - ReportServiceFixtures.writeArrayAssert("syntax.columnsHeader", (Object[]) report.getColumnHeaders()); + if (report.getRowHeaders() == null) { + ReportServiceFixtures.writeArrayAssert("syntax.columnsHeader"); + } else { + ReportServiceFixtures.writeArrayAssert("syntax.columnsHeader", (Object[]) report.getColumnHeaders()); + } if (report.getRowHeaders() == null) { ReportServiceFixtures.writeArrayAssert("syntax.rowsHeader"); } else { ===================================== core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationAccessoryCatchByGroupReportFixture.java → core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchByGroupReportFixture.java ===================================== @@ -35,7 +35,7 @@ import java.util.Iterator; * @since 1.9 */ @AutoService(ReportFixture.class) -public class PsObservationAccessoryCatchByGroupReportFixture extends ReportFixture { +public class PsObservationCatchByGroupReportFixture extends ReportFixture { @Override public void assertSyntax(Report report) { ===================================== core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetStoredDistributionLengthsLFReportFixture.java → core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationLengthsDistributionReportFixture.java ===================================== @@ -24,24 +24,21 @@ package fr.ird.observe.services.service.report.ps; import com.google.auto.service.AutoService; import fr.ird.observe.dto.report.Report; -import fr.ird.observe.dto.report.ReportRequest; import fr.ird.observe.services.service.ReportFixture; -import java.util.Iterator; - /** - * Created on 17/02/2021. + * Created on 13/11/2022. * * @author Tony Chemit - dev@tchemit.fr - * @since 8.0.6 + * @since 9.0.17 */ @AutoService(ReportFixture.class) -public class PsObservationTargetStoredDistributionLengthsLFReportFixture extends ReportFixture { +public class PsObservationLengthsDistributionReportFixture extends ReportFixture { @Override - public void assertSyntax(Report report) { - super.assertSyntax(report); - Iterator<ReportRequest> requests = getRequestIterator(report); - assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0); + protected void setVariables(Report report) { + setVariableValue(report, "species", "fr.ird.referential.common.Species#1239832684537#0.2397229787936519"); + setVariableValue(report, "sizeMeasureType", "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336"); } } + ===================================== core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationNonTargetDistributionLengthsReportFixture.java deleted ===================================== @@ -1,47 +0,0 @@ -/* - * #%L - * ObServe Core :: Services :: Test - * %% - * Copyright (C) 2008 - 2022 IRD, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -package fr.ird.observe.services.service.report.ps; - - -import com.google.auto.service.AutoService; -import fr.ird.observe.dto.report.Report; -import fr.ird.observe.dto.report.ReportRequest; -import fr.ird.observe.services.service.ReportFixture; - -import java.util.Iterator; - -/** - * Test du report {@code accessoryCatch}. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 1.9 - */ -@AutoService(ReportFixture.class) -public class PsObservationNonTargetDistributionLengthsReportFixture extends ReportFixture { - - @Override - public void assertSyntax(Report report) { - super.assertSyntax(report); - Iterator<ReportRequest> requests = getRequestIterator(report); - assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0); - } -} ===================================== core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetDiscardedDistributionLengthsLD1ReportFixture.java deleted ===================================== @@ -1,47 +0,0 @@ -package fr.ird.observe.services.service.report.ps; - -/*- - * #%L - * ObServe Core :: Services :: Test - * %% - * Copyright (C) 2008 - 2022 IRD, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.auto.service.AutoService; -import fr.ird.observe.dto.report.Report; -import fr.ird.observe.dto.report.ReportRequest; -import fr.ird.observe.services.service.ReportFixture; - -import java.util.Iterator; - -/** - * Created on 17/02/2021. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 8.0.6 - */ -@AutoService(ReportFixture.class) -public class PsObservationTargetDiscardedDistributionLengthsLD1ReportFixture extends ReportFixture { - - @Override - public void assertSyntax(Report report) { - super.assertSyntax(report); - Iterator<ReportRequest> requests = getRequestIterator(report); - assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0); - } -} ===================================== core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetDiscardedDistributionLengthsLFReportFixture.java deleted ===================================== @@ -1,47 +0,0 @@ -package fr.ird.observe.services.service.report.ps; - -/*- - * #%L - * ObServe Core :: Services :: Test - * %% - * Copyright (C) 2008 - 2022 IRD, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.auto.service.AutoService; -import fr.ird.observe.dto.report.Report; -import fr.ird.observe.dto.report.ReportRequest; -import fr.ird.observe.services.service.ReportFixture; - -import java.util.Iterator; - -/** - * Created on 17/02/2021. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 8.0.6 - */ -@AutoService(ReportFixture.class) -public class PsObservationTargetDiscardedDistributionLengthsLFReportFixture extends ReportFixture { - - @Override - public void assertSyntax(Report report) { - super.assertSyntax(report); - Iterator<ReportRequest> requests = getRequestIterator(report); - assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0); - } -} ===================================== core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetStoredDistributionLengthsLD1ReportFixture.java deleted ===================================== @@ -1,47 +0,0 @@ -package fr.ird.observe.services.service.report.ps; - -/*- - * #%L - * ObServe Core :: Services :: Test - * %% - * Copyright (C) 2008 - 2022 IRD, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.auto.service.AutoService; -import fr.ird.observe.dto.report.Report; -import fr.ird.observe.dto.report.ReportRequest; -import fr.ird.observe.services.service.ReportFixture; - -import java.util.Iterator; - -/** - * Created on 17/02/2021. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 8.0.6 - */ -@AutoService(ReportFixture.class) -public class PsObservationTargetStoredDistributionLengthsLD1ReportFixture extends ReportFixture { - - @Override - public void assertSyntax(Report report) { - super.assertSyntax(report); - Iterator<ReportRequest> requests = getRequestIterator(report); - assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0); - } -} ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationAccessoryCatchByGroup.properties → core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatchByGroup.properties ===================================== @@ -19,13 +19,13 @@ # <http://www.gnu.org/licenses/gpl-3.0.html>. # #L% ### -result.0=[FAO]ALV [sc]Alopias vulpinus [fr]Renard^0^3^3^0^0^0^0^0^0^0.0 -result.columns=11 +result.0=[FAO]ALV [sc]Alopias vulpinus [fr]Renard^0^3^3^0^0^0^0^0^0^0^0^0^0^0^0^0.0 +result.columns=17 result.rows=1 -syntax.columns=11 -syntax.columnsHeader=Espèce^Total BL^Total BO^Sorti vivant/échappé^Sorti mort^Rejeté vivant^Rejeté mort^Partiellement conservé^Cuve^Cuisine^Autre -syntax.description=Afficher les nombres de captures accessoires par groupe d'espèce selon le type de banc et le devenir -syntax.name=Observations - Dénombrement des captures accessoires et devenir, filtrés par groupe +syntax.columns=17 +syntax.columnsHeader=Espèce^Total BL^Total BO^Sorti vivant/échappé^Sorti mort^Rejeté vivant^Rejeté mort^Partiellement conservé^Cuve^Cuisine^Conservé pour le marché local ou poisson séché/salé à bord^Ailerons seulements^Rejeté statut inconnu (seulement pour l'observation électronique)^Conservé à des fins scientifiques^Rejeté suffocant^Rejeté blessé^Autre +syntax.description=Afficher les nombres de captures par groupe d'espèce selon le type de banc et le devenir +syntax.name=Observations - Dénombrement des captures par devenir, filtrés par groupe syntax.nbRequests=1 syntax.rows=-1 syntax.rowsHeader= ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationNonTargetDistributionLengths.properties → core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationLengthsDistribution.properties ===================================== @@ -19,11 +19,17 @@ # <http://www.gnu.org/licenses/gpl-3.0.html>. # #L% ### -syntax.columns=2 -syntax.columnsHeader=Classe de taille^Effectif -syntax.description=Afficher la nombre d'individus mesurés par classe de taille pour les espèces non ciblées -syntax.name=Observations - Distribution des tailles par espèces non ciblées -syntax.nbRequests=1 +syntax.name=Observations - Distribution des tailles par espèces et type de mesure +syntax.description=Afficher la nombre d'individus mesurés par classe de taille pour les espèces et le type de mesure syntax.rows=-1 +syntax.columns=-1 +syntax.columnsHeader= syntax.rowsHeader= -tripIds=${PS_COMMON_TRIP},${PS_COMMON_TRIP_MOVE} +syntax.nbRequests=0 +result.columns=3 +result.rows=5 +result.0=Classe de taille (cm)^Effectif ( devenir - Aucun )^Effectif total +result.1=50.0^2^2 +result.2=54.0^1^1 +result.3=68.0^1^1 +result.4=70.0^1^1 ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetCatchByAssociation.properties ===================================== @@ -19,3 +19,17 @@ # <http://www.gnu.org/licenses/gpl-3.0.html>. # #L% ### +syntax.name=Observations - Captures de thons selon le type d’association (en t) +syntax.description=Afficher la répartitions des captures de thons selon le type d'association +syntax.rows=5 +syntax.columns=7 +syntax.columnsHeader=YFT^SKJ^BET^LTA^FRI^Autres^Total +syntax.rowsHeader=BL sans baleine^BL avec baleine^BO avec requin-baleine^BO sans requin-baleine^Total +syntax.nbRequests=4 +result.columns=7 +result.rows=5 +result.0=175.0^0.0^7.0^0.0^0.0^0.0^182.0 +result.1=null^null^null^null^null^null^0.0 +result.2=null^null^null^null^null^null^0.0 +result.3=0.0^1.0^0.0^0.0^1.0^12.1406^14.1406 +result.4=175.0^1.0^7.0^0.0^1.0^12.1406^196.1406 \ No newline at end of file ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetDiscardedByAssociation.properties ===================================== @@ -19,11 +19,11 @@ # <http://www.gnu.org/licenses/gpl-3.0.html>. # #L% ### -result.0=175.0^0.0^7.0^0.0^0.0^0.2882^182.2882 +result.0=0.0^0.0^0.0^0.0^0.0^0.2882^0.2882 result.1=null^null^null^null^null^null^0.0 result.2=null^null^null^null^null^null^0.0 -result.3=0.0^1.0^5.0^0.0^1.0^160.4436^167.4436 -result.4=175.0^1.0^12.0^0.0^1.0^160.7318^349.7318 +result.3=0.0^0.0^5.0^0.0^0.0^148.303^153.303 +result.4=0.0^0.0^5.0^0.0^0.0^148.5912^153.5912 result.columns=7 result.rows=5 syntax.columns=7 ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetDiscardedDistributionLengthsLD1.properties deleted ===================================== @@ -1,28 +0,0 @@ -### -# #%L -# ObServe Core :: Services :: Test -# %% -# Copyright (C) 2008 - 2022 IRD, Ultreia.io -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -syntax.columns=2 -syntax.columnsHeader=Classe de taille^Effectif -syntax.description=Afficher la nombre d'individus rejetés, mesurés par classe de taille LD1 pour les espèces ciblées -syntax.name=Observations - Distribution des tailles des rejets par espèces ciblées (mesure LD1) -syntax.nbRequests=1 -syntax.rows=-1 -syntax.rowsHeader= ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetDiscardedDistributionLengthsLF.properties deleted ===================================== @@ -1,28 +0,0 @@ -### -# #%L -# ObServe Core :: Services :: Test -# %% -# Copyright (C) 2008 - 2022 IRD, Ultreia.io -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -syntax.columns=2 -syntax.columnsHeader=Classe de taille^Effectif -syntax.description=Afficher le nombre d'individus rejetés, mesurés par classe de taille LF pour les espèces ciblées -syntax.name=Observations - Distribution des tailles des rejets par espèces ciblées (mesure LF) -syntax.nbRequests=1 -syntax.rows=-1 -syntax.rowsHeader= ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetStoredDistributionLengthsLD1.properties deleted ===================================== @@ -1,28 +0,0 @@ -### -# #%L -# ObServe Core :: Services :: Test -# %% -# Copyright (C) 2008 - 2022 IRD, Ultreia.io -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -syntax.columns=2 -syntax.columnsHeader=Classe de taille^Effectif -syntax.description=Afficher le nombre d'individus capturés, mesurés par classe de taille LD1 pour les espèces ciblées -syntax.name=Observations - Distribution des tailles des captures par espèces ciblées (mesure LD1) -syntax.nbRequests=1 -syntax.rows=-1 -syntax.rowsHeader= ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationTargetStoredDistributionLengthsLF.properties deleted ===================================== @@ -1,28 +0,0 @@ -### -# #%L -# ObServe Core :: Services :: Test -# %% -# Copyright (C) 2008 - 2022 IRD, Ultreia.io -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -syntax.columns=2 -syntax.columnsHeader=Classe de taille^Effectif -syntax.description=Afficher le nombre d'individus capturés, mesurés par classe de taille LF pour les espèces ciblées -syntax.name=Observations - Distribution des tailles des captures par espèces ciblées (mesure LF) -syntax.nbRequests=1 -syntax.rows=-1 -syntax.rowsHeader= ===================================== toolkit/api/src/main/java/fr/ird/observe/dto/report/DataMatrix.java ===================================== @@ -159,7 +159,13 @@ public class DataMatrix implements JsonAware { log.debug(String.format("copying incoming matrix (dim: %s, location: %s)", incoming.getDimension(), incoming.getLocation())); for (int i = 0; i < width; i++) { + if (x + i < 0) { + continue; + } for (int j = 0; j < height; j++) { + if (y + j < 0) { + continue; + } Serializable value = incoming.getValue(i, j); setValue(x + i, y + j, value); } ===================================== toolkit/api/src/main/java/fr/ird/observe/dto/report/ReportBuilder.java ===================================== @@ -319,12 +319,14 @@ public class ReportBuilder { Map.Entry<String, String> entry = itr.next(); String key = entry.getKey(); if (!key.startsWith(VARIABLE_PREFIX)) { - continue; } String operations = entry.getValue(); String id = key.substring(VARIABLE_PREFIX.length()); - + int indexOf = id.indexOf("."); + if (indexOf > -1) { + id = id.substring(indexOf + 1); + } // on interdit la surcharge d'une variable déjà trouvée pour le report if (ids.contains(id)) { throw new IllegalArgumentException("La variable " + id + " est déjà définie pour le report " + reportName); @@ -359,12 +361,14 @@ public class ReportBuilder { Map.Entry<String, String> entry = itr.next(); String key = entry.getKey(); if (!key.startsWith(REPEAT_VARIABLE_PREFIX)) { - continue; } String operations = entry.getValue(); String id = key.substring(REPEAT_VARIABLE_PREFIX.length()); - + int indexOf = id.indexOf("."); + if (indexOf > -1) { + id = id.substring(indexOf + 1); + } // on interdit la surcharge d'une variable déjà trouvée pour le report if (ids.contains(id)) { throw new IllegalArgumentException("La variable de répétition " + id + " est déjà définie pour le report " + reportName); View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/0ae68cbfaca820bd5ebd103e7... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/0ae68cbfaca820bd5ebd103e7... You're receiving this email because of your account on gitlab.com.