Observe-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
November 2022
- 1 participants
- 117 discussions
[Git][ultreiaio/ird-observe][develop-9.0.x] Deleted 6 commits: Report model - Fix psObservationFobUsageMinimal report (one line escape was missing)
by Tony CHEMIT (@tchemit) 16 Nov '22
by Tony CHEMIT (@tchemit) 16 Nov '22
16 Nov '22
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:
5c72bc35 by Tony Chemit at 2022-11-16T01:18:28+01:00
Report model - Fix psObservationFobUsageMinimal report (one line escape was missing)
- - - - -
9304dbbb by Tony Chemit at 2022-11-16T01:18:28+01:00
Rapports Captures/Rejets selon le type d'association - Closes #2530
- - - - -
782d2838 by Tony Chemit at 2022-11-16T01:18:28+01:00
Rapport Dénombrement des captures accessoires et devenir, filtrées par groupe - Closes #2534
- - - - -
af7f63c9 by Tony Chemit at 2022-11-16T01:18:28+01:00
Rapports Distributions de tailles - Closes #2533
- - - - -
1b675eeb by Tony Chemit at 2022-11-16T01:18:28+01:00
Report Tck - Add more tests (for complex reports to make debug more easy)
- - - - -
03903a9e by Tony Chemit at 2022-11-16T01:18:53+01:00
Merge branch 'feature/issue_2531_v9.0.x' into develop-9.0.x
Closes #2531
- - - - -
16 changed files:
- core/api/dto/src/main/resources/observe-reports.properties
- core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetStoredDistributionLengthsLD1ReportFixture.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/ReportServiceFixtures.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/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationAccessoryCatchByGroup.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-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-psObservationTargetStoredDistributionLengthsLF.properties
Changes:
=====================================
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,64 +887,81 @@ 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.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|\
+Select distinct sg \
+From TripImpl t \
+Join t.routeObs r \
+Join r.activity a \
+Join a.set c \
+Join c.catches ca with ca.totalCount Is Not Null \
+Join ca.species e \
+Join e.speciesGroup sg \
+Where t.id In :tripId \
+Order By sg.code
+report.psObservationCatchByGroup.repeatVariable.1.species=fr.ird.observe.entities.referential.common.Species|\
+Select distinct e \
+From TripImpl t \
+Join t.routeObs r \
+Join r.activity a \
+Join a.set c \
+Join c.catches ca with ca.totalCount Is Not Null \
+Join ca.species e with e.speciesGroup.id = :speciesGroup \
+Where t.id In :tripId \
+Order By e.homeId
+report.psObservationCatchByGroup.repeatVariable.2.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 c \
+Join c.catches ca with ca.totalCount Is Not Null \
+Join ca.species e with e.id In :species \
+Join ca.speciesFate sf \
+Where t.id In :tripId \
+Order by sf.code
+report.psObservationCatchByGroup.request.1=0,0|row|\
Select \
concat(\
'[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \
' [sc]', (case when e.scientificLabel is not null then e.scientificLabel else '-' end), \
' [fr]', (case when e.label2 is not null then e.label2 else '-' end)), \
- Sum(case c.schoolType.id when 'fr.ird.referential.ps.common.SchoolType#0#2' then ca.totalCount else 0.0 end), \
- Sum(case c.schoolType.id when 'fr.ird.referential.ps.common.SchoolType#0#1' then ca.totalCount else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.9931091059863436' then ca.totalCount \
- when 'fr.ird.referential.ps.common.SpeciesFate#1239832683618#0.06155887805368032' then ca.totalCount \
- else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.11883784875534997' then ca.totalCount \
- else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5308862132841506' then ca.totalCount \
- else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.6250731662108877' then ca.totalCount \
- else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683620#0.46609703818634485' then ca.totalCount \
- else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5722739932065866' then ca.totalCount \
- 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#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 \
- when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5308862132841506' then 0.0 \
- when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.6250731662108877' then 0.0 \
- 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 \
- else ca.totalCount end) \
+ Sum(case c.schoolType.id when 'fr.ird.referential.ps.common.SchoolType#0#2' then ca.totalCount else 0 end), \
+ Sum(case c.schoolType.id when 'fr.ird.referential.ps.common.SchoolType#0#1' then ca.totalCount else 0 end) \
From TripImpl m \
Join m.routeObs r \
Join r.activity a \
Join a.set c \
- Join c.catches ca \
- Join ca.species e \
- with e.speciesGroup.id = :speciesGroup \
+ Join c.catches ca with ca.totalCount Is Not Null \
+ Join ca.species e with e.id In :species \
Where m.id In :tripId \
Group by e \
Order By e.homeId
+report.psObservationCatchByGroup.operations.1=ExecuteRequestAndReorganizeCountByRepeatVariable:species|speciesFate|\
+Select \
+ca.species.id, ca.speciesFate.id, Sum(ca.totalCount) \
+From TripImpl m \
+Join m.routeObs r \
+Join r.activity a \
+Join a.set c \
+Join c.catches ca with ca.speciesFate.id In :speciesFate And ca.species.id In :species \
+Where m.id In :tripId \
+Group by ca.species, ca.speciesFate \
+Order By ca.species.homeId, ca.speciesFate.code
+report.psObservationCatchByGroup.operations.2=ComputeDynamicHeader:Espèce,Total BL,Total BO|speciesFate
+report.psObservationCatchByGroup.operations.3=SumIntRow:1|3
+report.psObservationCatchByGroup.operations.4=SumIntColumn:1|1
###########################################################
-## 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.variable.1.species=fr.ird.observe.dto.referential.common.SpeciesDto|\
Select distinct ntl.species \
From TripImpl t \
Join t.routeObs r \
@@ -814,133 +969,47 @@ 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) \
+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 \
+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 \
- 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 \
+Order By sf.code
+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.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336'
-report.psObservationTargetDiscardedDistributionLengthsLF.request.1=0,0|row| \
-Select tl.length , Sum(tl.count) \
+Order By ntl.length
+report.psObservationLengthsDistribution.operations.1=CopyRepeatVariableToFirstColumn:length
+report.psObservationLengthsDistribution.operations.2=ExecuteRequestAndReorganizeCountByRepeatVariable:length|speciesFate|\
+Select ntl.length, sf.id, sum(ntl.count) \
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 \
+Left Join ntl.speciesFate sf with sf.id In :speciesFate \
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
+Group By ntl.length, sf \
+Order By ntl.length
+report.psObservationLengthsDistribution.operations.3=ComputeDynamicHeader:Classe de taille (cm)|speciesFate
+report.psObservationLengthsDistribution.operations.4=SumIntRow:1|1
############################################
## Répartition des calées par cuves
############################################
=====================================
core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetStoredDistributionLengthsLD1ReportFixture.java → core/services/local/src/test/java/fr/ird/observe/services/local/service/ReportServiceLocalReadTest.java
=====================================
@@ -1,8 +1,8 @@
-package fr.ird.observe.services.service.report.ps;
+package fr.ird.observe.services.local.service;
/*-
* #%L
- * ObServe Core :: Services :: Test
+ * ObServe Core :: Services :: Local
* %%
* Copyright (C) 2008 - 2022 IRD, Ultreia.io
* %%
@@ -22,26 +22,23 @@ package fr.ird.observe.services.service.report.ps;
* #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 fr.ird.observe.services.service.ReportService;
+import org.junit.Test;
-import java.util.Iterator;
+import javax.annotation.Generated;
-/**
- * Created on 17/02/2021.
- *
- * @author Tony Chemit - dev(a)tchemit.fr
- * @since 8.0.6
- */
-(a)AutoService(ReportFixture.class)
-public class PsObservationTargetStoredDistributionLengthsLD1ReportFixture extends ReportFixture {
+@Generated(value = "io.ultreia.java4all.http.maven.plugin.test.GenerateApiImplMojo", date = "Mon Nov 14 16:20:02 CET 2022")
+public class ReportServiceLocalReadTest extends GeneratedReportServiceLocalReadTest {
+
+ @Test
+ public void executeReportPsObservationLengthsDistribution() {
+ ReportService service = getService();
+ fixtures.executeReport(getServicesProvider(), service, "psObservationLengthsDistribution");
+ }
- @Override
- public void assertSyntax(Report report) {
- super.assertSyntax(report);
- Iterator<ReportRequest> requests = getRequestIterator(report);
- assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0);
+ @Test
+ public void executeReportPsObservationCatchByGroup() {
+ ReportService service = getService();
+ fixtures.executeReport(getServicesProvider(), service, "psObservationCatchByGroup");
}
}
=====================================
core/services/test/src/main/java/fr/ird/observe/services/service/ReportServiceFixtures.java
=====================================
@@ -109,10 +109,14 @@ public class ReportServiceFixtures extends GeneratedReportServiceFixtures {
@Override
public void executeReport(ObserveServicesProvider servicesProvider, ReportService service) {
for (String id : ReportServiceFixtures.getReportIds()) {
+ executeReport(servicesProvider, service, id);
+ }
+ }
+
+ public void executeReport(ObserveServicesProvider servicesProvider, ReportService service, String id) {
setReportId(id);
Report definition = getReport(id);
executeReport(definition, service);
- }
}
@Override
=====================================
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(a)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(a)tchemit.fr
- * @since 1.9
- */
-(a)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(a)tchemit.fr
- * @since 8.0.6
- */
-(a)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(a)tchemit.fr
- * @since 8.0.6
- */
-(a)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/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationAccessoryCatchByGroup.properties deleted
=====================================
@@ -1,31 +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%
-###
-result.0=[FAO]ALV [sc]Alopias vulpinus [fr]Renard^0^3^3^0^0^0^0^0^0^0.0
-result.columns=11
-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.nbRequests=1
-syntax.rows=-1
-syntax.rowsHeader=
=====================================
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-psObservationCatchByGroup.properties
=====================================
@@ -19,10 +19,15 @@
# <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.name=Observations - Dénombrement des captures par devenir, filtrés par groupe
+syntax.description=Afficher les nombres de captures par groupe d'espèce selon le type de banc et le devenir
syntax.rows=-1
+syntax.columns=-1
+syntax.columnsHeader=
syntax.rowsHeader=
+syntax.nbRequests=1
+result.columns=4
+result.rows=3
+result.0=Espèce^Total BL^Total BO^Echappe du filet (pour requin-baleine et cétacés)
+result.1=[FAO]ALV [sc]Alopias vulpinus [fr]Renard^0^3^3
+result.2=Total^0^3^3
=====================================
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)^Aucun^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-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=
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/f68f8bc029aababffa117e3a…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/f68f8bc029aababffa117e3a…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] 6 commits: Report model - Fix psObservationFobUsageMinimal report (one line escape was missing)
by Tony CHEMIT (@tchemit) 16 Nov '22
by Tony CHEMIT (@tchemit) 16 Nov '22
16 Nov '22
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
936017e7 by Tony Chemit at 2022-11-16T02:29:02+01:00
Report model - Fix psObservationFobUsageMinimal report (one line escape was missing)
- - - - -
7d77bc08 by Tony Chemit at 2022-11-16T02:29:03+01:00
Rapports Captures/Rejets selon le type d'association - Closes #2530
- - - - -
4f26b6d0 by Tony Chemit at 2022-11-16T02:29:03+01:00
Rapport Dénombrement des captures accessoires et devenir, filtrées par groupe - Closes #2534
- - - - -
274bec40 by Tony Chemit at 2022-11-16T02:29:03+01:00
Rapports Distributions de tailles - Closes #2533
- - - - -
3a33ad42 by Tony Chemit at 2022-11-16T02:29:03+01:00
Report Tck - Add more tests (for complex reports to make debug more easy)
- - - - -
cc8c98b3 by Tony Chemit at 2022-11-16T02:29:20+01:00
Merge branch 'feature/issue_2531_v9.1.x' into develop
Closes #2531
- - - - -
16 changed files:
- core/api/dto/src/main/resources/observe-reports.properties
- core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetStoredDistributionLengthsLD1ReportFixture.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/ReportServiceFixtures.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/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationAccessoryCatchByGroup.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-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-psObservationTargetStoredDistributionLengthsLF.properties
Changes:
=====================================
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,64 +887,81 @@ 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.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|\
+Select distinct sg \
+From TripImpl t \
+Join t.routeObs r \
+Join r.activity a \
+Join a.set c \
+Join c.catches ca with ca.totalCount Is Not Null \
+Join ca.species e \
+Join e.speciesGroup sg \
+Where t.id In :tripId \
+Order By sg.code
+report.psObservationCatchByGroup.repeatVariable.1.species=fr.ird.observe.entities.referential.common.Species|\
+Select distinct e \
+From TripImpl t \
+Join t.routeObs r \
+Join r.activity a \
+Join a.set c \
+Join c.catches ca with ca.totalCount Is Not Null \
+Join ca.species e with e.speciesGroup.id = :speciesGroup \
+Where t.id In :tripId \
+Order By e.homeId
+report.psObservationCatchByGroup.repeatVariable.2.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 c \
+Join c.catches ca with ca.totalCount Is Not Null \
+Join ca.species e with e.id In :species \
+Join ca.speciesFate sf \
+Where t.id In :tripId \
+Order by sf.code
+report.psObservationCatchByGroup.request.1=0,0|row|\
Select \
concat(\
'[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \
' [sc]', (case when e.scientificLabel is not null then e.scientificLabel else '-' end), \
' [fr]', (case when e.label2 is not null then e.label2 else '-' end)), \
- Sum(case c.schoolType.id when 'fr.ird.referential.ps.common.SchoolType#0#2' then ca.totalCount else 0.0 end), \
- Sum(case c.schoolType.id when 'fr.ird.referential.ps.common.SchoolType#0#1' then ca.totalCount else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.9931091059863436' then ca.totalCount \
- when 'fr.ird.referential.ps.common.SpeciesFate#1239832683618#0.06155887805368032' then ca.totalCount \
- else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.11883784875534997' then ca.totalCount \
- else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5308862132841506' then ca.totalCount \
- else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.6250731662108877' then ca.totalCount \
- else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683620#0.46609703818634485' then ca.totalCount \
- else 0.0 end), \
- Sum(case ca.speciesFate.id when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5722739932065866' then ca.totalCount \
- 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#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 \
- when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5308862132841506' then 0.0 \
- when 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.6250731662108877' then 0.0 \
- 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 \
- else ca.totalCount end) \
+ Sum(case c.schoolType.id when 'fr.ird.referential.ps.common.SchoolType#0#2' then ca.totalCount else 0 end), \
+ Sum(case c.schoolType.id when 'fr.ird.referential.ps.common.SchoolType#0#1' then ca.totalCount else 0 end) \
From TripImpl m \
Join m.routeObs r \
Join r.activity a \
Join a.set c \
- Join c.catches ca \
- Join ca.species e \
- with e.speciesGroup.id = :speciesGroup \
+ Join c.catches ca with ca.totalCount Is Not Null \
+ Join ca.species e with e.id In :species \
Where m.id In :tripId \
Group by e \
Order By e.homeId
+report.psObservationCatchByGroup.operations.1=ExecuteRequestAndReorganizeCountByRepeatVariable:species|speciesFate|\
+Select \
+ca.species.id, ca.speciesFate.id, Sum(ca.totalCount) \
+From TripImpl m \
+Join m.routeObs r \
+Join r.activity a \
+Join a.set c \
+Join c.catches ca with ca.speciesFate.id In :speciesFate And ca.species.id In :species \
+Where m.id In :tripId \
+Group by ca.species, ca.speciesFate \
+Order By ca.species.homeId, ca.speciesFate.code
+report.psObservationCatchByGroup.operations.2=ComputeDynamicHeader:Espèce,Total BL,Total BO|speciesFate
+report.psObservationCatchByGroup.operations.3=SumIntRow:1|3
+report.psObservationCatchByGroup.operations.4=SumIntColumn:1|1
###########################################################
-## 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.variable.1.species=fr.ird.observe.dto.referential.common.SpeciesDto|\
Select distinct ntl.species \
From TripImpl t \
Join t.routeObs r \
@@ -814,133 +969,47 @@ 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) \
+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 \
+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 \
- 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 \
+Order By sf.code
+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.sizeMeasureType = 'fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336'
-report.psObservationTargetDiscardedDistributionLengthsLF.request.1=0,0|row| \
-Select tl.length , Sum(tl.count) \
+Order By ntl.length
+report.psObservationLengthsDistribution.operations.1=CopyRepeatVariableToFirstColumn:length
+report.psObservationLengthsDistribution.operations.2=ExecuteRequestAndReorganizeCountByRepeatVariable:length|speciesFate|\
+Select ntl.length, sf.id, sum(ntl.count) \
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 \
+Left Join ntl.speciesFate sf with sf.id In :speciesFate \
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
+Group By ntl.length, sf \
+Order By ntl.length
+report.psObservationLengthsDistribution.operations.3=ComputeDynamicHeader:Classe de taille (cm)|speciesFate
+report.psObservationLengthsDistribution.operations.4=SumIntRow:1|1
############################################
## Répartition des calées par cuves
############################################
=====================================
core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetStoredDistributionLengthsLD1ReportFixture.java → core/services/local/src/test/java/fr/ird/observe/services/local/service/ReportServiceLocalReadTest.java
=====================================
@@ -1,8 +1,8 @@
-package fr.ird.observe.services.service.report.ps;
+package fr.ird.observe.services.local.service;
/*-
* #%L
- * ObServe Core :: Services :: Test
+ * ObServe Core :: Services :: Local
* %%
* Copyright (C) 2008 - 2022 IRD, Ultreia.io
* %%
@@ -22,26 +22,23 @@ package fr.ird.observe.services.service.report.ps;
* #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 fr.ird.observe.services.service.ReportService;
+import org.junit.Test;
-import java.util.Iterator;
+import javax.annotation.Generated;
-/**
- * Created on 17/02/2021.
- *
- * @author Tony Chemit - dev(a)tchemit.fr
- * @since 8.0.6
- */
-(a)AutoService(ReportFixture.class)
-public class PsObservationTargetStoredDistributionLengthsLD1ReportFixture extends ReportFixture {
+@Generated(value = "io.ultreia.java4all.http.maven.plugin.test.GenerateApiImplMojo", date = "Mon Nov 14 16:20:02 CET 2022")
+public class ReportServiceLocalReadTest extends GeneratedReportServiceLocalReadTest {
+
+ @Test
+ public void executeReportPsObservationLengthsDistribution() {
+ ReportService service = getService();
+ fixtures.executeReport(getServicesProvider(), service, "psObservationLengthsDistribution");
+ }
- @Override
- public void assertSyntax(Report report) {
- super.assertSyntax(report);
- Iterator<ReportRequest> requests = getRequestIterator(report);
- assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0);
+ @Test
+ public void executeReportPsObservationCatchByGroup() {
+ ReportService service = getService();
+ fixtures.executeReport(getServicesProvider(), service, "psObservationCatchByGroup");
}
}
=====================================
core/services/test/src/main/java/fr/ird/observe/services/service/ReportServiceFixtures.java
=====================================
@@ -109,10 +109,14 @@ public class ReportServiceFixtures extends GeneratedReportServiceFixtures {
@Override
public void executeReport(ObserveServicesProvider servicesProvider, ReportService service) {
for (String id : ReportServiceFixtures.getReportIds()) {
+ executeReport(servicesProvider, service, id);
+ }
+ }
+
+ public void executeReport(ObserveServicesProvider servicesProvider, ReportService service, String id) {
setReportId(id);
Report definition = getReport(id);
executeReport(definition, service);
- }
}
@Override
=====================================
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(a)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(a)tchemit.fr
- * @since 1.9
- */
-(a)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(a)tchemit.fr
- * @since 8.0.6
- */
-(a)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(a)tchemit.fr
- * @since 8.0.6
- */
-(a)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/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationAccessoryCatchByGroup.properties deleted
=====================================
@@ -1,31 +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%
-###
-result.0=[FAO]ALV [sc]Alopias vulpinus [fr]Renard^0^3^3^0^0^0^0^0^0^0.0
-result.columns=11
-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.nbRequests=1
-syntax.rows=-1
-syntax.rowsHeader=
=====================================
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-psObservationCatchByGroup.properties
=====================================
@@ -19,10 +19,14 @@
# <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.name=Observations - Dénombrement des captures par devenir, filtrés par groupe
+syntax.description=Afficher les nombres de captures par groupe d'espèce selon le type de banc et le devenir
syntax.rows=-1
+syntax.columns=-1
+syntax.columnsHeader=
syntax.rowsHeader=
+syntax.nbRequests=1
+result.columns=4
+result.rows=2
+result.0=Espèce^Total BL^Total BO^Echappe du filet (pour requin-baleine et cétacés)
+result.1=[FAO]ALV [sc]Alopias vulpinus [fr]Renard^0^3^3
\ No newline at end of file
=====================================
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=2
+result.rows=5
+result.0=Classe de taille (cm)^Aucun
+result.1=50.0^2
+result.2=54.0^1
+result.3=68.0^1
+result.4=70.0^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-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=
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/f0e84c38b09c64b872efc14c…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/f0e84c38b09c64b872efc14c…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] 14 commits: Rapport Liste des captures de faune accessoire selon le type de banc, filtrées...
by Tony CHEMIT (@tchemit) 16 Nov '22
by Tony CHEMIT (@tchemit) 16 Nov '22
16 Nov '22
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
6684283f by Tony Chemit at 2022-11-16T02:11:22+01:00
Rapport Liste des captures de faune accessoire selon le type de banc, filtrées par groupe - Closes #2532
- - - - -
18379b3e by Tony Chemit at 2022-11-16T02:11:22+01:00
GUI - use resetEdit state when reset entry on content table
- - - - -
12dfe7b6 by Tony Chemit at 2022-11-16T02:11:22+01:00
GUI - Sur échantillons PS observations saisis par lots, migrés vers 9.0, valeurs étranges sur le champ poids individuel - Closes #2503
- - - - -
46e605b6 by Tony Chemit at 2022-11-16T02:11:22+01:00
Report API - Add TimeLog in DefaultReportRequestExecutor
- - - - -
34b3dec6 by Tony Chemit at 2022-11-16T02:11:22+01:00
Report API - Clean ReportRequest code
- - - - -
0ac163ca by Tony Chemit at 2022-11-16T02:11:22+01:00
Report API - Improve executeReportRequest method (one for simple request and one for request with repeat)
- - - - -
5694c752 by Tony Chemit at 2022-11-16T02:11:22+01:00
Report API - Improve Sum operations (can now set x and y and better round of double)
- - - - -
357f447c by Tony Chemit at 2022-11-16T02:11:22+01:00
Report API - add safe guard tests (to be able to copy partial matrix)
- - - - -
6295fc29 by Tony Chemit at 2022-11-16T02:11:22+01:00
Report API - Be able to order variables and repeat variables
- - - - -
bacdc4d1 by Tony Chemit at 2022-11-16T02:11:22+01:00
Tck Report - columnHeaders can be null
Tck Report - Improve when to deliver asserts
- - - - -
be74c546 by Tony Chemit at 2022-11-16T02:11:22+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)
- - - - -
81146b7a by Tony Chemit at 2022-11-16T02:11:22+01:00
Report GUI - Respect report variables order in Report model
- - - - -
c0fab2d0 by Tony Chemit at 2022-11-16T02:11:22+01:00
Report API - Improve ReportVariable (add isEmpty and computeIndexList methods)
- - - - -
f0e84c38 by Tony Chemit at 2022-11-16T02:11:22+01:00
Report API - Add new neutral operations
- - - - -
24 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
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/entry/ResetEntry.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java
- core/api/dto/src/main/resources/observe-reports.properties
- − 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/PsObservationAccessoryCatchReportFixture.java → core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchReportFixture.java
- core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationAccessoryCatch.properties → core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatch.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
- toolkit/api/src/main/java/fr/ird/observe/dto/report/ReportRequest.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/ReportRequestExecutor.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/ReportVariable.java
- + toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/ComputeDynamicHeader.java
- + toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/CopyRepeatVariableToFirstColumn.java
- + toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/ExecuteRequestAndReorganizeCountByRepeatVariable.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/ExecuteRequests.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumColumn.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumFloatColumn.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumIntColumn.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumIntRow.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumRow.java
- toolkit/persistence/src/main/java/fr/ird/observe/spi/report/DefaultReportRequestExecutor.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() {
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/entry/ResetEntry.java
=====================================
@@ -59,7 +59,12 @@ public final class ResetEntry extends ContentTableUIActionSupport<ContentTableUI
}
} else {
// reset existing entry
- tableModel.resetEditBean();
+ ui.getStates().setResetEdit(true);
+ try {
+ tableModel.resetEditBean();
+ } finally {
+ ui.getStates().setResetEdit(false);
+ }
}
}
=====================================
client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java
=====================================
@@ -72,12 +72,11 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
private final PropertyChangeListener speciesChanged;
public SampleUIHandler() {
- weightChanged = evt -> onWeightChanged((Float) evt.getNewValue());
- lengthChanged = evt -> onLengthChanged((Float) evt.getNewValue());
+ weightChanged = evt -> onWeightChanged((Float) evt.getNewValue(), !ui.getStates().isResetEdit());
+ lengthChanged = evt -> onLengthChanged((Float) evt.getNewValue(), !ui.getStates().isResetEdit());
speciesChanged = evt -> onSpeciesChanged((SpeciesReference) evt.getNewValue());
}
-
@Override
public void onInit(SampleUI ui) {
super.onInit(ui);
@@ -97,8 +96,8 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
public void onSelectedRowChanged(SampleMeasureDto tableEditBean, SampleMeasureDto previousRowBean, boolean notPersisted, boolean newRow) {
- onLengthChanged(tableEditBean.getLength());
- onWeightChanged(tableEditBean.getWeight());
+ onLengthChanged(tableEditBean.getLength(), false);
+ onWeightChanged(tableEditBean.getWeight(), false);
SampleUIModel sampleModel = getModel();
@@ -209,6 +208,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
}
public void startEditTableEditBean(SampleMeasureDto tableEditBean) {
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_WEIGHT, weightChanged);
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_LENGTH, lengthChanged);
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_SPECIES, speciesChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_WEIGHT, weightChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_LENGTH, lengthChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_SPECIES, speciesChanged);
@@ -249,9 +251,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
acquisitionModeGroup.setSelectedValue(acquisitionMode);
}
- protected void onWeightChanged(Float newValue) {
+ protected void onWeightChanged(Float newValue, boolean realChange) {
SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean();
- if (tableEditBean.getAcquisitionMode() == 1) {
+ if (realChange && tableEditBean.getAcquisitionMode() == 1) {
tableEditBean.setIsWeightComputed(false);
}
if (newValue == null) {
@@ -259,9 +261,11 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
}
}
- protected void onLengthChanged(Float newValue) {
+ protected void onLengthChanged(Float newValue, boolean realChange) {
SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean();
- tableEditBean.setIsLengthComputed(false);
+ if (realChange) {
+ tableEditBean.setIsLengthComputed(false);
+ }
if (newValue == null) {
tableEditBean.setLengthMeasureMethod(null);
}
=====================================
core/api/dto/src/main/resources/observe-reports.properties
=====================================
@@ -697,26 +697,26 @@ report.psObservationTargetDiscardedByAssociation.request.19=0,3|row|\
and os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \
and os not in elements(a.observedSystem)
################################################################################
-## Captures accessoires observées
+## Captures observées
################################################################################
-report.psObservationAccessoryCatch.modelType=PS
-report.psObservationAccessoryCatch.name=Observations - Liste des captures accessoires selon le type de banc, filtrées par groupe
-report.psObservationAccessoryCatch.description=Afficher les captures accessoires par groupe d'espèce\nLes poids sont exprimés en tonnes.
-report.psObservationAccessoryCatch.columns=Espèce, Banc libre, Banc objet
-report.psObservationAccessoryCatch.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code
-report.psObservationAccessoryCatch.repeatVariable.speciesId=java.lang.String|\
+report.psObservationCatch.modelType=PS
+report.psObservationCatch.name=Observations - Liste des captures selon le type de banc, filtrées par groupe
+report.psObservationCatch.description=Afficher les captures par groupe d'espèce\nLes poids sont exprimés en tonnes.
+report.psObservationCatch.columns=Espèce, Banc libre, Banc objet
+report.psObservationCatch.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code
+report.psObservationCatch.repeatVariable.speciesId=java.lang.String|\
Select e.id From SpeciesImpl e \
Where e.speciesGroup.id = :speciesGroup \
Order By e.homeId
-report.psObservationAccessoryCatch.request.1=0,0|row|\
+report.psObservationCatch.request.1=0,0|row|\
Select \
concat('[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \
' [sc]', (case when e.scientificLabel is not null then e.scientificLabel else '-' end), \
' [fr]', (case when e.label2 is not null then e.label2 else '-' end)) \
From SpeciesImpl e \
Where e.id = :speciesId
-report.psObservationAccessoryCatch.request.1.repeat=speciesId|column
-report.psObservationAccessoryCatch.request.2=1,0|row|\
+report.psObservationCatch.request.1.repeat=speciesId|column
+report.psObservationCatch.request.2=1,0|row|\
Select \
case when Count(ca) > 0 then \
concat('+', \
@@ -731,8 +731,8 @@ report.psObservationAccessoryCatch.request.2=1,0|row|\
Join c.catches ca \
with ca.species.id = :speciesId \
Where m.id In :tripId
-report.psObservationAccessoryCatch.request.2.repeat=speciesId|column
-report.psObservationAccessoryCatch.request.3=2,0|row|\
+report.psObservationCatch.request.2.repeat=speciesId|column
+report.psObservationCatch.request.3=2,0|row|\
Select \
case when Count(ca) > 0 then \
concat('+', \
@@ -747,7 +747,7 @@ report.psObservationAccessoryCatch.request.3=2,0|row|\
Join c.catches ca \
with ca.species.id = :speciesId \
Where m.id In :tripId
-report.psObservationAccessoryCatch.request.3.repeat=speciesId|column
+report.psObservationCatch.request.3.repeat=speciesId|column
################################################################################
## Captures accessoires par speciesGroup d'espèces
################################################################################
=====================================
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/PsObservationAccessoryCatchReportFixture.java → core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchReportFixture.java
=====================================
@@ -36,7 +36,7 @@ import java.util.Iterator;
* @since 1.9
*/
@AutoService(ReportFixture.class)
-public class PsObservationAccessoryCatchReportFixture extends ReportFixture {
+public class PsObservationCatchReportFixture extends ReportFixture {
@Override
public void assertSyntax(Report report) {
=====================================
core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationAccessoryCatch.properties → core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatch.properties
=====================================
@@ -19,8 +19,24 @@
# <http://www.gnu.org/licenses/gpl-3.0.html>.
# #L%
###
+syntax.name=Observations - Liste des captures selon le type de banc, filtrées par groupe
+syntax.description=Afficher les captures par groupe d'espèce-Les poids sont exprimés en tonnes.
+syntax.columns=3
+syntax.rows=-1
+syntax.columnsHeader=Espèce^Banc libre^Banc objet
+syntax.nbRequests=3
+result.columns=3
+result.rows=49
result.0=[FAO]CCB [sc]Carcharhinus brevipinna [fr]Requin tisserand^-^-
result.1=[FAO]ALS [sc]Carcharhinus albimarginatus [fr]Requin pointe blanche^-^-
+result.2=[FAO]AML [sc]Carcharhinus amblyrhynchos [fr]Grey reef shark^-^-
+result.3=[FAO]PTH [sc]Alopias pelagicus [fr]Renard pélagique^-^-
+result.4=[FAO]BTH [sc]Alopias superciliosus [fr]Renard à gros yeux^-^-
+result.5=[FAO]ALV [sc]Alopias vulpinus [fr]Renard^-^+ Effectif : 3 Poids total (t) : 12.0
+result.6=[FAO]BLR [sc]Carcharhinus melanopterus [fr]Requin pointes noires^-^-
+result.7=[FAO]BRO [sc]Carcharhinus brachyurus [fr]Requin cuivre^-^-
+result.8=[FAO]WSH [sc]Carcharodon carcharias [fr]Grand requin blanc^-^-
+result.9=[FAO]CCE [sc]Carcharhinus leucas [fr]Requin bouledogue^-^-
result.10=[FAO]CCL [sc]Carcharhinus limbatus [fr]Requin bordé^-^-
result.11=[FAO]CCP [sc]Carcharhinus plumbeus [fr]Requin gris^-^-
result.12=[FAO]FAL [sc]Carcharhinus falciformis [fr]Requin soyeux^-^-
@@ -28,10 +44,9 @@ result.13=[FAO]OCS [sc]Carcharhinus longimanus [fr]Requin océanique^-^-
result.14=[FAO]CWZ [sc]Carcharhinus spp [fr]Requins Carcharhinus nca^-^-
result.15=[FAO]DUS [sc]Carcharhinus obscurus [fr]Requin sombre^-^-
result.16=[FAO]SHL [sc]Etmopterus spp [fr]Genre Etmopterus^-^-
-result.17=[FAO]THR [sc]Alopias spp [fr]Renards de mer nca ^-^-
+result.17=[FAO]THR [sc]Alopias spp [fr]Renards de mer nca^-^-
result.18=[FAO]RSK [sc]Carcharhinidae spp [fr]Famille Carcharhinidae^-^-
result.19=[FAO]MSK [sc]Lamnidae [fr]Famille Lamnidae^-^-
-result.2=[FAO]AML [sc]Carcharhinus amblyrhynchos [fr]Grey reef shark^-^-
result.20=[FAO]2FOD [sc]Odontaspididae [fr]Odontaspididae^-^-
result.21=[FAO]2FRH [sc]Rhincodontidae [fr]Famille Rhincodontidae^-^-
result.22=[FAO]SPY [sc]Sphyrnidae [fr]Famille Sphyrnidae^-^-
@@ -42,18 +57,16 @@ result.26=[FAO]LMA [sc]Isurus paucus [fr]Petite taupe, Mako^-^-
result.27=[FAO]MAK [sc]Isurus spp [fr]Taupes^-^-
result.28=[FAO]LMP [sc]Megachasma pelagios [fr]Requin grande gueule^-^-
result.29=[FAO]CVX [sc]Carcharhiniformes [fr]Ordre Carcharhiniformes^-^-
-result.3=[FAO]PTH [sc]Alopias pelagicus [fr]Renard pélagique^-^-
result.30=[FAO]HDQ [sc]Heterodontiformes [fr]Ordre Heterodontiformes^-^-
result.31=[FAO]HXW [sc]Hexanchiformes [fr]Ordre Hexanchiformes^-^-
result.32=[FAO]LMZ [sc]Lamniformes [fr]Ordre Lamniformes^-^-
result.33=[FAO]OCX [sc]Orectolobiformes [fr]Ordre Orectolobiformes^-^-
-result.34=[FAO]PWS [sc]Pristiophorus spp [fr]Requins-scies nca ^-^-
+result.34=[FAO]PWS [sc]Pristiophorus spp [fr]Requins-scies nca^-^-
result.35=[FAO]OSF [sc]Stegostoma fasciatum [fr]Requin zèbre^-^-
result.36=[FAO]SHX [sc]Squaliformes [fr]Ordre Squaliformes^-^-
-result.37=[FAO]ASK [sc]Squatinidae [fr]Anges de mer nca ^-^-
+result.37=[FAO]ASK [sc]Squatinidae [fr]Anges de mer nca^-^-
result.38=[FAO]BSH [sc]Prionace glauca [fr]Peau bleue^-^-
result.39=[FAO]POR [sc]Lamna nasus [fr]Requin taupe commun^-^-
-result.4=[FAO]BTH [sc]Alopias superciliosus [fr]Renard à gros yeux^-^-
result.40=[FAO]PSK [sc]Pseudocarcharias kamoharai [fr]Requin crocodile^-^-
result.41=[FAO]2REX [sc]Requin non identifié [fr]Requin non identifié^-^-
result.42=[FAO]BSK [sc]Cetorhinus maximus [fr]Requin pèlerin^-^-
@@ -63,17 +76,3 @@ result.45=[FAO]SPL [sc]Sphyrna lewini [fr]Requin marteau halicorne^-^-
result.46=[FAO]SPK [sc]Sphyrna mokarran [fr]Grand requin marteau^-^-
result.47=[FAO]SPN [sc]Sphyrna spp [fr]Requins marteau nca^-^-
result.48=[FAO]SPZ [sc]Sphyrna zygaena [fr]Requin marteau commun^-^-
-result.5=[FAO]ALV [sc]Alopias vulpinus [fr]Renard^-^+ Effectif : 3 Poids total (t) : 12.0
-result.6=[FAO]BLR [sc]Carcharhinus melanopterus [fr]Requin pointes noires^-^-
-result.7=[FAO]BRO [sc]Carcharhinus brachyurus [fr]Requin cuivre^-^-
-result.8=[FAO]WSH [sc]Carcharodon carcharias [fr]Grand requin blanc^-^-
-result.9=[FAO]CCE [sc]Carcharhinus leucas [fr]Requin bouledogue^-^-
-result.columns=3
-result.rows=49
-syntax.columns=3
-syntax.columnsHeader=Espèce^Banc libre^Banc objet
-syntax.description=Afficher les captures accessoires par groupe d'espèce-Les poids sont exprimés en tonnes.
-syntax.name=Observations - Liste des captures accessoires selon le type de banc, filtrées par groupe
-syntax.nbRequests=3
-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);
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/ReportRequest.java
=====================================
@@ -27,9 +27,9 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import java.awt.Point;
import java.io.Serializable;
-import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
/**
* Pour caractériser une requète à lancer dans un report.
@@ -90,46 +90,17 @@ public class ReportRequest implements Serializable, JsonAware {
}
public static Map<String, Object> extractParams(Report report, Set<String> tripId) {
-
- Map<String, Object> params = new HashMap<>();
-
+ Map<String, Object> params = new TreeMap<>();
params.put(TRIP_ID_VARIABLE, tripId);
-
for (ReportVariable<?> variable : report.getVariables()) {
-
String name = variable.getName();
-
Object value = variable.getSelectedValue();
-
params.put(name, value);
-
}
return params;
}
-// public static Object[] getParams(String request, Map<String, Object> params) {
-//
-// // on parcourt la liste de tous les paramètres pour savoir si on doit
-// // les inclure pour la requête donnée :
-// List<String> namesToUsed = new ArrayList<>();
-// for (String paramName : params.keySet()) {
-// if (request.contains(":" + paramName)) {
-// namesToUsed.add(paramName);
-// }
-// }
-// Object[] datas = new Object[namesToUsed.size() * 2];
-// int index = 0;
-// for (String name : namesToUsed) {
-// Object value = params.get(name);
-// datas[index * 2] = name;
-// datas[index * 2 + 1] = value;
-// index++;
-// }
-// namesToUsed.clear();
-// return datas;
-// }
-
public ReportRequest(RequestLayout layout,
int x,
int y,
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/ReportRequestExecutor.java
=====================================
@@ -29,6 +29,7 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
/**
* To execute a request.
@@ -49,11 +50,20 @@ public interface ReportRequestExecutor {
<V> void populateVariable(ReportVariable<V> variable, Map<String, Object> vars);
- default DataMatrix executeReportRequest(ReportRequest request, Report report, Set<String> dataId, ReportVariable<?> repeatValues) {
+ default DataMatrix executeReportRequest(ReportRequest request, Report report, Set<String> dataId) {
Map<String, Object> params = ReportRequest.extractParams(report, dataId);
- if (repeatValues == null) {
- return executeReportRequest(request, params);
+ String hql = request.getRequest();
+ for (ReportVariable<?> repeatVariable : report.getRepeatVariables()) {
+ if (hql.contains(":" + repeatVariable.getName() + " ")) {
+ // add this repeat variable values to parameters
+ params.put(repeatVariable.getName(), repeatVariable.computeIndexList());
+ }
}
+ return executeReportRequest(request, params);
+ }
+
+ default DataMatrix executeReportRequest(ReportRequest request, Report report, Set<String> dataId, ReportVariable<?> repeatValues) {
+ Map<String, Object> params = ReportRequest.extractParams(report, dataId);
DataMatrix result = new DataMatrix();
for (Object repeatValue : repeatValues.getValues()) {
params.put(request.getRepeat().getVariableName(), repeatValue);
@@ -97,15 +107,27 @@ public interface ReportRequestExecutor {
return result;
}
- @SuppressWarnings("unchecked")
default void doPopulateRepeatVariables(Report report, Set<String> tripId) {
Map<String, Object> vars = ReportRequest.extractParams(report, tripId);
- for (@SuppressWarnings("rawtypes") ReportVariable variable : report.getRepeatVariables()) {
- String hql = variable.getRequest();
- List<Object> universe = executeRequest(hql, vars);
- LinkedHashSet<Object> values = new LinkedHashSet<>(universe);
- variable.setValues(values);
+ for (ReportVariable<?> variable : report.getRepeatVariables()) {
+ doPopulateRepeatVariable(report, tripId, new TreeMap<>(vars), variable);
+ }
+ }
+
+ default <R> void doPopulateRepeatVariable(Report report, Set<String> tripId, Map<String, Object> vars, ReportVariable<R> variable) {
+ String hql = variable.getRequest();
+ for (ReportVariable<?> repeatVariable : report.getRepeatVariables()) {
+ if (variable.equals(repeatVariable)) {
+ continue;
+ }
+ if (hql.contains(":" + repeatVariable.getName() + " ")) {
+ // add this repeat variable values to parameters
+ vars.put(repeatVariable.getName(), repeatVariable.computeIndexList());
+ }
}
+ List<R> universe = executeRequest(hql, vars);
+ LinkedHashSet<R> values = new LinkedHashSet<>(universe);
+ variable.setValues(values);
}
private DataMatrixDimension computeDimension(ReportRequest request, List<?> list) {
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/ReportVariable.java
=====================================
@@ -22,10 +22,15 @@ package fr.ird.observe.dto.report;
* #L%
*/
+import fr.ird.observe.dto.ToolkitId;
import io.ultreia.java4all.util.json.JsonAware;
import java.io.Serializable;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Objects;
import java.util.Set;
+import java.util.stream.Collectors;
/**
* La définition d'une variable utilisable dans un report.
@@ -90,4 +95,31 @@ public class ReportVariable<V> implements Serializable, JsonAware {
public void setSelectedValue(V selectedValue) {
this.selectedValue = selectedValue;
}
+
+ public List<String> computeIndexList() {
+ Set<V> tmp = new LinkedHashSet<>(values);
+ boolean useNullValue = tmp.remove(null);
+ List<String> result = tmp.stream().map(s -> s instanceof ToolkitId ? ((ToolkitId) s).getId() : String.valueOf(s)).collect(Collectors.toList());
+ if (useNullValue) {
+ result.add("null");
+ }
+ return result;
+ }
+
+ public boolean isEmpty() {
+ return values == null || values.isEmpty();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ReportVariable)) return false;
+ ReportVariable<?> that = (ReportVariable<?>) o;
+ return Objects.equals(name, that.name);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name);
+ }
}
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/ComputeDynamicHeader.java
=====================================
@@ -0,0 +1,84 @@
+package fr.ird.observe.dto.report.operations;
+
+/*-
+ * #%L
+ * ObServe Toolkit :: API
+ * %%
+ * 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.referential.WithI18n;
+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 java.util.Set;
+
+/**
+ * To compute dynamic headers (for report with no column headers defined).
+ * <p>
+ * You can set as parameters an array of fixed column names + a repeat variable to complete the header.
+ * <p>
+ * Example:
+ * <code>Col1,Col2,Col3|repeatVariableName</code>
+ * <p>
+ * Created on 15/11/2022.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 9.0.17
+ */
+(a)AutoService(ReportOperationConsumer.class)
+public class ComputeDynamicHeader implements ReportOperationConsumer {
+ @Override
+ public DataMatrix consume(String parameters, ReportRequestExecutor requestExecutor, Report report, Set<String> tripId, DataMatrix incoming) {
+ if (parameters.isEmpty()) {
+ throw new IllegalStateException(String.format("parameters of operation %s can't not be null (format: col1,col2,...|repeatVariableName)", getClass().getName()));
+ }
+ String[] split = parameters.split("\\|");
+ if (split.length != 2) {
+ throw new IllegalStateException(String.format("parameters of operation %s (value %s) has bad format (format: col1,col2,...|repeatVariableName)", getClass().getName(), parameters));
+ }
+ String[] fixedColumnNames = split[0].split("\\s*,\\s*");
+ String repeatVariableName = split[1].trim();
+ Set<?> repeatVariableValues = report.getRepeatVariable(repeatVariableName).getValues();
+ int columnIndex = 0;
+ DataMatrix tmpMatrix = createTmpMatrix(0, 0, incoming.getWidth(), 1);
+ boolean useNullRepeatVariableValue = false;
+ for (String beginHeader : fixedColumnNames) {
+ tmpMatrix.setValue(columnIndex++, 0, beginHeader);
+ }
+ for (Object repeatVariable : repeatVariableValues) {
+ if (repeatVariable == null) {
+ useNullRepeatVariableValue = true;
+ } else {
+ if (repeatVariable instanceof WithI18n) {
+ tmpMatrix.setValue(columnIndex++, 0, ((WithI18n) repeatVariable).getLabel2());
+ } else {
+ tmpMatrix.setValue(columnIndex++, 0, repeatVariable.toString());
+ }
+ }
+ }
+ if (useNullRepeatVariableValue) {
+ tmpMatrix.setValue(columnIndex, 0, "Aucun");
+ }
+ incoming.setY(1);
+ return DataMatrix.merge(incoming, tmpMatrix);
+ }
+}
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/CopyRepeatVariableToFirstColumn.java
=====================================
@@ -0,0 +1,66 @@
+package fr.ird.observe.dto.report.operations;
+
+/*-
+ * #%L
+ * ObServe Toolkit :: API
+ * %%
+ * 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.referential.WithI18n;
+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 java.util.Set;
+
+/**
+ * To copy all values of a repeat variable to the first column.
+ * <p>
+ * If repeat variables values are {@link WithI18n}, then will use the {@link WithI18n#getLabel2()}.
+ * <p>
+ * TODO: Be able to use the correct locale to translate with correct label.
+ * <p>
+ * Created on 15/11/2022.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 9.0.17
+ */
+(a)AutoService(ReportOperationConsumer.class)
+public class CopyRepeatVariableToFirstColumn implements ReportOperationConsumer {
+ @Override
+ public DataMatrix consume(String parameters, ReportRequestExecutor requestExecutor, Report report, Set<String> tripId, DataMatrix incoming) {
+ if (parameters.isEmpty()) {
+ throw new IllegalStateException(String.format("parameters of operation %s can't not be null (format: repeatVariableName)", getClass().getName()));
+ }
+ String repeatVariableName = parameters.trim();
+ Set<?> repeatVariableValues = report.getRepeatVariable(repeatVariableName).getValues();
+ DataMatrix tmpMatrix = createTmpMatrix(0, 0, 1 + incoming.getWidth(), repeatVariableValues.size());
+ int index = 0;
+ for (Object value : repeatVariableValues) {
+ if (value instanceof WithI18n) {
+ value = ((WithI18n) value).getLabel2();
+ }
+ tmpMatrix.setValue(0, index++, value);
+ }
+ incoming.setX(1);
+ return DataMatrix.merge(incoming, tmpMatrix);
+ }
+}
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/ExecuteRequestAndReorganizeCountByRepeatVariable.java
=====================================
@@ -0,0 +1,120 @@
+package fr.ird.observe.dto.report.operations;
+
+/*-
+ * #%L
+ * ObServe Toolkit :: API
+ * %%
+ * 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.ReportRequest;
+import fr.ird.observe.dto.report.ReportRequestExecutor;
+import fr.ird.observe.dto.report.ReportVariable;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * To execute a query and then reorganize it using repeat variables position (on x axis and y axis).
+ * <p>
+ * Created on 15/11/2022.
+ * <p>
+ * Parameters format is
+ * <code>repeatVariableForRow|repeatVariableFormColum|request</code>
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 9.0.17
+ */
+(a)AutoService(ReportOperationConsumer.class)
+public class ExecuteRequestAndReorganizeCountByRepeatVariable implements ReportOperationConsumer {
+
+ @Override
+ public DataMatrix consume(String parameters, ReportRequestExecutor requestExecutor, Report report, Set<String> tripId, DataMatrix incoming) {
+ if (parameters.isEmpty()) {
+ throw new IllegalStateException(String.format("parameters of operation %s can't not be null (format: repeatVariableForRow|repeatVariableFormColum|request)", getClass().getName()));
+ }
+ String[] split = parameters.split("\\|");
+ if (split.length != 3) {
+ throw new IllegalStateException(String.format("parameters of operation %s (value %s) has bad format (format: repeatVariableForRow|repeatVariableFormColum|request)", getClass().getName(), parameters));
+ }
+ String repeatVariableForColumName = split[1].trim();
+ ReportVariable<?> repeatVariableForColumn = report.getRepeatVariable(repeatVariableForColumName);
+ if (repeatVariableForColumn.isEmpty()) {
+ return incoming;
+ }
+ String repeatVariableForRowName = split[0].trim();
+ ReportVariable<?> repeatVariableForRow = report.getRepeatVariable(repeatVariableForRowName);
+ if (repeatVariableForRow.isEmpty()) {
+ return incoming;
+ }
+ String request = split[2].trim();
+
+ List<String> columnIdList = repeatVariableForColumn.computeIndexList();
+ List<String> rowIdList = repeatVariableForRow.computeIndexList();
+
+ Map<String, Object> queryParameters = computeQueryParameters(report,
+ tripId,
+ request,
+ repeatVariableForRowName,
+ rowIdList,
+ repeatVariableForColumName,
+ columnIdList);
+
+ DataMatrix result = createTmpMatrix(incoming.getWidth(), 0, columnIdList.size(), rowIdList.size());
+
+ List<Object[]> rows = requestExecutor.executeRequest(request, queryParameters);
+ reorganize(result, rows, rowIdList, columnIdList);
+ return DataMatrix.merge(incoming, result);
+ }
+
+ private Map<String, Object> computeQueryParameters(Report report,
+ Set<String> tripId,
+ String request,
+ String repeatVariableForRow,
+ List<String> rowIdList,
+ String repeatVariableFormColum,
+ List<String> columnIdList) {
+ Map<String, Object> queryParameters = ReportRequest.extractParams(report, tripId);
+
+ if (request.contains(":" + repeatVariableForRow + " ")) {
+ // add this variable to queryParameters
+ queryParameters.put(repeatVariableForRow, rowIdList);
+ }
+ if (request.contains(":" + repeatVariableFormColum + " ")) {
+ // add this variable to queryParameters
+ queryParameters.put(repeatVariableFormColum, columnIdList);
+ }
+ return queryParameters;
+ }
+
+ private void reorganize(DataMatrix result, List<Object[]> rows, List<String> rowIdList, List<String> columnIdList) {
+ for (Object[] row : rows) {
+ String rowId = String.valueOf(row[0]);
+ int rowIndex = rowIdList.indexOf(rowId);
+ String columnId = String.valueOf(row[1]);
+ int columnIndex = columnIdList.indexOf(columnId);
+ Number count = (Number) row[2];
+ result.setValue(columnIndex, rowIndex, count);
+ }
+ }
+}
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/ExecuteRequests.java
=====================================
@@ -53,7 +53,7 @@ public class ExecuteRequests implements ReportOperationConsumer {
DataMatrix result;
if (repeatVariable == null) {
// requête simple sans repetition
- result = requestExecutor.executeReportRequest(request, report, tripId, null);
+ result = requestExecutor.executeReportRequest(request, report, tripId);
} else {
// on a une requête avec repetition
String repeatVariableName = repeatVariable.getVariableName();
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumColumn.java
=====================================
@@ -27,6 +27,7 @@ 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 io.ultreia.java4all.lang.Numbers;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -45,19 +46,37 @@ public class SumColumn implements ReportOperationConsumer {
@Override
public DataMatrix consume(String parameters, ReportRequestExecutor requestExecutor, Report report, Set<String> tripId, DataMatrix incoming) {
- DataMatrix tmpMatrix = createTmpMatrix(0, incoming.getHeight(), incoming.getWidth(), 1);
- for (int column = 0, nbColumns = incoming.getWidth(); column < nbColumns; column++) {
- Object sumColumn = getSumColumn(column, incoming);
+ int x = 0;
+ int y = 0;
+ int height = incoming.getHeight();
+ int width = incoming.getWidth();
+ if (!parameters.isEmpty()) {
+ String[] split = parameters.split("\\|");
+ x = Integer.parseInt(split[0]);
+ y = Integer.parseInt(split[1]);
+ if (x + 1 >= height) {
+ // only one row in column to sum, so skip operation
+ return incoming;
+ }
+ }
+
+ DataMatrix tmpMatrix = createTmpMatrix(0, height, width, 1);
+ for (int column = y; column < width; column++) {
+ Object sumColumn = getSumColumn(column, x, incoming);
tmpMatrix.setValue(column, 0, sumColumn);
}
- return DataMatrix.merge(incoming, tmpMatrix);
+ DataMatrix merge = DataMatrix.merge(incoming, tmpMatrix);
+ if (report.getColumnHeaders() == null) {
+ merge.setValue(0, height, "Total");
+ }
+ return merge;
}
- protected Object getSumColumn(int column, DataMatrix incoming) {
- double result = 0d;
+ protected Object getSumColumn(int column, int x, DataMatrix incoming) {
+ float result = 0f;
int nbRows = incoming.getHeight();
- for (int row = 0; row < nbRows; row++) {
+ for (int row = x; row < nbRows; row++) {
Serializable o = incoming.getValue(column, row);
if (o == null || "null".equals(o)) {
o = 0;
@@ -71,6 +90,6 @@ public class SumColumn implements ReportOperationConsumer {
}
result += d;
}
- return result;
+ return Numbers.roundFourDigits(result);
}
}
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumFloatColumn.java
=====================================
@@ -41,7 +41,7 @@ public class SumFloatColumn extends SumColumn implements ReportOperationConsumer
private static final Logger log = LogManager.getLogger(SumFloatColumn.class);
@Override
- protected Object getSumColumn(int column, DataMatrix incoming) {
+ protected Object getSumColumn(int column, int x, DataMatrix incoming) {
double result = 0d;
int nbRows = incoming.getHeight();
for (int row = 0; row < nbRows; row++) {
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumIntColumn.java
=====================================
@@ -36,8 +36,8 @@ import fr.ird.observe.dto.report.ReportOperationConsumer;
public class SumIntColumn extends SumColumn implements ReportOperationConsumer {
@Override
- protected Object getSumColumn(int column, DataMatrix incoming) {
- Object sumColumn = super.getSumColumn(column, incoming);
+ protected Object getSumColumn(int column, int x, DataMatrix incoming) {
+ Object sumColumn = super.getSumColumn(column, x, incoming);
return sumColumn instanceof Number ? ((Number) sumColumn).intValue() : sumColumn;
}
}
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumIntRow.java
=====================================
@@ -35,8 +35,8 @@ import fr.ird.observe.dto.report.ReportOperationConsumer;
@AutoService(ReportOperationConsumer.class)
public class SumIntRow extends SumRow implements ReportOperationConsumer {
@Override
- protected Object getSumRow(int row, DataMatrix incoming) {
- Object sumColumn = super.getSumRow(row, incoming);
+ protected Object getSumRow(int row, int y, DataMatrix incoming) {
+ Object sumColumn = super.getSumRow(row, y, incoming);
return sumColumn instanceof Number ? ((Number) sumColumn).intValue() : sumColumn;
}
}
=====================================
toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumRow.java
=====================================
@@ -27,6 +27,7 @@ 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 io.ultreia.java4all.lang.Numbers;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -45,18 +46,37 @@ public class SumRow implements ReportOperationConsumer {
@Override
public DataMatrix consume(String parameters, ReportRequestExecutor requestExecutor, Report report, Set<String> tripId, DataMatrix incoming) {
- DataMatrix tmpMatrix = createTmpMatrix(incoming.getWidth(), 0, 1, incoming.getHeight());
- for (int row = 0, nbRows = incoming.getHeight(); row < nbRows; row++) {
- Object sumRow = getSumRow(row, incoming);
+ int x = 0;
+ int y = 0;
+ int width = incoming.getWidth();
+ int height = incoming.getHeight();
+
+
+ if (!parameters.isEmpty()) {
+ String[] split = parameters.split("\\|");
+ x = Integer.parseInt(split[0]);
+ y = Integer.parseInt(split[1]);
+ if (y + 1 >= width) {
+ // only one column in row to sum, so skip operation
+ return incoming;
+ }
+ }
+ DataMatrix tmpMatrix = createTmpMatrix(width, 0, 1, height);
+ for (int row = x; row < height; row++) {
+ Object sumRow = getSumRow(row, y, incoming);
tmpMatrix.setValue(0, row, sumRow);
}
- return DataMatrix.merge(incoming, tmpMatrix);
+ DataMatrix merge = DataMatrix.merge(incoming, tmpMatrix);
+ if (report.getRowHeaders() == null) {
+ merge.setValue(width, 0, "Total");
+ }
+ return merge;
}
- protected Object getSumRow(int row, DataMatrix incoming) {
- double result = 0d;
+ protected Object getSumRow(int row, int y, DataMatrix incoming) {
+ float result = 0f;
int nbColumns = incoming.getWidth();
- for (int col = 0; col < nbColumns; col++) {
+ for (int col = y; col < nbColumns; col++) {
Serializable o = incoming.getValue(col, row);
if (o == null || "null".equals(o)) {
o = 0;
@@ -71,6 +91,6 @@ public class SumRow implements ReportOperationConsumer {
}
result += d;
}
- return result;
+ return Numbers.roundFourDigits(result);
}
}
=====================================
toolkit/persistence/src/main/java/fr/ird/observe/spi/report/DefaultReportRequestExecutor.java
=====================================
@@ -36,6 +36,7 @@ import fr.ird.observe.dto.report.ReportRequestExecutor;
import fr.ird.observe.dto.report.ReportVariable;
import fr.ird.observe.dto.report.operations.ExecuteRequests;
import fr.ird.observe.spi.PersistenceBusinessProject;
+import io.ultreia.java4all.util.TimeLog;
import org.nuiton.topia.persistence.TopiaDao;
import java.util.Collection;
@@ -57,6 +58,7 @@ import java.util.function.Supplier;
@SuppressWarnings("SpellCheckingInspection")
public abstract class DefaultReportRequestExecutor implements ReportRequestExecutor {
+ public static final TimeLog TIME_LOG = new TimeLog(DefaultReportRequestExecutor.class, 500, 1000);
private final Supplier<? extends TopiaDao<?>> daoSupplier;
private final ReferentialLocale referentialLocale;
@@ -67,11 +69,15 @@ public abstract class DefaultReportRequestExecutor implements ReportRequestExecu
@Override
public Report populateVariables(Report report, Set<String> tripIds) {
+ long t00 = TimeLog.getTime();
Map<String, Object> vars = new TreeMap<>();
vars.put(ReportRequest.TRIP_ID_VARIABLE, tripIds);
for (ReportVariable<?> variable : report.getVariables()) {
+ long t0 = TimeLog.getTime();
populateVariable(variable, vars);
+ TIME_LOG.log(t0, "populate variable", variable.getName());
}
+ TIME_LOG.log(t00, "populate variables");
return report;
}
@@ -103,14 +109,29 @@ public abstract class DefaultReportRequestExecutor implements ReportRequestExecu
return result;
}
+ @Override
+ public void doPopulateRepeatVariables(Report report, Set<String> tripId) {
+ long t0 = TimeLog.getTime();
+ ReportRequestExecutor.super.doPopulateRepeatVariables(report, tripId);
+ TIME_LOG.log(t0, "populate repeat variables");
+ }
+
+ @Override
+ public <R> void doPopulateRepeatVariable(Report report, Set<String> tripId, Map<String, Object> vars, ReportVariable<R> variable) {
+ long t0 = TimeLog.getTime();
+ ReportRequestExecutor.super.doPopulateRepeatVariable(report, tripId, vars, variable);
+ TIME_LOG.log(t0, "populate repeat variable", variable.getName());
+ }
+
@Override
public <R> List<R> executeRequest(String request, Map<String, Object> params) {
+ long t0 = TimeLog.getTime();
// si il y a des references de DTO dans les valeurs des paramètres on les remplace par leur id
// on copie pour ne pas modifier le paramètre de la méthode
Map<String, Object> paramsFixes = new HashMap<>();
for (Map.Entry<String, Object> entry : params.entrySet()) {
String name = entry.getKey();
- if (request.contains(":" + name)) {
+ if (request.contains(":" + name + " ") || request.endsWith(":" + name)) {
Object value = entry.getValue();
if (value instanceof DtoReference) {
DtoReference referenceDto = (DtoReference) value;
@@ -120,7 +141,11 @@ public abstract class DefaultReportRequestExecutor implements ReportRequestExecu
}
}
log.debug(String.format("Request: %s, params: %s", request, paramsFixes));
- return daoSupplier.get().findAll(request, paramsFixes);
+ try {
+ return daoSupplier.get().findAll(request, paramsFixes);
+ } finally {
+ TIME_LOG.log(t0, "execute request", request);
+ }
}
@SuppressWarnings("unchecked")
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/b8a08b6b41646e5e148525dc…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/b8a08b6b41646e5e148525dc…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-9.0.x] 17 commits: Report API - Add TimeLog in DefaultReportRequestExecutor
by Tony CHEMIT (@tchemit) 16 Nov '22
by Tony CHEMIT (@tchemit) 16 Nov '22
16 Nov '22
Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe
Commits:
5e4a6ebb by Tony Chemit at 2022-11-16T00:45:19+01:00
Report API - Add TimeLog in DefaultReportRequestExecutor
- - - - -
3bd433b6 by Tony Chemit at 2022-11-16T00:45:28+01:00
Report API - Clean ReportRequest code
- - - - -
e8829668 by Tony Chemit at 2022-11-16T00:45:37+01:00
Report API - Improve executeReportRequest method (one for simple request and one for request with repeat)
- - - - -
9db0b05d by Tony Chemit at 2022-11-16T00:45:43+01:00
Report API - Improve Sum operations (can now set x and y and better round of double)
- - - - -
50e5bc76 by Tony Chemit at 2022-11-16T00:47:17+01:00
Report API - add safe guard tests (to be able to copy partial matrix)
- - - - -
9eea592f by Tony Chemit at 2022-11-16T00:47:23+01:00
Report API - Be able to order variables and repeat variables
- - - - -
35b99acf by Tony Chemit at 2022-11-16T00:47:29+01:00
Tck Report - columnHeaders can be null
Tck Report - Improve when to deliver asserts
- - - - -
4ca5a8fb by Tony Chemit at 2022-11-16T00:47:34+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)
- - - - -
f0e410ce by Tony Chemit at 2022-11-16T00:47:42+01:00
Report GUI - Respect report variables order in Report model
- - - - -
c3a6a87b by Tony Chemit at 2022-11-16T00:58:54+01:00
Report API - Improve ReportVariable (add isEmpty and computeIndexList methods)
- - - - -
f68f8bc0 by Tony Chemit at 2022-11-16T01:15:15+01:00
Report API - Add new neutral operations
- - - - -
5c72bc35 by Tony Chemit at 2022-11-16T01:18:28+01:00
Report model - Fix psObservationFobUsageMinimal report (one line escape was missing)
- - - - -
9304dbbb by Tony Chemit at 2022-11-16T01:18:28+01:00
Rapports Captures/Rejets selon le type d'association - Closes #2530
- - - - -
782d2838 by Tony Chemit at 2022-11-16T01:18:28+01:00
Rapport Dénombrement des captures accessoires et devenir, filtrées par groupe - Closes #2534
- - - - -
af7f63c9 by Tony Chemit at 2022-11-16T01:18:28+01:00
Rapports Distributions de tailles - Closes #2533
- - - - -
1b675eeb by Tony Chemit at 2022-11-16T01:18:28+01:00
Report Tck - Add more tests (for complex reports to make debug more easy)
- - - - -
03903a9e by Tony Chemit at 2022-11-16T01:18:53+01:00
Merge branch 'feature/issue_2531_v9.0.x' into develop-9.0.x
Closes #2531
- - - - -
30 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/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/ReportServiceFixtures.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/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationAccessoryCatchByGroup.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-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-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
- toolkit/api/src/main/java/fr/ird/observe/dto/report/ReportRequest.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/ReportRequestExecutor.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/ReportVariable.java
- + toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/ComputeDynamicHeader.java
- core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationTargetStoredDistributionLengthsLD1ReportFixture.java → toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/CopyRepeatVariableToFirstColumn.java
- + toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/ExecuteRequestAndReorganizeCountByRepeatVariable.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/ExecuteRequests.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumColumn.java
- toolkit/api/src/main/java/fr/ird/observe/dto/report/operations/SumFloatColumn.java
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/0ae68cbfaca820bd5ebd103e…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/0ae68cbfaca820bd5ebd103e…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-9.0.x] Deleted 9 commits: Rapports Captures/Rejets selon le type d'association - Closes #2530
by Tony CHEMIT (@tchemit) 14 Nov '22
by Tony CHEMIT (@tchemit) 14 Nov '22
14 Nov '22
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(a)tchemit.fr
+ * @since 9.0.17
+ */
+(a)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(a)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(a)tchemit.fr
- * @since 1.9
- */
-(a)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(a)tchemit.fr
- * @since 8.0.6
- */
-(a)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(a)tchemit.fr
- * @since 8.0.6
- */
-(a)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(a)tchemit.fr
- * @since 8.0.6
- */
-(a)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/0ae68cbfaca820bd5ebd103e…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/0ae68cbfaca820bd5ebd103e…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-9.0.x] 6 commits: Rapports Distributions de tailles - Closes #2533
by Tony CHEMIT (@tchemit) 14 Nov '22
by Tony CHEMIT (@tchemit) 14 Nov '22
14 Nov '22
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
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
- - - - -
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:
=====================================
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' \
@@ -949,14 +949,13 @@ report.psObservationCatchByGroup.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 \
@@ -964,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(a)tchemit.fr
+ * @since 9.0.17
+ */
+(a)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/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(a)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(a)tchemit.fr
- * @since 1.9
- */
-(a)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(a)tchemit.fr
- * @since 8.0.6
- */
-(a)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(a)tchemit.fr
- * @since 8.0.6
- */
-(a)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(a)tchemit.fr
- * @since 8.0.6
- */
-(a)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-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-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/29db74f10ccd6fa8fa2cf010…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/29db74f10ccd6fa8fa2cf010…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-9.0.x] 12 commits: Rapport Liste des captures de faune accessoire selon le type de banc, filtrées...
by Tony CHEMIT (@tchemit) 14 Nov '22
by Tony CHEMIT (@tchemit) 14 Nov '22
14 Nov '22
Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe
Commits:
4fcb9612 by Tony Chemit at 2022-11-13T15:28:50+01:00
Rapport Liste des captures de faune accessoire selon le type de banc, filtrées par groupe - Closes #2532
- - - - -
ec5fe21b by Tony Chemit at 2022-11-13T15:28:50+01:00
GUI - use resetEdit state when reset entry on content table
- - - - -
0ae68cbf by Tony Chemit at 2022-11-13T15:28:50+01:00
GUI - Sur échantillons PS observations saisis par lots, migrés vers 9.0, valeurs étranges sur le champ poids individuel - Closes #2503
- - - - -
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
- - - - -
6a3376f9 by Tony Chemit at 2022-11-14T13:21:55+01:00
Rapports Distributions de tailles - Closes #2533
- - - - -
6534f2a5 by Tony Chemit at 2022-11-14T13:22:16+01:00
Report API - add safe guard tests (to be able to copy partial matrix)
- - - - -
c81cfbc3 by Tony Chemit at 2022-11-14T13:22:16+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)
- - - - -
63946e03 by Tony Chemit at 2022-11-14T13:22:16+01:00
Report model - Fix psObservationFobUsageMinimal report (one line escape was missing)
- - - - -
4ae9268b by Tony Chemit at 2022-11-14T13:22:16+01:00
Report API - Be able to order variables and repeat variables
- - - - -
29db74f1 by Tony Chemit at 2022-11-14T13:22:16+01:00
Report GUI - Respect report variables order in Report model
- - - - -
17 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
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/entry/ResetEntry.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.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/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/PsObservationAccessoryCatchReportFixture.java → core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchReportFixture.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/report/ps/PsObservationLengthsDistributionReportFixture.java
- core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationAccessoryCatch.properties → core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatch.properties
- 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-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
- 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() {
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/entry/ResetEntry.java
=====================================
@@ -59,7 +59,12 @@ public final class ResetEntry extends ContentTableUIActionSupport<ContentTableUI
}
} else {
// reset existing entry
- tableModel.resetEditBean();
+ ui.getStates().setResetEdit(true);
+ try {
+ tableModel.resetEditBean();
+ } finally {
+ ui.getStates().setResetEdit(false);
+ }
}
}
=====================================
client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java
=====================================
@@ -72,12 +72,11 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
private final PropertyChangeListener speciesChanged;
public SampleUIHandler() {
- weightChanged = evt -> onWeightChanged((Float) evt.getNewValue());
- lengthChanged = evt -> onLengthChanged((Float) evt.getNewValue());
+ weightChanged = evt -> onWeightChanged((Float) evt.getNewValue(), !ui.getStates().isResetEdit());
+ lengthChanged = evt -> onLengthChanged((Float) evt.getNewValue(), !ui.getStates().isResetEdit());
speciesChanged = evt -> onSpeciesChanged((SpeciesReference) evt.getNewValue());
}
-
@Override
public void onInit(SampleUI ui) {
super.onInit(ui);
@@ -97,8 +96,8 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
public void onSelectedRowChanged(SampleMeasureDto tableEditBean, SampleMeasureDto previousRowBean, boolean notPersisted, boolean newRow) {
- onLengthChanged(tableEditBean.getLength());
- onWeightChanged(tableEditBean.getWeight());
+ onLengthChanged(tableEditBean.getLength(), false);
+ onWeightChanged(tableEditBean.getWeight(), false);
SampleUIModel sampleModel = getModel();
@@ -209,6 +208,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
}
public void startEditTableEditBean(SampleMeasureDto tableEditBean) {
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_WEIGHT, weightChanged);
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_LENGTH, lengthChanged);
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_SPECIES, speciesChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_WEIGHT, weightChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_LENGTH, lengthChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_SPECIES, speciesChanged);
@@ -249,9 +251,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
acquisitionModeGroup.setSelectedValue(acquisitionMode);
}
- protected void onWeightChanged(Float newValue) {
+ protected void onWeightChanged(Float newValue, boolean realChange) {
SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean();
- if (tableEditBean.getAcquisitionMode() == 1) {
+ if (realChange && tableEditBean.getAcquisitionMode() == 1) {
tableEditBean.setIsWeightComputed(false);
}
if (newValue == null) {
@@ -259,9 +261,11 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
}
}
- protected void onLengthChanged(Float newValue) {
+ protected void onLengthChanged(Float newValue, boolean realChange) {
SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean();
- tableEditBean.setIsLengthComputed(false);
+ if (realChange) {
+ tableEditBean.setIsLengthComputed(false);
+ }
if (newValue == null) {
tableEditBean.setLengthMeasureMethod(null);
}
=====================================
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,33 +827,34 @@ 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 \
and os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \
and os not in elements(a.observedSystem)
################################################################################
-## Captures accessoires observées
+## Captures observées
################################################################################
-report.psObservationAccessoryCatch.modelType=PS
-report.psObservationAccessoryCatch.name=Observations - Liste des captures accessoires selon le type de banc, filtrées par groupe
-report.psObservationAccessoryCatch.description=Afficher les captures accessoires par groupe d'espèce\nLes poids sont exprimés en tonnes.
-report.psObservationAccessoryCatch.columns=Espèce, Banc libre, Banc objet
-report.psObservationAccessoryCatch.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code
-report.psObservationAccessoryCatch.repeatVariable.speciesId=java.lang.String|\
+report.psObservationCatch.modelType=PS
+report.psObservationCatch.name=Observations - Liste des captures selon le type de banc, filtrées par groupe
+report.psObservationCatch.description=Afficher les captures par groupe d'espèce\nLes poids sont exprimés en tonnes.
+report.psObservationCatch.columns=Espèce, Banc libre, Banc objet
+report.psObservationCatch.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code
+report.psObservationCatch.repeatVariable.speciesId=java.lang.String|\
Select e.id From SpeciesImpl e \
Where e.speciesGroup.id = :speciesGroup \
Order By e.homeId
-report.psObservationAccessoryCatch.request.1=0,0|row|\
+report.psObservationCatch.request.1=0,0|row|\
Select \
concat('[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \
' [sc]', (case when e.scientificLabel is not null then e.scientificLabel else '-' end), \
' [fr]', (case when e.label2 is not null then e.label2 else '-' end)) \
From SpeciesImpl e \
Where e.id = :speciesId
-report.psObservationAccessoryCatch.request.1.repeat=speciesId|column
-report.psObservationAccessoryCatch.request.2=1,0|row|\
+report.psObservationCatch.request.1.repeat=speciesId|column
+report.psObservationCatch.request.2=1,0|row|\
Select \
case when Count(ca) > 0 then \
concat('+', \
@@ -731,8 +869,8 @@ report.psObservationAccessoryCatch.request.2=1,0|row|\
Join c.catches ca \
with ca.species.id = :speciesId \
Where m.id In :tripId
-report.psObservationAccessoryCatch.request.2.repeat=speciesId|column
-report.psObservationAccessoryCatch.request.3=2,0|row|\
+report.psObservationCatch.request.2.repeat=speciesId|column
+report.psObservationCatch.request.3=2,0|row|\
Select \
case when Count(ca) > 0 then \
concat('+', \
@@ -747,16 +885,16 @@ report.psObservationAccessoryCatch.request.3=2,0|row|\
Join c.catches ca \
with ca.species.id = :speciesId \
Where m.id In :tripId
-report.psObservationAccessoryCatch.request.3.repeat=speciesId|column
+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,6 +949,47 @@ report.psObservationAccessoryCatchByGroup.request.1=0,0|row|\
Group by e \
Order By e.homeId
###########################################################
+## Distribution des tailles par espèces et type de mesure
+###########################################################
+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 \
+Join r.activity a \
+Join a.set.sample nts \
+Join nts.sampleMeasure ntl \
+Where t.id In :tripId
+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
+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 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 nts \
+Join nts.sampleMeasure ntl with ntl.species.id = :species And ntl.sizeMeasureType.id = :sizeMeasureType \
+Where t.id In :tripId \
+Order By ntl.length
+###########################################################
## Distribution des tailles par espèces non ciblées
###########################################################
report.psObservationNonTargetDistributionLengths.modelType=PS
=====================================
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(a)tchemit.fr
+ * @since 9.0.17
+ */
+(a)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/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/PsObservationAccessoryCatchReportFixture.java → core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchReportFixture.java
=====================================
@@ -36,7 +36,7 @@ import java.util.Iterator;
* @since 1.9
*/
@AutoService(ReportFixture.class)
-public class PsObservationAccessoryCatchReportFixture extends ReportFixture {
+public class PsObservationCatchReportFixture extends ReportFixture {
@Override
public void assertSyntax(Report report) {
=====================================
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/report/ps/PsObservationLengthsDistributionReportFixture.java
=====================================
@@ -1,8 +1,8 @@
-package fr.ird.observe.services.local.service;
+package fr.ird.observe.services.service.report.ps;
/*-
* #%L
- * ObServe Core :: Services :: Local
+ * ObServe Core :: Services :: Test
* %%
* Copyright (C) 2008 - 2022 IRD, Ultreia.io
* %%
@@ -22,17 +22,23 @@ package fr.ird.observe.services.local.service;
* #L%
*/
-import fr.ird.observe.services.service.ReportServiceFixtures;
-import org.junit.AfterClass;
+import com.google.auto.service.AutoService;
+import fr.ird.observe.dto.report.Report;
+import fr.ird.observe.services.service.ReportFixture;
-public class ReportServiceLocalReadTest extends GeneratedReportServiceLocalReadTest {
+/**
+ * Created on 13/11/2022.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 9.0.17
+ */
+(a)AutoService(ReportFixture.class)
+public class PsObservationLengthsDistributionReportFixture extends ReportFixture {
- @AfterClass
- public static void afterClass() {
- if (!ReportServiceFixtures.WITH_ASSERT) {
- System.out.println("New asserts:\n" + String.join("\n", ReportServiceFixtures.getAsserts()));
- ReportServiceFixtures.getAsserts().clear();
- }
+ @Override
+ 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/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationAccessoryCatch.properties → core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatch.properties
=====================================
@@ -19,8 +19,24 @@
# <http://www.gnu.org/licenses/gpl-3.0.html>.
# #L%
###
+syntax.name=Observations - Liste des captures selon le type de banc, filtrées par groupe
+syntax.description=Afficher les captures par groupe d'espèce-Les poids sont exprimés en tonnes.
+syntax.columns=3
+syntax.rows=-1
+syntax.columnsHeader=Espèce^Banc libre^Banc objet
+syntax.nbRequests=3
+result.columns=3
+result.rows=49
result.0=[FAO]CCB [sc]Carcharhinus brevipinna [fr]Requin tisserand^-^-
result.1=[FAO]ALS [sc]Carcharhinus albimarginatus [fr]Requin pointe blanche^-^-
+result.2=[FAO]AML [sc]Carcharhinus amblyrhynchos [fr]Grey reef shark^-^-
+result.3=[FAO]PTH [sc]Alopias pelagicus [fr]Renard pélagique^-^-
+result.4=[FAO]BTH [sc]Alopias superciliosus [fr]Renard à gros yeux^-^-
+result.5=[FAO]ALV [sc]Alopias vulpinus [fr]Renard^-^+ Effectif : 3 Poids total (t) : 12.0
+result.6=[FAO]BLR [sc]Carcharhinus melanopterus [fr]Requin pointes noires^-^-
+result.7=[FAO]BRO [sc]Carcharhinus brachyurus [fr]Requin cuivre^-^-
+result.8=[FAO]WSH [sc]Carcharodon carcharias [fr]Grand requin blanc^-^-
+result.9=[FAO]CCE [sc]Carcharhinus leucas [fr]Requin bouledogue^-^-
result.10=[FAO]CCL [sc]Carcharhinus limbatus [fr]Requin bordé^-^-
result.11=[FAO]CCP [sc]Carcharhinus plumbeus [fr]Requin gris^-^-
result.12=[FAO]FAL [sc]Carcharhinus falciformis [fr]Requin soyeux^-^-
@@ -28,10 +44,9 @@ result.13=[FAO]OCS [sc]Carcharhinus longimanus [fr]Requin océanique^-^-
result.14=[FAO]CWZ [sc]Carcharhinus spp [fr]Requins Carcharhinus nca^-^-
result.15=[FAO]DUS [sc]Carcharhinus obscurus [fr]Requin sombre^-^-
result.16=[FAO]SHL [sc]Etmopterus spp [fr]Genre Etmopterus^-^-
-result.17=[FAO]THR [sc]Alopias spp [fr]Renards de mer nca ^-^-
+result.17=[FAO]THR [sc]Alopias spp [fr]Renards de mer nca^-^-
result.18=[FAO]RSK [sc]Carcharhinidae spp [fr]Famille Carcharhinidae^-^-
result.19=[FAO]MSK [sc]Lamnidae [fr]Famille Lamnidae^-^-
-result.2=[FAO]AML [sc]Carcharhinus amblyrhynchos [fr]Grey reef shark^-^-
result.20=[FAO]2FOD [sc]Odontaspididae [fr]Odontaspididae^-^-
result.21=[FAO]2FRH [sc]Rhincodontidae [fr]Famille Rhincodontidae^-^-
result.22=[FAO]SPY [sc]Sphyrnidae [fr]Famille Sphyrnidae^-^-
@@ -42,18 +57,16 @@ result.26=[FAO]LMA [sc]Isurus paucus [fr]Petite taupe, Mako^-^-
result.27=[FAO]MAK [sc]Isurus spp [fr]Taupes^-^-
result.28=[FAO]LMP [sc]Megachasma pelagios [fr]Requin grande gueule^-^-
result.29=[FAO]CVX [sc]Carcharhiniformes [fr]Ordre Carcharhiniformes^-^-
-result.3=[FAO]PTH [sc]Alopias pelagicus [fr]Renard pélagique^-^-
result.30=[FAO]HDQ [sc]Heterodontiformes [fr]Ordre Heterodontiformes^-^-
result.31=[FAO]HXW [sc]Hexanchiformes [fr]Ordre Hexanchiformes^-^-
result.32=[FAO]LMZ [sc]Lamniformes [fr]Ordre Lamniformes^-^-
result.33=[FAO]OCX [sc]Orectolobiformes [fr]Ordre Orectolobiformes^-^-
-result.34=[FAO]PWS [sc]Pristiophorus spp [fr]Requins-scies nca ^-^-
+result.34=[FAO]PWS [sc]Pristiophorus spp [fr]Requins-scies nca^-^-
result.35=[FAO]OSF [sc]Stegostoma fasciatum [fr]Requin zèbre^-^-
result.36=[FAO]SHX [sc]Squaliformes [fr]Ordre Squaliformes^-^-
-result.37=[FAO]ASK [sc]Squatinidae [fr]Anges de mer nca ^-^-
+result.37=[FAO]ASK [sc]Squatinidae [fr]Anges de mer nca^-^-
result.38=[FAO]BSH [sc]Prionace glauca [fr]Peau bleue^-^-
result.39=[FAO]POR [sc]Lamna nasus [fr]Requin taupe commun^-^-
-result.4=[FAO]BTH [sc]Alopias superciliosus [fr]Renard à gros yeux^-^-
result.40=[FAO]PSK [sc]Pseudocarcharias kamoharai [fr]Requin crocodile^-^-
result.41=[FAO]2REX [sc]Requin non identifié [fr]Requin non identifié^-^-
result.42=[FAO]BSK [sc]Cetorhinus maximus [fr]Requin pèlerin^-^-
@@ -63,17 +76,3 @@ result.45=[FAO]SPL [sc]Sphyrna lewini [fr]Requin marteau halicorne^-^-
result.46=[FAO]SPK [sc]Sphyrna mokarran [fr]Grand requin marteau^-^-
result.47=[FAO]SPN [sc]Sphyrna spp [fr]Requins marteau nca^-^-
result.48=[FAO]SPZ [sc]Sphyrna zygaena [fr]Requin marteau commun^-^-
-result.5=[FAO]ALV [sc]Alopias vulpinus [fr]Renard^-^+ Effectif : 3 Poids total (t) : 12.0
-result.6=[FAO]BLR [sc]Carcharhinus melanopterus [fr]Requin pointes noires^-^-
-result.7=[FAO]BRO [sc]Carcharhinus brachyurus [fr]Requin cuivre^-^-
-result.8=[FAO]WSH [sc]Carcharodon carcharias [fr]Grand requin blanc^-^-
-result.9=[FAO]CCE [sc]Carcharhinus leucas [fr]Requin bouledogue^-^-
-result.columns=3
-result.rows=49
-syntax.columns=3
-syntax.columnsHeader=Espèce^Banc libre^Banc objet
-syntax.description=Afficher les captures accessoires par groupe d'espèce-Les poids sont exprimés en tonnes.
-syntax.name=Observations - Liste des captures accessoires selon le type de banc, filtrées par groupe
-syntax.nbRequests=3
-syntax.rows=-1
-syntax.rowsHeader=
=====================================
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-psObservationLengthsDistribution.properties
=====================================
@@ -0,0 +1,35 @@
+###
+# #%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.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=
+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
=====================================
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/210adc7fd460ad0565ebe6ea…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/210adc7fd460ad0565ebe6ea…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] 3 commits: Rapport Liste des captures de faune accessoire selon le type de banc, filtrées...
by Tony CHEMIT (@tchemit) 13 Nov '22
by Tony CHEMIT (@tchemit) 13 Nov '22
13 Nov '22
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
7d63077a by Tony Chemit at 2022-11-13T12:25:33+01:00
Rapport Liste des captures de faune accessoire selon le type de banc, filtrées par groupe - Closes #2532
- - - - -
a0b62552 by Tony Chemit at 2022-11-13T12:25:37+01:00
GUI - use resetEdit state when reset entry on content table
- - - - -
b8a08b6b by Tony Chemit at 2022-11-13T12:25:42+01:00
GUI - Sur échantillons PS observations saisis par lots, migrés vers 9.0, valeurs étranges sur le champ poids individuel - Closes #2503
- - - - -
3 changed files:
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/entry/ResetEntry.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java
- core/api/dto/src/main/resources/observe-reports.properties
Changes:
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/entry/ResetEntry.java
=====================================
@@ -59,7 +59,12 @@ public final class ResetEntry extends ContentTableUIActionSupport<ContentTableUI
}
} else {
// reset existing entry
- tableModel.resetEditBean();
+ ui.getStates().setResetEdit(true);
+ try {
+ tableModel.resetEditBean();
+ } finally {
+ ui.getStates().setResetEdit(false);
+ }
}
}
=====================================
client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java
=====================================
@@ -51,7 +51,7 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
*
* @since 3.0
*/
- private final PropertyChangeListener weightChanged;
+ private final PropertyChangeListener weightChanged = evt -> onWeightChanged((Float) evt.getNewValue(), !ui.getStates().isResetEdit());
/**
* Ecoute les modifications de la propriété {@link SampleMeasureDto#getLength()},
@@ -60,7 +60,7 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
*
* @since 3.0
*/
- private final PropertyChangeListener lengthChanged;
+ private final PropertyChangeListener lengthChanged = evt -> onLengthChanged((Float) evt.getNewValue(), !ui.getStates().isResetEdit());
/**
* Ecoute les modifications de la propriété {@link SampleMeasureDto#getLength()},
@@ -69,14 +69,7 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
*
* @since 3.0
*/
- private final PropertyChangeListener speciesChanged;
-
- public SampleUIHandler() {
- weightChanged = evt -> onWeightChanged((Float) evt.getNewValue());
- lengthChanged = evt -> onLengthChanged((Float) evt.getNewValue());
- speciesChanged = evt -> onSpeciesChanged((SpeciesReference) evt.getNewValue());
- }
-
+ private final PropertyChangeListener speciesChanged = evt -> onSpeciesChanged((SpeciesReference) evt.getNewValue());
@Override
public void onInit(SampleUI ui) {
@@ -97,8 +90,8 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
public void onSelectedRowChanged(SampleMeasureDto tableEditBean, SampleMeasureDto previousRowBean, boolean notPersisted, boolean newRow) {
- onLengthChanged(tableEditBean.getLength());
- onWeightChanged(tableEditBean.getWeight());
+ onLengthChanged(tableEditBean.getLength(), false);
+ onWeightChanged(tableEditBean.getWeight(), false);
SampleUIModel sampleModel = getModel();
@@ -209,6 +202,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
}
public void startEditTableEditBean(SampleMeasureDto tableEditBean) {
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_WEIGHT, weightChanged);
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_LENGTH, lengthChanged);
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_SPECIES, speciesChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_WEIGHT, weightChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_LENGTH, lengthChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_SPECIES, speciesChanged);
@@ -249,9 +245,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
acquisitionModeGroup.setSelectedValue(acquisitionMode);
}
- protected void onWeightChanged(Float newValue) {
+ protected void onWeightChanged(Float newValue, boolean realChange) {
SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean();
- if (tableEditBean.getAcquisitionMode() == 1) {
+ if (realChange && tableEditBean.getAcquisitionMode() == 1) {
tableEditBean.setIsWeightComputed(false);
}
if (newValue == null) {
@@ -259,9 +255,11 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
}
}
- protected void onLengthChanged(Float newValue) {
+ protected void onLengthChanged(Float newValue, boolean realChange) {
SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean();
- tableEditBean.setIsLengthComputed(false);
+ if (realChange) {
+ tableEditBean.setIsLengthComputed(false);
+ }
if (newValue == null) {
tableEditBean.setLengthMeasureMethod(null);
}
=====================================
core/api/dto/src/main/resources/observe-reports.properties
=====================================
@@ -697,26 +697,26 @@ report.psObservationTargetDiscardedByAssociation.request.19=0,3|row|\
and os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \
and os not in elements(a.observedSystem)
################################################################################
-## Captures accessoires observées
+## Captures observées
################################################################################
-report.psObservationAccessoryCatch.modelType=PS
-report.psObservationAccessoryCatch.name=Observations - Liste des captures accessoires selon le type de banc, filtrées par groupe
-report.psObservationAccessoryCatch.description=Afficher les captures accessoires par groupe d'espèce\nLes poids sont exprimés en tonnes.
-report.psObservationAccessoryCatch.columns=Espèce, Banc libre, Banc objet
-report.psObservationAccessoryCatch.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code
-report.psObservationAccessoryCatch.repeatVariable.speciesId=java.lang.String|\
+report.psObservationCatch.modelType=PS
+report.psObservationCatch.name=Observations - Liste des captures selon le type de banc, filtrées par groupe
+report.psObservationCatch.description=Afficher les captures par groupe d'espèce\nLes poids sont exprimés en tonnes.
+report.psObservationCatch.columns=Espèce, Banc libre, Banc objet
+report.psObservationCatch.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code
+report.psObservationCatch.repeatVariable.speciesId=java.lang.String|\
Select e.id From SpeciesImpl e \
Where e.speciesGroup.id = :speciesGroup \
Order By e.homeId
-report.psObservationAccessoryCatch.request.1=0,0|row|\
+report.psObservationCatch.request.1=0,0|row|\
Select \
concat('[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \
' [sc]', (case when e.scientificLabel is not null then e.scientificLabel else '-' end), \
' [fr]', (case when e.label2 is not null then e.label2 else '-' end)) \
From SpeciesImpl e \
Where e.id = :speciesId
-report.psObservationAccessoryCatch.request.1.repeat=speciesId|column
-report.psObservationAccessoryCatch.request.2=1,0|row|\
+report.psObservationCatch.request.1.repeat=speciesId|column
+report.psObservationCatch.request.2=1,0|row|\
Select \
case when Count(ca) > 0 then \
concat('+', \
@@ -731,8 +731,8 @@ report.psObservationAccessoryCatch.request.2=1,0|row|\
Join c.catches ca \
with ca.species.id = :speciesId \
Where m.id In :tripId
-report.psObservationAccessoryCatch.request.2.repeat=speciesId|column
-report.psObservationAccessoryCatch.request.3=2,0|row|\
+report.psObservationCatch.request.2.repeat=speciesId|column
+report.psObservationCatch.request.3=2,0|row|\
Select \
case when Count(ca) > 0 then \
concat('+', \
@@ -747,7 +747,7 @@ report.psObservationAccessoryCatch.request.3=2,0|row|\
Join c.catches ca \
with ca.species.id = :speciesId \
Where m.id In :tripId
-report.psObservationAccessoryCatch.request.3.repeat=speciesId|column
+report.psObservationCatch.request.3.repeat=speciesId|column
################################################################################
## Captures accessoires par speciesGroup d'espèces
################################################################################
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/43773fea3548323dff3a5ea8…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/43773fea3548323dff3a5ea8…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-9.0.x] 3 commits: Rapport Liste des captures de faune accessoire selon le type de banc, filtrées...
by Tony CHEMIT (@tchemit) 13 Nov '22
by Tony CHEMIT (@tchemit) 13 Nov '22
13 Nov '22
Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe
Commits:
eba86672 by Tony Chemit at 2022-11-13T11:30:30+01:00
Rapport Liste des captures de faune accessoire selon le type de banc, filtrées par groupe - Closes #2532
- - - - -
61679ca9 by Tony Chemit at 2022-11-13T12:24:03+01:00
GUI - use resetEdit state when reset entry on content table
- - - - -
210adc7f by Tony Chemit at 2022-11-13T12:24:40+01:00
GUI - Sur échantillons PS observations saisis par lots, migrés vers 9.0, valeurs étranges sur le champ poids individuel - Closes #2503
- - - - -
3 changed files:
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/entry/ResetEntry.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java
- core/api/dto/src/main/resources/observe-reports.properties
Changes:
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/entry/ResetEntry.java
=====================================
@@ -59,7 +59,12 @@ public final class ResetEntry extends ContentTableUIActionSupport<ContentTableUI
}
} else {
// reset existing entry
- tableModel.resetEditBean();
+ ui.getStates().setResetEdit(true);
+ try {
+ tableModel.resetEditBean();
+ } finally {
+ ui.getStates().setResetEdit(false);
+ }
}
}
=====================================
client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java
=====================================
@@ -51,7 +51,7 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
*
* @since 3.0
*/
- private final PropertyChangeListener weightChanged;
+ private final PropertyChangeListener weightChanged = evt -> onWeightChanged((Float) evt.getNewValue(), !ui.getStates().isResetEdit());
/**
* Ecoute les modifications de la propriété {@link SampleMeasureDto#getLength()},
@@ -60,7 +60,7 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
*
* @since 3.0
*/
- private final PropertyChangeListener lengthChanged;
+ private final PropertyChangeListener lengthChanged = evt -> onLengthChanged((Float) evt.getNewValue(), !ui.getStates().isResetEdit());
/**
* Ecoute les modifications de la propriété {@link SampleMeasureDto#getLength()},
@@ -69,14 +69,7 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
*
* @since 3.0
*/
- private final PropertyChangeListener speciesChanged;
-
- public SampleUIHandler() {
- weightChanged = evt -> onWeightChanged((Float) evt.getNewValue());
- lengthChanged = evt -> onLengthChanged((Float) evt.getNewValue());
- speciesChanged = evt -> onSpeciesChanged((SpeciesReference) evt.getNewValue());
- }
-
+ private final PropertyChangeListener speciesChanged = evt -> onSpeciesChanged((SpeciesReference) evt.getNewValue());
@Override
public void onInit(SampleUI ui) {
@@ -97,8 +90,8 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
public void onSelectedRowChanged(SampleMeasureDto tableEditBean, SampleMeasureDto previousRowBean, boolean notPersisted, boolean newRow) {
- onLengthChanged(tableEditBean.getLength());
- onWeightChanged(tableEditBean.getWeight());
+ onLengthChanged(tableEditBean.getLength(), false);
+ onWeightChanged(tableEditBean.getWeight(), false);
SampleUIModel sampleModel = getModel();
@@ -209,6 +202,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
}
public void startEditTableEditBean(SampleMeasureDto tableEditBean) {
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_WEIGHT, weightChanged);
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_LENGTH, lengthChanged);
+ tableEditBean.removePropertyChangeListener(SampleMeasureDto.PROPERTY_SPECIES, speciesChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_WEIGHT, weightChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_LENGTH, lengthChanged);
tableEditBean.addPropertyChangeListener(SampleMeasureDto.PROPERTY_SPECIES, speciesChanged);
@@ -249,9 +245,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
acquisitionModeGroup.setSelectedValue(acquisitionMode);
}
- protected void onWeightChanged(Float newValue) {
+ protected void onWeightChanged(Float newValue, boolean realChange) {
SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean();
- if (tableEditBean.getAcquisitionMode() == 1) {
+ if (realChange && tableEditBean.getAcquisitionMode() == 1) {
tableEditBean.setIsWeightComputed(false);
}
if (newValue == null) {
@@ -259,9 +255,11 @@ public class SampleUIHandler extends GeneratedSampleUIHandler {
}
}
- protected void onLengthChanged(Float newValue) {
+ protected void onLengthChanged(Float newValue, boolean realChange) {
SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean();
- tableEditBean.setIsLengthComputed(false);
+ if (realChange) {
+ tableEditBean.setIsLengthComputed(false);
+ }
if (newValue == null) {
tableEditBean.setLengthMeasureMethod(null);
}
=====================================
core/api/dto/src/main/resources/observe-reports.properties
=====================================
@@ -697,26 +697,26 @@ report.psObservationTargetDiscardedByAssociation.request.19=0,3|row|\
and os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \
and os not in elements(a.observedSystem)
################################################################################
-## Captures accessoires observées
+## Captures observées
################################################################################
-report.psObservationAccessoryCatch.modelType=PS
-report.psObservationAccessoryCatch.name=Observations - Liste des captures accessoires selon le type de banc, filtrées par groupe
-report.psObservationAccessoryCatch.description=Afficher les captures accessoires par groupe d'espèce\nLes poids sont exprimés en tonnes.
-report.psObservationAccessoryCatch.columns=Espèce, Banc libre, Banc objet
-report.psObservationAccessoryCatch.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code
-report.psObservationAccessoryCatch.repeatVariable.speciesId=java.lang.String|\
+report.psObservationCatch.modelType=PS
+report.psObservationCatch.name=Observations - Liste des captures selon le type de banc, filtrées par groupe
+report.psObservationCatch.description=Afficher les captures par groupe d'espèce\nLes poids sont exprimés en tonnes.
+report.psObservationCatch.columns=Espèce, Banc libre, Banc objet
+report.psObservationCatch.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code
+report.psObservationCatch.repeatVariable.speciesId=java.lang.String|\
Select e.id From SpeciesImpl e \
Where e.speciesGroup.id = :speciesGroup \
Order By e.homeId
-report.psObservationAccessoryCatch.request.1=0,0|row|\
+report.psObservationCatch.request.1=0,0|row|\
Select \
concat('[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \
' [sc]', (case when e.scientificLabel is not null then e.scientificLabel else '-' end), \
' [fr]', (case when e.label2 is not null then e.label2 else '-' end)) \
From SpeciesImpl e \
Where e.id = :speciesId
-report.psObservationAccessoryCatch.request.1.repeat=speciesId|column
-report.psObservationAccessoryCatch.request.2=1,0|row|\
+report.psObservationCatch.request.1.repeat=speciesId|column
+report.psObservationCatch.request.2=1,0|row|\
Select \
case when Count(ca) > 0 then \
concat('+', \
@@ -731,8 +731,8 @@ report.psObservationAccessoryCatch.request.2=1,0|row|\
Join c.catches ca \
with ca.species.id = :speciesId \
Where m.id In :tripId
-report.psObservationAccessoryCatch.request.2.repeat=speciesId|column
-report.psObservationAccessoryCatch.request.3=2,0|row|\
+report.psObservationCatch.request.2.repeat=speciesId|column
+report.psObservationCatch.request.3=2,0|row|\
Select \
case when Count(ca) > 0 then \
concat('+', \
@@ -747,7 +747,7 @@ report.psObservationAccessoryCatch.request.3=2,0|row|\
Join c.catches ca \
with ca.species.id = :speciesId \
Where m.id In :tripId
-report.psObservationAccessoryCatch.request.3.repeat=speciesId|column
+report.psObservationCatch.request.3.repeat=speciesId|column
################################################################################
## Captures accessoires par speciesGroup d'espèces
################################################################################
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/7c8b227dfe67f5582e808ca9…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/7c8b227dfe67f5582e808ca9…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] Adaptation de la validation et du formulaire Captures suite à la nouvelle...
by Tony CHEMIT (@tchemit) 13 Nov '22
by Tony CHEMIT (@tchemit) 13 Nov '22
13 Nov '22
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
43773fea by Tony Chemit at 2022-11-13T10:58:17+01:00
Adaptation de la validation et du formulaire Captures suite à la nouvelle migration v9 - Closes #2526
- - - - -
8 changed files:
- client/datasource/editor/ps/src/main/i18n/getters/jaxx.getter
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUI.jaxx
- core/api/services/src/main/i18n/getters/labels.getter
- core/services/i18n/src/main/i18n/translations/services_en_GB.properties
- core/services/i18n/src/main/i18n/translations/services_es_ES.properties
- core/services/i18n/src/main/i18n/translations/services_fr_FR.properties
- model/src/main/models/Observe/dto/class/i18nLabels.properties
- model/src/main/models/Observe/dto/class/i18nOverrideLabels.properties
Changes:
=====================================
client/datasource/editor/ps/src/main/i18n/getters/jaxx.getter
=====================================
@@ -187,9 +187,12 @@ observe.data.ps.observation.Activity.previousFpaZone
observe.data.ps.observation.Activity.surroundingActivity
observe.data.ps.observation.Activity.time
observe.data.ps.observation.Catch.catchWeight
+observe.data.ps.observation.Catch.catchWeightTotalCount
observe.data.ps.observation.Catch.maxWeight
observe.data.ps.observation.Catch.meanLength
observe.data.ps.observation.Catch.meanWeight
+observe.data.ps.observation.Catch.meanWeightMeanLength
+observe.data.ps.observation.Catch.minMaxWeight
observe.data.ps.observation.Catch.minWeight
observe.data.ps.observation.Catch.reasonForDiscard
observe.data.ps.observation.Catch.totalCount
=====================================
client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUI.jaxx
=====================================
@@ -62,8 +62,6 @@
errorTableModel='{getErrorTableModel()}' context='update'/>
<Table id='editorPanel' fill='both' insets='1' beanScope="tableEditBean">
-
- <!-- species -->
<row>
<cell>
<JLabel id='speciesLabel'/>
@@ -72,8 +70,6 @@
<FilterableComboBox id='species' genericType='SpeciesReference'/>
</cell>
</row>
-
- <!-- speciesFate -->
<row>
<cell>
<JLabel id='speciesFateLabel'/>
@@ -82,8 +78,6 @@
<FilterableComboBox id='speciesFate' genericType='SpeciesFateReference'/>
</cell>
</row>
-
- <!-- raison rejet -->
<row>
<cell>
<JLabel id='reasonForDiscardLabel'/>
@@ -92,18 +86,17 @@
<FilterableComboBox id='reasonForDiscard' genericType='ReasonForDiscardReference'/>
</cell>
</row>
-
- <!-- weight estime -->
<row>
<cell>
- <JLabel id='catchWeightLabel'/>
+ <JLabel id='catchWeightTotalCountLabel'/>
</cell>
<cell weightx='1' anchor='east'>
- <NumberEditor id='catchWeight' styleClass="float3"/>
+ <JPanel layout="{new GridLayout()}">
+ <NumberEditor id='catchWeight' styleClass="float3"/>
+ <NumberEditor id='totalCount' styleClass="int6"/>
+ </JPanel>
</cell>
</row>
-
- <!-- weightMeasureMethod -->
<row>
<cell>
<JLabel id='weightMeasureMethodLabel'/>
@@ -112,53 +105,28 @@
<FilterableComboBox id='weightMeasureMethod' genericType='WeightMeasureMethodReference'/>
</cell>
</row>
-
- <!-- count estime -->
<row>
<cell>
- <JLabel id='totalCountLabel'/>
+ <JLabel id='minMaxWeightLabel'/>
</cell>
<cell weightx='1'>
- <NumberEditor id='totalCount' styleClass="int6"/>
-
+ <JPanel layout="{new GridLayout()}">
+ <NumberEditor id='minWeight' styleClass="float2"/>
+ <NumberEditor id='maxWeight' styleClass="float2"/>
+ </JPanel>
</cell>
</row>
<row>
<cell>
- <JLabel id='minWeightLabel'/>
+ <JLabel id='meanWeightMeanLengthLabel'/>
</cell>
<cell weightx='1'>
- <NumberEditor id='minWeight' styleClass="float2"/>
+ <JPanel layout="{new GridLayout()}">
+ <NumberEditor id='meanWeight' styleClass="float2"/>
+ <NumberEditor id='meanLength' styleClass="float2"/>
+ </JPanel>
</cell>
</row>
- <row>
- <cell>
- <JLabel id='meanWeightLabel'/>
- </cell>
- <cell weightx='1'>
- <NumberEditor id='meanWeight' styleClass="float2"/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id='maxWeightLabel'/>
- </cell>
- <cell weightx='1'>
- <NumberEditor id='maxWeight' styleClass="float2"/>
- </cell>
- </row>
-
- <!-- taille moyenne -->
- <row>
- <cell>
- <JLabel id='meanLengthLabel'/>
- </cell>
- <cell weightx='1'>
- <NumberEditor id='meanLength' styleClass="float2"/>
- </cell>
- </row>
-
- <!-- well -->
<row>
<cell>
<JLabel id='wellLabel'/>
@@ -167,8 +135,6 @@
<NormalTextEditor id='well'/>
</cell>
</row>
-
- <!-- informationSource -->
<row>
<cell>
<JLabel id='informationSourceLabel'/>
@@ -177,8 +143,6 @@
<FilterableComboBox id='informationSource' genericType='InformationSourceReference'/>
</cell>
</row>
-
- <!-- comment -->
<row>
<cell columns='3' weighty='1'>
<BigTextEditor id="comment"/>
=====================================
core/api/services/src/main/i18n/getters/labels.getter
=====================================
@@ -1065,6 +1065,7 @@ observe.data.ps.observation.Catch.catchWeight
observe.data.ps.observation.Catch.catchWeight.short
observe.data.ps.observation.Catch.catchWeightComputed.computed.tip
observe.data.ps.observation.Catch.catchWeightComputed.observed.tip
+observe.data.ps.observation.Catch.catchWeightTotalCount
observe.data.ps.observation.Catch.maxWeight
observe.data.ps.observation.Catch.maxWeight.short
observe.data.ps.observation.Catch.meanLength
@@ -1075,6 +1076,8 @@ observe.data.ps.observation.Catch.meanWeight
observe.data.ps.observation.Catch.meanWeight.short
observe.data.ps.observation.Catch.meanWeightComputed.computed.tip
observe.data.ps.observation.Catch.meanWeightComputed.observed.tip
+observe.data.ps.observation.Catch.meanWeightMeanLength
+observe.data.ps.observation.Catch.minMaxWeight
observe.data.ps.observation.Catch.minWeight
observe.data.ps.observation.Catch.minWeight.short
observe.data.ps.observation.Catch.reasonForDiscard
=====================================
core/services/i18n/src/main/i18n/translations/services_en_GB.properties
=====================================
@@ -1275,6 +1275,7 @@ observe.data.ps.observation.Catch.catchWeight.short=Weight
observe.data.ps.observation.Catch.catchWeight.validation.required=Weight or estimated count must be filled
observe.data.ps.observation.Catch.catchWeightComputed.computed.tip=Catch weight was computed (%s)
observe.data.ps.observation.Catch.catchWeightComputed.observed.tip=Catch weight was observed
+observe.data.ps.observation.Catch.catchWeightTotalCount=Total weight estimated (in t) / Estimated count
observe.data.ps.observation.Catch.maxWeight=Upper weight limit (in kg)
observe.data.ps.observation.Catch.maxWeight.short=Max weight (in kg)
observe.data.ps.observation.Catch.meanLength=Mean length (in cm)
@@ -1287,6 +1288,8 @@ observe.data.ps.observation.Catch.meanWeight.short=Mean weight
observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Weight or mean size must be filled.
observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=Mean weight was computed (%s)
observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=Mean weight was observed
+observe.data.ps.observation.Catch.meanWeightMeanLength=Mean weight (in kg) / Mean length (in cm)
+observe.data.ps.observation.Catch.minMaxWeight=Lower / upper weight limit (in kg)
observe.data.ps.observation.Catch.minWeight=Lower weight limit (in kg)
observe.data.ps.observation.Catch.minWeight.short=Min weight (in kg)
observe.data.ps.observation.Catch.reasonForDiscard=Reason for discard
=====================================
core/services/i18n/src/main/i18n/translations/services_es_ES.properties
=====================================
@@ -1275,6 +1275,7 @@ observe.data.ps.observation.Catch.catchWeight.short=Peso
observe.data.ps.observation.Catch.catchWeight.validation.required=Debe seleccionar uno de los dos valores (peso o count)
observe.data.ps.observation.Catch.catchWeightComputed.computed.tip=Peso estimado calculado
observe.data.ps.observation.Catch.catchWeightComputed.observed.tip=Peso estimado observado
+observe.data.ps.observation.Catch.catchWeightTotalCount=Pesos total estimados (en t) / Número estimado
observe.data.ps.observation.Catch.maxWeight=Upper weight limit (in kg) TODO
observe.data.ps.observation.Catch.maxWeight.short=Max weight (in kg)
observe.data.ps.observation.Catch.meanLength=Talla media (en cm)
@@ -1287,6 +1288,8 @@ observe.data.ps.observation.Catch.meanWeight.short=Peso medio
observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Debe seleccionar uno de los dos valores (peso medio o talla media).
observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=El peso medio se calculó
observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=El peso medio se observó
+observe.data.ps.observation.Catch.meanWeightMeanLength=Peso medio (en kg) / Talla media (en cm)
+observe.data.ps.observation.Catch.minMaxWeight=Lower / upper weight limit (in kg) TODO
observe.data.ps.observation.Catch.minWeight=Lower weight limit (in kg) TODO
observe.data.ps.observation.Catch.minWeight.short=Max weight (in kg)
observe.data.ps.observation.Catch.reasonForDiscard=Razón del descarte
=====================================
core/services/i18n/src/main/i18n/translations/services_fr_FR.properties
=====================================
@@ -1275,6 +1275,7 @@ observe.data.ps.observation.Catch.catchWeight.short=Poids
observe.data.ps.observation.Catch.catchWeight.validation.required=Une des deux valeurs (poids ou taille moyenne) devrait être renseignée.
observe.data.ps.observation.Catch.catchWeightComputed.computed.tip=Le poids estimé a été calculé (%s)
observe.data.ps.observation.Catch.catchWeightComputed.observed.tip=Le poids estimé a été observé
+observe.data.ps.observation.Catch.catchWeightTotalCount=Poids total estimé (en t) / Nombre estimé
observe.data.ps.observation.Catch.maxWeight=Borne de poids supérieure (en kg)
observe.data.ps.observation.Catch.maxWeight.short=Poids max (en kg)
observe.data.ps.observation.Catch.meanLength=Taille moyenne (en cm)
@@ -1287,6 +1288,8 @@ observe.data.ps.observation.Catch.meanWeight.short=Poids moy
observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Une des deux valeurs (poids moyen ou taille moyenne) devrait être renseignée.
observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=Le poids moyen a été calculé (%s)
observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=Le poids moyen a été observé
+observe.data.ps.observation.Catch.meanWeightMeanLength=Poids moyen (en kg) / Taille moyenne (en cm)
+observe.data.ps.observation.Catch.minMaxWeight=Borne de poids inférieure / supérieure (en kg)
observe.data.ps.observation.Catch.minWeight=Borne de poids inférieure (en kg)
observe.data.ps.observation.Catch.minWeight.short=Poids min (en kg)
observe.data.ps.observation.Catch.reasonForDiscard=Raison rejet
=====================================
model/src/main/models/Observe/dto/class/i18nLabels.properties
=====================================
@@ -84,7 +84,7 @@ data.ps.logbook.Well=well,wellVessel,wellFactory,wellSamplingConformity,wellSamp
data.ps.logbook.WellActivity=activity,wellActivitySpecies
data.ps.logbook.WellActivitySpecies=species,weight,weightCategory,count,setSpeciesNumber
data.ps.observation.Activity=date,coordinate,observedSystem.available,observedSystem.selected,comment,comment2,currentFpaZone,dataQuality,detectionMode,ersId,floatingObjectEmpty,latitude,longitude,nextFpaZone,nonTargetCatchSpecies,observedSystem,observedSystemDistance,previousFpaZone,quadrant,reasonForNoFishing,seaSurfaceTemperature,surroundingActivity,time,vesselActivity,vesselSpeed,wind,generalTab,error.no.activity.6,measurementsTab,observedSystemTab
-data.ps.observation.Catch=catchWeight,comment,informationSource,lengthMeasureMethod,meanLength,minWeight,maxWeight,meanWeight,reasonForDiscard,species,speciesFate,totalCount,weightMeasureMethod,well,catchWeightComputed.computed.tip,catchWeightComputed.observed.tip,meanLengthComputed.computed.tip,meanLengthComputed.observed.tip,meanWeightComputed.computed.tip,meanWeightComputed.observed.tip,totalCountComputed.computed.tip,totalCountComputed.observed.tip
+data.ps.observation.Catch=catchWeight,catchWeightTotalCount,meanWeightMeanLength,comment,informationSource,lengthMeasureMethod,meanLength,minWeight,maxWeight,meanWeight,minMaxWeight,reasonForDiscard,species,speciesFate,totalCount,weightMeasureMethod,well,catchWeightComputed.computed.tip,catchWeightComputed.observed.tip,meanLengthComputed.computed.tip,meanLengthComputed.observed.tip,meanWeightComputed.computed.tip,meanWeightComputed.observed.tip,totalCountComputed.computed.tip,totalCountComputed.observed.tip
data.ps.observation.FloatingObject=materialsValid,objectOperation,supportVesselName,country,vessel,computedBiodegradable,computedNonEntangling,computedSimplifiedObjectType,computedValues,generalTab,buoysTab,materialsTab,notComputed,type.short
data.ps.observation.NonTargetCatchRelease=comment,conformity,count,length,lengthMeasureMethod,releasingTime,sex,status,species,speciesGroupReleaseMode,message.cantAdd
data.ps.observation.ObjectObservedSpecies=count,species,speciesStatus
=====================================
model/src/main/models/Observe/dto/class/i18nOverrideLabels.properties
=====================================
@@ -23,7 +23,7 @@ data.ll.common.Trip=species
data.ll.landing.Landing=vessel
data.ps.localmarket.Sample=well
data.ps.logbook.Catch=weightMeasureMethod.validation.required
-data.ps.observation.Catch=minWeight,maxWeight,weightMeasureMethod
+data.ps.observation.Catch=minWeight,maxWeight,minMaxWeight,weightMeasureMethod
data.ps.observation.SchoolEstimate=species
data.ps.observation.Set=startTime,haulingStartTimeStamp,haulingEndTimeStamp,endTimeStamp
referential.common.Species=codeAndHomeId
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/43773fea3548323dff3a5ea8e…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/43773fea3548323dff3a5ea8e…
You're receiving this email because of your account on gitlab.com.
1
0