Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe
Commits:
-
5973b503
by Tony Chemit at 2022-11-14T13:38:45+01:00
-
5829f08b
by Tony Chemit at 2022-11-14T13:38:45+01:00
-
21b35310
by Tony Chemit at 2022-11-14T13:38:45+01:00
-
246f57a8
by Tony Chemit at 2022-11-14T13:38:45+01:00
-
832e14f1
by Tony Chemit at 2022-11-14T13:38:45+01:00
-
78659144
by Tony Chemit at 2022-11-14T13:38:45+01:00
16 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/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-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-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:
| ... | ... | @@ -43,10 +43,10 @@ import java.net.URL; |
| 43 | 43 | import java.nio.file.Files;
|
| 44 | 44 | import java.util.Collections;
|
| 45 | 45 | import java.util.Date;
|
| 46 | +import java.util.LinkedHashMap;
|
|
| 46 | 47 | import java.util.List;
|
| 47 | 48 | import java.util.Map;
|
| 48 | 49 | import java.util.Objects;
|
| 49 | -import java.util.TreeMap;
|
|
| 50 | 50 | import java.util.stream.Collectors;
|
| 51 | 51 | |
| 52 | 52 | /**
|
| ... | ... | @@ -81,7 +81,7 @@ public class ReportModel extends AdminActionModel { |
| 81 | 81 | /**
|
| 82 | 82 | * les variables utilisées pour le report.
|
| 83 | 83 | */
|
| 84 | - protected final Map<String, Object> variables;
|
|
| 84 | + protected final Map<String, Object> variables = new LinkedHashMap<>();
|
|
| 85 | 85 | /**
|
| 86 | 86 | * la fichier contenant la définition des reports.
|
| 87 | 87 | */
|
| ... | ... | @@ -128,7 +128,6 @@ public class ReportModel extends AdminActionModel { |
| 128 | 128 | |
| 129 | 129 | public ReportModel() {
|
| 130 | 130 | super(AdminStep.REPORT);
|
| 131 | - variables = new TreeMap<>();
|
|
| 132 | 131 | // quand le type de modèle change, on mets à jour les rapports disponibles
|
| 133 | 132 | addPropertyChangeListener(REPORT_FILE_PROPERTY_NAME, evt -> updateReports());
|
| 134 | 133 | }
|
| ... | ... | @@ -149,12 +149,11 @@ public class ResultTableModel extends AbstractTableModel { |
| 149 | 149 | rowNames.addAll(Arrays.asList(report.getRowHeaders()));
|
| 150 | 150 | }
|
| 151 | 151 | |
| 152 | - withColumnHeader = !columnNames.isEmpty();
|
|
| 153 | - withRowHeader = !rowNames.isEmpty();
|
|
| 154 | - table.setTableHeader(!withColumnHeader ? null : tableHeader);
|
|
| 155 | - table.createDefaultColumnsFromModel();
|
|
| 156 | 152 | int nbRows = incomingData.getHeight();
|
| 157 | 153 | int nbCols = incomingData.getWidth();
|
| 154 | + |
|
| 155 | + withColumnHeader = !columnNames.isEmpty();
|
|
| 156 | + withRowHeader = !rowNames.isEmpty();
|
|
| 158 | 157 | if (withRowHeader) {
|
| 159 | 158 | // on ajoute une première colonne aux données
|
| 160 | 159 | nbCols += 1;
|
| ... | ... | @@ -162,6 +161,22 @@ public class ResultTableModel extends AbstractTableModel { |
| 162 | 161 | incomingData.setX(1);
|
| 163 | 162 | }
|
| 164 | 163 | |
| 164 | + if (!withColumnHeader && !withRowHeader) {
|
|
| 165 | + // let's say we always use columns from incomingData
|
|
| 166 | + table.setTableHeader(tableHeader);
|
|
| 167 | + for (int i = 0; i < nbCols; i++) {
|
|
| 168 | + columnNames.add((String) incomingData.getValue(i, 0));
|
|
| 169 | + }
|
|
| 170 | + incomingData.setY(-1);
|
|
| 171 | + withColumnHeader = true;
|
|
| 172 | + nbRows--;
|
|
| 173 | + |
|
| 174 | + } else {
|
|
| 175 | + table.setTableHeader(!withColumnHeader ? null : tableHeader);
|
|
| 176 | + }
|
|
| 177 | + table.createDefaultColumnsFromModel();
|
|
| 178 | + |
|
| 179 | + |
|
| 165 | 180 | data.setHeight(nbRows);
|
| 166 | 181 | data.setWidth(nbCols);
|
| 167 | 182 | |
| ... | ... | @@ -185,7 +200,9 @@ public class ResultTableModel extends AbstractTableModel { |
| 185 | 200 | } else if (withColumnHeader) {
|
| 186 | 201 | |
| 187 | 202 | }
|
| 188 | - data.copyData(incomingData);
|
|
| 203 | + if (nbCols > 0) {
|
|
| 204 | + data.copyData(incomingData);
|
|
| 205 | + }
|
|
| 189 | 206 | fireTableStructureChanged();
|
| 190 | 207 | table.revalidate();
|
| 191 | 208 | table.repaint();
|
| ... | ... | @@ -220,7 +237,7 @@ public class ResultTableModel extends AbstractTableModel { |
| 220 | 237 | }
|
| 221 | 238 | |
| 222 | 239 | public String getClipboardContent(boolean copyRowHeaders, boolean copyColumnHeaders) {
|
| 223 | - return getDataContent(copyRowHeaders, copyColumnHeaders, true,'\t');
|
|
| 240 | + return getDataContent(copyRowHeaders, copyColumnHeaders, true, '\t');
|
|
| 224 | 241 | }
|
| 225 | 242 | |
| 226 | 243 | public String getCsvContent() {
|
| ... | ... | @@ -157,8 +157,8 @@ report.psObservationFobUsageMinimal.request.3=2,0|row|\ |
| 157 | 157 | Where \
|
| 158 | 158 | m.id In :tripId \
|
| 159 | 159 | and dcp.computedWhenArrivingSimplifiedObjectType = :typeObjetId \
|
| 160 | - and a.vesselActivity.id != 'fr.ird.referential.ps.common.VesselActivity#1239832675369#0.12552908048322586'
|
|
| 161 | -and (dcp.objectOperation.id = 'fr.ird.referential.ps.common.ObjectOperation#0#2' \
|
|
| 160 | + and a.vesselActivity.id != 'fr.ird.referential.ps.common.VesselActivity#1239832675369#0.12552908048322586' \
|
|
| 161 | + and (dcp.objectOperation.id = 'fr.ird.referential.ps.common.ObjectOperation#0#2' \
|
|
| 162 | 162 | or dcp.objectOperation.id = 'fr.ird.referential.ps.common.ObjectOperation#0#8' \
|
| 163 | 163 | or dcp.objectOperation.id = 'fr.ird.referential.ps.common.ObjectOperation#0#4' \
|
| 164 | 164 | or dcp.objectOperation.id = 'fr.ird.referential.ps.common.ObjectOperation#0#5' \
|
| ... | ... | @@ -949,14 +949,13 @@ report.psObservationCatchByGroup.request.1=0,0|row|\ |
| 949 | 949 | Group by e \
|
| 950 | 950 | Order By e.homeId
|
| 951 | 951 | ###########################################################
|
| 952 | -## Distribution des tailles par espèces non ciblées
|
|
| 952 | +## Distribution des tailles par espèces et type de mesure
|
|
| 953 | 953 | ###########################################################
|
| 954 | -report.psObservationNonTargetDistributionLengths.modelType=PS
|
|
| 955 | -report.psObservationNonTargetDistributionLengths.name=Observations - Distribution des tailles par espèces non ciblées
|
|
| 956 | -report.psObservationNonTargetDistributionLengths.description=Afficher la nombre d'individus mesurés par classe de taille pour les espèces non ciblées
|
|
| 957 | -report.psObservationNonTargetDistributionLengths.columns=Classe de taille,Effectif
|
|
| 958 | -report.psObservationNonTargetDistributionLengths.operations.1=GroupByLength
|
|
| 959 | -report.psObservationNonTargetDistributionLengths.variable.speciesId=fr.ird.observe.dto.referential.common.SpeciesDto|\
|
|
| 954 | +report.psObservationLengthsDistribution.modelType=PS
|
|
| 955 | +report.psObservationLengthsDistribution.name=Observations - Distribution des tailles par espèces et type de mesure
|
|
| 956 | +report.psObservationLengthsDistribution.description=Afficher la nombre d'individus mesurés par classe de taille pour les espèces et le type de mesure
|
|
| 957 | +report.psObservationLengthsDistribution.operations.1=ComputePsObservationLengthsDistribution
|
|
| 958 | +report.psObservationLengthsDistribution.variable.1.species=fr.ird.observe.dto.referential.common.SpeciesDto|\
|
|
| 960 | 959 | Select distinct ntl.species \
|
| 961 | 960 | From TripImpl t \
|
| 962 | 961 | Join t.routeObs r \
|
| ... | ... | @@ -964,133 +963,32 @@ Join r.activity a \ |
| 964 | 963 | Join a.set.sample nts \
|
| 965 | 964 | Join nts.sampleMeasure ntl \
|
| 966 | 965 | Where t.id In :tripId
|
| 967 | -report.psObservationNonTargetDistributionLengths.request.1=0,0|row| \
|
|
| 968 | -Select ntl.length, sum(ntl.count) \
|
|
| 966 | +report.psObservationLengthsDistribution.variable.2.sizeMeasureType=fr.ird.observe.dto.referential.common.SizeMeasureTypeDto|\
|
|
| 967 | +Select distinct ntl.sizeMeasureType \
|
|
| 969 | 968 | From TripImpl t \
|
| 970 | 969 | Join t.routeObs r \
|
| 971 | 970 | Join r.activity a \
|
| 972 | 971 | Join a.set.sample nts \
|
| 973 | 972 | Join nts.sampleMeasure ntl \
|
| 974 | -Where t.id In :tripId \
|
|
| 975 | -And ntl.species.id = :speciesId \
|
|
| 976 | -Group By ntl.length \
|
|
| 977 | -Order By ntl.length
|
|
| 978 | -####################################################################
|
|
| 979 | -## Distribution des tailles des conservés par espèces ciblées (LD1)
|
|
| 980 | -####################################################################
|
|
| 981 | -report.psObservationTargetStoredDistributionLengthsLD1.modelType=PS
|
|
| 982 | -report.psObservationTargetStoredDistributionLengthsLD1.name=Observations - Distribution des tailles des captures par espèces ciblées (mesure LD1)
|
|
| 983 | -report.psObservationTargetStoredDistributionLengthsLD1.description=Afficher le nombre d'individus capturés, mesurés par classe de taille LD1 pour les espèces ciblées
|
|
| 984 | -report.psObservationTargetStoredDistributionLengthsLD1.columns=Classe de taille,Effectif
|
|
| 985 | -report.psObservationTargetStoredDistributionLengthsLD1.operations.1=GroupByLength
|
|
| 986 | -report.psObservationTargetStoredDistributionLengthsLD1.variable.speciesId=fr.ird.observe.dto.referential.common.SpeciesDto|\
|
|
| 987 | -Select distinct tl.species \
|
|
| 988 | -From TripImpl t \
|
|
| 989 | -Join t.routeObs r \
|
|
| 990 | -Join r.activity a \
|
|
| 991 | -Join a.set.sample ts \
|
|
| 992 | -Join ts.sampleMeasure tl \
|
|
| 993 | -Where t.id In :tripId \
|
|
| 994 | -And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499466774#0.529249255312607'
|
|
| 995 | -report.psObservationTargetStoredDistributionLengthsLD1.request.1=0,0|row| \
|
|
| 996 | -Select tl.length , Sum(tl.count) \
|
|
| 997 | -From TripImpl t \
|
|
| 998 | -Join t.routeObs r \
|
|
| 999 | -Join r.activity a \
|
|
| 1000 | -Join a.set.sample ts \
|
|
| 1001 | -Join ts.sampleMeasure tl \
|
|
| 1002 | -Where t.id In :tripId \
|
|
| 1003 | - And tl.species.id = :speciesId \
|
|
| 1004 | - And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499466774#0.529249255312607' \
|
|
| 1005 | -Group By tl.length \
|
|
| 1006 | -Order By tl.length
|
|
| 1007 | -################################################################
|
|
| 1008 | -## Distribution des tailles des rejets par espèces ciblées (LD1)
|
|
| 1009 | -################################################################
|
|
| 1010 | -report.psObservationTargetDiscardedDistributionLengthsLD1.modelType=PS
|
|
| 1011 | -report.psObservationTargetDiscardedDistributionLengthsLD1.name=Observations - Distribution des tailles des rejets par espèces ciblées (mesure LD1)
|
|
| 1012 | -report.psObservationTargetDiscardedDistributionLengthsLD1.description=Afficher la nombre d'individus rejetés, mesurés par classe de taille LD1 pour les espèces ciblées
|
|
| 1013 | -report.psObservationTargetDiscardedDistributionLengthsLD1.columns=Classe de taille,Effectif
|
|
| 1014 | -report.psObservationTargetDiscardedDistributionLengthsLD1.operations.1=GroupByLength
|
|
| 1015 | -report.psObservationTargetDiscardedDistributionLengthsLD1.variable.speciesId=fr.ird.observe.dto.referential.common.SpeciesDto|\
|
|
| 1016 | -Select distinct tl.species \
|
|
| 1017 | -From TripImpl t \
|
|
| 1018 | -Join t.routeObs r \
|
|
| 1019 | -Join r.activity a \
|
|
| 1020 | -Join a.set.sample ts \
|
|
| 1021 | -Join ts.sampleMeasure tl \
|
|
| 1022 | -Where t.id In :tripId \
|
|
| 1023 | -And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499466774#0.529249255312607'
|
|
| 1024 | -report.psObservationTargetDiscardedDistributionLengthsLD1.request.1=0,0|row| \
|
|
| 1025 | -Select tl.length , Sum(tl.count) \
|
|
| 1026 | -From TripImpl t \
|
|
| 1027 | -Join t.routeObs r \
|
|
| 1028 | -Join r.activity a \
|
|
| 1029 | -Join a.set.sample ts \
|
|
| 1030 | -Join ts.sampleMeasure tl \
|
|
| 1031 | -Where t.id In :tripId \
|
|
| 1032 | - And tl.species.id = :speciesId \
|
|
| 1033 | - And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499466774#0.529249255312607'\
|
|
| 1034 | -Group By tl.length \
|
|
| 1035 | -Order By tl.length
|
|
| 1036 | -###############################################################
|
|
| 1037 | -## Distribution des tailles des conservés par espèces ciblées (LF)
|
|
| 1038 | -###############################################################
|
|
| 1039 | -report.psObservationTargetStoredDistributionLengthsLF.modelType=PS
|
|
| 1040 | -report.psObservationTargetStoredDistributionLengthsLF.name=Observations - Distribution des tailles des captures par espèces ciblées (mesure LF)
|
|
| 1041 | -report.psObservationTargetStoredDistributionLengthsLF.description=Afficher le nombre d'individus capturés, mesurés par classe de taille LF pour les espèces ciblées
|
|
| 1042 | -report.psObservationTargetStoredDistributionLengthsLF.columns=Classe de taille,Effectif
|
|
| 1043 | -report.psObservationTargetStoredDistributionLengthsLF.operations.1=GroupByLength
|
|
| 1044 | -report.psObservationTargetStoredDistributionLengthsLF.variable.speciesId=fr.ird.observe.dto.referential.common.SpeciesDto|\
|
|
| 1045 | -Select distinct tl.species \
|
|
| 1046 | -From TripImpl t \
|
|
| 1047 | -Join t.routeObs r \
|
|
| 1048 | -Join r.activity a \
|
|
| 1049 | -Join a.set.sample ts \
|
|
| 1050 | -Join ts.sampleMeasure tl \
|
|
| 1051 | -Where t.id In :tripId \
|
|
| 1052 | -And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336'
|
|
| 1053 | -report.psObservationTargetStoredDistributionLengthsLF.request.1=0,0|row| \
|
|
| 1054 | -Select tl.length , Sum(tl.count) \
|
|
| 1055 | -From TripImpl t \
|
|
| 1056 | -Join t.routeObs r \
|
|
| 1057 | -Join r.activity a \
|
|
| 1058 | -Join a.set.sample ts \
|
|
| 1059 | -Join ts.sampleMeasure tl \
|
|
| 1060 | -Where t.id In :tripId \
|
|
| 1061 | - And tl.species.id = :speciesId \
|
|
| 1062 | - And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336' \
|
|
| 1063 | -Group By tl.length \
|
|
| 1064 | -Order By tl.length
|
|
| 1065 | -###############################################################
|
|
| 1066 | -## Distribution des tailles des rejets par espèces ciblées (LF)
|
|
| 1067 | -###############################################################
|
|
| 1068 | -report.psObservationTargetDiscardedDistributionLengthsLF.modelType=PS
|
|
| 1069 | -report.psObservationTargetDiscardedDistributionLengthsLF.name=Observations - Distribution des tailles des rejets par espèces ciblées (mesure LF)
|
|
| 1070 | -report.psObservationTargetDiscardedDistributionLengthsLF.description=Afficher le nombre d'individus rejetés, mesurés par classe de taille LF pour les espèces ciblées
|
|
| 1071 | -report.psObservationTargetDiscardedDistributionLengthsLF.columns=Classe de taille,Effectif
|
|
| 1072 | -report.psObservationTargetDiscardedDistributionLengthsLF.operations.1=GroupByLength
|
|
| 1073 | -report.psObservationTargetDiscardedDistributionLengthsLF.variable.speciesId=fr.ird.observe.dto.referential.common.SpeciesDto|\
|
|
| 1074 | -Select distinct tl.species \
|
|
| 973 | +Where t.id In :tripId
|
|
| 974 | +report.psObservationLengthsDistribution.repeatVariable.speciesFate=fr.ird.observe.entities.referential.ps.common.SpeciesFate|\
|
|
| 975 | +Select distinct sf \
|
|
| 1075 | 976 | From TripImpl t \
|
| 1076 | 977 | Join t.routeObs r \
|
| 1077 | 978 | Join r.activity a \
|
| 1078 | -Join a.set.sample ts \
|
|
| 1079 | -Join ts.sampleMeasure tl \
|
|
| 1080 | -Where t.id In :tripId \
|
|
| 1081 | -And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336'
|
|
| 1082 | -report.psObservationTargetDiscardedDistributionLengthsLF.request.1=0,0|row| \
|
|
| 1083 | -Select tl.length , Sum(tl.count) \
|
|
| 979 | +Join a.set.sample nts \
|
|
| 980 | +Join nts.sampleMeasure ntl with ntl.species.id = :species And ntl.sizeMeasureType.id = :sizeMeasureType \
|
|
| 981 | +Left Join ntl.speciesFate sf \
|
|
| 982 | +Where t.id In :tripId
|
|
| 983 | +report.psObservationLengthsDistribution.repeatVariable.length=java.lang.Float|\
|
|
| 984 | +Select distinct ntl.length \
|
|
| 1084 | 985 | From TripImpl t \
|
| 1085 | 986 | Join t.routeObs r \
|
| 1086 | 987 | Join r.activity a \
|
| 1087 | -Join a.set.sample ts \
|
|
| 1088 | -Join ts.sampleMeasure tl \
|
|
| 988 | +Join a.set.sample nts \
|
|
| 989 | +Join nts.sampleMeasure ntl with ntl.species.id = :species And ntl.sizeMeasureType.id = :sizeMeasureType \
|
|
| 1089 | 990 | Where t.id In :tripId \
|
| 1090 | - And tl.species.id = :speciesId \
|
|
| 1091 | - And tl.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336' \
|
|
| 1092 | -Group By tl.length \
|
|
| 1093 | -Order By tl.length
|
|
| 991 | +Order By ntl.length
|
|
| 1094 | 992 | ############################################
|
| 1095 | 993 | ## Répartition des calées par cuves
|
| 1096 | 994 | ############################################
|
| 1 | +package fr.ird.observe.spi.report;
|
|
| 2 | + |
|
| 3 | +/*-
|
|
| 4 | + * #%L
|
|
| 5 | + * ObServe Core :: Persistence :: Java
|
|
| 6 | + * %%
|
|
| 7 | + * Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 8 | + * %%
|
|
| 9 | + * This program is free software: you can redistribute it and/or modify
|
|
| 10 | + * it under the terms of the GNU General Public License as
|
|
| 11 | + * published by the Free Software Foundation, either version 3 of the
|
|
| 12 | + * License, or (at your option) any later version.
|
|
| 13 | + *
|
|
| 14 | + * This program is distributed in the hope that it will be useful,
|
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 | + * GNU General Public License for more details.
|
|
| 18 | + *
|
|
| 19 | + * You should have received a copy of the GNU General Public
|
|
| 20 | + * License along with this program. If not, see
|
|
| 21 | + * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 | + * #L%
|
|
| 23 | + */
|
|
| 24 | + |
|
| 25 | +import com.google.auto.service.AutoService;
|
|
| 26 | +import fr.ird.observe.dto.report.DataMatrix;
|
|
| 27 | +import fr.ird.observe.dto.report.Report;
|
|
| 28 | +import fr.ird.observe.dto.report.ReportOperationConsumer;
|
|
| 29 | +import fr.ird.observe.dto.report.ReportRequestExecutor;
|
|
| 30 | +import fr.ird.observe.dto.report.ReportVariable;
|
|
| 31 | +import fr.ird.observe.entities.referential.ps.common.SpeciesFate;
|
|
| 32 | + |
|
| 33 | +import java.util.List;
|
|
| 34 | +import java.util.Map;
|
|
| 35 | +import java.util.Set;
|
|
| 36 | +import java.util.TreeMap;
|
|
| 37 | +import java.util.stream.Collectors;
|
|
| 38 | + |
|
| 39 | +/**
|
|
| 40 | + * Created on 13/11/2022.
|
|
| 41 | + *
|
|
| 42 | + * @author Tony Chemit - dev@tchemit.fr
|
|
| 43 | + * @since 9.0.17
|
|
| 44 | + */
|
|
| 45 | +@AutoService(ReportOperationConsumer.class)
|
|
| 46 | +public class ComputePsObservationLengthsDistribution implements ReportOperationConsumer {
|
|
| 47 | + |
|
| 48 | + /**
|
|
| 49 | + * To get total count per length.
|
|
| 50 | + */
|
|
| 51 | + public static final String TOTAL_COUNT_REQUEST = "" +
|
|
| 52 | + "Select sum(ntl.count) \n" +
|
|
| 53 | + "From TripImpl t \n" +
|
|
| 54 | + "Join t.routeObs r \n" +
|
|
| 55 | + "Join r.activity a \n" +
|
|
| 56 | + "Join a.set.sample nts \n" +
|
|
| 57 | + "Join nts.sampleMeasure ntl With ntl.species.id = :species And ntl.sizeMeasureType.id = :sizeMeasureType \n" +
|
|
| 58 | + "Where t.id In :tripId \n" +
|
|
| 59 | + "Group By ntl.length \n" +
|
|
| 60 | + "Order By ntl.length";
|
|
| 61 | + |
|
| 62 | + /**
|
|
| 63 | + * To get species fate count per length
|
|
| 64 | + */
|
|
| 65 | + public static final String SPECIES_FATE_COUNT_REQUEST = "" +
|
|
| 66 | + "Select ntl.length, sum(ntl.count) \n" +
|
|
| 67 | + "From TripImpl t \n" +
|
|
| 68 | + "Join t.routeObs r \n" +
|
|
| 69 | + "Join r.activity a \n" +
|
|
| 70 | + "Join a.set.sample nts \n" +
|
|
| 71 | + "Join nts.sampleMeasure ntl With ntl.species.id = :species And ntl.sizeMeasureType.id = :sizeMeasureType And ntl.speciesFate.id = :speciesFate\n" +
|
|
| 72 | + "Where t.id In :tripId \n" +
|
|
| 73 | + "Group By ntl.length \n" +
|
|
| 74 | + "Order By ntl.length";
|
|
| 75 | + |
|
| 76 | + /**
|
|
| 77 | + * To get null species fate count per length
|
|
| 78 | + */
|
|
| 79 | + public static final String NULL_SPECIES_FATE_COUNT_REQUEST = "" +
|
|
| 80 | + "Select ntl.length, sum(ntl.count) \n" +
|
|
| 81 | + "From TripImpl t \n" +
|
|
| 82 | + "Join t.routeObs r \n" +
|
|
| 83 | + "Join r.activity a \n" +
|
|
| 84 | + "Join a.set.sample nts \n" +
|
|
| 85 | + "Join nts.sampleMeasure ntl With ntl.species.id = :species And ntl.sizeMeasureType.id = :sizeMeasureType And ntl.speciesFate Is Null\n" +
|
|
| 86 | + "Where t.id In :tripId \n" +
|
|
| 87 | + "Group By ntl.length \n" +
|
|
| 88 | + "Order By ntl.length";
|
|
| 89 | + |
|
| 90 | + @Override
|
|
| 91 | + public DataMatrix consume(String parameters, ReportRequestExecutor requestExecutor, Report report, Set<String> tripId, DataMatrix incoming) {
|
|
| 92 | + |
|
| 93 | + Map<String, Object> queryParameters = new TreeMap<>();
|
|
| 94 | + queryParameters.put("tripId", tripId);
|
|
| 95 | + for (ReportVariable<?> variable : report.getVariables()) {
|
|
| 96 | + queryParameters.put(variable.getName(), variable.getSelectedValue());
|
|
| 97 | + }
|
|
| 98 | + |
|
| 99 | + Set<SpeciesFate> speciesFateList = report.<SpeciesFate>getRepeatVariable("speciesFate").getValues();
|
|
| 100 | + List<String> lengthList = report.getRepeatVariable("length").getValues().stream().map(Object::toString).collect(Collectors.toList());
|
|
| 101 | + |
|
| 102 | + DataMatrix result = createTmpMatrix(0, 0, 2 + speciesFateList.size(), 1 + lengthList.size());
|
|
| 103 | + boolean useNullSpeciesFate = speciesFateList.remove(null);
|
|
| 104 | + int columnIndex = 0;
|
|
| 105 | + fillLengthsColumn(result, columnIndex++, lengthList);
|
|
| 106 | + |
|
| 107 | + for (SpeciesFate speciesFate : speciesFateList) {
|
|
| 108 | + fillSpeciesFateCountColumn(result, columnIndex++, queryParameters, speciesFate, lengthList, requestExecutor);
|
|
| 109 | + }
|
|
| 110 | + |
|
| 111 | + if (useNullSpeciesFate) {
|
|
| 112 | + fillSpeciesFateCountColumn(result, columnIndex++, queryParameters, null, lengthList, requestExecutor);
|
|
| 113 | + }
|
|
| 114 | + |
|
| 115 | + fillTotalCountColumn(result, columnIndex, queryParameters, requestExecutor);
|
|
| 116 | + |
|
| 117 | + return result;
|
|
| 118 | + }
|
|
| 119 | + |
|
| 120 | + private void fillLengthsColumn(DataMatrix result, int columnIndex, List<String> lengthList) {
|
|
| 121 | + int index = 0;
|
|
| 122 | + result.setValue(columnIndex, index++, "Classe de taille (cm)");
|
|
| 123 | + for (String length : lengthList) {
|
|
| 124 | + result.setValue(columnIndex, index++, length);
|
|
| 125 | + }
|
|
| 126 | + }
|
|
| 127 | + |
|
| 128 | + private void fillSpeciesFateCountColumn(DataMatrix result, int columnIndex, Map<String, Object> queryParameters, SpeciesFate speciesFate, List<String> lengthList, ReportRequestExecutor requestExecutor) {
|
|
| 129 | + String header;
|
|
| 130 | + List<Object[]> rows;
|
|
| 131 | + if (speciesFate == null) {
|
|
| 132 | + header = "Aucun";
|
|
| 133 | + queryParameters.remove("speciesFate");
|
|
| 134 | + rows = requestExecutor.executeRequest(NULL_SPECIES_FATE_COUNT_REQUEST, queryParameters);
|
|
| 135 | + } else {
|
|
| 136 | + header = speciesFate.getLabel2();
|
|
| 137 | + queryParameters.put("speciesFate", speciesFate.getId());
|
|
| 138 | + rows = requestExecutor.executeRequest(SPECIES_FATE_COUNT_REQUEST, queryParameters);
|
|
| 139 | + }
|
|
| 140 | + result.setValue(columnIndex, 0, String.format("Effectif ( devenir - %s )", header));
|
|
| 141 | + |
|
| 142 | + for (Object[] row : rows) {
|
|
| 143 | + String length = row[0].toString();
|
|
| 144 | + Number count = (Number) row[1];
|
|
| 145 | + int index = lengthList.indexOf(length);
|
|
| 146 | + result.setValue(columnIndex, index + 1, count);
|
|
| 147 | + }
|
|
| 148 | + }
|
|
| 149 | + |
|
| 150 | + private void fillTotalCountColumn(DataMatrix result, int columnIndex, Map<String, Object> queryParameters, ReportRequestExecutor requestExecutor) {
|
|
| 151 | + result.setValue(columnIndex, 0, "Effectif total");
|
|
| 152 | + List<Object> rows = requestExecutor.executeRequest(TOTAL_COUNT_REQUEST, queryParameters);
|
|
| 153 | + int index = 1;
|
|
| 154 | + for (Object row : rows) {
|
|
| 155 | + Number count = (Number) row;
|
|
| 156 | + result.setValue(columnIndex, index++, count);
|
|
| 157 | + }
|
|
| 158 | + }
|
|
| 159 | + |
|
| 160 | +}
|
|
| 161 | + |
| ... | ... | @@ -24,24 +24,21 @@ package fr.ird.observe.services.service.report.ps; |
| 24 | 24 | |
| 25 | 25 | import com.google.auto.service.AutoService;
|
| 26 | 26 | import fr.ird.observe.dto.report.Report;
|
| 27 | -import fr.ird.observe.dto.report.ReportRequest;
|
|
| 28 | 27 | import fr.ird.observe.services.service.ReportFixture;
|
| 29 | 28 | |
| 30 | -import java.util.Iterator;
|
|
| 31 | - |
|
| 32 | 29 | /**
|
| 33 | - * Created on 17/02/2021.
|
|
| 30 | + * Created on 13/11/2022.
|
|
| 34 | 31 | *
|
| 35 | 32 | * @author Tony Chemit - dev@tchemit.fr
|
| 36 | - * @since 8.0.6
|
|
| 33 | + * @since 9.0.17
|
|
| 37 | 34 | */
|
| 38 | 35 | @AutoService(ReportFixture.class)
|
| 39 | -public class PsObservationTargetStoredDistributionLengthsLFReportFixture extends ReportFixture {
|
|
| 36 | +public class PsObservationLengthsDistributionReportFixture extends ReportFixture {
|
|
| 40 | 37 | |
| 41 | 38 | @Override
|
| 42 | - public void assertSyntax(Report report) {
|
|
| 43 | - super.assertSyntax(report);
|
|
| 44 | - Iterator<ReportRequest> requests = getRequestIterator(report);
|
|
| 45 | - assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0);
|
|
| 39 | + protected void setVariables(Report report) {
|
|
| 40 | + setVariableValue(report, "species", "fr.ird.referential.common.Species#1239832684537#0.2397229787936519");
|
|
| 41 | + setVariableValue(report, "sizeMeasureType", "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336");
|
|
| 46 | 42 | }
|
| 47 | 43 | }
|
| 44 | + |
| 1 | -/*
|
|
| 2 | - * #%L
|
|
| 3 | - * ObServe Core :: Services :: Test
|
|
| 4 | - * %%
|
|
| 5 | - * Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 6 | - * %%
|
|
| 7 | - * This program is free software: you can redistribute it and/or modify
|
|
| 8 | - * it under the terms of the GNU General Public License as
|
|
| 9 | - * published by the Free Software Foundation, either version 3 of the
|
|
| 10 | - * License, or (at your option) any later version.
|
|
| 11 | - *
|
|
| 12 | - * This program is distributed in the hope that it will be useful,
|
|
| 13 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 | - * GNU General Public License for more details.
|
|
| 16 | - *
|
|
| 17 | - * You should have received a copy of the GNU General Public
|
|
| 18 | - * License along with this program. If not, see
|
|
| 19 | - * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 | - * #L%
|
|
| 21 | - */
|
|
| 22 | -package fr.ird.observe.services.service.report.ps;
|
|
| 23 | - |
|
| 24 | - |
|
| 25 | -import com.google.auto.service.AutoService;
|
|
| 26 | -import fr.ird.observe.dto.report.Report;
|
|
| 27 | -import fr.ird.observe.dto.report.ReportRequest;
|
|
| 28 | -import fr.ird.observe.services.service.ReportFixture;
|
|
| 29 | - |
|
| 30 | -import java.util.Iterator;
|
|
| 31 | - |
|
| 32 | -/**
|
|
| 33 | - * Test du report {@code accessoryCatch}.
|
|
| 34 | - *
|
|
| 35 | - * @author Tony Chemit - dev@tchemit.fr
|
|
| 36 | - * @since 1.9
|
|
| 37 | - */
|
|
| 38 | -@AutoService(ReportFixture.class)
|
|
| 39 | -public class PsObservationNonTargetDistributionLengthsReportFixture extends ReportFixture {
|
|
| 40 | - |
|
| 41 | - @Override
|
|
| 42 | - public void assertSyntax(Report report) {
|
|
| 43 | - super.assertSyntax(report);
|
|
| 44 | - Iterator<ReportRequest> requests = getRequestIterator(report);
|
|
| 45 | - assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0);
|
|
| 46 | - }
|
|
| 47 | -} |
| 1 | -package fr.ird.observe.services.service.report.ps;
|
|
| 2 | - |
|
| 3 | -/*-
|
|
| 4 | - * #%L
|
|
| 5 | - * ObServe Core :: Services :: Test
|
|
| 6 | - * %%
|
|
| 7 | - * Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 8 | - * %%
|
|
| 9 | - * This program is free software: you can redistribute it and/or modify
|
|
| 10 | - * it under the terms of the GNU General Public License as
|
|
| 11 | - * published by the Free Software Foundation, either version 3 of the
|
|
| 12 | - * License, or (at your option) any later version.
|
|
| 13 | - *
|
|
| 14 | - * This program is distributed in the hope that it will be useful,
|
|
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 | - * GNU General Public License for more details.
|
|
| 18 | - *
|
|
| 19 | - * You should have received a copy of the GNU General Public
|
|
| 20 | - * License along with this program. If not, see
|
|
| 21 | - * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 | - * #L%
|
|
| 23 | - */
|
|
| 24 | - |
|
| 25 | -import com.google.auto.service.AutoService;
|
|
| 26 | -import fr.ird.observe.dto.report.Report;
|
|
| 27 | -import fr.ird.observe.dto.report.ReportRequest;
|
|
| 28 | -import fr.ird.observe.services.service.ReportFixture;
|
|
| 29 | - |
|
| 30 | -import java.util.Iterator;
|
|
| 31 | - |
|
| 32 | -/**
|
|
| 33 | - * Created on 17/02/2021.
|
|
| 34 | - *
|
|
| 35 | - * @author Tony Chemit - dev@tchemit.fr
|
|
| 36 | - * @since 8.0.6
|
|
| 37 | - */
|
|
| 38 | -@AutoService(ReportFixture.class)
|
|
| 39 | -public class PsObservationTargetDiscardedDistributionLengthsLD1ReportFixture extends ReportFixture {
|
|
| 40 | - |
|
| 41 | - @Override
|
|
| 42 | - public void assertSyntax(Report report) {
|
|
| 43 | - super.assertSyntax(report);
|
|
| 44 | - Iterator<ReportRequest> requests = getRequestIterator(report);
|
|
| 45 | - assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0);
|
|
| 46 | - }
|
|
| 47 | -} |
| 1 | -package fr.ird.observe.services.service.report.ps;
|
|
| 2 | - |
|
| 3 | -/*-
|
|
| 4 | - * #%L
|
|
| 5 | - * ObServe Core :: Services :: Test
|
|
| 6 | - * %%
|
|
| 7 | - * Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 8 | - * %%
|
|
| 9 | - * This program is free software: you can redistribute it and/or modify
|
|
| 10 | - * it under the terms of the GNU General Public License as
|
|
| 11 | - * published by the Free Software Foundation, either version 3 of the
|
|
| 12 | - * License, or (at your option) any later version.
|
|
| 13 | - *
|
|
| 14 | - * This program is distributed in the hope that it will be useful,
|
|
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 | - * GNU General Public License for more details.
|
|
| 18 | - *
|
|
| 19 | - * You should have received a copy of the GNU General Public
|
|
| 20 | - * License along with this program. If not, see
|
|
| 21 | - * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 | - * #L%
|
|
| 23 | - */
|
|
| 24 | - |
|
| 25 | -import com.google.auto.service.AutoService;
|
|
| 26 | -import fr.ird.observe.dto.report.Report;
|
|
| 27 | -import fr.ird.observe.dto.report.ReportRequest;
|
|
| 28 | -import fr.ird.observe.services.service.ReportFixture;
|
|
| 29 | - |
|
| 30 | -import java.util.Iterator;
|
|
| 31 | - |
|
| 32 | -/**
|
|
| 33 | - * Created on 17/02/2021.
|
|
| 34 | - *
|
|
| 35 | - * @author Tony Chemit - dev@tchemit.fr
|
|
| 36 | - * @since 8.0.6
|
|
| 37 | - */
|
|
| 38 | -@AutoService(ReportFixture.class)
|
|
| 39 | -public class PsObservationTargetDiscardedDistributionLengthsLFReportFixture extends ReportFixture {
|
|
| 40 | - |
|
| 41 | - @Override
|
|
| 42 | - public void assertSyntax(Report report) {
|
|
| 43 | - super.assertSyntax(report);
|
|
| 44 | - Iterator<ReportRequest> requests = getRequestIterator(report);
|
|
| 45 | - assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0);
|
|
| 46 | - }
|
|
| 47 | -} |
| 1 | -package fr.ird.observe.services.service.report.ps;
|
|
| 2 | - |
|
| 3 | -/*-
|
|
| 4 | - * #%L
|
|
| 5 | - * ObServe Core :: Services :: Test
|
|
| 6 | - * %%
|
|
| 7 | - * Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 8 | - * %%
|
|
| 9 | - * This program is free software: you can redistribute it and/or modify
|
|
| 10 | - * it under the terms of the GNU General Public License as
|
|
| 11 | - * published by the Free Software Foundation, either version 3 of the
|
|
| 12 | - * License, or (at your option) any later version.
|
|
| 13 | - *
|
|
| 14 | - * This program is distributed in the hope that it will be useful,
|
|
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 | - * GNU General Public License for more details.
|
|
| 18 | - *
|
|
| 19 | - * You should have received a copy of the GNU General Public
|
|
| 20 | - * License along with this program. If not, see
|
|
| 21 | - * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 | - * #L%
|
|
| 23 | - */
|
|
| 24 | - |
|
| 25 | -import com.google.auto.service.AutoService;
|
|
| 26 | -import fr.ird.observe.dto.report.Report;
|
|
| 27 | -import fr.ird.observe.dto.report.ReportRequest;
|
|
| 28 | -import fr.ird.observe.services.service.ReportFixture;
|
|
| 29 | - |
|
| 30 | -import java.util.Iterator;
|
|
| 31 | - |
|
| 32 | -/**
|
|
| 33 | - * Created on 17/02/2021.
|
|
| 34 | - *
|
|
| 35 | - * @author Tony Chemit - dev@tchemit.fr
|
|
| 36 | - * @since 8.0.6
|
|
| 37 | - */
|
|
| 38 | -@AutoService(ReportFixture.class)
|
|
| 39 | -public class PsObservationTargetStoredDistributionLengthsLD1ReportFixture extends ReportFixture {
|
|
| 40 | - |
|
| 41 | - @Override
|
|
| 42 | - public void assertSyntax(Report report) {
|
|
| 43 | - super.assertSyntax(report);
|
|
| 44 | - Iterator<ReportRequest> requests = getRequestIterator(report);
|
|
| 45 | - assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0);
|
|
| 46 | - }
|
|
| 47 | -} |
| ... | ... | @@ -19,11 +19,17 @@ |
| 19 | 19 | # <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 | # #L%
|
| 21 | 21 | ###
|
| 22 | -syntax.columns=2
|
|
| 23 | -syntax.columnsHeader=Classe de taille^Effectif
|
|
| 24 | -syntax.description=Afficher la nombre d'individus mesurés par classe de taille pour les espèces non ciblées
|
|
| 25 | -syntax.name=Observations - Distribution des tailles par espèces non ciblées
|
|
| 26 | -syntax.nbRequests=1
|
|
| 22 | +syntax.name=Observations - Distribution des tailles par espèces et type de mesure
|
|
| 23 | +syntax.description=Afficher la nombre d'individus mesurés par classe de taille pour les espèces et le type de mesure
|
|
| 27 | 24 | syntax.rows=-1
|
| 25 | +syntax.columns=-1
|
|
| 26 | +syntax.columnsHeader=
|
|
| 28 | 27 | syntax.rowsHeader=
|
| 29 | -tripIds=${PS_COMMON_TRIP},${PS_COMMON_TRIP_MOVE} |
|
| 28 | +syntax.nbRequests=0
|
|
| 29 | +result.columns=3
|
|
| 30 | +result.rows=5
|
|
| 31 | +result.0=Classe de taille (cm)^Effectif ( devenir - Aucun )^Effectif total
|
|
| 32 | +result.1=50.0^2^2
|
|
| 33 | +result.2=54.0^1^1
|
|
| 34 | +result.3=68.0^1^1
|
|
| 35 | +result.4=70.0^1^1 |
| 1 | -###
|
|
| 2 | -# #%L
|
|
| 3 | -# ObServe Core :: Services :: Test
|
|
| 4 | -# %%
|
|
| 5 | -# Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 6 | -# %%
|
|
| 7 | -# This program is free software: you can redistribute it and/or modify
|
|
| 8 | -# it under the terms of the GNU General Public License as
|
|
| 9 | -# published by the Free Software Foundation, either version 3 of the
|
|
| 10 | -# License, or (at your option) any later version.
|
|
| 11 | -#
|
|
| 12 | -# This program is distributed in the hope that it will be useful,
|
|
| 13 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 | -# GNU General Public License for more details.
|
|
| 16 | -#
|
|
| 17 | -# You should have received a copy of the GNU General Public
|
|
| 18 | -# License along with this program. If not, see
|
|
| 19 | -# <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 | -# #L%
|
|
| 21 | -###
|
|
| 22 | -syntax.columns=2
|
|
| 23 | -syntax.columnsHeader=Classe de taille^Effectif
|
|
| 24 | -syntax.description=Afficher la nombre d'individus rejetés, mesurés par classe de taille LD1 pour les espèces ciblées
|
|
| 25 | -syntax.name=Observations - Distribution des tailles des rejets par espèces ciblées (mesure LD1)
|
|
| 26 | -syntax.nbRequests=1
|
|
| 27 | -syntax.rows=-1
|
|
| 28 | -syntax.rowsHeader= |
| 1 | -###
|
|
| 2 | -# #%L
|
|
| 3 | -# ObServe Core :: Services :: Test
|
|
| 4 | -# %%
|
|
| 5 | -# Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 6 | -# %%
|
|
| 7 | -# This program is free software: you can redistribute it and/or modify
|
|
| 8 | -# it under the terms of the GNU General Public License as
|
|
| 9 | -# published by the Free Software Foundation, either version 3 of the
|
|
| 10 | -# License, or (at your option) any later version.
|
|
| 11 | -#
|
|
| 12 | -# This program is distributed in the hope that it will be useful,
|
|
| 13 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 | -# GNU General Public License for more details.
|
|
| 16 | -#
|
|
| 17 | -# You should have received a copy of the GNU General Public
|
|
| 18 | -# License along with this program. If not, see
|
|
| 19 | -# <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 | -# #L%
|
|
| 21 | -###
|
|
| 22 | -syntax.columns=2
|
|
| 23 | -syntax.columnsHeader=Classe de taille^Effectif
|
|
| 24 | -syntax.description=Afficher le nombre d'individus rejetés, mesurés par classe de taille LF pour les espèces ciblées
|
|
| 25 | -syntax.name=Observations - Distribution des tailles des rejets par espèces ciblées (mesure LF)
|
|
| 26 | -syntax.nbRequests=1
|
|
| 27 | -syntax.rows=-1
|
|
| 28 | -syntax.rowsHeader= |
| 1 | -###
|
|
| 2 | -# #%L
|
|
| 3 | -# ObServe Core :: Services :: Test
|
|
| 4 | -# %%
|
|
| 5 | -# Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 6 | -# %%
|
|
| 7 | -# This program is free software: you can redistribute it and/or modify
|
|
| 8 | -# it under the terms of the GNU General Public License as
|
|
| 9 | -# published by the Free Software Foundation, either version 3 of the
|
|
| 10 | -# License, or (at your option) any later version.
|
|
| 11 | -#
|
|
| 12 | -# This program is distributed in the hope that it will be useful,
|
|
| 13 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 | -# GNU General Public License for more details.
|
|
| 16 | -#
|
|
| 17 | -# You should have received a copy of the GNU General Public
|
|
| 18 | -# License along with this program. If not, see
|
|
| 19 | -# <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 | -# #L%
|
|
| 21 | -###
|
|
| 22 | -syntax.columns=2
|
|
| 23 | -syntax.columnsHeader=Classe de taille^Effectif
|
|
| 24 | -syntax.description=Afficher le nombre d'individus capturés, mesurés par classe de taille LD1 pour les espèces ciblées
|
|
| 25 | -syntax.name=Observations - Distribution des tailles des captures par espèces ciblées (mesure LD1)
|
|
| 26 | -syntax.nbRequests=1
|
|
| 27 | -syntax.rows=-1
|
|
| 28 | -syntax.rowsHeader= |
| 1 | -###
|
|
| 2 | -# #%L
|
|
| 3 | -# ObServe Core :: Services :: Test
|
|
| 4 | -# %%
|
|
| 5 | -# Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 6 | -# %%
|
|
| 7 | -# This program is free software: you can redistribute it and/or modify
|
|
| 8 | -# it under the terms of the GNU General Public License as
|
|
| 9 | -# published by the Free Software Foundation, either version 3 of the
|
|
| 10 | -# License, or (at your option) any later version.
|
|
| 11 | -#
|
|
| 12 | -# This program is distributed in the hope that it will be useful,
|
|
| 13 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 | -# GNU General Public License for more details.
|
|
| 16 | -#
|
|
| 17 | -# You should have received a copy of the GNU General Public
|
|
| 18 | -# License along with this program. If not, see
|
|
| 19 | -# <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 | -# #L%
|
|
| 21 | -###
|
|
| 22 | -syntax.columns=2
|
|
| 23 | -syntax.columnsHeader=Classe de taille^Effectif
|
|
| 24 | -syntax.description=Afficher le nombre d'individus capturés, mesurés par classe de taille LF pour les espèces ciblées
|
|
| 25 | -syntax.name=Observations - Distribution des tailles des captures par espèces ciblées (mesure LF)
|
|
| 26 | -syntax.nbRequests=1
|
|
| 27 | -syntax.rows=-1
|
|
| 28 | -syntax.rowsHeader= |
| ... | ... | @@ -159,7 +159,13 @@ public class DataMatrix implements JsonAware { |
| 159 | 159 | log.debug(String.format("copying incoming matrix (dim: %s, location: %s)", incoming.getDimension(), incoming.getLocation()));
|
| 160 | 160 | |
| 161 | 161 | for (int i = 0; i < width; i++) {
|
| 162 | + if (x + i < 0) {
|
|
| 163 | + continue;
|
|
| 164 | + }
|
|
| 162 | 165 | for (int j = 0; j < height; j++) {
|
| 166 | + if (y + j < 0) {
|
|
| 167 | + continue;
|
|
| 168 | + }
|
|
| 163 | 169 | Serializable value = incoming.getValue(i, j);
|
| 164 | 170 | setValue(x + i, y + j, value);
|
| 165 | 171 | }
|
| ... | ... | @@ -319,12 +319,14 @@ public class ReportBuilder { |
| 319 | 319 | Map.Entry<String, String> entry = itr.next();
|
| 320 | 320 | String key = entry.getKey();
|
| 321 | 321 | if (!key.startsWith(VARIABLE_PREFIX)) {
|
| 322 | - |
|
| 323 | 322 | continue;
|
| 324 | 323 | }
|
| 325 | 324 | String operations = entry.getValue();
|
| 326 | 325 | String id = key.substring(VARIABLE_PREFIX.length());
|
| 327 | - |
|
| 326 | + int indexOf = id.indexOf(".");
|
|
| 327 | + if (indexOf > -1) {
|
|
| 328 | + id = id.substring(indexOf + 1);
|
|
| 329 | + }
|
|
| 328 | 330 | // on interdit la surcharge d'une variable déjà trouvée pour le report
|
| 329 | 331 | if (ids.contains(id)) {
|
| 330 | 332 | throw new IllegalArgumentException("La variable " + id + " est déjà définie pour le report " + reportName);
|
| ... | ... | @@ -359,12 +361,14 @@ public class ReportBuilder { |
| 359 | 361 | Map.Entry<String, String> entry = itr.next();
|
| 360 | 362 | String key = entry.getKey();
|
| 361 | 363 | if (!key.startsWith(REPEAT_VARIABLE_PREFIX)) {
|
| 362 | - |
|
| 363 | 364 | continue;
|
| 364 | 365 | }
|
| 365 | 366 | String operations = entry.getValue();
|
| 366 | 367 | String id = key.substring(REPEAT_VARIABLE_PREFIX.length());
|
| 367 | - |
|
| 368 | + int indexOf = id.indexOf(".");
|
|
| 369 | + if (indexOf > -1) {
|
|
| 370 | + id = id.substring(indexOf + 1);
|
|
| 371 | + }
|
|
| 368 | 372 | // on interdit la surcharge d'une variable déjà trouvée pour le report
|
| 369 | 373 | if (ids.contains(id)) {
|
| 370 | 374 | throw new IllegalArgumentException("La variable de répétition " + id + " est déjà définie pour le report " + reportName);
|