Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

12 changed files:

Changes:

  • client/src/main/java/fr/ird/observe/client/ui/admin/config/SelectDataModel.java
    ... ... @@ -22,24 +22,28 @@ package fr.ird.observe.client.ui.admin.config;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    +import com.google.common.collect.ImmutableSet;
    
    25 26
     import fr.ird.observe.client.db.ObserveSwingDataSource;
    
    26 27
     import fr.ird.observe.client.ui.admin.AdminActionModel;
    
    27 28
     import fr.ird.observe.client.ui.admin.AdminStep;
    
    28 29
     import fr.ird.observe.client.ui.admin.AdminUIModel;
    
    29 30
     import fr.ird.observe.client.ui.admin.report.ReportModel;
    
    30 31
     import fr.ird.observe.client.ui.tree.selection.SelectionTreeModel;
    
    32
    +import fr.ird.observe.dto.IdDto;
    
    31 33
     import fr.ird.observe.dto.IdHelper;
    
    32 34
     import fr.ird.observe.dto.ObserveModelType;
    
    33 35
     import fr.ird.observe.dto.data.longline.TripLonglineReference;
    
    34 36
     import fr.ird.observe.dto.data.seine.TripSeineReference;
    
    35 37
     import fr.ird.observe.dto.reference.DataDtoReference;
    
    36 38
     import fr.ird.observe.dto.reference.DataDtoReferenceSet;
    
    39
    +import fr.ird.observe.services.service.actions.report.Report;
    
    37 40
     import org.apache.commons.logging.Log;
    
    38 41
     import org.apache.commons.logging.LogFactory;
    
    39 42
     
    
    40 43
     import java.util.ArrayList;
    
    41 44
     import java.util.List;
    
    42 45
     import java.util.Set;
    
    46
    +import java.util.stream.Collectors;
    
    43 47
     
    
    44 48
     /**
    
    45 49
      * Created on 28/11/16.
    
    ... ... @@ -136,6 +140,17 @@ public class SelectDataModel extends AdminActionModel {
    136 140
             return null;
    
    137 141
         }
    
    138 142
     
    
    143
    +    public ImmutableSet<DataDtoReference> getSelectedTrips() {
    
    144
    +        ImmutableSet.Builder<DataDtoReference> result = ImmutableSet.builder();
    
    145
    +        Set<DataDtoReference<?, ?>> data = getSelectionDataModel().getSelectedData();
    
    146
    +        for (DataDtoReference<?, ?> datum : data) {
    
    147
    +            if (IdHelper.isTrip(datum)) {
    
    148
    +                result.add(datum);
    
    149
    +            }
    
    150
    +        }
    
    151
    +        return result.build();
    
    152
    +    }
    
    153
    +
    
    139 154
         public void start(AdminUIModel uiModel) {
    
    140 155
     
    
    141 156
             if (!uiModel.needSelect()) {
    
    ... ... @@ -236,10 +251,14 @@ public class SelectDataModel extends AdminActionModel {
    236 251
     
    
    237 252
                     // il faut exactement une Trip de selectionnee
    
    238 253
                     int selectedCount = selectionDataModel.getSelectedCount();
    
    239
    -                validate = selectedCount == 1;
    
    254
    +                validate = selectedCount > 0;
    
    240 255
                 }
    
    241 256
             }
    
    242 257
     
    
    243 258
             return validate;
    
    244 259
         }
    
    260
    +
    
    261
    +    public ImmutableSet<String> getSelectedTripIds() {
    
    262
    +        return ImmutableSet.copyOf(getSelectedTrips().stream().map(IdDto::getId).collect(Collectors.toSet()));
    
    263
    +    }
    
    245 264
     }

  • client/src/main/java/fr/ird/observe/client/ui/admin/report/ReportUI.jcss
    ... ... @@ -71,7 +71,7 @@ JToolBar {
    71 71
     }
    
    72 72
     
    
    73 73
     #reportDescription {
    
    74
    -  text:{getHandler().updateSelectedReportDescrption(stepModel.getSelectedReport())};
    
    74
    +  text:{getHandler().updateSelectedReportDescription(stepModel.getSelectedReport())};
    
    75 75
       editable:false;
    
    76 76
       focusable:false;
    
    77 77
     }
    

  • client/src/main/java/fr/ird/observe/client/ui/admin/report/ReportUIHandler.java
    ... ... @@ -6,22 +6,22 @@
    6 6
      * %%
    
    7 7
      * This program is free software: you can redistribute it and/or modify
    
    8 8
      * it under the terms of the GNU General Public License as
    
    9
    - * published by the Free Software Foundation, either version 3 of the 
    
    9
    + * published by the Free Software Foundation, either version 3 of the
    
    10 10
      * License, or (at your option) any later version.
    
    11
    - * 
    
    11
    + *
    
    12 12
      * This program is distributed in the hope that it will be useful,
    
    13 13
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14 14
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15 15
      * GNU General Public License for more details.
    
    16
    - * 
    
    17
    - * You should have received a copy of the GNU General Public 
    
    16
    + *
    
    17
    + * You should have received a copy of the GNU General Public
    
    18 18
      * License along with this program.  If not, see
    
    19 19
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20 20
      * #L%
    
    21 21
      */
    
    22 22
     package fr.ird.observe.client.ui.admin.report;
    
    23 23
     
    
    24
    -import com.google.common.collect.Lists;
    
    24
    +import com.google.common.collect.ImmutableSet;
    
    25 25
     import fr.ird.observe.client.ObserveSwingTechnicalException;
    
    26 26
     import fr.ird.observe.client.db.ObserveSwingDataSource;
    
    27 27
     import fr.ird.observe.client.ui.admin.AdminStep;
    
    ... ... @@ -30,12 +30,15 @@ import fr.ird.observe.client.ui.admin.config.ConfigUI;
    30 30
     import fr.ird.observe.client.ui.util.UIHelper;
    
    31 31
     import fr.ird.observe.dto.ObserveModelType;
    
    32 32
     import fr.ird.observe.dto.data.DataDto;
    
    33
    +import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
    
    34
    +import fr.ird.observe.dto.decoration.ObserveI18nLabelsBuilder;
    
    33 35
     import fr.ird.observe.dto.reference.DataDtoReference;
    
    34 36
     import fr.ird.observe.dto.referential.ReferentialDto;
    
    35 37
     import fr.ird.observe.services.service.actions.report.DataMatrix;
    
    36 38
     import fr.ird.observe.services.service.actions.report.Report;
    
    37 39
     import fr.ird.observe.services.service.actions.report.ReportService;
    
    38 40
     import fr.ird.observe.services.service.actions.report.ReportVariable;
    
    41
    +import fr.ird.observe.spi.DtoModelHelper;
    
    39 42
     import org.apache.commons.logging.Log;
    
    40 43
     import org.apache.commons.logging.LogFactory;
    
    41 44
     import org.nuiton.decorator.Decorator;
    
    ... ... @@ -57,6 +60,7 @@ import java.awt.Component;
    57 60
     import java.awt.Font;
    
    58 61
     import java.awt.event.ItemEvent;
    
    59 62
     import java.io.File;
    
    63
    +import java.util.ArrayList;
    
    60 64
     import java.util.List;
    
    61 65
     import java.util.Map;
    
    62 66
     import java.util.Set;
    
    ... ... @@ -71,7 +75,7 @@ import static org.nuiton.i18n.I18n.t;
    71 75
      */
    
    72 76
     public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHandler<ReportUI> {
    
    73 77
     
    
    74
    -    public static final String VARIABLE_NAME = "variableName";
    
    78
    +    private static final String VARIABLE_NAME = "variableName";
    
    75 79
     
    
    76 80
         /** Logger */
    
    77 81
         private static final Log log = LogFactory.getLog(ReportUIHandler.class);
    
    ... ... @@ -142,14 +146,14 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    142 146
     
    
    143 147
                 Font headerFont;
    
    144 148
     
    
    145
    -            public Font getDefaultFont(JTable table) {
    
    149
    +            Font getDefaultFont(JTable table) {
    
    146 150
                     if (defaultFont == null) {
    
    147 151
                         defaultFont = table.getFont();
    
    148 152
                     }
    
    149 153
                     return defaultFont;
    
    150 154
                 }
    
    151 155
     
    
    152
    -            public Font getHeaderFont(JTable table) {
    
    156
    +            Font getHeaderFont(JTable table) {
    
    153 157
                     if (headerFont == null) {
    
    154 158
                         headerFont = getDefaultFont(table).deriveFont(Font.BOLD);
    
    155 159
                     }
    
    ... ... @@ -187,13 +191,13 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    187 191
             configUI.getExtraConfig().add(extraConfig);
    
    188 192
         }
    
    189 193
     
    
    190
    -    public void setModelTypeFromEvent(ItemEvent event) {
    
    194
    +    void setModelTypeFromEvent(ItemEvent event) {
    
    191 195
             if (event.getStateChange() == ItemEvent.SELECTED) {
    
    192 196
                 getStepModel().setModelType((ObserveModelType) event.getItem());
    
    193 197
             }
    
    194 198
         }
    
    195 199
     
    
    196
    -    public void updateSelectedReportFromEvent(ItemEvent event) {
    
    200
    +    void updateSelectedReportFromEvent(ItemEvent event) {
    
    197 201
     
    
    198 202
             if (event.getStateChange() == ItemEvent.SELECTED) {
    
    199 203
                 if (log.isInfoEnabled()) {
    
    ... ... @@ -204,7 +208,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    204 208
             }
    
    205 209
         }
    
    206 210
     
    
    207
    -    public void updateSelectedReport(Report report) {
    
    211
    +    void updateSelectedReport(Report report) {
    
    208 212
             ui.getModel().setBusy(true);
    
    209 213
             try {
    
    210 214
                 if (log.isInfoEnabled()) {
    
    ... ... @@ -217,14 +221,14 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    217 221
             }
    
    218 222
         }
    
    219 223
     
    
    220
    -    public String updateSelectedReportDescrption(Report report) {
    
    224
    +    String updateSelectedReportDescription(Report report) {
    
    221 225
             if (report == null) {
    
    222 226
                 return t("observe.message.no.report.selected");
    
    223 227
             }
    
    224 228
             return t(report.getDescription());
    
    225 229
         }
    
    226 230
     
    
    227
    -    public void updateVariable(JComboBox combo, Object value) {
    
    231
    +    private void updateVariable(JComboBox combo, Object value) {
    
    228 232
             String variableName = (String) combo.getClientProperty(VARIABLE_NAME);
    
    229 233
             if (variableName == null) {
    
    230 234
                 throw new IllegalStateException(
    
    ... ... @@ -236,7 +240,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    236 240
             getStepModel().addVariable(variableName, value);
    
    237 241
         }
    
    238 242
     
    
    239
    -    public void chooseReportFile() {
    
    243
    +    void chooseReportFile() {
    
    240 244
             ReportModel model = ui.getModel().getReportModel();
    
    241 245
             File f = UIHelper.chooseFile(
    
    242 246
                     ui,
    
    ... ... @@ -248,10 +252,10 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    248 252
             model.setReportFile(f);
    
    249 253
         }
    
    250 254
     
    
    251
    -    public void copyReportToClipBoard(Report report,
    
    252
    -                                      ResultTableModel model,
    
    253
    -                                      boolean copyRowHeaders,
    
    254
    -                                      boolean copyColumnHeaders) {
    
    255
    +    void copyReportToClipBoard(Report report,
    
    256
    +                               ResultTableModel model,
    
    257
    +                               boolean copyRowHeaders,
    
    258
    +                               boolean copyColumnHeaders) {
    
    255 259
             if (report == null) {
    
    256 260
     
    
    257 261
                 // pas de report sélectionné, rien à faire
    
    ... ... @@ -261,13 +265,13 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    261 265
             if (log.isDebugEnabled()) {
    
    262 266
                 log.debug("Will copy result of report " + report.getName());
    
    263 267
                 log.debug("Result dimension : [" + model.getRowCount() + "," +
    
    264
    -                              model.getColumnCount() + "]");
    
    268
    +                    model.getColumnCount() + "]");
    
    265 269
             }
    
    266 270
             String content = model.getClipbordContent(copyRowHeaders, copyColumnHeaders);
    
    267 271
             UIHelper.copyToClipBoard(content);
    
    268 272
         }
    
    269 273
     
    
    270
    -    protected void onReportsChanged(ReportUI tabUI, List<?> newValue) {
    
    274
    +    private void onReportsChanged(ReportUI tabUI, List<?> newValue) {
    
    271 275
     
    
    272 276
             if (log.isDebugEnabled()) {
    
    273 277
                 log.debug("New reports : " + newValue);
    
    ... ... @@ -281,7 +285,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    281 285
         }
    
    282 286
     
    
    283 287
         @SuppressWarnings({"unchecked"})
    
    284
    -    protected void onSelectedReportChanged(ReportUI tabUI, ReportModel model, Report report) {
    
    288
    +    private void onSelectedReportChanged(ReportUI tabUI, ReportModel model, Report report) {
    
    285 289
     
    
    286 290
             if (log.isInfoEnabled()) {
    
    287 291
                 log.info("New selected report [" + report + "]");
    
    ... ... @@ -309,7 +313,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    309 313
     
    
    310 314
                         ReportService reportService = dataSource.getReportService();
    
    311 315
     
    
    312
    -                    report = reportService.populateVariables(report, ui.getModel().getSelectDataModel().getSelectedTrip().getId());
    
    316
    +                    report = reportService.populateVariables(report, ui.getModel().getSelectDataModel().getSelectedTripIds());
    
    313 317
     
    
    314 318
                     } catch (Exception e) {
    
    315 319
                         throw new ObserveSwingTechnicalException("unable to populate report : " + report.getName(), e);
    
    ... ... @@ -322,19 +326,32 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    322 326
                             String variableName = variable.getName();
    
    323 327
                             //                String value = variables.get(variableName);
    
    324 328
                             Set values = variable.getValues();
    
    325
    -                        List<Object> universe = Lists.newArrayList(values);
    
    329
    +                        List<Object> universe = new ArrayList<>(values);
    
    326 330
                             BeanComboBox<Object> combo = new BeanComboBox<>();
    
    327 331
     
    
    328 332
                             combo.setShowReset(true);
    
    329 333
                             variablesPanel.add(combo);
    
    334
    +                        log.info("init variable: " + variable);
    
    335
    +                        Class variableType = variable.getType();
    
    330 336
                             Decorator decorator;
    
    331
    -                        if (ReferentialDto.class.isAssignableFrom(variable.getType()) && !universe.isEmpty()) {
    
    332
    -                            decorator = getDecoratorService().getReferentialReferenceDecorator(variable.getType());
    
    333
    -                        } else if (DataDto.class.isAssignableFrom(variable.getType()) && !universe.isEmpty()) {
    
    334
    -                            decorator = getDecoratorService().getDataReferenceDecorator(variable.getType());
    
    337
    +                        Class referenceType;
    
    338
    +                        if (ReferentialDto.class.isAssignableFrom(variableType) && !universe.isEmpty()) {
    
    339
    +                            referenceType = DtoModelHelper.fromReferentialDto(variableType).toReferenceType();
    
    340
    +                            decorator = getDecoratorService().getReferentialReferenceDecorator(referenceType);
    
    341
    +                        } else if (DataDto.class.isAssignableFrom(variableType) && !universe.isEmpty()) {
    
    342
    +                            referenceType = DtoModelHelper.fromDataDto(variableType).toReferenceType();
    
    343
    +                            decorator = getDecoratorService().getDataReferenceDecorator(referenceType);
    
    335 344
                             } else {
    
    336
    -                            decorator = getDecoratorService().getDecoratorByType(variable.getType());
    
    345
    +                            referenceType = variableType;
    
    346
    +                            decorator = getDecoratorService().getDecoratorByType(variableType);
    
    337 347
                             }
    
    348
    +                        log.info("decorator: " + decorator);
    
    349
    +                        combo.setI18nPrefix("observe.common.");
    
    350
    +                        combo.setBeanType(referenceType);
    
    351
    +                        combo.setI18nLabelBuilder(ObserveI18nLabelsBuilder.createFromReferenceType(referenceType));
    
    352
    +                        String entityLabel = t(ObserveI18nDecoratorHelper.getTypeI18nKey(variableType));
    
    353
    +                        combo.setPopupTitleText(t("observe.common.ReferentialDto.type", entityLabel));
    
    354
    +
    
    338 355
                             combo.init((JXPathDecorator<Object>) decorator, universe);
    
    339 356
                             JComboBox jComboBox = combo.getCombobox();
    
    340 357
                             jComboBox.putClientProperty(VARIABLE_NAME, variableName);
    
    ... ... @@ -372,7 +389,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    372 389
             }
    
    373 390
         }
    
    374 391
     
    
    375
    -    protected void onVariablesChanges(ReportModel model, Map<String, Object> variables) {
    
    392
    +    private void onVariablesChanges(ReportModel model, Map<String, Object> variables) {
    
    376 393
     
    
    377 394
             Report report = model.getSelectedReport();
    
    378 395
             if (report != null) {
    
    ... ... @@ -381,7 +398,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    381 398
             }
    
    382 399
         }
    
    383 400
     
    
    384
    -    protected void onValidChanged(ReportModel model, boolean valid) {
    
    401
    +    private void onValidChanged(ReportModel model, boolean valid) {
    
    385 402
     
    
    386 403
             if (log.isInfoEnabled()) {
    
    387 404
                 log.info("valid state changed to " + valid);
    
    ... ... @@ -399,11 +416,10 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    399 416
     
    
    400 417
                 Report report = model.getSelectedReport();
    
    401 418
     
    
    419
    +            ImmutableSet<String> tripIds = ui.getModel().getSelectDataModel().getSelectedTripIds();
    
    402 420
                 DataDtoReference trip = ui.getModel().getSelectDataModel().getSelectedTrip();
    
    403 421
     
    
    404
    -            if (log.isDebugEnabled()) {
    
    405
    -                log.debug("Build result for report [" + report.getName() + "] on " + trip);
    
    406
    -            }
    
    422
    +            log.info(String.format("Build result for report [%s] on %s", report.getName(), trip));
    
    407 423
     
    
    408 424
                 Map<String, Object> variables = model.getVariables();
    
    409 425
     
    
    ... ... @@ -421,13 +437,11 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    421 437
     
    
    422 438
                 ReportService reportService = dataSource.getReportService();
    
    423 439
     
    
    424
    -            DataMatrix data = reportService.executeReport(report, trip.getId());
    
    440
    +            DataMatrix data = reportService.executeReport(report, tripIds);
    
    425 441
     
    
    426 442
                 timeLog.log(startTime, "execute", report.getName());
    
    427 443
     
    
    428
    -            if (log.isInfoEnabled()) {
    
    429
    -                log.info("Result to dispaly:\n" + data.getClipboardContent(true, true, false, '\t'));
    
    430
    -            }
    
    444
    +            log.info("Result to display:\n" + data.getClipboardContent(true, true, false, '\t'));
    
    431 445
     
    
    432 446
                 // calcul des données et contruction du tableau
    
    433 447
                 model.getResultModel().populate(report, data);
    
    ... ... @@ -435,21 +449,15 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    435 449
                 // mise a jour du clipboard automatique si requis
    
    436 450
                 if (model.isAutoCopyToClipboard()) {
    
    437 451
                     copyReportToClipBoard(report,
    
    438
    -                                      model.getResultModel(),
    
    439
    -                                      model.isCopyRowHeaders(),
    
    440
    -                                      model.isCopyColumnHeaders());
    
    452
    +                        model.getResultModel(),
    
    453
    +                        model.isCopyRowHeaders(),
    
    454
    +                        model.isCopyColumnHeaders());
    
    441 455
                 }
    
    442
    -
    
    443 456
             } catch (Exception e) {
    
    444
    -
    
    445 457
                 UIHelper.handlingError("Could not obtain report data", e);
    
    446
    -
    
    447 458
                 model.getResultModel().clear();
    
    448
    -
    
    449 459
             } finally {
    
    450
    -
    
    451 460
                 ui.getModel().setBusy(false);
    
    452
    -
    
    453 461
             }
    
    454 462
         }
    
    455 463
     
    
    ... ... @@ -457,15 +465,13 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa
    457 465
             return ui.getModel().getReportModel();
    
    458 466
         }
    
    459 467
     
    
    460
    -    protected void updateValidState(Report report, Map<String, Object> variables) {
    
    461
    -
    
    468
    +    private void updateValidState(Report report, Map<String, Object> variables) {
    
    462 469
             boolean canExecute = report != null && report.canExecute(variables);
    
    463 470
             getStepModel().setValid(canExecute);
    
    464 471
         }
    
    465 472
     
    
    466 473
         public void destroy() {
    
    467 474
             ObserveSwingDataSource dataSource = ui.getModel().getConfigModel().getSafeLocalSource(false);
    
    468
    -
    
    469 475
             if (dataSource.isOpen()) {
    
    470 476
                 dataSource.close();
    
    471 477
             }
    

  • services-client/src/test/java/fr/ird/observe/services/client/service/actions/report/AbstractReportServiceClientTest.java
    ... ... @@ -6,15 +6,15 @@
    6 6
      * %%
    
    7 7
      * This program is free software: you can redistribute it and/or modify
    
    8 8
      * it under the terms of the GNU General Public License as
    
    9
    - * published by the Free Software Foundation, either version 3 of the 
    
    9
    + * published by the Free Software Foundation, either version 3 of the
    
    10 10
      * License, or (at your option) any later version.
    
    11
    - * 
    
    11
    + *
    
    12 12
      * This program is distributed in the hope that it will be useful,
    
    13 13
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14 14
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15 15
      * GNU General Public License for more details.
    
    16
    - * 
    
    17
    - * You should have received a copy of the GNU General Public 
    
    16
    + *
    
    17
    + * You should have received a copy of the GNU General Public
    
    18 18
      * License along with this program.  If not, see
    
    19 19
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20 20
      * #L%
    
    ... ... @@ -22,6 +22,7 @@
    22 22
     package fr.ird.observe.services.client.service.actions.report;
    
    23 23
     
    
    24 24
     
    
    25
    +import com.google.common.collect.ImmutableSet;
    
    25 26
     import fr.ird.observe.dto.reference.DtoReference;
    
    26 27
     import fr.ird.observe.services.client.service.ServiceClientTestSupport;
    
    27 28
     import fr.ird.observe.services.service.actions.report.DataMatrix;
    
    ... ... @@ -43,7 +44,7 @@ import java.util.List;
    43 44
     
    
    44 45
     /**
    
    45 46
      * Classe abstraite de test d'un report.
    
    46
    - *
    
    47
    + * <p>
    
    47 48
      * On définit ici le mécanisme pour tester unitairement un report et son
    
    48 49
      * résultat.
    
    49 50
      *
    
    ... ... @@ -54,15 +55,45 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS
    54 55
     
    
    55 56
         /** Logger */
    
    56 57
         private static final Log log = LogFactory.getLog(AbstractReportServiceClientTest.class);
    
    57
    -
    
    58
    -    protected ReportService service;
    
    59
    -
    
    60 58
         /** La liste de tous les reports connus. */
    
    61 59
         protected static List<Report> reports;
    
    62
    -
    
    60
    +    protected ReportService service;
    
    63 61
         /** Le report à tester. */
    
    64 62
         private Report report;
    
    65 63
     
    
    64
    +    protected static Report getReport(Log log, String reportId) throws IOException {
    
    65
    +        if (reports == null) {
    
    66
    +
    
    67
    +            URL reportLocation =
    
    68
    +                    AbstractReportServiceClientTest.class.getResource("/observe-reports.properties");
    
    69
    +
    
    70
    +            if (log.isInfoEnabled()) {
    
    71
    +                log.info("Loading reports from " + reportLocation);
    
    72
    +            }
    
    73
    +
    
    74
    +            ReportBuilder builder = new ReportBuilder();
    
    75
    +
    
    76
    +            reports = builder.load(reportLocation);
    
    77
    +
    
    78
    +            builder.clear();
    
    79
    +
    
    80
    +            Assert.assertNotNull(reports);
    
    81
    +            Assert.assertFalse(reports.isEmpty());
    
    82
    +        }
    
    83
    +
    
    84
    +        Report result = null;
    
    85
    +        // recuperation du report à tester
    
    86
    +        for (Report report : reports) {
    
    87
    +            if (reportId.equals(report.getId())) {
    
    88
    +                result = report;
    
    89
    +                break;
    
    90
    +            }
    
    91
    +        }
    
    92
    +
    
    93
    +        Assert.assertNotNull("Could not find report with id " + reportId, reports);
    
    94
    +        return result;
    
    95
    +    }
    
    96
    +
    
    66 97
         protected abstract String getReportId();
    
    67 98
     
    
    68 99
         @Before
    
    ... ... @@ -81,16 +112,14 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS
    81 112
     
    
    82 113
         }
    
    83 114
     
    
    84
    -
    
    85 115
         /**
    
    86 116
          * L'unique test à lancer.
    
    87
    -     *
    
    117
    +     * <p>
    
    88 118
          * On vérifie :
    
    89 119
          * <ul>
    
    90 120
          * <li>la syntaxe du report via {@link #testReportSyntax(Report)}</li>
    
    91 121
          * <li>le résultat du report via {@link #testReportResult(DataMatrix)}</li>
    
    92 122
          * </ul>
    
    93
    -     *
    
    94 123
          */
    
    95 124
         @Test
    
    96 125
         public final void testReport() {
    
    ... ... @@ -99,23 +128,25 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS
    99 128
             testReportSyntax(report);
    
    100 129
     
    
    101 130
             // creation de l'executeur de report
    
    102
    -        report = service.populateVariables(report, ObserveFixtures.TRIP_SEINE_ID_1);
    
    131
    +        ImmutableSet<String> tripIds = getTripIds();
    
    132
    +        report = service.populateVariables(report, tripIds);
    
    103 133
     
    
    104 134
             // preparation des variables
    
    105 135
             prepareVariables();
    
    106 136
     
    
    107 137
     
    
    108 138
             // on execute le report
    
    109
    -        DataMatrix result = service.executeReport(report,ObserveFixtures. TRIP_SEINE_ID_1);
    
    110
    -
    
    111
    -        if (log.isInfoEnabled()) {
    
    112
    -            log.info("Result :\n" + result.getClipboardContent(true, true, false, '\t'));
    
    113
    -        }
    
    139
    +        DataMatrix result = service.executeReport(report, tripIds);
    
    114 140
     
    
    141
    +        log.info("Result :\n" + result.getClipboardContent(true, true, false, '\t'));
    
    115 142
             // on verifie le resultat
    
    116 143
             testReportResult(result);
    
    117 144
         }
    
    118 145
     
    
    146
    +    protected ImmutableSet<String> getTripIds() {
    
    147
    +        return ImmutableSet.of(ObserveFixtures.TRIP_SEINE_ID_1);
    
    148
    +    }
    
    149
    +
    
    119 150
         protected void prepareVariables() {
    
    120 151
     
    
    121 152
         }
    
    ... ... @@ -127,9 +158,9 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS
    127 158
                 if (variableName.equals(variable.getName())) {
    
    128 159
     
    
    129 160
                     Object value = variable.getValues().stream()
    
    130
    -                                       .filter(DtoReference.newIdPredicate(id))
    
    131
    -                                       .findFirst()
    
    132
    -                                       .orElse(null);
    
    161
    +                        .filter(DtoReference.newIdPredicate(id))
    
    162
    +                        .findFirst()
    
    163
    +                        .orElse(null);
    
    133 164
     
    
    134 165
                     variable.setSelectedValue(value);
    
    135 166
     
    
    ... ... @@ -143,39 +174,6 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS
    143 174
     
    
    144 175
         protected abstract void testReportResult(DataMatrix result);
    
    145 176
     
    
    146
    -    protected static Report getReport(Log log, String reportId) throws IOException {
    
    147
    -        if (reports == null) {
    
    148
    -
    
    149
    -            URL reportLocation =
    
    150
    -                    AbstractReportServiceClientTest.class.getResource("/observe-reports.properties");
    
    151
    -
    
    152
    -            if (log.isInfoEnabled()) {
    
    153
    -                log.info("Loading reports from " + reportLocation);
    
    154
    -            }
    
    155
    -
    
    156
    -            ReportBuilder builder = new ReportBuilder();
    
    157
    -
    
    158
    -            reports = builder.load(reportLocation);
    
    159
    -
    
    160
    -            builder.clear();
    
    161
    -
    
    162
    -            Assert.assertNotNull(reports);
    
    163
    -            Assert.assertFalse(reports.isEmpty());
    
    164
    -        }
    
    165
    -
    
    166
    -        Report result = null;
    
    167
    -        // recuperation du report à tester
    
    168
    -        for (Report report : reports) {
    
    169
    -            if (reportId.equals(report.getId())) {
    
    170
    -                result = report;
    
    171
    -                break;
    
    172
    -            }
    
    173
    -        }
    
    174
    -
    
    175
    -        Assert.assertNotNull("Could not find report with id " + reportId, reports);
    
    176
    -        return result;
    
    177
    -    }
    
    178
    -
    
    179 177
         protected void assertReportName(Report report,
    
    180 178
                                         String name,
    
    181 179
                                         String description) {
    

  • services-local/src/main/java/fr/ird/observe/services/local/service/actions/report/ReportServiceLocal.java
    ... ... @@ -22,6 +22,7 @@ package fr.ird.observe.services.local.service.actions.report;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    +import com.google.common.collect.ImmutableSet;
    
    25 26
     import com.google.common.collect.Maps;
    
    26 27
     import fr.ird.observe.dto.data.DataDto;
    
    27 28
     import fr.ird.observe.dto.reference.DataDtoReferenceSet;
    
    ... ... @@ -66,11 +67,11 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer
    66 67
         private static final Log log = LogFactory.getLog(ReportServiceLocal.class);
    
    67 68
     
    
    68 69
         @Override
    
    69
    -    public Report populateVariables(Report report, String tripId) {
    
    70
    +    public Report populateVariables(Report report, ImmutableSet<String> tripIds) {
    
    70 71
     
    
    71 72
             Map<String, Object> vars = new TreeMap<>();
    
    72 73
     
    
    73
    -        vars.put(ReportRequest.TRIP_ID_VARIABLE, tripId);
    
    74
    +        vars.put(ReportRequest.TRIP_ID_VARIABLE, tripIds);
    
    74 75
     
    
    75 76
             for (ReportVariable variable : report.getVariables()) {
    
    76 77
     
    
    ... ... @@ -116,7 +117,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer
    116 117
         }
    
    117 118
     
    
    118 119
         @Override
    
    119
    -    public DataMatrix executeReport(Report report, String tripId) {
    
    120
    +    public DataMatrix executeReport(Report report, ImmutableSet<String> tripId) {
    
    120 121
     
    
    121 122
             if (report == null) {
    
    122 123
     
    
    ... ... @@ -171,7 +172,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer
    171 172
             return result;
    
    172 173
         }
    
    173 174
     
    
    174
    -    private DataMatrix executeReportOperation(ReportOperation executeRequests, Report report, String tripId, DataMatrix incoming) {
    
    175
    +    private DataMatrix executeReportOperation(ReportOperation executeRequests, Report report, ImmutableSet<String> tripId, DataMatrix incoming) {
    
    175 176
     
    
    176 177
             DataMatrix result = incoming;
    
    177 178
     
    
    ... ... @@ -413,7 +414,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer
    413 414
             return result;
    
    414 415
         }
    
    415 416
     
    
    416
    -    private DataMatrix executeReportRequest(ReportRequest request, Report report, String tripId, ReportVariable repeatValues) {
    
    417
    +    private DataMatrix executeReportRequest(ReportRequest request, Report report, ImmutableSet<String> tripId, ReportVariable repeatValues) {
    
    417 418
     
    
    418 419
             DataMatrix result = new DataMatrix();
    
    419 420
     
    
    ... ... @@ -457,7 +458,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer
    457 458
             return result;
    
    458 459
         }
    
    459 460
     
    
    460
    -    private DataMatrix executeReportRequest(ReportRequest request, Report report, String tripId) {
    
    461
    +    private DataMatrix executeReportRequest(ReportRequest request, Report report, ImmutableSet<String> tripId) {
    
    461 462
             Map<String, Object> params = ReportRequest.extractParams(report, tripId);
    
    462 463
     
    
    463 464
             return executeReportRequest(request, params);
    
    ... ... @@ -653,7 +654,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer
    653 654
             return dao.findAllFromHql(request, paramsFixes);
    
    654 655
         }
    
    655 656
     
    
    656
    -    private void doPopulateRepeatVariables(Report report, String tripId) {
    
    657
    +    private void doPopulateRepeatVariables(Report report, ImmutableSet<String> tripId) {
    
    657 658
     
    
    658 659
             Map<String, Object> vars = ReportRequest.extractParams(report, tripId);
    
    659 660
     
    

  • services-local/src/test/java/fr/ird/observe/services/local/service/actions/report/AbstractReportServiceLocalTest.java
    ... ... @@ -22,6 +22,7 @@
    22 22
     package fr.ird.observe.services.local.service.actions.report;
    
    23 23
     
    
    24 24
     
    
    25
    +import com.google.common.collect.ImmutableSet;
    
    25 26
     import fr.ird.observe.dto.reference.DtoReference;
    
    26 27
     import fr.ird.observe.services.local.service.ServiceLocalTestSupport;
    
    27 28
     import fr.ird.observe.services.service.actions.report.DataMatrix;
    
    ... ... @@ -33,15 +34,16 @@ import fr.ird.observe.services.service.actions.report.ReportVariable;
    33 34
     import fr.ird.observe.test.DatabaseName;
    
    34 35
     import fr.ird.observe.test.ObserveFixtures;
    
    35 36
     import fr.ird.observe.test.spi.DatabaseNameConfiguration;
    
    36
    -import java.io.IOException;
    
    37
    -import java.net.URL;
    
    38
    -import java.util.List;
    
    39 37
     import org.apache.commons.logging.Log;
    
    40 38
     import org.apache.commons.logging.LogFactory;
    
    41 39
     import org.junit.Assert;
    
    42 40
     import org.junit.Before;
    
    43 41
     import org.junit.Test;
    
    44 42
     
    
    43
    +import java.io.IOException;
    
    44
    +import java.net.URL;
    
    45
    +import java.util.List;
    
    46
    +
    
    45 47
     /**
    
    46 48
      * Classe abstraite de test d'un report.
    
    47 49
      * <p>
    
    ... ... @@ -98,24 +100,28 @@ public abstract class AbstractReportServiceLocalTest extends ServiceLocalTestSup
    98 100
             // test de la syntaxe du report
    
    99 101
             testReportSyntax(report);
    
    100 102
     
    
    103
    +        ImmutableSet<String> tripIds = getTripIds();
    
    104
    +
    
    101 105
             // creation de l'executeur de report
    
    102
    -        report = service.populateVariables(report, ObserveFixtures.TRIP_SEINE_ID_1);
    
    106
    +        report = service.populateVariables(report, tripIds);
    
    103 107
     
    
    104 108
             // preparation des variables
    
    105 109
             prepareVariables();
    
    106 110
     
    
    107 111
     
    
    108 112
             // on execute le report
    
    109
    -        DataMatrix result = service.executeReport(report, ObserveFixtures.TRIP_SEINE_ID_1);
    
    113
    +        DataMatrix result = service.executeReport(report, tripIds);
    
    110 114
     
    
    111
    -        if (log.isInfoEnabled()) {
    
    112
    -            log.info("Result :\n" + result.getClipboardContent(true, true, true, ','));
    
    113
    -        }
    
    115
    +        log.info(String.format("Result :\n%s", result.getClipboardContent(true, true, true, ',')));
    
    114 116
     
    
    115 117
             // on verifie le resultat
    
    116 118
             testReportResult(result);
    
    117 119
         }
    
    118 120
     
    
    121
    +    protected ImmutableSet<String> getTripIds() {
    
    122
    +        return ImmutableSet.of(ObserveFixtures.TRIP_SEINE_ID_1);
    
    123
    +    }
    
    124
    +
    
    119 125
         protected void prepareVariables() {
    
    120 126
     
    
    121 127
         }
    

  • services-local/src/test/java/fr/ird/observe/services/local/service/actions/report/ReportNonTargetDistributionLengthsTest.java
    1
    +/*
    
    2
    + * #%L
    
    3
    + * ObServe :: Services local implementation
    
    4
    + * %%
    
    5
    + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
    
    6
    + * %%
    
    7
    + * This program is free software: you can redistribute it and/or modify
    
    8
    + * it under the terms of the GNU General Public License as
    
    9
    + * published by the Free Software Foundation, either version 3 of the 
    
    10
    + * License, or (at your option) any later version.
    
    11
    + * 
    
    12
    + * This program is distributed in the hope that it will be useful,
    
    13
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + * GNU General Public License for more details.
    
    16
    + * 
    
    17
    + * You should have received a copy of the GNU General Public 
    
    18
    + * License along with this program.  If not, see
    
    19
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + * #L%
    
    21
    + */
    
    22
    +package fr.ird.observe.services.local.service.actions.report;
    
    23
    +
    
    24
    +
    
    25
    +import com.google.common.collect.ImmutableSet;
    
    26
    +import fr.ird.observe.services.service.actions.report.DataMatrix;
    
    27
    +import fr.ird.observe.services.service.actions.report.Report;
    
    28
    +import fr.ird.observe.services.service.actions.report.ReportRequest;
    
    29
    +import fr.ird.observe.test.ObserveFixtures;
    
    30
    +import org.junit.Assert;
    
    31
    +
    
    32
    +/**
    
    33
    + * Test du report {@code accessoryCatch}.
    
    34
    + *
    
    35
    + * @author Tony Chemit - dev@tchemit.fr
    
    36
    + * @since 1.9
    
    37
    + */
    
    38
    +public class ReportNonTargetDistributionLengthsTest extends AbstractReportServiceLocalTest {
    
    39
    +
    
    40
    +    @Override
    
    41
    +    protected void testReportSyntax(Report report) {
    
    42
    +        Assert.assertNotNull(report);
    
    43
    +        assertReportName(
    
    44
    +                report,
    
    45
    +                "Distribution des tailles par espèces non ciblées",
    
    46
    +                "Afficher la nombre d'individus mesurés par classe de taille pour les espèces non ciblées"
    
    47
    +        );
    
    48
    +
    
    49
    +        assertReportDimension(
    
    50
    +                report,
    
    51
    +                -1,
    
    52
    +                2,
    
    53
    +                new String[]{"Classe de taille", "Effectif"}
    
    54
    +        );
    
    55
    +
    
    56
    +        assertReportNbRequests(report, 1);
    
    57
    +
    
    58
    +        ReportRequest[] requests = report.getRequests();
    
    59
    +
    
    60
    +        assertReportRequestDimension(
    
    61
    +                requests[0],
    
    62
    +                ReportRequest.RequestLayout.row,
    
    63
    +                0,
    
    64
    +                0
    
    65
    +        );
    
    66
    +
    
    67
    +    }
    
    68
    +
    
    69
    +    @Override
    
    70
    +    protected String getReportId() {
    
    71
    +        return "nonTargetDistributionLengths";
    
    72
    +    }
    
    73
    +
    
    74
    +    @Override
    
    75
    +    protected ImmutableSet<String> getTripIds() {
    
    76
    +        return ImmutableSet.of(ObserveFixtures.TRIP_SEINE_ID_1, ObserveFixtures.TRIP_SEINE_ID_2);
    
    77
    +    }
    
    78
    +
    
    79
    +    @Override
    
    80
    +    protected void prepareVariables() {
    
    81
    +        setVariableValue("speciesId", "fr.ird.observe.entities.referentiel.Species#1239832684439#0.9130769003657221");
    
    82
    +    }
    
    83
    +
    
    84
    +    @Override
    
    85
    +    protected void testReportResult(DataMatrix result) {
    
    86
    +        assertResultDimension(result, 2, 1, 0, 1);
    
    87
    +        assertResultRow(result, 0, "14.0", "1");
    
    88
    +    }
    
    89
    +}

  • services/pom.xml
    ... ... @@ -93,6 +93,10 @@
    93 93
           <groupId>io.ultreia.java4all.jaxx</groupId>
    
    94 94
           <artifactId>jaxx-widgets-gis</artifactId>
    
    95 95
         </dependency>
    
    96
    +    <dependency>
    
    97
    +      <groupId>io.ultreia.java4all</groupId>
    
    98
    +      <artifactId>java-lang</artifactId>
    
    99
    +    </dependency>
    
    96 100
     
    
    97 101
         <!-- XWork -->
    
    98 102
         <dependency>
    

  • services/src/main/java/fr/ird/observe/services/service/actions/report/ReportBuilder.java
    ... ... @@ -23,6 +23,7 @@ package fr.ird.observe.services.service.actions.report;
    23 23
     
    
    24 24
     
    
    25 25
     import fr.ird.observe.dto.ObserveModelType;
    
    26
    +import io.ultreia.java4all.lang.Objects2;
    
    26 27
     import org.apache.commons.logging.Log;
    
    27 28
     import org.apache.commons.logging.LogFactory;
    
    28 29
     import org.nuiton.util.SortedProperties;
    
    ... ... @@ -50,24 +51,24 @@ import java.util.regex.Pattern;
    50 51
      */
    
    51 52
     public class ReportBuilder {
    
    52 53
     
    
    53
    -    public static final Pattern REPORT_DEFINITION_PATTERN = Pattern.compile("report.(\\w+).name");
    
    54
    +    private static final Pattern REPORT_DEFINITION_PATTERN = Pattern.compile("report.(\\w+).name");
    
    54 55
     
    
    55
    -    public static final String REQUEST_PREFIX = "request.";
    
    56
    +    private static final String REQUEST_PREFIX = "request.";
    
    56 57
     
    
    57
    -    public static final String OPERATION_PREFIX = "operations.";
    
    58
    +    private static final String OPERATION_PREFIX = "operations.";
    
    58 59
     
    
    59
    -    public static final String VARIABLE_PREFIX = "variable.";
    
    60
    +    private static final String VARIABLE_PREFIX = "variable.";
    
    60 61
     
    
    61
    -    public static final String REPEAT_VARIABLE_PREFIX = "repeatVariable.";
    
    62
    +    private static final String REPEAT_VARIABLE_PREFIX = "repeatVariable.";
    
    62 63
     
    
    63 64
         /** Logger */
    
    64 65
         private static final Log log = LogFactory.getLog(ReportBuilder.class);
    
    65 66
     
    
    66 67
         /** les propriétés chargées par le builder pour construire les reports */
    
    67
    -    protected Properties properties;
    
    68
    +    private Properties properties;
    
    68 69
     
    
    69 70
         /** la liste des lastName sde reports connus par le système */
    
    70
    -    protected List<String> reportNames;
    
    71
    +    private List<String> reportNames;
    
    71 72
     
    
    72 73
         /** les operations connues par le système */
    
    73 74
         protected static Map<String, Class<?>> operations;
    
    ... ... @@ -96,7 +97,7 @@ public class ReportBuilder {
    96 97
         }
    
    97 98
     
    
    98 99
     
    
    99
    -    protected List<String> detectReportNames() {
    
    100
    +    private List<String> detectReportNames() {
    
    100 101
             List<String> reportNames = new ArrayList<>();
    
    101 102
             Enumeration<Object> keys = properties.keys();
    
    102 103
             while (keys.hasMoreElements()) {
    
    ... ... @@ -162,7 +163,7 @@ public class ReportBuilder {
    162 163
             );
    
    163 164
         }
    
    164 165
     
    
    165
    -    protected Map<String, String> detectReportProperties(String reportName) {
    
    166
    +    private Map<String, String> detectReportProperties(String reportName) {
    
    166 167
     
    
    167 168
             Map<String, String> dico = new TreeMap<>();
    
    168 169
     
    
    ... ... @@ -237,8 +238,8 @@ public class ReportBuilder {
    237 238
             return result.toArray(new ReportRequest[0]);
    
    238 239
         }
    
    239 240
     
    
    240
    -    protected ReportRequest getRequest(String requestDef,
    
    241
    -                                       String requestRepeatDef) {
    
    241
    +    private ReportRequest getRequest(String requestDef,
    
    242
    +                                     String requestRepeatDef) {
    
    242 243
     
    
    243 244
             String[] parts = requestDef.split("\\|");
    
    244 245
             if (parts.length != 3) {
    
    ... ... @@ -310,7 +311,7 @@ public class ReportBuilder {
    310 311
             return result.toArray(new ReportOperation[0]);
    
    311 312
         }
    
    312 313
     
    
    313
    -    protected ReportVariable[] getVariables(String reportName, Map<String, String> dico) {
    
    314
    +    private ReportVariable[] getVariables(String reportName, Map<String, String> dico) {
    
    314 315
             List<ReportVariable> result = new ArrayList<>();
    
    315 316
             Iterator<Map.Entry<String, String>> itr = dico.entrySet().iterator();
    
    316 317
             List<String> ids = new ArrayList<>();
    
    ... ... @@ -331,7 +332,7 @@ public class ReportBuilder {
    331 332
     
    
    332 333
                 // on interdit l'utilisation de la variable tripId
    
    333 334
                 if (ReportRequest.TRIP_ID_VARIABLE.equals(id)) {
    
    334
    -                throw new IllegalArgumentException("La variable tripId n'est pas utilisable (c'est uen variable réservée) pour le report " + reportName);
    
    335
    +                throw new IllegalArgumentException("La variable tripId n'est pas utilisable (c'est une variable réservée) pour le report " + reportName);
    
    335 336
                 }
    
    336 337
                 ids.add(id);
    
    337 338
                 String[] parts = operations.split("\\|");
    
    ... ... @@ -341,13 +342,8 @@ public class ReportBuilder {
    341 342
                 }
    
    342 343
                 String typeStr = parts[0].trim();
    
    343 344
                 String request = parts[1].trim();
    
    344
    -            Class<?> type;
    
    345
    -            try {
    
    346
    -                type = Class.forName(typeStr);
    
    347
    -            } catch (ClassNotFoundException eee) {
    
    348
    -                throw new IllegalArgumentException("Le type " + typeStr + " n'est pas connu", eee);
    
    349
    -            }
    
    350
    -            ReportVariable variable = new ReportVariable(id, type, request);
    
    345
    +            Class<?> type = Objects2.forName(typeStr);
    
    346
    +            ReportVariable<?> variable = new ReportVariable<>(id, type, request);
    
    351 347
                 log.debug(String.format("Detects a variable : [%s:%s] = %s (type = %s)", reportName, variable.getName(), variable.getRequest(), variable.getType().getName()));
    
    352 348
                 result.add(variable);
    
    353 349
                 itr.remove();
    
    ... ... @@ -355,7 +351,7 @@ public class ReportBuilder {
    355 351
             return result.toArray(new ReportVariable[0]);
    
    356 352
         }
    
    357 353
     
    
    358
    -    protected ReportVariable[] getRepeatVariables(String reportName, Map<String, String> dico) {
    
    354
    +    private ReportVariable[] getRepeatVariables(String reportName, Map<String, String> dico) {
    
    359 355
             List<ReportVariable> result = new ArrayList<>();
    
    360 356
             Iterator<Map.Entry<String, String>> itr = dico.entrySet().iterator();
    
    361 357
             List<String> ids = new ArrayList<>();
    
    ... ... @@ -386,12 +382,7 @@ public class ReportBuilder {
    386 382
                 }
    
    387 383
                 String typeStr = parts[0].trim();
    
    388 384
                 String request = parts[1].trim();
    
    389
    -            Class<?> type = null;
    
    390
    -            try {
    
    391
    -                type = Class.forName(typeStr);
    
    392
    -            } catch (ClassNotFoundException eee) {
    
    393
    -                throw new IllegalArgumentException("Le type " + typeStr + " n'est pas connu", eee);
    
    394
    -            }
    
    385
    +            Class<?> type = Objects2.forName(typeStr);
    
    395 386
                 ReportVariable<?> variable = new ReportVariable<>(id, type, request);
    
    396 387
                 log.debug(String.format("Detects a variable : [%s:%s] = %s (type = %s)", reportName, variable.getName(), variable.getRequest(), variable.getType().getName()));
    
    397 388
                 result.add(variable);
    

  • services/src/main/java/fr/ird/observe/services/service/actions/report/ReportRequest.java
    ... ... @@ -21,6 +21,7 @@
    21 21
      */
    
    22 22
     package fr.ird.observe.services.service.actions.report;
    
    23 23
     
    
    24
    +import com.google.common.collect.ImmutableSet;
    
    24 25
     import com.google.common.collect.Maps;
    
    25 26
     import fr.ird.observe.dto.ObserveDto;
    
    26 27
     import org.apache.commons.lang3.builder.ToStringBuilder;
    
    ... ... @@ -134,7 +135,7 @@ public class ReportRequest implements Serializable, ObserveDto {
    134 135
             return repeat;
    
    135 136
         }
    
    136 137
     
    
    137
    -    public static Map<String, Object> extractParams(Report report, String tripId) {
    
    138
    +    public static Map<String, Object> extractParams(Report report, ImmutableSet<String> tripId) {
    
    138 139
     
    
    139 140
             Map<String, Object> params = Maps.newHashMap();
    
    140 141
     
    

  • services/src/main/java/fr/ird/observe/services/service/actions/report/ReportService.java
    ... ... @@ -22,6 +22,7 @@ package fr.ird.observe.services.service.actions.report;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    +import com.google.common.collect.ImmutableSet;
    
    25 26
     import fr.ird.observe.services.service.ObserveService;
    
    26 27
     import fr.ird.observe.services.spi.ReadDataPermission;
    
    27 28
     import fr.ird.observe.services.spi.ReadReferentialPermission;
    
    ... ... @@ -35,10 +36,10 @@ public interface ReportService extends ObserveService {
    35 36
         @ReadDataPermission
    
    36 37
         @ReadReferentialPermission
    
    37 38
         @Post
    
    38
    -    Report populateVariables(Report report, String tripId);
    
    39
    +    Report populateVariables(Report report, ImmutableSet<String> tripId);
    
    39 40
     
    
    40 41
         @ReadDataPermission
    
    41 42
         @ReadReferentialPermission
    
    42 43
         @Post
    
    43
    -    DataMatrix executeReport(Report report, String tripId);
    
    44
    +    DataMatrix executeReport(Report report, ImmutableSet<String> tripId);
    
    44 45
     }

  • services/src/main/resources/observe-reports.properties
    ... ... @@ -33,7 +33,7 @@ report.tripSeineGearUseFeatures.repeatVariable.gearUseFeaturesId=java.lang.Strin
    33 33
       From TripSeineImpl m \
    
    34 34
       Join m.gearUseFeaturesSeine g \
    
    35 35
       Where \
    
    36
    -      m.id = :tripId \
    
    36
    +      m.id In :tripId \
    
    37 37
           and g in elements (m.gearUseFeaturesSeine) \
    
    38 38
       Order By g.gear.label2
    
    39 39
     
    
    ... ... @@ -60,7 +60,7 @@ report.tripLonglineGearUseFeatures.repeatVariable.gearUseFeaturesId=java.lang.St
    60 60
       From TripLonglineImpl m \
    
    61 61
       Join m.gearUseFeaturesLongline g \
    
    62 62
       Where \
    
    63
    -      m.id = :tripId \
    
    63
    +      m.id In :tripId \
    
    64 64
           and g in elements (m.gearUseFeaturesLongline) \
    
    65 65
       Order By g.gear.label2
    
    66 66
     
    
    ... ... @@ -88,7 +88,7 @@ report.activityWithComment.request.1=0,0|row|\
    88 88
       Join r.activitySeine a \
    
    89 89
       Join a.vesselActivitySeine ab \
    
    90 90
       Where \
    
    91
    -      m.id = :tripId \
    
    91
    +      m.id In :tripId \
    
    92 92
           and a.comment is not null \
    
    93 93
       Order By r.date, a.time
    
    94 94
     
    
    ... ... @@ -106,7 +106,7 @@ report.allActivitys.request.1=0,0|row|\
    106 106
       Join r.activitySeine a \
    
    107 107
       Join a.vesselActivitySeine ab \
    
    108 108
       Where \
    
    109
    -      m.id = :tripId \
    
    109
    +      m.id In :tripId \
    
    110 110
       Order By r.date, a.time
    
    111 111
     
    
    112 112
     ################################################################################
    
    ... ... @@ -124,7 +124,7 @@ report.dailySetAndCatch.request.1=0,0|row|\
    124 124
       Join a.setSeine s \
    
    125 125
       left join s.targetCatch  as ct \
    
    126 126
       Where \
    
    127
    -      m.id = :tripId \
    
    127
    +      m.id In :tripId \
    
    128 128
       Group By r.date \
    
    129 129
       Order By r.date
    
    130 130
     
    
    ... ... @@ -143,7 +143,7 @@ report.dcpUsage.repeatVariable.typeObjetId=java.lang.String|\
    143 143
       Join a.floatingObject dcp \
    
    144 144
       Join dcp.objectType to \
    
    145 145
       Where \
    
    146
    -      m.id = :tripId \
    
    146
    +      m.id In :tripId \
    
    147 147
       Order by to.code
    
    148 148
     
    
    149 149
     report.dcpUsage.request.1=0,0|row|\
    
    ... ... @@ -160,7 +160,7 @@ report.dcpUsage.request.2=1,0|row|\
    160 160
       Join r.activitySeine a \
    
    161 161
       Join a.floatingObject dcp \
    
    162 162
       Where \
    
    163
    -      m.id = :tripId \
    
    163
    +      m.id In :tripId \
    
    164 164
           and dcp.objectType.id = :typeObjetId  \
    
    165 165
           and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686249#0.8268884472438458'
    
    166 166
     report.dcpUsage.request.2.repeat=typeObjetId|column
    
    ... ... @@ -172,7 +172,7 @@ report.dcpUsage.request.3=2,0|row|\
    172 172
       Join r.activitySeine a \
    
    173 173
       Join a.floatingObject dcp \
    
    174 174
       Where \
    
    175
    -      m.id = :tripId \
    
    175
    +      m.id In :tripId \
    
    176 176
           and dcp.objectType.id = :typeObjetId  \
    
    177 177
           and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686249#0.8431519556575698'
    
    178 178
     report.dcpUsage.request.3.repeat=typeObjetId|column
    
    ... ... @@ -184,7 +184,7 @@ report.dcpUsage.request.4=3,0|row|\
    184 184
       Join r.activitySeine a \
    
    185 185
       Join a.floatingObject dcp \
    
    186 186
       Where \
    
    187
    -      m.id = :tripId \
    
    187
    +      m.id In :tripId \
    
    188 188
           and dcp.objectType.id = :typeObjetId  \
    
    189 189
           and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686248#0.8669327599318251'
    
    190 190
     report.dcpUsage.request.4.repeat=typeObjetId|column
    
    ... ... @@ -196,7 +196,7 @@ report.dcpUsage.request.5=4,0|row|\
    196 196
       Join r.activitySeine a \
    
    197 197
       Join a.floatingObject dcp \
    
    198 198
       Where \
    
    199
    -      m.id = :tripId \
    
    199
    +      m.id In :tripId \
    
    200 200
           and dcp.objectType.id = :typeObjetId  \
    
    201 201
           and dcp.objectFate.id = 'fr.ird.observe.entities.referentiel.seine.ObjectFate#1396860761530#0.8869464242156488' \
    
    202 202
           and dcp.objectOperation.id != 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686248#0.8669327599318251'
    
    ... ... @@ -209,7 +209,7 @@ report.dcpUsage.request.6=5,0|row|\
    209 209
       Join r.activitySeine a \
    
    210 210
       Join a.floatingObject dcp \
    
    211 211
       Where \
    
    212
    -      m.id = :tripId \
    
    212
    +      m.id In :tripId \
    
    213 213
           and dcp.objectType.id = :typeObjetId  \
    
    214 214
           and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686249#0.7838704130950722'
    
    215 215
     report.dcpUsage.request.6.repeat=typeObjetId|column
    
    ... ... @@ -222,7 +222,7 @@ report.dcpUsage.request.7=6,0|row| \
    222 222
       Join a.floatingObject dcp \
    
    223 223
       Join dcp.objectObservedSpecies efo \
    
    224 224
       Where \
    
    225
    -      m.id = :tripId \
    
    225
    +      m.id In :tripId \
    
    226 226
           and dcp.objectType.id = :typeObjetId  \
    
    227 227
           and efo.species.speciesGroup.id = 'fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.24333033683679461'
    
    228 228
     report.dcpUsage.request.7.repeat=typeObjetId|column
    
    ... ... @@ -244,7 +244,7 @@ report.setByAssociation.request.1=0,0|column|\
    244 244
       Join r.activitySeine a, \
    
    245 245
       ObservedSystemImpl os \
    
    246 246
       Where \
    
    247
    -      m.id = :tripId \
    
    247
    +      m.id In :tripId \
    
    248 248
           and a.setSeine.schoolType = 2 \
    
    249 249
           and a.setSeine.reasonForNullSet is null \
    
    250 250
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
    
    ... ... @@ -257,7 +257,7 @@ report.setByAssociation.request.2=0,1|column|\
    257 257
       Join r.activitySeine a, \
    
    258 258
       ObservedSystemImpl os \
    
    259 259
       Where \
    
    260
    -      m.id = :tripId \
    
    260
    +      m.id In :tripId \
    
    261 261
           and a.setSeine.schoolType = 2 \
    
    262 262
           and a.setSeine.reasonForNullSet is not null \
    
    263 263
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
    
    ... ... @@ -270,7 +270,7 @@ report.setByAssociation.request.3=1,0|column|\
    270 270
       Join r.activitySeine a, \
    
    271 271
       ObservedSystemImpl os \
    
    272 272
       Where \
    
    273
    -      m.id = :tripId \
    
    273
    +      m.id In :tripId \
    
    274 274
           and a.setSeine.schoolType = 2 \
    
    275 275
           and a.setSeine.reasonForNullSet is null \
    
    276 276
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
    
    ... ... @@ -283,7 +283,7 @@ report.setByAssociation.request.4=1,1|column|\
    283 283
       Join r.activitySeine a, \
    
    284 284
       ObservedSystemImpl os \
    
    285 285
       Where \
    
    286
    -      m.id = :tripId \
    
    286
    +      m.id In :tripId \
    
    287 287
           and a.setSeine.schoolType = 2 \
    
    288 288
           and a.setSeine.reasonForNullSet is not null \
    
    289 289
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
    
    ... ... @@ -296,7 +296,7 @@ report.setByAssociation.request.5=2,0|column|\
    296 296
       Join r.activitySeine a, \
    
    297 297
       ObservedSystemImpl os \
    
    298 298
       Where \
    
    299
    -      m.id = :tripId \
    
    299
    +      m.id In :tripId \
    
    300 300
           and a.setSeine.schoolType = 1 \
    
    301 301
           and a.setSeine.reasonForNullSet is null \
    
    302 302
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
    
    ... ... @@ -309,7 +309,7 @@ report.setByAssociation.request.6=2,1|column|\
    309 309
       Join r.activitySeine a, \
    
    310 310
       ObservedSystemImpl os \
    
    311 311
       Where \
    
    312
    -      m.id = :tripId \
    
    312
    +      m.id In :tripId \
    
    313 313
           and a.setSeine.schoolType = 1 \
    
    314 314
           and a.setSeine.reasonForNullSet is not null \
    
    315 315
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
    
    ... ... @@ -322,7 +322,7 @@ report.setByAssociation.request.7=3,0|column|\
    322 322
       Join r.activitySeine a, \
    
    323 323
       ObservedSystemImpl os \
    
    324 324
       Where \
    
    325
    -      m.id = :tripId \
    
    325
    +      m.id In :tripId \
    
    326 326
           and a.setSeine.schoolType = 1 \
    
    327 327
           and a.setSeine.reasonForNullSet is null \
    
    328 328
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
    
    ... ... @@ -335,7 +335,7 @@ report.setByAssociation.request.8=3,1|column|\
    335 335
       Join r.activitySeine a, \
    
    336 336
       ObservedSystemImpl os \
    
    337 337
       Where \
    
    338
    -      m.id = :tripId \
    
    338
    +      m.id In :tripId \
    
    339 339
           and a.setSeine.schoolType = 1 \
    
    340 340
           and a.setSeine.reasonForNullSet is not null \
    
    341 341
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
    
    ... ... @@ -380,7 +380,7 @@ report.targetCatchByAssociation.request.1=0,0|row|\
    380 380
           with ct.discarded = false, \
    
    381 381
       ObservedSystemImpl os \
    
    382 382
       Where \
    
    383
    -      m.id = :tripId \
    
    383
    +      m.id In :tripId \
    
    384 384
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
    
    385 385
           and os not in elements(a.observedSystem)
    
    386 386
     
    
    ... ... @@ -412,7 +412,7 @@ report.targetCatchByAssociation.request.7=0,1|row|\
    412 412
           with ct.discarded = false, \
    
    413 413
       ObservedSystemImpl os \
    
    414 414
       Where \
    
    415
    -      m.id = :tripId \
    
    415
    +      m.id In :tripId \
    
    416 416
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
    
    417 417
           and os in elements(a.observedSystem)
    
    418 418
     
    
    ... ... @@ -444,7 +444,7 @@ report.targetCatchByAssociation.request.13=0,2|row|\
    444 444
           with ct.discarded = false, \
    
    445 445
       ObservedSystemImpl os \
    
    446 446
       Where \
    
    447
    -      m.id = :tripId \
    
    447
    +      m.id In :tripId \
    
    448 448
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
    
    449 449
           and os in elements(a.observedSystem)
    
    450 450
     
    
    ... ... @@ -476,7 +476,7 @@ report.targetCatchByAssociation.request.19=0,3|row|\
    476 476
           with ct.discarded = false, \
    
    477 477
       ObservedSystemImpl os \
    
    478 478
       Where \
    
    479
    -      m.id = :tripId \
    
    479
    +      m.id In :tripId \
    
    480 480
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
    
    481 481
           and os not in elements(a.observedSystem)
    
    482 482
     
    
    ... ... @@ -519,7 +519,7 @@ report.targetDiscardedByAssociation.request.1=0,0|row|\
    519 519
           with ct.discarded = true, \
    
    520 520
       ObservedSystemImpl os \
    
    521 521
       Where \
    
    522
    -      m.id = :tripId \
    
    522
    +      m.id In :tripId \
    
    523 523
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
    
    524 524
           and os not in elements(a.observedSystem)
    
    525 525
     
    
    ... ... @@ -551,7 +551,7 @@ report.targetDiscardedByAssociation.request.7=0,1|row|\
    551 551
           with ct.discarded = true, \
    
    552 552
       ObservedSystemImpl os \
    
    553 553
       Where \
    
    554
    -      m.id = :tripId \
    
    554
    +      m.id In :tripId \
    
    555 555
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
    
    556 556
           and os in elements(a.observedSystem)
    
    557 557
     
    
    ... ... @@ -583,7 +583,7 @@ report.targetDiscardedByAssociation.request.13=0,2|row|\
    583 583
           with ct.discarded = true, \
    
    584 584
       ObservedSystemImpl os \
    
    585 585
       Where \
    
    586
    -      m.id = :tripId \
    
    586
    +      m.id In :tripId \
    
    587 587
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
    
    588 588
           and os in elements(a.observedSystem)
    
    589 589
     
    
    ... ... @@ -615,7 +615,7 @@ report.targetDiscardedByAssociation.request.19=0,3|row|\
    615 615
           with ct.discarded = true, \
    
    616 616
       ObservedSystemImpl os \
    
    617 617
       Where \
    
    618
    -      m.id = :tripId \
    
    618
    +      m.id In :tripId \
    
    619 619
           and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
    
    620 620
           and os not in elements(a.observedSystem)
    
    621 621
     
    
    ... ... @@ -655,7 +655,7 @@ report.accessoryCatch.request.2=1,0|row|\
    655 655
            with c.schoolType = 2 \
    
    656 656
       Join c.nonTargetCatch ca \
    
    657 657
            with ca.species.id = :speciesId \
    
    658
    -  Where m.id = :tripId
    
    658
    +  Where m.id In :tripId
    
    659 659
     report.accessoryCatch.request.2.repeat=speciesId|column
    
    660 660
     
    
    661 661
     report.accessoryCatch.request.3=2,0|row|\
    
    ... ... @@ -672,7 +672,7 @@ report.accessoryCatch.request.3=2,0|row|\
    672 672
            with c.schoolType = 1 \
    
    673 673
       Join c.nonTargetCatch ca \
    
    674 674
            with ca.species.id = :speciesId \
    
    675
    -  Where m.id = :tripId
    
    675
    +  Where m.id In :tripId
    
    676 676
     report.accessoryCatch.request.3.repeat=speciesId|column
    
    677 677
     
    
    678 678
     ################################################################################
    
    ... ... @@ -723,7 +723,7 @@ report.accessoryCatchByGroup.request.1=0,0|row|\
    723 723
       Join c.nonTargetCatch ca \
    
    724 724
       Join ca.species e \
    
    725 725
            with e.speciesGroup.id = :speciesGroup \
    
    726
    -  Where m.id = :tripId \
    
    726
    +  Where m.id In :tripId \
    
    727 727
       Group by e \
    
    728 728
       Order By e.homeId
    
    729 729
     
    
    ... ... @@ -742,7 +742,7 @@ Join t.route r \
    742 742
     Join r.activitySeine a \
    
    743 743
     Join a.setSeine.nonTargetSample nts \
    
    744 744
     Join nts.nonTargetLength ntl \
    
    745
    -Where t.id = :tripId
    
    745
    +Where t.id In :tripId
    
    746 746
     report.nonTargetDistributionLengths.request.1=0,0|row| \
    
    747 747
     Select ntl.length, sum(ntl.count) \
    
    748 748
     From TripSeineImpl t \
    
    ... ... @@ -750,7 +750,7 @@ Join t.route r \
    750 750
     Join r.activitySeine a \
    
    751 751
     Join a.setSeine.nonTargetSample nts \
    
    752 752
     Join nts.nonTargetLength ntl \
    
    753
    -Where t.id = :tripId \
    
    753
    +Where t.id In :tripId \
    
    754 754
     And ntl.species.id = :speciesId \
    
    755 755
     Group By ntl.length \
    
    756 756
     Order By ntl.length
    
    ... ... @@ -770,7 +770,7 @@ Join t.route r \
    770 770
     Join r.activitySeine a \
    
    771 771
     Join a.setSeine.targetSample ts \
    
    772 772
     Join ts.targetLength tl \
    
    773
    -Where t.id = :tripId \
    
    773
    +Where t.id In :tripId \
    
    774 774
     And tl.sizeMeasureType = 1 \
    
    775 775
     And ts.discarded = false
    
    776 776
     report.targetStoredDistributionLengthsLD1.request.1=0,0|row| \
    
    ... ... @@ -780,7 +780,7 @@ Join t.route r \
    780 780
     Join r.activitySeine a \
    
    781 781
     Join a.setSeine.targetSample ts \
    
    782 782
     Join ts.targetLength tl \
    
    783
    -Where t.id = :tripId \
    
    783
    +Where t.id In :tripId \
    
    784 784
       And tl.species.id = :speciesId \
    
    785 785
       And tl.sizeMeasureType = 1 \
    
    786 786
       And ts.discarded = false \
    
    ... ... @@ -802,7 +802,7 @@ Join t.route r \
    802 802
     Join r.activitySeine a \
    
    803 803
     Join a.setSeine.targetSample ts \
    
    804 804
     Join ts.targetLength tl \
    
    805
    -Where t.id = :tripId \
    
    805
    +Where t.id In :tripId \
    
    806 806
     And tl.sizeMeasureType = 1 \
    
    807 807
     And ts.discarded = true
    
    808 808
     report.targetDiscardedDistributionLengthsLD1.request.1=0,0|row| \
    
    ... ... @@ -812,7 +812,7 @@ Join t.route r \
    812 812
     Join r.activitySeine a \
    
    813 813
     Join a.setSeine.targetSample ts \
    
    814 814
     Join ts.targetLength tl \
    
    815
    -Where t.id = :tripId \
    
    815
    +Where t.id In :tripId \
    
    816 816
       And tl.species.id = :speciesId \
    
    817 817
       And tl.sizeMeasureType = 1\
    
    818 818
       And ts.discarded = true \
    
    ... ... @@ -834,7 +834,7 @@ Join t.route r \
    834 834
     Join r.activitySeine a \
    
    835 835
     Join a.setSeine.targetSample ts \
    
    836 836
     Join ts.targetLength tl \
    
    837
    -Where t.id = :tripId \
    
    837
    +Where t.id In :tripId \
    
    838 838
     And tl.sizeMeasureType = 2 \
    
    839 839
     And ts.discarded = false
    
    840 840
     report.targetStoredDistributionLengthsLF.request.1=0,0|row| \
    
    ... ... @@ -844,7 +844,7 @@ Join t.route r \
    844 844
     Join r.activitySeine a \
    
    845 845
     Join a.setSeine.targetSample ts \
    
    846 846
     Join ts.targetLength tl \
    
    847
    -Where t.id = :tripId \
    
    847
    +Where t.id In :tripId \
    
    848 848
       And tl.species.id = :speciesId \
    
    849 849
       And tl.sizeMeasureType = 2 \
    
    850 850
       And ts.discarded = false \
    
    ... ... @@ -866,7 +866,7 @@ Join t.route r \
    866 866
     Join r.activitySeine a \
    
    867 867
     Join a.setSeine.targetSample ts \
    
    868 868
     Join ts.targetLength tl \
    
    869
    -Where t.id = :tripId \
    
    869
    +Where t.id In :tripId \
    
    870 870
     And tl.sizeMeasureType = 2 \
    
    871 871
     And ts.discarded = true
    
    872 872
     report.targetDiscardedDistributionLengthsLF.request.1=0,0|row| \
    
    ... ... @@ -876,7 +876,7 @@ Join t.route r \
    876 876
     Join r.activitySeine a \
    
    877 877
     Join a.setSeine.targetSample ts \
    
    878 878
     Join ts.targetLength tl \
    
    879
    -Where t.id = :tripId \
    
    879
    +Where t.id In :tripId \
    
    880 880
       And tl.species.id = :speciesId \
    
    881 881
       And tl.sizeMeasureType = 2 \
    
    882 882
       And ts.discarded = true \
    
    ... ... @@ -902,6 +902,6 @@ From TripSeineImpl t \
    902 902
     Join t.route r \
    
    903 903
     Join r.activitySeine a \
    
    904 904
     Join a.setSeine.targetCatch tc \
    
    905
    -Where t.id = :tripId \
    
    905
    +Where t.id In :tripId \
    
    906 906
     Group By r.date, a.time, a.latitude, a.longitude, tc.weightCategory.species, tc.weightCategory.species.faoCode, tc.well, a.setSeine.schoolType \
    
    907 907
     Order By r.date, a.time, tc.weightCategory.species, tc.well