Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
747f5194
by Tony Chemit at 2022-12-11T00:56:52+01:00
-
9bebca7f
by Tony Chemit at 2022-12-11T00:57:17+01:00
-
9d195aef
by Tony Chemit at 2022-12-11T00:57:21+01:00
-
e79d8d76
by Tony Chemit at 2022-12-11T00:57:24+01:00
-
9d070c7d
by Tony Chemit at 2022-12-11T00:57:28+01:00
-
3dbafec5
by Tony Chemit at 2022-12-11T00:57:31+01:00
-
7933cad8
by Tony Chemit at 2022-12-11T00:57:36+01:00
-
afb181a3
by Tony Chemit at 2022-12-11T00:57:40+01:00
-
424f54de
by Tony Chemit at 2022-12-11T00:57:43+01:00
-
8a2e9e77
by Tony Chemit at 2022-12-11T00:57:49+01:00
15 changed files:
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportUIHandler.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/PsObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociationReportFixture.java
- + core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociationReportFixture.java
- core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psLogbookWellPlanCheck.properties
- + core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.properties
- + core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.properties
- pom.xml
- toolkit/api/src/main/java/fr/ird/observe/dto/report/Report.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/SumRow.java
- toolkit/persistence/src/main/java/fr/ird/observe/spi/report/DefaultReportRequestExecutor.java
- toolkit/persistence/src/main/java/org/nuiton/topia/persistence/internal/support/HibernateTopiaJpaSupport.java
Changes:
| ... | ... | @@ -41,6 +41,7 @@ import fr.ird.observe.spi.module.BusinessProjectMapping; |
| 41 | 41 | import fr.ird.observe.spi.module.ObserveBusinessProject;
|
| 42 | 42 | import io.ultreia.java4all.bean.JavaBean;
|
| 43 | 43 | import io.ultreia.java4all.decoration.Decorator;
|
| 44 | +import io.ultreia.java4all.jaxx.widgets.choice.BooleanEditor;
|
|
| 44 | 45 | import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox;
|
| 45 | 46 | import io.ultreia.java4all.util.TimeLog;
|
| 46 | 47 | import org.apache.logging.log4j.LogManager;
|
| ... | ... | @@ -220,43 +221,79 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 220 | 221 | for (ReportVariable variable : report.getVariables()) {
|
| 221 | 222 | String variableName = variable.getName();
|
| 222 | 223 | Set values = variable.getValues();
|
| 223 | - List<JavaBean> universe = new ArrayList<>(values);
|
|
| 224 | 224 | log.info("Variable type: " + variable.getType());
|
| 225 | 225 | //FIXME Decorators, let's object deal with it and never ask at this level... Just do a toString()...
|
| 226 | 226 | Decorator decorator;
|
| 227 | 227 | Class type;
|
| 228 | 228 | BusinessProjectMapping mapping = ObserveBusinessProject.get().getMapping();
|
| 229 | - if (ReferentialDto.class.isAssignableFrom(variable.getType()) && !universe.isEmpty()) {
|
|
| 229 | + if (ReferentialDto.class.isAssignableFrom(variable.getType()) && !values.isEmpty()) {
|
|
| 230 | 230 | type = mapping.getReferenceType(variable.getType());
|
| 231 | 231 | decorator = getDecoratorService().getDecoratorByType(type);
|
| 232 | - } else if (DataDto.class.isAssignableFrom(variable.getType()) && !universe.isEmpty()) {
|
|
| 232 | + } else if (DataDto.class.isAssignableFrom(variable.getType()) && !values.isEmpty()) {
|
|
| 233 | 233 | type = mapping.getReferenceType(variable.getType());
|
| 234 | 234 | decorator = getDecoratorService().getDecoratorByType(type);
|
| 235 | + } else if (Boolean.class.isAssignableFrom(variable.getType()) && !values.isEmpty()) {
|
|
| 236 | + type = variable.getType();
|
|
| 237 | + decorator = null;
|
|
| 235 | 238 | } else {
|
| 236 | 239 | type = variable.getType();
|
| 237 | 240 | decorator = getDecoratorService().getDecoratorByType(type);
|
| 238 | 241 | }
|
| 239 | 242 | log.info(String.format("Variable real type: %s", type));
|
| 240 | - FilterableComboBox<?> combo = UIHelper.newFilterableComboBox(type, decorator, universe);
|
|
| 241 | - combo.setShowReset(true);
|
|
| 242 | - JPanel p = new JPanel(new BorderLayout());
|
|
| 243 | - p.add(new JLabel(t(I18nDecoratorHelper.getType(variable.getType()))), BorderLayout.WEST);
|
|
| 244 | - p.add(combo, BorderLayout.CENTER);
|
|
| 245 | - variablesPanel.add(p);
|
|
| 246 | - JComboBox<?> jComboBox = combo.getCombobox();
|
|
| 247 | - jComboBox.putClientProperty(VARIABLE_NAME, variableName);
|
|
| 248 | - jComboBox.addItemListener(e -> {
|
|
| 249 | - JComboBox<?> comboBox = (JComboBox<?>) e.getSource();
|
|
| 250 | - if (e.getStateChange() == ItemEvent.DESELECTED) {
|
|
| 251 | - // ne rien faire de l'évènement de déselection sauf si le modèle devient vide
|
|
| 252 | - if (comboBox.getSelectedItem() == null) {
|
|
| 253 | - updateVariable(comboBox, null);
|
|
| 254 | - }
|
|
| 255 | - return;
|
|
| 243 | + if (type.equals(Boolean.class)) {
|
|
| 244 | + BooleanEditor.Builder builder = BooleanEditor.newBuilder();
|
|
| 245 | + if (values.contains(false)) {
|
|
| 246 | + builder.addFalseEntry("conservé");
|
|
| 247 | + }
|
|
| 248 | + if (values.contains(true)) {
|
|
| 249 | + builder.addTrueEntry("rejeté");
|
|
| 256 | 250 | }
|
| 257 | - Object o = e.getItem();
|
|
| 258 | - updateVariable(comboBox, o);
|
|
| 259 | - });
|
|
| 251 | + if (values.contains(null)) {
|
|
| 252 | + builder.addNullEntry("inconnu");
|
|
| 253 | + }
|
|
| 254 | + BooleanEditor jComboBox = builder.build();
|
|
| 255 | + JPanel p = new JPanel(new BorderLayout());
|
|
| 256 | + //FIXME Add i18n from the reportName + reportVariableName
|
|
| 257 | + p.add(new JLabel("Mode (conservé/rejeté/inconnu)"), BorderLayout.WEST);
|
|
| 258 | + p.add(jComboBox, BorderLayout.CENTER);
|
|
| 259 | + variablesPanel.add(p);
|
|
| 260 | + jComboBox.putClientProperty(VARIABLE_NAME, variableName);
|
|
| 261 | + jComboBox.addItemListener(e -> {
|
|
| 262 | + JComboBox<?> comboBox = (JComboBox<?>) e.getSource();
|
|
| 263 | + if (e.getStateChange() == ItemEvent.DESELECTED) {
|
|
| 264 | + // ne rien faire de l'évènement de déselection sauf si le modèle devient vide
|
|
| 265 | + if (comboBox.getSelectedItem() == null) {
|
|
| 266 | + updateVariable(comboBox, null);
|
|
| 267 | + }
|
|
| 268 | + return;
|
|
| 269 | + }
|
|
| 270 | + Boolean booleanValue = jComboBox.getBooleanValue();
|
|
| 271 | + updateVariable(comboBox, booleanValue);
|
|
| 272 | + });
|
|
| 273 | + } else {
|
|
| 274 | + List<JavaBean> universe = new ArrayList<>(values);
|
|
| 275 | + FilterableComboBox<?> combo = UIHelper.newFilterableComboBox(type, decorator, universe);
|
|
| 276 | + combo.setShowReset(true);
|
|
| 277 | + JPanel p = new JPanel(new BorderLayout());
|
|
| 278 | + p.add(new JLabel(t(I18nDecoratorHelper.getType(variable.getType()))), BorderLayout.WEST);
|
|
| 279 | + p.add(combo, BorderLayout.CENTER);
|
|
| 280 | + variablesPanel.add(p);
|
|
| 281 | + JComboBox<?> jComboBox = combo.getCombobox();
|
|
| 282 | + jComboBox.putClientProperty(VARIABLE_NAME, variableName);
|
|
| 283 | + jComboBox.addItemListener(e -> {
|
|
| 284 | + JComboBox<?> comboBox = (JComboBox<?>) e.getSource();
|
|
| 285 | + if (e.getStateChange() == ItemEvent.DESELECTED) {
|
|
| 286 | + // ne rien faire de l'évènement de déselection sauf si le modèle devient vide
|
|
| 287 | + if (comboBox.getSelectedItem() == null) {
|
|
| 288 | + updateVariable(comboBox, null);
|
|
| 289 | + }
|
|
| 290 | + return;
|
|
| 291 | + }
|
|
| 292 | + Object o = e.getItem();
|
|
| 293 | + updateVariable(comboBox, o);
|
|
| 294 | + });
|
|
| 295 | + }
|
|
| 296 | + |
|
| 260 | 297 | }
|
| 261 | 298 | }
|
| 262 | 299 |
| ... | ... | @@ -567,6 +567,266 @@ report.psObservationSetByAssociation.request.8=3,1|column|\ |
| 567 | 567 | and os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \
|
| 568 | 568 | and os not in elements(a.observedSystem)
|
| 569 | 569 | ################################################################################
|
| 570 | +## Observations - Poids des captures selon le type d'association, filtrées par groupe et rejet
|
|
| 571 | +################################################################################
|
|
| 572 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.modelType=PS
|
|
| 573 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.name=Observations - Poids des captures selon le type d'association, filtrées par groupe et mode (rejeté/conservé) (en t)
|
|
| 574 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.description=Afficher le poids de rejets par groupe d'espèces et mode (rejeté/conservé) selon le type d'association
|
|
| 575 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.columns=Espèce,BL sans baleine,BL avec baleine,BO avec requin-baleine,BO sans requin-baleine,Total
|
|
| 576 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.variable.1.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|\
|
|
| 577 | +Select distinct sg \
|
|
| 578 | +From TripImpl t \
|
|
| 579 | +Join t.routeObs r \
|
|
| 580 | +Join r.activity a \
|
|
| 581 | +Join a.set c \
|
|
| 582 | +Join c.catches ca with ca.catchWeight Is Not Null \
|
|
| 583 | +Join ca.species e \
|
|
| 584 | +Join e.speciesGroup sg \
|
|
| 585 | +Where t.id In :tripId \
|
|
| 586 | +Order By sg.code
|
|
| 587 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.variable.2.discardMode=java.lang.Boolean|\
|
|
| 588 | +Select distinct sf.discard \
|
|
| 589 | +From TripImpl t \
|
|
| 590 | +Join t.routeObs r \
|
|
| 591 | +Join r.activity a \
|
|
| 592 | +Join a.set c \
|
|
| 593 | +Join c.catches ca with ca.catchWeight Is Not Null \
|
|
| 594 | +Join ca.speciesFate sf \
|
|
| 595 | +Where t.id In :tripId \
|
|
| 596 | +Order By sf.discard
|
|
| 597 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.repeatVariable.1.species=fr.ird.observe.entities.referential.common.Species|\
|
|
| 598 | +Select distinct e \
|
|
| 599 | +From TripImpl t \
|
|
| 600 | +Join t.routeObs r \
|
|
| 601 | +Join r.activity a \
|
|
| 602 | +Join a.set c \
|
|
| 603 | +Join c.catches ca with ca.catchWeight Is Not Null And ca.speciesFate.discard = :discardMode \
|
|
| 604 | +Join ca.species e with e.speciesGroup.id = :speciesGroup \
|
|
| 605 | +Where t.id In :tripId \
|
|
| 606 | +Order By e.faoCode
|
|
| 607 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.operations.1=SumRow:0|1
|
|
| 608 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.operations.2=SumColumn:0|1
|
|
| 609 | +# Colonne 1 (les espèces)
|
|
| 610 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.request.1=0,0|row|\
|
|
| 611 | + Select \
|
|
| 612 | + concat(\
|
|
| 613 | + '[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \
|
|
| 614 | + ' [sc]', (case when e.scientificLabel is not null then e.scientificLabel else '-' end), \
|
|
| 615 | + ' [fr]', (case when e.label2 is not null then e.label2 else '-' end)) \
|
|
| 616 | + From SpeciesImpl e \
|
|
| 617 | + Where e = :species
|
|
| 618 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.request.1.repeat=species|column
|
|
| 619 | +# colonne 2 (BL sans baleine)
|
|
| 620 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.request.2=1,0|row|\
|
|
| 621 | + Select Sum(CASE When ca.species = :species Then ca.catchWeight Else 0.0 End) \
|
|
| 622 | + From TripImpl m \
|
|
| 623 | + Join m.routeObs r \
|
|
| 624 | + Join r.activity a \
|
|
| 625 | + Join a.set c with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#2' \
|
|
| 626 | + Join c.catches ca with ca.catchWeight Is Not Null \
|
|
| 627 | + Join ca.speciesFate sf with sf.discard = :discardMode, \
|
|
| 628 | + ObservedSystemImpl os, \
|
|
| 629 | + SpeciesImpl e \
|
|
| 630 | + Where \
|
|
| 631 | + m.id In :tripId \
|
|
| 632 | + And e = :species \
|
|
| 633 | + And os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9395222812356602' \
|
|
| 634 | + And os not in elements(a.observedSystem) \
|
|
| 635 | + Group by e
|
|
| 636 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.request.2.repeat=species|column
|
|
| 637 | +# colonne 3 (BL avec baleine)
|
|
| 638 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.request.3=2,0|row|\
|
|
| 639 | + Select Sum(CASE When ca.species = :species Then ca.catchWeight Else 0.0 End) \
|
|
| 640 | + From TripImpl m \
|
|
| 641 | + Join m.routeObs r \
|
|
| 642 | + Join r.activity a \
|
|
| 643 | + Join a.set c with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#2' \
|
|
| 644 | + Join c.catches ca with ca.catchWeight Is Not Null \
|
|
| 645 | + Join ca.speciesFate sf with sf.discard = :discardMode, \
|
|
| 646 | + ObservedSystemImpl os, \
|
|
| 647 | + SpeciesImpl e \
|
|
| 648 | + Where \
|
|
| 649 | + m.id In :tripId \
|
|
| 650 | + And e = :species \
|
|
| 651 | + And os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9395222812356602' \
|
|
| 652 | + And os in elements(a.observedSystem) \
|
|
| 653 | + Group by e
|
|
| 654 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.request.3.repeat=species|column
|
|
| 655 | +# colonne 4 (BO avec requin-baleine)
|
|
| 656 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.request.4=3,0|row|\
|
|
| 657 | + Select Sum(CASE When ca.species = :species Then ca.catchWeight Else 0.0 End) \
|
|
| 658 | + From TripImpl m \
|
|
| 659 | + Join m.routeObs r \
|
|
| 660 | + Join r.activity a \
|
|
| 661 | + Join a.set c with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#1' \
|
|
| 662 | + Join c.catches ca with ca.catchWeight Is Not Null \
|
|
| 663 | + Join ca.speciesFate sf with sf.discard = :discardMode, \
|
|
| 664 | + ObservedSystemImpl os1, \
|
|
| 665 | + ObservedSystemImpl os2, \
|
|
| 666 | + ObservedSystemImpl os3, \
|
|
| 667 | + SpeciesImpl e \
|
|
| 668 | + Where \
|
|
| 669 | + m.id In :tripId \
|
|
| 670 | + And e = :species \
|
|
| 671 | + And os1.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \
|
|
| 672 | + And os2.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#0#1.0' \
|
|
| 673 | + And os3.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#0#1.1' \
|
|
| 674 | + And ( os1 in elements(a.observedSystem) Or os2 in elements(a.observedSystem) Or os3 in elements(a.observedSystem) ) \
|
|
| 675 | + Group by e
|
|
| 676 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.request.4.repeat=species|column
|
|
| 677 | +# colonne 5 (BO sans requin-baleine)
|
|
| 678 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.request.5=4,0|row|\
|
|
| 679 | + Select Sum(CASE When ca.species = :species Then ca.catchWeight Else 0.0 End) \
|
|
| 680 | + From TripImpl m \
|
|
| 681 | + Join m.routeObs r \
|
|
| 682 | + Join r.activity a \
|
|
| 683 | + Join a.set c with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#1' \
|
|
| 684 | + Join c.catches ca with ca.catchWeight Is Not Null \
|
|
| 685 | + Join ca.speciesFate sf with sf.discard = :discardMode, \
|
|
| 686 | + ObservedSystemImpl os1, \
|
|
| 687 | + ObservedSystemImpl os2, \
|
|
| 688 | + ObservedSystemImpl os3, \
|
|
| 689 | + SpeciesImpl e \
|
|
| 690 | + Where \
|
|
| 691 | + m.id In :tripId \
|
|
| 692 | + And e = :species \
|
|
| 693 | + And os1.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \
|
|
| 694 | + And os2.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#0#1.0' \
|
|
| 695 | + And os3.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#0#1.1' \
|
|
| 696 | + And os1 not in elements(a.observedSystem) And os2 not in elements(a.observedSystem) And os3 not in elements(a.observedSystem) \
|
|
| 697 | + Group by e
|
|
| 698 | +report.psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation.request.5.repeat=species|column
|
|
| 699 | +################################################################################
|
|
| 700 | +## Observations - Dénombrement des captures selon le type d'association, filtrées par groupe et rejet
|
|
| 701 | +################################################################################
|
|
| 702 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.modelType=PS
|
|
| 703 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.name=Observations - Dénombrement des captures selon le type d'association, filtrées par groupe et mode (rejeté/conservé)
|
|
| 704 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.description=Afficher le dénombrement de rejets par groupe d'espèces et mode (rejeté/conservé) selon le type d'association
|
|
| 705 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.columns=Espèce,BL sans baleine,BL avec baleine,BO avec requin-baleine,BO sans requin-baleine,Total
|
|
| 706 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.variable.1.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|\
|
|
| 707 | +Select distinct sg \
|
|
| 708 | +From TripImpl t \
|
|
| 709 | +Join t.routeObs r \
|
|
| 710 | +Join r.activity a \
|
|
| 711 | +Join a.set c \
|
|
| 712 | +Join c.catches ca with ca.totalCount Is Not Null \
|
|
| 713 | +Join ca.species e \
|
|
| 714 | +Join e.speciesGroup sg \
|
|
| 715 | +Where t.id In :tripId \
|
|
| 716 | +Order By sg.code
|
|
| 717 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.variable.2.discardMode=java.lang.Boolean|\
|
|
| 718 | +Select distinct sf.discard \
|
|
| 719 | +From TripImpl t \
|
|
| 720 | +Join t.routeObs r \
|
|
| 721 | +Join r.activity a \
|
|
| 722 | +Join a.set c \
|
|
| 723 | +Join c.catches ca with ca.totalCount Is Not Null \
|
|
| 724 | +Join ca.speciesFate sf \
|
|
| 725 | +Where t.id In :tripId \
|
|
| 726 | +Order By sf.discard
|
|
| 727 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.repeatVariable.1.species=fr.ird.observe.entities.referential.common.Species|\
|
|
| 728 | +Select distinct e \
|
|
| 729 | +From TripImpl t \
|
|
| 730 | +Join t.routeObs r \
|
|
| 731 | +Join r.activity a \
|
|
| 732 | +Join a.set c \
|
|
| 733 | +Join c.catches ca with ca.totalCount Is Not Null And ca.speciesFate.discard = :discardMode \
|
|
| 734 | +Join ca.species e with e.speciesGroup.id = :speciesGroup \
|
|
| 735 | +Where t.id In :tripId \
|
|
| 736 | +Order By e.faoCode
|
|
| 737 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.operations.1=SumIntRow:0|1
|
|
| 738 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.operations.2=SumIntColumn:0|1
|
|
| 739 | +# Colonne 1 (les espèces)
|
|
| 740 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.request.1=0,0|row|\
|
|
| 741 | + Select \
|
|
| 742 | + concat(\
|
|
| 743 | + '[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \
|
|
| 744 | + ' [sc]', (case when e.scientificLabel is not null then e.scientificLabel else '-' end), \
|
|
| 745 | + ' [fr]', (case when e.label2 is not null then e.label2 else '-' end)) \
|
|
| 746 | + From SpeciesImpl e \
|
|
| 747 | + Where e = :species
|
|
| 748 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.request.1.repeat=species|column
|
|
| 749 | +# colonne 2 (BL sans baleine)
|
|
| 750 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.request.2=1,0|row|\
|
|
| 751 | + Select Sum(CASE When ca.species = :species Then ca.totalCount Else 0.0 End) \
|
|
| 752 | + From TripImpl m \
|
|
| 753 | + Join m.routeObs r \
|
|
| 754 | + Join r.activity a \
|
|
| 755 | + Join a.set c with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#2' \
|
|
| 756 | + Join c.catches ca with ca.totalCount Is Not Null \
|
|
| 757 | + Join ca.speciesFate sf with sf.discard = :discardMode, \
|
|
| 758 | + ObservedSystemImpl os, \
|
|
| 759 | + SpeciesImpl e \
|
|
| 760 | + Where \
|
|
| 761 | + m.id In :tripId \
|
|
| 762 | + And e = :species \
|
|
| 763 | + And os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9395222812356602' \
|
|
| 764 | + And os not in elements(a.observedSystem) \
|
|
| 765 | + Group by e
|
|
| 766 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.request.2.repeat=species|column
|
|
| 767 | +# colonne 3 (BL avec baleine)
|
|
| 768 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.request.3=2,0|row|\
|
|
| 769 | + Select Sum(CASE When ca.species = :species Then ca.totalCount Else 0.0 End) \
|
|
| 770 | + From TripImpl m \
|
|
| 771 | + Join m.routeObs r \
|
|
| 772 | + Join r.activity a \
|
|
| 773 | + Join a.set c with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#2' \
|
|
| 774 | + Join c.catches ca with ca.totalCount Is Not Null \
|
|
| 775 | + Join ca.speciesFate sf with sf.discard = :discardMode, \
|
|
| 776 | + ObservedSystemImpl os, \
|
|
| 777 | + SpeciesImpl e \
|
|
| 778 | + Where \
|
|
| 779 | + m.id In :tripId \
|
|
| 780 | + And e = :species \
|
|
| 781 | + And os.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9395222812356602' \
|
|
| 782 | + And os in elements(a.observedSystem) \
|
|
| 783 | + Group by e
|
|
| 784 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.request.3.repeat=species|column
|
|
| 785 | +# colonne 4 (BO avec requin-baleine)
|
|
| 786 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.request.4=3,0|row|\
|
|
| 787 | + Select Sum(CASE When ca.species = :species Then ca.totalCount Else 0.0 End) \
|
|
| 788 | + From TripImpl m \
|
|
| 789 | + Join m.routeObs r \
|
|
| 790 | + Join r.activity a \
|
|
| 791 | + Join a.set c with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#1' \
|
|
| 792 | + Join c.catches ca with ca.totalCount Is Not Null \
|
|
| 793 | + Join ca.speciesFate sf with sf.discard = :discardMode, \
|
|
| 794 | + ObservedSystemImpl os1, \
|
|
| 795 | + ObservedSystemImpl os2, \
|
|
| 796 | + ObservedSystemImpl os3, \
|
|
| 797 | + SpeciesImpl e \
|
|
| 798 | + Where \
|
|
| 799 | + m.id In :tripId \
|
|
| 800 | + And e = :species \
|
|
| 801 | + And os1.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \
|
|
| 802 | + And os2.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#0#1.0' \
|
|
| 803 | + And os3.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#0#1.1' \
|
|
| 804 | + And ( os1 in elements(a.observedSystem) Or os2 in elements(a.observedSystem) Or os3 in elements(a.observedSystem) ) \
|
|
| 805 | + Group by e
|
|
| 806 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.request.4.repeat=species|column
|
|
| 807 | +# colonne 5 (BO sans requin-baleine)
|
|
| 808 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.request.5=4,0|row|\
|
|
| 809 | + Select Sum(CASE When ca.species = :species Then ca.totalCount Else 0.0 End) \
|
|
| 810 | + From TripImpl m \
|
|
| 811 | + Join m.routeObs r \
|
|
| 812 | + Join r.activity a \
|
|
| 813 | + Join a.set c with c.schoolType.id = 'fr.ird.referential.ps.common.SchoolType#0#1' \
|
|
| 814 | + Join c.catches ca with ca.totalCount Is Not Null \
|
|
| 815 | + Join ca.speciesFate sf with sf.discard = :discardMode, \
|
|
| 816 | + ObservedSystemImpl os1, \
|
|
| 817 | + ObservedSystemImpl os2, \
|
|
| 818 | + ObservedSystemImpl os3, \
|
|
| 819 | + SpeciesImpl e \
|
|
| 820 | + Where \
|
|
| 821 | + m.id In :tripId \
|
|
| 822 | + And e = :species \
|
|
| 823 | + And os1.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#1239832686428#0.9217864901728908' \
|
|
| 824 | + And os2.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#0#1.0' \
|
|
| 825 | + And os3.topiaId = 'fr.ird.referential.ps.common.ObservedSystem#0#1.1' \
|
|
| 826 | + And os1 not in elements(a.observedSystem) And os2 not in elements(a.observedSystem) And os3 not in elements(a.observedSystem) \
|
|
| 827 | + Group by e
|
|
| 828 | +report.psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation.request.5.repeat=species|column
|
|
| 829 | +################################################################################
|
|
| 570 | 830 | ## Captures thons selon le type d'association
|
| 571 | 831 | ################################################################################
|
| 572 | 832 | report.psObservationTargetCatchByAssociation.modelType=PS
|
| ... | ... | @@ -59,4 +59,16 @@ public class ReportServiceLocalReadTest extends GeneratedReportServiceLocalReadT |
| 59 | 59 | ReportService service = getService();
|
| 60 | 60 | fixtures.executeReport(getServicesProvider(), service, "psObservationCatchTotalCountByGroupPerReasonForDiscard");
|
| 61 | 61 | }
|
| 62 | + |
|
| 63 | + @Test
|
|
| 64 | + public void executeReportPsObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation() {
|
|
| 65 | + ReportService service = getService();
|
|
| 66 | + fixtures.executeReport(getServicesProvider(), service, "psObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociation");
|
|
| 67 | + }
|
|
| 68 | + |
|
| 69 | + @Test
|
|
| 70 | + public void executeReportPsObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation() {
|
|
| 71 | + ReportService service = getService();
|
|
| 72 | + fixtures.executeReport(getServicesProvider(), service, "psObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociation");
|
|
| 73 | + }
|
|
| 62 | 74 | } |
| ... | ... | @@ -35,6 +35,7 @@ import java.beans.Introspector; |
| 35 | 35 | import java.util.Arrays;
|
| 36 | 36 | import java.util.Iterator;
|
| 37 | 37 | import java.util.LinkedHashSet;
|
| 38 | +import java.util.Objects;
|
|
| 38 | 39 | import java.util.Set;
|
| 39 | 40 | |
| 40 | 41 | import static fr.ird.observe.test.ObserveFixtures.WITH_ASSERT;
|
| ... | ... | @@ -107,6 +108,18 @@ public abstract class ReportFixture { |
| 107 | 108 | }
|
| 108 | 109 | }
|
| 109 | 110 | |
| 111 | + protected void setVariableValue(Report report, String variableName, Boolean id) {
|
|
| 112 | + for (ReportVariable variable : report.getVariables()) {
|
|
| 113 | + if (variableName.equals(variable.getName())) {
|
|
| 114 | + Boolean value = (Boolean) variable.getValues().stream()
|
|
| 115 | + .filter(f-> Objects.equals(f, id))
|
|
| 116 | + .findFirst()
|
|
| 117 | + .orElse(null);
|
|
| 118 | + variable.setSelectedValue(value);
|
|
| 119 | + }
|
|
| 120 | + }
|
|
| 121 | + }
|
|
| 122 | + |
|
| 110 | 123 | public void assertSyntax(Report actual) {
|
| 111 | 124 | Assert.assertNotNull(actual);
|
| 112 | 125 | assertReportName(actual);
|
| ... | ... | @@ -175,7 +188,7 @@ public abstract class ReportFixture { |
| 175 | 188 | } else {
|
| 176 | 189 | ReportServiceFixtures.addAssert("syntax.rows", report.getRows());
|
| 177 | 190 | ReportServiceFixtures.addAssert("syntax.columns", report.getColumns());
|
| 178 | - if (report.getRowHeaders() == null) {
|
|
| 191 | + if (report.getColumnHeaders() == null) {
|
|
| 179 | 192 | ReportServiceFixtures.writeArrayAssert("syntax.columnsHeader");
|
| 180 | 193 | } else {
|
| 181 | 194 | ReportServiceFixtures.writeArrayAssert("syntax.columnsHeader", (Object[]) report.getColumnHeaders());
|
| 1 | +package fr.ird.observe.services.service.report.ps;
|
|
| 2 | + |
|
| 3 | +/*-
|
|
| 4 | + * #%L
|
|
| 5 | + * ObServe Core :: Services :: Test
|
|
| 6 | + * %%
|
|
| 7 | + * Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 8 | + * %%
|
|
| 9 | + * This program is free software: you can redistribute it and/or modify
|
|
| 10 | + * it under the terms of the GNU General Public License as
|
|
| 11 | + * published by the Free Software Foundation, either version 3 of the
|
|
| 12 | + * License, or (at your option) any later version.
|
|
| 13 | + *
|
|
| 14 | + * This program is distributed in the hope that it will be useful,
|
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 | + * GNU General Public License for more details.
|
|
| 18 | + *
|
|
| 19 | + * You should have received a copy of the GNU General Public
|
|
| 20 | + * License along with this program. If not, see
|
|
| 21 | + * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 | + * #L%
|
|
| 23 | + */
|
|
| 24 | + |
|
| 25 | +import com.google.auto.service.AutoService;
|
|
| 26 | +import fr.ird.observe.dto.report.Report;
|
|
| 27 | +import fr.ird.observe.dto.report.ReportRequest;
|
|
| 28 | +import fr.ird.observe.services.service.ReportFixture;
|
|
| 29 | + |
|
| 30 | +import java.util.Iterator;
|
|
| 31 | + |
|
| 32 | +/**
|
|
| 33 | + * Created on 09/12/2022.
|
|
| 34 | + *
|
|
| 35 | + * @author Tony Chemit - dev@tchemit.fr
|
|
| 36 | + * @since 9.0.22
|
|
| 37 | + */
|
|
| 38 | +@AutoService(ReportFixture.class)
|
|
| 39 | +public class PsObservationCatchTotalCountByGroupAndSpeciesFateDiscardPerAssociationReportFixture extends ReportFixture {
|
|
| 40 | + |
|
| 41 | + @Override
|
|
| 42 | + public void assertSyntax(Report report) {
|
|
| 43 | + super.assertSyntax(report);
|
|
| 44 | + Iterator<ReportRequest> requests = getRequestIterator(report);
|
|
| 45 | + assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0);
|
|
| 46 | + assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 1, 0);
|
|
| 47 | + assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 2, 0);
|
|
| 48 | + assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 3, 0);
|
|
| 49 | + assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 4, 0);
|
|
| 50 | + }
|
|
| 51 | + |
|
| 52 | + @Override
|
|
| 53 | + protected void setVariables(Report report) {
|
|
| 54 | + setVariableValue(report, "speciesGroup", "fr.ird.referential.common.SpeciesGroup#1239832683689#0.17327457618202002");
|
|
| 55 | + setVariableValue(report, "discardMode", false);
|
|
| 56 | + }
|
|
| 57 | +} |
|
| \ No newline at end of file |
| 1 | +package fr.ird.observe.services.service.report.ps;
|
|
| 2 | + |
|
| 3 | +/*-
|
|
| 4 | + * #%L
|
|
| 5 | + * ObServe Core :: Services :: Test
|
|
| 6 | + * %%
|
|
| 7 | + * Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 8 | + * %%
|
|
| 9 | + * This program is free software: you can redistribute it and/or modify
|
|
| 10 | + * it under the terms of the GNU General Public License as
|
|
| 11 | + * published by the Free Software Foundation, either version 3 of the
|
|
| 12 | + * License, or (at your option) any later version.
|
|
| 13 | + *
|
|
| 14 | + * This program is distributed in the hope that it will be useful,
|
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 | + * GNU General Public License for more details.
|
|
| 18 | + *
|
|
| 19 | + * You should have received a copy of the GNU General Public
|
|
| 20 | + * License along with this program. If not, see
|
|
| 21 | + * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 | + * #L%
|
|
| 23 | + */
|
|
| 24 | + |
|
| 25 | +import com.google.auto.service.AutoService;
|
|
| 26 | +import fr.ird.observe.dto.report.Report;
|
|
| 27 | +import fr.ird.observe.dto.report.ReportRequest;
|
|
| 28 | +import fr.ird.observe.services.service.ReportFixture;
|
|
| 29 | + |
|
| 30 | +import java.util.Iterator;
|
|
| 31 | + |
|
| 32 | +/**
|
|
| 33 | + * Created on 09/12/2022.
|
|
| 34 | + *
|
|
| 35 | + * @author Tony Chemit - dev@tchemit.fr
|
|
| 36 | + * @since 9.0.22
|
|
| 37 | + */
|
|
| 38 | +@AutoService(ReportFixture.class)
|
|
| 39 | +public class PsObservationCatchWeightByGroupAndSpeciesFateDiscardPerAssociationReportFixture extends ReportFixture {
|
|
| 40 | + |
|
| 41 | + @Override
|
|
| 42 | + public void assertSyntax(Report report) {
|
|
| 43 | + super.assertSyntax(report);
|
|
| 44 | + Iterator<ReportRequest> requests = getRequestIterator(report);
|
|
| 45 | + assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0);
|
|
| 46 | + assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 1, 0);
|
|
| 47 | + assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 2, 0);
|
|
| 48 | + assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 3, 0);
|
|
| 49 | + assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 4, 0);
|
|
| 50 | + }
|
|
| 51 | + |
|
| 52 | + @Override
|
|
| 53 | + protected void setVariables(Report report) {
|
|
| 54 | + setVariableValue(report, "speciesGroup", "fr.ird.referential.common.SpeciesGroup#1433499401278#0.203439718578011");
|
|
| 55 | + setVariableValue(report, "discardMode", false);
|
|
| 56 | + }
|
|
| 57 | +}
|
|
| 58 | + |
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | # #L%
|
| 21 | 21 | ###
|
| 22 | 22 | result.0=483^CAP BOJADOR^30/3/2019^8/4/2019^30/3/2019^1^15:12^0.0^123.0^43.0^0.0^0.0^0.0^0.0^24.0^0.0^0.0^166.0^24.0^142.0
|
| 23 | -result.1=-^-^-^-^-^-^-^0^123^43^0^0^0^0^24^0^0^166^24^142
|
|
| 23 | +result.1=Total^-^-^-^-^-^-^0^123^43^0^0^0^0^24^0^0^166^24^142
|
|
| 24 | 24 | result.columns=20
|
| 25 | 25 | result.rows=2
|
| 26 | 26 | syntax.columns=20
|
| 1 | +###
|
|
| 2 | +# #%L
|
|
| 3 | +# ObServe Core :: Services :: Test
|
|
| 4 | +# %%
|
|
| 5 | +# Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 6 | +# %%
|
|
| 7 | +# This program is free software: you can redistribute it and/or modify
|
|
| 8 | +# it under the terms of the GNU General Public License as
|
|
| 9 | +# published by the Free Software Foundation, either version 3 of the
|
|
| 10 | +# License, or (at your option) any later version.
|
|
| 11 | +#
|
|
| 12 | +# This program is distributed in the hope that it will be useful,
|
|
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 | +# GNU General Public License for more details.
|
|
| 16 | +#
|
|
| 17 | +# You should have received a copy of the GNU General Public
|
|
| 18 | +# License along with this program. If not, see
|
|
| 19 | +# <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 | +# #L%
|
|
| 21 | +###
|
|
| 22 | +syntax.name=Observations - Dénombrement des captures selon le type d'association, filtrées par groupe et mode (rejeté/conservé)
|
|
| 23 | +syntax.description=Afficher le dénombrement de rejets par groupe d'espèces et mode (rejeté/conservé) selon le type d'association
|
|
| 24 | +syntax.rows=-1
|
|
| 25 | +syntax.columns=6
|
|
| 26 | +syntax.columnsHeader=Espèce^BL sans baleine^BL avec baleine^BO avec requin-baleine^BO sans requin-baleine^Total
|
|
| 27 | +syntax.rowsHeader=
|
|
| 28 | +syntax.nbRequests=5
|
|
| 29 | +result.columns=6
|
|
| 30 | +result.rows=1
|
|
| 31 | +result.0=[FAO]SAI [sc]Istiophorus albicans [fr]Voilier de l'Atlantique^null^null^null^4^4 |
|
| \ No newline at end of file |
| 1 | +###
|
|
| 2 | +# #%L
|
|
| 3 | +# ObServe Core :: Services :: Test
|
|
| 4 | +# %%
|
|
| 5 | +# Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
|
| 6 | +# %%
|
|
| 7 | +# This program is free software: you can redistribute it and/or modify
|
|
| 8 | +# it under the terms of the GNU General Public License as
|
|
| 9 | +# published by the Free Software Foundation, either version 3 of the
|
|
| 10 | +# License, or (at your option) any later version.
|
|
| 11 | +#
|
|
| 12 | +# This program is distributed in the hope that it will be useful,
|
|
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 | +# GNU General Public License for more details.
|
|
| 16 | +#
|
|
| 17 | +# You should have received a copy of the GNU General Public
|
|
| 18 | +# License along with this program. If not, see
|
|
| 19 | +# <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 | +# #L%
|
|
| 21 | +###
|
|
| 22 | +syntax.name=Observations - Poids des captures selon le type d'association, filtrées par groupe et mode (rejeté/conservé) (en t)
|
|
| 23 | +syntax.description=Afficher le poids de rejets par groupe d'espèces et mode (rejeté/conservé) selon le type d'association
|
|
| 24 | +syntax.rows=-1
|
|
| 25 | +syntax.columns=6
|
|
| 26 | +syntax.columnsHeader=Espèce^BL sans baleine^BL avec baleine^BO avec requin-baleine^BO sans requin-baleine^Total
|
|
| 27 | +syntax.rowsHeader=
|
|
| 28 | +syntax.nbRequests=5
|
|
| 29 | +result.columns=6
|
|
| 30 | +result.rows=6
|
|
| 31 | +result.0=[FAO]BET [sc]Thunnus obesus [fr]Patudo, thon obèse, thon gros yeux^7.0^null^null^0.0^7.0
|
|
| 32 | +result.1=[FAO]FRI [sc]Auxis thazard [fr]Auxide^0.0^null^null^1.0^1.0
|
|
| 33 | +result.2=[FAO]FRZ [sc]Auxis spp [fr]Auxis^0.0^null^null^12.0^12.0
|
|
| 34 | +result.3=[FAO]SKJ [sc]Katsuwonus pelamis [fr]Listao, bonite à ventre rayé^0.0^null^null^1.0^1.0
|
|
| 35 | +result.4=[FAO]YFT [sc]Thunnus albacares [fr]Albacore, thon à nageoires jaunes^175.0^null^null^0.0^175.0
|
|
| 36 | +result.5=Total^182.0^0.0^0.0^14.0^196.0 |
|
| \ No newline at end of file |
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | <parent>
|
| 24 | 24 | <groupId>io.ultreia.maven</groupId>
|
| 25 | 25 | <artifactId>pom</artifactId>
|
| 26 | - <version>2022.97</version>
|
|
| 26 | + <version>2022.98</version>
|
|
| 27 | 27 | </parent>
|
| 28 | 28 | <groupId>fr.ird.observe</groupId>
|
| 29 | 29 | <artifactId>ird-observe</artifactId>
|
| ... | ... | @@ -164,7 +164,10 @@ public class Report implements Serializable, JsonAware { |
| 164 | 164 | public boolean canExecute() {
|
| 165 | 165 | |
| 166 | 166 | for (ReportVariable<?> variable : getVariables()) {
|
| 167 | - |
|
| 167 | + if (variable.getType().equals(Boolean.class)) {
|
|
| 168 | + // Boolean type can be null
|
|
| 169 | + continue;
|
|
| 170 | + }
|
|
| 168 | 171 | // on verifie qu'on a bien cette variable
|
| 169 | 172 | String name = variable.getName();
|
| 170 | 173 | if (variable.getSelectedValue() == null) {
|
| ... | ... | @@ -180,7 +183,10 @@ public class Report implements Serializable, JsonAware { |
| 180 | 183 | public boolean canExecute(Map<String, Object> variables) {
|
| 181 | 184 | |
| 182 | 185 | for (ReportVariable<?> variable : getVariables()) {
|
| 183 | - |
|
| 186 | + if (variable.getType().equals(Boolean.class)) {
|
|
| 187 | + // Boolean type can be null
|
|
| 188 | + continue;
|
|
| 189 | + }
|
|
| 184 | 190 | // on verifie qu'on a bien cette variable
|
| 185 | 191 | String name = variable.getName();
|
| 186 | 192 | if (variables.get(name) == null) {
|
| ... | ... | @@ -66,7 +66,7 @@ public class SumColumn implements ReportOperationConsumer { |
| 66 | 66 | tmpMatrix.setValue(column, 0, sumColumn);
|
| 67 | 67 | }
|
| 68 | 68 | DataMatrix merge = DataMatrix.merge(incoming, tmpMatrix);
|
| 69 | - if (report.getColumnHeaders() == null) {
|
|
| 69 | + if (report.getRowHeaders() == null) {
|
|
| 70 | 70 | merge.setValue(0, height, "Total");
|
| 71 | 71 | }
|
| 72 | 72 | return merge;
|
| ... | ... | @@ -67,7 +67,7 @@ public class SumRow implements ReportOperationConsumer { |
| 67 | 67 | tmpMatrix.setValue(0, row, sumRow);
|
| 68 | 68 | }
|
| 69 | 69 | DataMatrix merge = DataMatrix.merge(incoming, tmpMatrix);
|
| 70 | - if (report.getRowHeaders() == null) {
|
|
| 70 | + if (report.getColumnHeaders() == null) {
|
|
| 71 | 71 | merge.setValue(width, 0, "Total");
|
| 72 | 72 | }
|
| 73 | 73 | return merge;
|
| ... | ... | @@ -131,7 +131,7 @@ public abstract class DefaultReportRequestExecutor implements ReportRequestExecu |
| 131 | 131 | Map<String, Object> paramsFixes = new HashMap<>();
|
| 132 | 132 | for (Map.Entry<String, Object> entry : params.entrySet()) {
|
| 133 | 133 | String name = entry.getKey();
|
| 134 | - if (request.contains(":" + name + " ") || request.endsWith(":" + name)) {
|
|
| 134 | + if (request.contains(":" + name + " ") || request.contains(":" + name + ",") || request.endsWith(":" + name)) {
|
|
| 135 | 135 | Object value = entry.getValue();
|
| 136 | 136 | if (value instanceof DtoReference) {
|
| 137 | 137 | DtoReference referenceDto = (DtoReference) value;
|
| ... | ... | @@ -85,7 +85,9 @@ public class HibernateTopiaJpaSupport implements TopiaJpaSupport { |
| 85 | 85 | for (Map.Entry<String, Object> entry : parameters.entrySet()) {
|
| 86 | 86 | String name = entry.getKey();
|
| 87 | 87 | Object value = entry.getValue();
|
| 88 | - if (value.getClass().isArray()) {
|
|
| 88 | + if (value == null) {
|
|
| 89 | + query.setParameter(name, null);
|
|
| 90 | + } else if (value.getClass().isArray()) {
|
|
| 89 | 91 | query.setParameterList(name, (Object[]) value);
|
| 90 | 92 | } else if (value instanceof Collection<?>) {
|
| 91 | 93 | query.setParameterList(name, (Collection<?>) value);
|